~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to intern/audaspace/intern/AUD_Mixer.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: AUD_Mixer.h 26712 2010-02-08 15:37:38Z nexyon $
3
 
 *
4
 
 * ***** BEGIN LGPL LICENSE BLOCK *****
5
 
 *
6
 
 * Copyright 2009 Jörg Hermann Müller
 
2
 * ***** BEGIN GPL LICENSE BLOCK *****
 
3
 *
 
4
 * Copyright 2009-2011 Jörg Hermann Müller
7
5
 *
8
6
 * This file is part of AudaSpace.
9
7
 *
10
 
 * AudaSpace is free software: you can redistribute it and/or modify
11
 
 * it under the terms of the GNU Lesser General Public License as published by
12
 
 * the Free Software Foundation, either version 3 of the License, or
 
8
 * Audaspace is free software; you can redistribute it and/or modify
 
9
 * it under the terms of the GNU General Public License as published by
 
10
 * the Free Software Foundation; either version 2 of the License, or
13
11
 * (at your option) any later version.
14
12
 *
15
13
 * AudaSpace is distributed in the hope that it will be useful,
16
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
 * GNU Lesser General Public License for more details.
19
 
 *
20
 
 * You should have received a copy of the GNU Lesser General Public License
21
 
 * along with AudaSpace.  If not, see <http://www.gnu.org/licenses/>.
22
 
 *
23
 
 * ***** END LGPL LICENSE BLOCK *****
24
 
 */
25
 
 
26
 
#ifndef AUD_MIXER
27
 
#define AUD_MIXER
28
 
 
29
 
#define AUD_MIXER_RESAMPLER AUD_SRCResampleFactory
 
16
 * GNU General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU General Public License
 
19
 * along with Audaspace; if not, write to the Free Software Foundation,
 
20
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
21
 *
 
22
 * ***** END GPL LICENSE BLOCK *****
 
23
 */
 
24
 
 
25
/** \file audaspace/intern/AUD_Mixer.h
 
26
 *  \ingroup audaspaceintern
 
27
 */
 
28
 
 
29
 
 
30
#ifndef __AUD_MIXER_H__
 
31
#define __AUD_MIXER_H__
30
32
 
31
33
#include "AUD_ConverterFunctions.h"
32
 
class AUD_ConverterFactory;
33
 
class AUD_MIXER_RESAMPLER;
34
 
class AUD_ChannelMapperFactory;
35
 
class AUD_Buffer;
 
34
#include "AUD_Buffer.h"
 
35
#include "AUD_Reference.h"
36
36
class AUD_IReader;
37
 
#include <list>
38
 
 
39
 
struct AUD_MixerBuffer
40
 
{
41
 
        sample_t* buffer;
42
 
        int start;
43
 
        int length;
44
 
        float volume;
45
 
};
46
37
 
47
38
/**
48
 
 * This class is able to mix audiosignals of different channel count and sample
49
 
 * rate and convert it to a specific output format.
50
 
 * It uses a default ChannelMapperFactory and a SRCResampleFactory for
51
 
 * the perparation.
 
39
 * This abstract class is able to mix audiosignals with same channel count
 
40
 * and sample rate and convert it to a specific output format.
52
41
 */
53
42
class AUD_Mixer
54
43
{
55
 
private:
56
 
        /**
57
 
         * The resampling factory that resamples all readers for superposition.
58
 
         */
59
 
        AUD_MIXER_RESAMPLER* m_resampler;
60
 
 
61
 
        /**
62
 
         * The channel mapper factory that maps all readers for superposition.
63
 
         */
64
 
        AUD_ChannelMapperFactory* m_mapper;
65
 
 
66
 
        /**
67
 
         * The list of buffers to superpose.
68
 
         */
69
 
        std::list<AUD_MixerBuffer> m_buffers;
70
 
 
 
44
protected:
71
45
        /**
72
46
         * The output specification.
73
47
         */
74
48
        AUD_DeviceSpecs m_specs;
75
49
 
76
50
        /**
77
 
         * The temporary mixing buffer.
78
 
         */
79
 
        AUD_Buffer* m_buffer;
 
51
         * The length of the mixing buffer.
 
52
         */
 
53
        int m_length;
 
54
 
 
55
        /**
 
56
         * The mixing buffer.
 
57
         */
 
58
        AUD_Buffer m_buffer;
80
59
 
81
60
        /**
82
61
         * Converter function.
87
66
        /**
88
67
         * Creates the mixer.
89
68
         */
90
 
        AUD_Mixer();
 
69
        AUD_Mixer(AUD_DeviceSpecs specs);
91
70
 
92
71
        /**
93
72
         * Destroys the mixer.
94
73
         */
95
 
        ~AUD_Mixer();
96
 
 
97
 
        /**
98
 
         * This funuction prepares a reader for playback.
99
 
         * \param reader The reader to prepare.
100
 
         * \return The reader that should be used for playback.
101
 
         */
102
 
        AUD_IReader* prepare(AUD_IReader* reader);
 
74
        virtual ~AUD_Mixer() {}
103
75
 
104
76
        /**
105
77
         * Returns the target specification for superposing.
106
78
         * \return The target specification.
107
79
         */
108
 
        AUD_DeviceSpecs getSpecs();
 
80
        AUD_DeviceSpecs getSpecs() const;
109
81
 
110
82
        /**
111
83
         * Sets the target specification for superposing.
112
84
         * \param specs The target specification.
113
85
         */
114
 
        void setSpecs(AUD_DeviceSpecs specs);
 
86
        void setSpecs(AUD_Specs specs);
115
87
 
116
88
        /**
117
 
         * Adds a buffer for superposition.
 
89
         * Mixes a buffer.
118
90
         * \param buffer The buffer to superpose.
119
91
         * \param start The start sample of the buffer.
120
92
         * \param length The length of the buffer in samples.
121
93
         * \param volume The mixing volume. Must be a value between 0.0 and 1.0.
122
94
         */
123
 
        void add(sample_t* buffer, int start, int length, float volume);
 
95
        void mix(sample_t* buffer, int start, int length, float volume);
124
96
 
125
97
        /**
126
 
         * Superposes all added buffers into an output buffer.
 
98
         * Writes the mixing buffer into an output buffer.
127
99
         * \param buffer The target buffer for superposing.
 
100
         * \param volume The mixing volume. Must be a value between 0.0 and 1.0.
 
101
         */
 
102
        void read(data_t* buffer, float volume);
 
103
 
 
104
        /**
 
105
         * Clears the mixing buffer.
128
106
         * \param length The length of the buffer in samples.
129
 
         * \param volume The mixing volume. Must be a value between 0.0 and 1.0.
130
107
         */
131
 
        void superpose(data_t* buffer, int length, float volume);
 
108
        void clear(int length);
132
109
};
133
110
 
134
 
#endif //AUD_MIXER
 
111
#endif //__AUD_MIXER_H__