~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to intern/audaspace/intern/AUD_ChannelMapperReader.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_ChannelMapperReader.h 22328 2009-08-09 23:23:19Z gsrb3d $
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_CHANNELMAPPERREADER
27
 
#define AUD_CHANNELMAPPERREADER
 
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_ChannelMapperReader.h
 
26
 *  \ingroup audaspaceintern
 
27
 */
 
28
 
 
29
 
 
30
#ifndef __AUD_CHANNELMAPPERREADER_H__
 
31
#define __AUD_CHANNELMAPPERREADER_H__
28
32
 
29
33
#include "AUD_EffectReader.h"
30
 
class AUD_Buffer;
 
34
#include "AUD_Buffer.h"
31
35
 
32
36
/**
33
37
 * This class maps a sound source's channels to a specific output channel count.
37
41
{
38
42
private:
39
43
        /**
40
 
         * The sound output buffer.
 
44
         * The sound reading buffer.
41
45
         */
42
 
        AUD_Buffer *m_buffer;
 
46
        AUD_Buffer m_buffer;
43
47
 
44
48
        /**
45
49
         * The output specification.
46
50
         */
47
 
        AUD_Specs m_specs;
 
51
        AUD_Channels m_target_channels;
48
52
 
49
53
        /**
50
54
         * The channel count of the reader.
51
55
         */
52
 
        int m_rch;
 
56
        AUD_Channels m_source_channels;
53
57
 
54
58
        /**
55
59
         * The mapping specification.
56
60
         */
57
 
        float **m_mapping;
 
61
        float* m_mapping;
 
62
 
 
63
        /**
 
64
         * The size of the mapping.
 
65
         */
 
66
        int m_map_size;
 
67
 
 
68
        /**
 
69
         * The mono source angle.
 
70
         */
 
71
        float m_mono_angle;
 
72
 
 
73
        static const AUD_Channel MONO_MAP[];
 
74
        static const AUD_Channel STEREO_MAP[];
 
75
        static const AUD_Channel STEREO_LFE_MAP[];
 
76
        static const AUD_Channel SURROUND4_MAP[];
 
77
        static const AUD_Channel SURROUND5_MAP[];
 
78
        static const AUD_Channel SURROUND51_MAP[];
 
79
        static const AUD_Channel SURROUND61_MAP[];
 
80
        static const AUD_Channel SURROUND71_MAP[];
 
81
        static const AUD_Channel* CHANNEL_MAPS[];
 
82
 
 
83
        static const float MONO_ANGLES[];
 
84
        static const float STEREO_ANGLES[];
 
85
        static const float STEREO_LFE_ANGLES[];
 
86
        static const float SURROUND4_ANGLES[];
 
87
        static const float SURROUND5_ANGLES[];
 
88
        static const float SURROUND51_ANGLES[];
 
89
        static const float SURROUND61_ANGLES[];
 
90
        static const float SURROUND71_ANGLES[];
 
91
        static const float* CHANNEL_ANGLES[];
 
92
 
 
93
        // hide copy constructor and operator=
 
94
        AUD_ChannelMapperReader(const AUD_ChannelMapperReader&);
 
95
        AUD_ChannelMapperReader& operator=(const AUD_ChannelMapperReader&);
 
96
 
 
97
        /**
 
98
         * Calculates the mapping matrix.
 
99
         */
 
100
        void calculateMapping();
 
101
 
 
102
        /**
 
103
         * Calculates the distance between two angles.
 
104
         */
 
105
        float angleDistance(float alpha, float beta);
58
106
 
59
107
public:
60
108
        /**
61
109
         * Creates a channel mapper reader.
62
110
         * \param reader The reader to map.
63
111
         * \param mapping The mapping specification as two dimensional float array.
64
 
         * \exception AUD_Exception Thrown if the reader is NULL.
65
112
         */
66
 
        AUD_ChannelMapperReader(AUD_IReader* reader, float **mapping);
 
113
        AUD_ChannelMapperReader(AUD_Reference<AUD_IReader> reader, AUD_Channels channels);
 
114
 
67
115
        /**
68
116
         * Destroys the reader.
69
117
         */
70
118
        ~AUD_ChannelMapperReader();
71
119
 
72
 
        virtual AUD_Specs getSpecs();
73
 
        virtual void read(int & length, sample_t* & buffer);
 
120
        /**
 
121
         * Sets the requested channel output count.
 
122
         * \param channels The channel output count.
 
123
         */
 
124
        void setChannels(AUD_Channels channels);
 
125
 
 
126
        /**
 
127
         * Sets the angle for mono sources.
 
128
         * \param angle The angle for mono sources.
 
129
         */
 
130
        void setMonoAngle(float angle);
 
131
 
 
132
        virtual AUD_Specs getSpecs() const;
 
133
        virtual void read(int& length, bool& eos, sample_t* buffer);
74
134
};
75
135
 
76
 
#endif //AUD_CHANNELMAPPERREADER
 
136
#endif //__AUD_CHANNELMAPPERREADER_H__