00001 00002 // 00003 // AkSpeakerConfig.h 00004 // 00005 // 00006 // Copyright 2008-2009 Audiokinetic Inc. 00007 // 00009 00010 #ifndef _AK_SPEAKERCONFIG_H_ 00011 #define _AK_SPEAKERCONFIG_H_ 00012 00013 #include <AK/SoundEngine/Common/AkTypes.h> 00014 00016 #define AK_SPEAKER_FRONT_LEFT 0x1 ///< Front left speaker bit mask 00017 #define AK_SPEAKER_FRONT_RIGHT 0x2 ///< Front right speaker bit mask 00018 #define AK_SPEAKER_FRONT_CENTER 0x4 ///< Front center speaker bit mask 00019 #define AK_SPEAKER_LOW_FREQUENCY 0x8 ///< Low-frequency speaker bit mask 00020 #define AK_SPEAKER_BACK_LEFT 0x10 ///< Rear left speaker bit mask 00021 #define AK_SPEAKER_BACK_RIGHT 0x20 ///< Rear right speaker bit mask 00022 #define AK_SPEAKER_BACK_CENTER 0x100 ///< Rear center speaker ("surround speaker") bit mask 00023 #define AK_SPEAKER_SIDE_LEFT 0x200 ///< Side left speaker bit mask 00024 #define AK_SPEAKER_SIDE_RIGHT 0x400 ///< Side right speaker bit mask 00025 00027 #define AK_SPEAKER_TOP 0x800 ///< Top speaker bit mask 00028 #define AK_SPEAKER_HEIGHT_FRONT_LEFT 0x1000 ///< Front left speaker bit mask 00029 #define AK_SPEAKER_HEIGHT_FRONT_CENTER 0x2000 ///< Front center speaker bit mask 00030 #define AK_SPEAKER_HEIGHT_FRONT_RIGHT 0x4000 ///< Front right speaker bit mask 00031 #define AK_SPEAKER_HEIGHT_BACK_LEFT 0x8000 ///< Rear left speaker bit mask 00032 #define AK_SPEAKER_HEIGHT_BACK_CENTER 0x10000 ///< Rear center speaker bit mask 00033 #define AK_SPEAKER_HEIGHT_BACK_RIGHT 0x20000 ///< Rear right speaker bit mask 00034 00035 // 00036 // Supported speaker setups. Those are the ones that can be used in the Wwise Sound Engine audio pipeline. 00037 // 00038 00039 #define AK_SPEAKER_SETUP_MONO AK_SPEAKER_FRONT_CENTER ///< 1.0 setup channel mask 00040 #define AK_SPEAKER_SETUP_0POINT1 AK_SPEAKER_LOW_FREQUENCY ///< 0.1 setup channel mask 00041 #define AK_SPEAKER_SETUP_1POINT1 (AK_SPEAKER_FRONT_CENTER | AK_SPEAKER_LOW_FREQUENCY) ///< 1.1 setup channel mask 00042 #define AK_SPEAKER_SETUP_STEREO (AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_FRONT_RIGHT) ///< 2.0 setup channel mask 00043 #define AK_SPEAKER_SETUP_2POINT1 (AK_SPEAKER_SETUP_STEREO | AK_SPEAKER_LOW_FREQUENCY) ///< 2.1 setup channel mask 00044 #define AK_SPEAKER_SETUP_3STEREO (AK_SPEAKER_SETUP_STEREO | AK_SPEAKER_FRONT_CENTER) ///< 3.0 setup channel mask 00045 #define AK_SPEAKER_SETUP_3POINT1 (AK_SPEAKER_SETUP_3STEREO | AK_SPEAKER_LOW_FREQUENCY) ///< 3.1 setup channel mask 00046 #define AK_SPEAKER_SETUP_4 (AK_SPEAKER_SETUP_STEREO | AK_SPEAKER_SIDE_LEFT | AK_SPEAKER_SIDE_RIGHT) ///< 4.0 setup channel mask 00047 #define AK_SPEAKER_SETUP_4POINT1 (AK_SPEAKER_SETUP_4 | AK_SPEAKER_LOW_FREQUENCY) ///< 4.1 setup channel mask 00048 #define AK_SPEAKER_SETUP_5 (AK_SPEAKER_SETUP_4 | AK_SPEAKER_FRONT_CENTER) ///< 5.0 setup channel mask 00049 #define AK_SPEAKER_SETUP_5POINT1 (AK_SPEAKER_SETUP_5 | AK_SPEAKER_LOW_FREQUENCY) ///< 5.1 setup channel mask 00050 #define AK_SPEAKER_SETUP_6 (AK_SPEAKER_SETUP_4 | AK_SPEAKER_BACK_LEFT | AK_SPEAKER_BACK_RIGHT) ///< 6.0 setup channel mask 00051 #define AK_SPEAKER_SETUP_6POINT1 (AK_SPEAKER_SETUP_6 | AK_SPEAKER_LOW_FREQUENCY) ///< 6.1 setup channel mask 00052 #define AK_SPEAKER_SETUP_7 (AK_SPEAKER_SETUP_6 | AK_SPEAKER_FRONT_CENTER) ///< 7.0 setup channel mask 00053 #define AK_SPEAKER_SETUP_7POINT1 (AK_SPEAKER_SETUP_7 | AK_SPEAKER_LOW_FREQUENCY) ///< 7.1 setup channel mask 00054 #define AK_SPEAKER_SETUP_SURROUND (AK_SPEAKER_SETUP_STEREO | AK_SPEAKER_BACK_CENTER) ///< Wii surround setup channel mask 00055 00056 // Note. DPL2 does not really have 4 channels, but it is used by plugins to differentiate from stereo setup. 00057 #define AK_SPEAKER_SETUP_DPL2 (AK_SPEAKER_SETUP_4) ///< Wii DPL2 setup channel mask 00058 00059 #define AK_SPEAKER_SETUP_HEIGHT_4 (AK_SPEAKER_HEIGHT_FRONT_LEFT | AK_SPEAKER_HEIGHT_FRONT_RIGHT | AK_SPEAKER_HEIGHT_BACK_LEFT | AK_SPEAKER_HEIGHT_BACK_RIGHT) ///< 4 speaker height layer. 00060 #define AK_SPEAKER_SETUP_HEIGHT_5 (AK_SPEAKER_SETUP_HEIGHT_4 | AK_SPEAKER_HEIGHT_FRONT_CENTER) ///< 5 speaker height layer. 00061 #define AK_SPEAKER_SETUP_HEIGHT_ALL (AK_SPEAKER_SETUP_HEIGHT_5 | AK_SPEAKER_HEIGHT_BACK_CENTER) ///< All height speaker layer. 00062 00063 // Auro speaker setups 00064 #define AK_SPEAKER_SETUP_AURO_222 (AK_SPEAKER_SETUP_4 | AK_SPEAKER_HEIGHT_FRONT_LEFT | AK_SPEAKER_HEIGHT_FRONT_RIGHT) ///< Auro-222 setup channel mask 00065 #define AK_SPEAKER_SETUP_AURO_8 (AK_SPEAKER_SETUP_AURO_222 | AK_SPEAKER_HEIGHT_BACK_LEFT | AK_SPEAKER_HEIGHT_BACK_RIGHT) ///< Auro-8 setup channel mask 00066 #define AK_SPEAKER_SETUP_AURO_9 (AK_SPEAKER_SETUP_AURO_8 | AK_SPEAKER_FRONT_CENTER) ///< Auro-9.0 setup channel mask 00067 #define AK_SPEAKER_SETUP_AURO_9POINT1 (AK_SPEAKER_SETUP_AURO_9 | AK_SPEAKER_LOW_FREQUENCY) ///< Auro-9.1 setup channel mask 00068 #define AK_SPEAKER_SETUP_AURO_10 (AK_SPEAKER_SETUP_AURO_9 | AK_SPEAKER_TOP) ///< Auro-10.0 setup channel mask 00069 #define AK_SPEAKER_SETUP_AURO_10POINT1 (AK_SPEAKER_SETUP_AURO_10 | AK_SPEAKER_LOW_FREQUENCY) ///< Auro-10.1 setup channel mask 00070 #define AK_SPEAKER_SETUP_AURO_11 (AK_SPEAKER_SETUP_AURO_10 | AK_SPEAKER_HEIGHT_FRONT_CENTER) ///< Auro-11.0 setup channel mask 00071 #define AK_SPEAKER_SETUP_AURO_11POINT1 (AK_SPEAKER_SETUP_AURO_11 | AK_SPEAKER_LOW_FREQUENCY) ///< Auro-11.1 setup channel mask 00072 #define AK_SPEAKER_SETUP_AURO_11_740 (AK_SPEAKER_SETUP_7 | AK_SPEAKER_SETUP_HEIGHT_4) ///< Auro-11.0 (7+4) setup channel mask 00073 #define AK_SPEAKER_SETUP_AURO_11POINT1_740 (AK_SPEAKER_SETUP_AURO_11_740 | AK_SPEAKER_LOW_FREQUENCY) ///< Auro-11.1 (7+4) setup channel mask 00074 #define AK_SPEAKER_SETUP_AURO_13_751 (AK_SPEAKER_SETUP_7 | AK_SPEAKER_SETUP_HEIGHT_5 | AK_SPEAKER_TOP) ///< Auro-13.0 setup channel mask 00075 #define AK_SPEAKER_SETUP_AURO_13POINT1_751 (AK_SPEAKER_SETUP_AURO_13_751 | AK_SPEAKER_LOW_FREQUENCY) ///< Auro-13.1 setup channel mask 00076 00077 // Dolby speaker setups: in Dolby standard, [#plane].[lfe].[#height] 00078 #define AK_SPEAKER_SETUP_DOLBY_5_0_2 (AK_SPEAKER_SETUP_5 | AK_SPEAKER_HEIGHT_FRONT_LEFT | AK_SPEAKER_HEIGHT_FRONT_RIGHT ) ///< Dolby 5.0.2 setup channel mask 00079 #define AK_SPEAKER_SETUP_DOLBY_5_1_2 (AK_SPEAKER_SETUP_DOLBY_5_0_2 | AK_SPEAKER_LOW_FREQUENCY ) ///< Dolby 5.1.2 setup channel mask 00080 #define AK_SPEAKER_SETUP_DOLBY_7_0_2 (AK_SPEAKER_SETUP_7 | AK_SPEAKER_HEIGHT_FRONT_LEFT | AK_SPEAKER_HEIGHT_FRONT_RIGHT ) ///< Dolby 7.0.2 setup channel mask 00081 #define AK_SPEAKER_SETUP_DOLBY_7_1_2 (AK_SPEAKER_SETUP_DOLBY_7_0_2 | AK_SPEAKER_LOW_FREQUENCY ) ///< Dolby 7.1.2 setup channel mask 00082 00083 #define AK_SPEAKER_SETUP_ALL_SPEAKERS (AK_SPEAKER_SETUP_7POINT1 | AK_SPEAKER_BACK_CENTER | AK_SPEAKER_SETUP_HEIGHT_ALL | AK_SPEAKER_TOP) ///< All speakers. 00084 00085 // Channel indices. 00086 // ------------------------------------------------ 00087 00088 // Channel indices for standard setups on the plane. 00089 #define AK_IDX_SETUP_FRONT_LEFT (0) ///< Index of front-left channel in all configurations. 00090 #define AK_IDX_SETUP_FRONT_RIGHT (1) ///< Index of front-right channel in all configurations. 00091 #define AK_IDX_SETUP_CENTER (2) ///< Index of front-center channel in all configurations. 00092 00093 #define AK_IDX_SETUP_NOCENTER_BACK_LEFT (2) ///< Index of back-left channel in configurations with no front-center channel. 00094 #define AK_IDX_SETUP_NOCENTER_BACK_RIGHT (3) ///< Index of back-right channel in configurations with no front-center channel. 00095 #define AK_IDX_SETUP_NOCENTER_SIDE_LEFT (4) ///< Index of side-left channel in configurations with no front-center channel. 00096 #define AK_IDX_SETUP_NOCENTER_SIDE_RIGHT (5) ///< Index of side-right channel in configurations with no front-center channel. 00097 00098 #define AK_IDX_SETUP_WITHCENTER_BACK_LEFT (3) ///< Index of back-left channel in configurations with a front-center channel. 00099 #define AK_IDX_SETUP_WITHCENTER_BACK_RIGHT (4) ///< Index of back-right channel in configurations with a front-center channel. 00100 #define AK_IDX_SETUP_WITHCENTER_SIDE_LEFT (5) ///< Index of side-left channel in configurations with a front-center channel. 00101 #define AK_IDX_SETUP_WITHCENTER_SIDE_RIGHT (6) ///< Index of side-right channel in configurations with a front-center channel. 00102 00103 // Channel indices for specific setups. 00104 #define AK_IDX_SETUP_0_LFE (0) ///< Index of low-frequency channel in 0.1 setup (use with AkAudioBuffer::GetChannel()) 00105 00106 #define AK_IDX_SETUP_1_CENTER (0) ///< Index of center channel in 1.x setups (use with AkAudioBuffer::GetChannel()) 00107 #define AK_IDX_SETUP_1_LFE (1) ///< Index of low-frequency channel in 1.1 setup (use with AkAudioBuffer::GetChannel()) 00108 00109 #define AK_IDX_SETUP_2_LEFT (0) ///< Index of left channel in 2.x setups (use with AkAudioBuffer::GetChannel()) 00110 #define AK_IDX_SETUP_2_RIGHT (1) ///< Index of right channel in 2.x setups (use with AkAudioBuffer::GetChannel()) 00111 #define AK_IDX_SETUP_2_LFE (2) ///< Index of low-frequency channel in 2.1 setup (use with AkAudioBuffer::GetChannel()) 00112 00113 #define AK_IDX_SETUP_3_LEFT (0) ///< Index of left channel in 3.x setups (use with AkAudioBuffer::GetChannel()) 00114 #define AK_IDX_SETUP_3_RIGHT (1) ///< Index of right channel in 3.x setups (use with AkAudioBuffer::GetChannel()) 00115 #define AK_IDX_SETUP_3_CENTER (2) ///< Index of center channel in 3.x setups (use with AkAudioBuffer::GetChannel()) 00116 #define AK_IDX_SETUP_3_LFE (3) ///< Index of low-frequency channel in 3.1 setup (use with AkAudioBuffer::GetChannel()) 00117 00118 #define AK_IDX_SETUP_4_FRONTLEFT (0) ///< Index of front left channel in 4.x setups (use with AkAudioBuffer::GetChannel()) 00119 #define AK_IDX_SETUP_4_FRONTRIGHT (1) ///< Index of front right channel in 4.x setups (use with AkAudioBuffer::GetChannel()) 00120 #define AK_IDX_SETUP_4_REARLEFT (2) ///< Index of rear left channel in 4.x setups (use with AkAudioBuffer::GetChannel()) 00121 #define AK_IDX_SETUP_4_REARRIGHT (3) ///< Index of rear right channel in 4.x setups (use with AkAudioBuffer::GetChannel()) 00122 #define AK_IDX_SETUP_4_LFE (4) ///< Index of low-frequency channel in 4.1 setup (use with AkAudioBuffer::GetChannel()) 00123 00124 #define AK_IDX_SETUP_5_FRONTLEFT (0) ///< Index of front left channel in 5.x setups (use with AkAudioBuffer::GetChannel()) 00125 #define AK_IDX_SETUP_5_FRONTRIGHT (1) ///< Index of front right channel in 5.x setups (use with AkAudioBuffer::GetChannel()) 00126 #define AK_IDX_SETUP_5_CENTER (2) ///< Index of center channel in 5.x setups (use with AkAudioBuffer::GetChannel()) 00127 #define AK_IDX_SETUP_5_REARLEFT (3) ///< Index of rear left channel in 5.x setups (use with AkAudioBuffer::GetChannel()) 00128 #define AK_IDX_SETUP_5_REARRIGHT (4) ///< Index of rear right channel in 5.x setups (use with AkAudioBuffer::GetChannel()) 00129 #define AK_IDX_SETUP_5_LFE (5) ///< Index of low-frequency channel in 5.1 setup (use with AkAudioBuffer::GetChannel()) 00130 00131 #ifdef AK_71AUDIO 00132 #define AK_IDX_SETUP_6_FRONTLEFT (0) ///< Index of front left channel in 6.x setups (use with AkAudioBuffer::GetChannel()) 00133 #define AK_IDX_SETUP_6_FRONTRIGHT (1) ///< Index of fornt right channel in 6x setups (use with AkAudioBuffer::GetChannel()) 00134 #define AK_IDX_SETUP_6_REARLEFT (2) ///< Index of rear left channel in 6.x setups (use with AkAudioBuffer::GetChannel()) 00135 #define AK_IDX_SETUP_6_REARRIGHT (3) ///< Index of rear right channel in 6.x setups (use with AkAudioBuffer::GetChannel()) 00136 #define AK_IDX_SETUP_6_SIDELEFT (4) ///< Index of side left channel in 6.x setups (use with AkAudioBuffer::GetChannel()) 00137 #define AK_IDX_SETUP_6_SIDERIGHT (5) ///< Index of side right channel in 6.x setups (use with AkAudioBuffer::GetChannel()) 00138 #define AK_IDX_SETUP_6_LFE (6) ///< Index of low-frequency channel in 6.1 setup (use with AkAudioBuffer::GetChannel()) 00139 00140 #define AK_IDX_SETUP_7_FRONTLEFT (0) ///< Index of front left channel in 7.x setups (use with AkAudioBuffer::GetChannel()) 00141 #define AK_IDX_SETUP_7_FRONTRIGHT (1) ///< Index of fornt right channel in 7.x setups (use with AkAudioBuffer::GetChannel()) 00142 #define AK_IDX_SETUP_7_CENTER (2) ///< Index of center channel in 7.x setups (use with AkAudioBuffer::GetChannel()) 00143 #define AK_IDX_SETUP_7_REARLEFT (3) ///< Index of rear left channel in 7.x setups (use with AkAudioBuffer::GetChannel()) 00144 #define AK_IDX_SETUP_7_REARRIGHT (4) ///< Index of rear right channel in 7.x setups (use with AkAudioBuffer::GetChannel()) 00145 #define AK_IDX_SETUP_7_SIDELEFT (5) ///< Index of side left channel in 7.x setups (use with AkAudioBuffer::GetChannel()) 00146 #define AK_IDX_SETUP_7_SIDERIGHT (6) ///< Index of side right channel in 7.x setups (use with AkAudioBuffer::GetChannel()) 00147 #define AK_IDX_SETUP_7_LFE (7) ///< Index of low-frequency channel in 7.1 setup (use with AkAudioBuffer::GetChannel()) 00148 #endif 00149 00150 // 00151 // Extra speaker setups. This is a more exhaustive list of speaker setups, which might not all be supported 00152 // by the Wwise Sound Engine audio pipeline. 00153 // 00154 00155 #define AK_SPEAKER_SETUP_0_1 ( AK_SPEAKER_LOW_FREQUENCY ) //0.1 00156 #define AK_SPEAKER_SETUP_1_0 ( AK_SPEAKER_FRONT_LEFT ) //1.0 (L) 00157 #define AK_SPEAKER_SETUP_1_1 ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_LOW_FREQUENCY ) //1.1 (L) 00158 00159 #define AK_SPEAKER_SETUP_1_0_CENTER ( AK_SPEAKER_FRONT_CENTER ) //1.0 (C) 00160 #define AK_SPEAKER_SETUP_1_1_CENTER ( AK_SPEAKER_FRONT_CENTER | AK_SPEAKER_LOW_FREQUENCY ) //1.1 (C) 00161 00162 #define AK_SPEAKER_SETUP_2_0 ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_FRONT_RIGHT ) //2.0 00163 #define AK_SPEAKER_SETUP_2_1 ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_FRONT_RIGHT | AK_SPEAKER_LOW_FREQUENCY ) //2.1 00164 00165 #define AK_SPEAKER_SETUP_3_0 ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_FRONT_RIGHT | AK_SPEAKER_FRONT_CENTER ) //3.0 00166 #define AK_SPEAKER_SETUP_3_1 ( AK_SPEAKER_SETUP_3_0 | AK_SPEAKER_LOW_FREQUENCY ) //3.1 00167 00168 #define AK_SPEAKER_SETUP_FRONT ( AK_SPEAKER_SETUP_3_0 ) 00169 00170 #define AK_SPEAKER_SETUP_4_0 ( AK_SPEAKER_SETUP_4 ) 00171 #define AK_SPEAKER_SETUP_4_1 ( AK_SPEAKER_SETUP_4POINT1 ) 00172 #define AK_SPEAKER_SETUP_5_0 ( AK_SPEAKER_SETUP_5 ) 00173 #define AK_SPEAKER_SETUP_5_1 ( AK_SPEAKER_SETUP_5POINT1 ) 00174 00175 #define AK_SPEAKER_SETUP_6_0 ( AK_SPEAKER_SETUP_6 ) 00176 #define AK_SPEAKER_SETUP_6_1 ( AK_SPEAKER_SETUP_6POINT1 ) 00177 #define AK_SPEAKER_SETUP_7_0 ( AK_SPEAKER_SETUP_7 ) 00178 #define AK_SPEAKER_SETUP_7_1 ( AK_SPEAKER_SETUP_7POINT1 ) 00179 00180 inline void AK_SPEAKER_SETUP_FIX_LEFT_TO_CENTER( AkUInt32 &io_uChannelMask ) 00181 { 00182 if( !(io_uChannelMask & AK_SPEAKER_FRONT_CENTER) 00183 && !(io_uChannelMask & AK_SPEAKER_FRONT_RIGHT) 00184 && (io_uChannelMask & AK_SPEAKER_FRONT_LEFT) ) 00185 { 00186 io_uChannelMask &= ~AK_SPEAKER_FRONT_LEFT; // remove left 00187 io_uChannelMask |= AK_SPEAKER_FRONT_CENTER; // add center 00188 } 00189 } 00190 00191 inline void AK_SPEAKER_SETUP_FIX_REAR_TO_SIDE( AkUInt32 &io_uChannelMask ) 00192 { 00193 if( io_uChannelMask & ( AK_SPEAKER_BACK_LEFT ) && !( io_uChannelMask & AK_SPEAKER_SIDE_LEFT ) ) 00194 { 00195 io_uChannelMask &= ~( AK_SPEAKER_BACK_LEFT | AK_SPEAKER_BACK_RIGHT ); // remove rears 00196 io_uChannelMask |= ( AK_SPEAKER_SIDE_LEFT | AK_SPEAKER_SIDE_RIGHT ); // add sides 00197 } 00198 } 00199 00200 inline void AK_SPEAKER_SETUP_CONVERT_TO_SUPPORTED( AkUInt32 &io_uChannelMask ) 00201 { 00202 AK_SPEAKER_SETUP_FIX_LEFT_TO_CENTER( io_uChannelMask ); 00203 AK_SPEAKER_SETUP_FIX_REAR_TO_SIDE( io_uChannelMask ); 00204 } 00205 00206 namespace AK 00207 { 00208 00210 static inline unsigned int ChannelMaskToNumChannels( AkChannelMask in_uChannelMask ) 00211 { 00212 unsigned int num = 0; 00213 while( in_uChannelMask ){ ++num; in_uChannelMask &= in_uChannelMask-1; } // iterate max once per channel. 00214 return num; 00215 } 00216 00219 static inline AkChannelMask ChannelMaskFromNumChannels( unsigned int in_uNumChannels ) 00220 { 00221 AkChannelMask uChannelMask = 0; 00222 00223 switch ( in_uNumChannels ) 00224 { 00225 case 1: 00226 uChannelMask = AK_SPEAKER_SETUP_1_0_CENTER; 00227 break; 00228 case 2: 00229 uChannelMask = AK_SPEAKER_SETUP_2_0; 00230 break; 00231 case 3: 00232 uChannelMask = AK_SPEAKER_SETUP_2_1; 00233 break; 00234 case 4: 00235 uChannelMask = AK_SPEAKER_SETUP_4_0; 00236 break; 00237 case 5: 00238 uChannelMask = AK_SPEAKER_SETUP_5_0; 00239 break; 00240 case 6: 00241 uChannelMask = AK_SPEAKER_SETUP_5_1; 00242 break; 00243 case 7: 00244 uChannelMask = AK_SPEAKER_SETUP_7; 00245 break; 00246 case 8: 00247 uChannelMask = AK_SPEAKER_SETUP_7POINT1; 00248 break; 00249 } 00250 00251 return uChannelMask; 00252 } 00253 00255 enum AkChannelOrdering 00256 { 00257 ChannelOrdering_Standard, // L-R-C-Lfe-RL-RR-RC-SL-SR-HL-HR-HC-HRL-HRR-HRC-T 00258 ChannelOrdering_RunTime // L-R-C-RL-RR-RC-SL-SR-HL-HR-HC-HRL-HRR-HRC-T-Lfe 00259 }; 00260 00263 AkForceInline bool HasSurroundChannels( AkChannelMask in_uChannelMask ) 00264 { 00265 return ( in_uChannelMask & AK_SPEAKER_BACK_LEFT || in_uChannelMask & AK_SPEAKER_SIDE_LEFT ); 00266 } 00267 00271 AkForceInline bool HasStrictlyOnePairOfSurroundChannels( AkChannelMask in_uChannelMask ) 00272 { 00273 return ( ( ( in_uChannelMask & AK_SPEAKER_BACK_LEFT ) != 0 ) ^ ( ( in_uChannelMask & AK_SPEAKER_SIDE_LEFT ) != 0 ) ); 00274 } 00275 00279 AkForceInline bool HasSideAndRearChannels( AkChannelMask in_uChannelMask ) 00280 { 00281 return ( in_uChannelMask & AK_SPEAKER_BACK_LEFT && in_uChannelMask & AK_SPEAKER_SIDE_LEFT ); 00282 } 00283 00286 AkForceInline AkChannelMask BackToSideChannels( AkChannelMask in_uChannelMask ) 00287 { 00288 if ( HasStrictlyOnePairOfSurroundChannels( in_uChannelMask ) ) 00289 { 00290 in_uChannelMask &= ~( AK_SPEAKER_BACK_LEFT | AK_SPEAKER_BACK_RIGHT ); // remove rears 00291 in_uChannelMask |= ( AK_SPEAKER_SIDE_LEFT | AK_SPEAKER_SIDE_RIGHT ); // add sides 00292 } 00293 return in_uChannelMask; 00294 } 00295 00300 static inline unsigned int ChannelIndexToDisplayIndex( AkChannelOrdering in_eOrdering, unsigned int in_uChannelMask, unsigned int in_uChannelIdx ) 00301 { 00302 if ( in_eOrdering == ChannelOrdering_Standard ) 00303 { 00304 unsigned int uNumChannelsFront = ChannelMaskToNumChannels( in_uChannelMask & AK_SPEAKER_SETUP_FRONT ); 00305 if ( ( in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY ) 00306 && ( in_uChannelIdx == uNumChannelsFront ) ) 00307 { 00308 // Lfe. Return penultimate channel. 00309 in_uChannelIdx = ChannelMaskToNumChannels( in_uChannelMask ) - 1; 00310 } 00311 else if ( in_uChannelIdx >= uNumChannelsFront ) // strictly greater than uNumChannelsFront (lfe index) if lfe is present, greater or equal otherwise. 00312 { 00313 // Back channel. Return index or index-1 if there is an LFE (uLfeOffset==1). 00314 unsigned int uLfeOffset = ( in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY ) ? 1 : 0; 00315 00316 // 6-7.x: Need to swap back and sides. 00317 if ( HasSideAndRearChannels( in_uChannelMask ) ) 00318 { 00319 unsigned int uRearIdx = uNumChannelsFront + uLfeOffset; 00320 unsigned int uSideIdx = uRearIdx + 2; 00321 unsigned int uAfterSideIdx = uSideIdx + 2; 00322 if ( in_uChannelIdx < uAfterSideIdx ) 00323 { 00324 if ( in_uChannelIdx >= uSideIdx ) 00325 in_uChannelIdx -= 2; // input is side, swap it with back. 00326 else 00327 in_uChannelIdx += 2; // input is back, swap it with side. 00328 } 00329 } 00330 in_uChannelIdx -= uLfeOffset; // compensate for LFE if it was skipped above. 00331 } 00332 } 00333 else 00334 { 00335 // 6-7.x: Need to swap back and sides. 00336 if ( HasSideAndRearChannels( in_uChannelMask ) ) 00337 { 00338 unsigned int uRearIdx = ChannelMaskToNumChannels( in_uChannelMask & AK_SPEAKER_SETUP_FRONT ); 00339 unsigned int uMaxIdx = uRearIdx + 4; // Side and rear channels. 00340 00341 if ( in_uChannelIdx >= uRearIdx 00342 && in_uChannelIdx < uMaxIdx ) 00343 { 00344 // Surround channel (not LFE). 00345 unsigned int uSideIdx = uRearIdx + 2; 00346 if ( in_uChannelIdx >= uSideIdx ) 00347 in_uChannelIdx -= 2; // input is side, swap it with back. 00348 else 00349 in_uChannelIdx += 2; // input is back, swap it with side. 00350 } 00351 } 00352 } 00353 00354 return in_uChannelIdx; 00355 } 00356 00357 } // namespace AK 00358 00359 #endif //_AK_SPEAKERCONFIG_H_
프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.
Wwise를 시작해 보세요