2
* $Id: AUD_ChannelMapperReader.h 22328 2009-08-09 23:23:19Z gsrb3d $
4
* ***** BEGIN LGPL LICENSE BLOCK *****
6
* Copyright 2009 Jörg Hermann Müller
2
* ***** BEGIN GPL LICENSE BLOCK *****
4
* Copyright 2009-2011 Jörg Hermann Müller
8
6
* This file is part of AudaSpace.
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.
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.
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/>.
23
* ***** END LGPL LICENSE BLOCK *****
26
#ifndef AUD_CHANNELMAPPERREADER
27
#define AUD_CHANNELMAPPERREADER
16
* GNU General Public License for more details.
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.
22
* ***** END GPL LICENSE BLOCK *****
25
/** \file audaspace/intern/AUD_ChannelMapperReader.h
26
* \ingroup audaspaceintern
30
#ifndef __AUD_CHANNELMAPPERREADER_H__
31
#define __AUD_CHANNELMAPPERREADER_H__
29
33
#include "AUD_EffectReader.h"
34
#include "AUD_Buffer.h"
33
37
* This class maps a sound source's channels to a specific output channel count.
40
* The sound output buffer.
44
* The sound reading buffer.
45
49
* The output specification.
51
AUD_Channels m_target_channels;
50
54
* The channel count of the reader.
56
AUD_Channels m_source_channels;
55
59
* The mapping specification.
64
* The size of the mapping.
69
* The mono source angle.
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[];
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[];
93
// hide copy constructor and operator=
94
AUD_ChannelMapperReader(const AUD_ChannelMapperReader&);
95
AUD_ChannelMapperReader& operator=(const AUD_ChannelMapperReader&);
98
* Calculates the mapping matrix.
100
void calculateMapping();
103
* Calculates the distance between two angles.
105
float angleDistance(float alpha, float beta);
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.
66
AUD_ChannelMapperReader(AUD_IReader* reader, float **mapping);
113
AUD_ChannelMapperReader(AUD_Reference<AUD_IReader> reader, AUD_Channels channels);
68
116
* Destroys the reader.
70
118
~AUD_ChannelMapperReader();
72
virtual AUD_Specs getSpecs();
73
virtual void read(int & length, sample_t* & buffer);
121
* Sets the requested channel output count.
122
* \param channels The channel output count.
124
void setChannels(AUD_Channels channels);
127
* Sets the angle for mono sources.
128
* \param angle The angle for mono sources.
130
void setMonoAngle(float angle);
132
virtual AUD_Specs getSpecs() const;
133
virtual void read(int& length, bool& eos, sample_t* buffer);
76
#endif //AUD_CHANNELMAPPERREADER
136
#endif //__AUD_CHANNELMAPPERREADER_H__