Blender V2.61 - r43446

AUD_ChannelMapperReader.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * Copyright 2009-2011 Jörg Hermann Müller
00005  *
00006  * This file is part of AudaSpace.
00007  *
00008  * Audaspace is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * AudaSpace is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with Audaspace; if not, write to the Free Software Foundation,
00020  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #ifndef AUD_CHANNELMAPPERREADER
00031 #define AUD_CHANNELMAPPERREADER
00032 
00033 #include "AUD_EffectReader.h"
00034 #include "AUD_Buffer.h"
00035 
00040 class AUD_ChannelMapperReader : public AUD_EffectReader
00041 {
00042 private:
00046     AUD_Buffer m_buffer;
00047 
00051     AUD_Channels m_target_channels;
00052 
00056     AUD_Channels m_source_channels;
00057 
00061     float* m_mapping;
00062 
00066     int m_map_size;
00067 
00071     float m_mono_angle;
00072 
00073     static const AUD_Channel MONO_MAP[];
00074     static const AUD_Channel STEREO_MAP[];
00075     static const AUD_Channel STEREO_LFE_MAP[];
00076     static const AUD_Channel SURROUND4_MAP[];
00077     static const AUD_Channel SURROUND5_MAP[];
00078     static const AUD_Channel SURROUND51_MAP[];
00079     static const AUD_Channel SURROUND61_MAP[];
00080     static const AUD_Channel SURROUND71_MAP[];
00081     static const AUD_Channel* CHANNEL_MAPS[];
00082 
00083     static const float MONO_ANGLES[];
00084     static const float STEREO_ANGLES[];
00085     static const float STEREO_LFE_ANGLES[];
00086     static const float SURROUND4_ANGLES[];
00087     static const float SURROUND5_ANGLES[];
00088     static const float SURROUND51_ANGLES[];
00089     static const float SURROUND61_ANGLES[];
00090     static const float SURROUND71_ANGLES[];
00091     static const float* CHANNEL_ANGLES[];
00092 
00093     // hide copy constructor and operator=
00094     AUD_ChannelMapperReader(const AUD_ChannelMapperReader&);
00095     AUD_ChannelMapperReader& operator=(const AUD_ChannelMapperReader&);
00096 
00100     void calculateMapping();
00101 
00105     float angleDistance(float alpha, float beta);
00106 
00107 public:
00113     AUD_ChannelMapperReader(AUD_Reference<AUD_IReader> reader, AUD_Channels channels);
00114 
00118     ~AUD_ChannelMapperReader();
00119 
00124     void setChannels(AUD_Channels channels);
00125 
00130     void setMonoAngle(float angle);
00131 
00132     virtual AUD_Specs getSpecs() const;
00133     virtual void read(int& length, bool& eos, sample_t* buffer);
00134 };
00135 
00136 #endif //AUD_CHANNELMAPPERREADER