목차

include/AK/SoundEngine/Common/AkSpeakerConfig.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
00003 released in source code form as part of the SDK installer package.
00004 
00005 Commercial License Usage
00006 
00007 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
00008 may use this file in accordance with the end user license agreement provided 
00009 with the software or, alternatively, in accordance with the terms contained in a
00010 written agreement between you and Audiokinetic Inc.
00011 
00012 Apache License Usage
00013 
00014 Alternatively, this file may be used under the Apache License, Version 2.0 (the 
00015 "Apache License"); you may not use this file except in compliance with the 
00016 Apache License. You may obtain a copy of the Apache License at 
00017 http://www.apache.org/licenses/LICENSE-2.0.
00018 
00019 Unless required by applicable law or agreed to in writing, software distributed
00020 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
00021 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
00022 the specific language governing permissions and limitations under the License.
00023 
00024   Version: <VERSION>  Build: <BUILDNUMBER>
00025   Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
00026 *******************************************************************************/
00027 
00028 #ifndef _AK_SPEAKERCONFIG_H_
00029 #define _AK_SPEAKERCONFIG_H_
00030 
00031 #include <AK/SoundEngine/Common/AkTypes.h>
00032 
00033 /// Standard speakers (channel mask):
00034 #define AK_SPEAKER_FRONT_LEFT               0x1     ///< Front left speaker bit mask
00035 #define AK_SPEAKER_FRONT_RIGHT              0x2     ///< Front right speaker bit mask
00036 #define AK_SPEAKER_FRONT_CENTER             0x4     ///< Front center speaker bit mask
00037 #define AK_SPEAKER_LOW_FREQUENCY            0x8     ///< Low-frequency speaker bit mask
00038 #define AK_SPEAKER_BACK_LEFT                0x10    ///< Rear left speaker bit mask
00039 #define AK_SPEAKER_BACK_RIGHT               0x20    ///< Rear right speaker bit mask
00040 #define AK_SPEAKER_BACK_CENTER              0x100   ///< Rear center speaker ("surround speaker") bit mask
00041 #define AK_SPEAKER_SIDE_LEFT                0x200   ///< Side left speaker bit mask
00042 #define AK_SPEAKER_SIDE_RIGHT               0x400   ///< Side right speaker bit mask
00043 
00044 /// "Height" speakers.
00045 #define AK_SPEAKER_TOP                      0x800   ///< Top speaker bit mask
00046 #define AK_SPEAKER_HEIGHT_FRONT_LEFT        0x1000  ///< Front left speaker bit mask
00047 #define AK_SPEAKER_HEIGHT_FRONT_CENTER      0x2000  ///< Front center speaker bit mask
00048 #define AK_SPEAKER_HEIGHT_FRONT_RIGHT       0x4000  ///< Front right speaker bit mask
00049 #define AK_SPEAKER_HEIGHT_BACK_LEFT         0x8000  ///< Rear left speaker bit mask
00050 #define AK_SPEAKER_HEIGHT_BACK_CENTER       0x10000 ///< Rear center speaker bit mask
00051 #define AK_SPEAKER_HEIGHT_BACK_RIGHT        0x20000 ///< Rear right speaker bit mask
00052 
00053 //
00054 // Supported speaker setups. Those are the ones that can be used in the Wwise Sound Engine audio pipeline.
00055 //
00056 
00057 #define AK_SPEAKER_SETUP_MONO           AK_SPEAKER_FRONT_CENTER     ///< 1.0 setup channel mask
00058 #define AK_SPEAKER_SETUP_0POINT1        AK_SPEAKER_LOW_FREQUENCY    ///< 0.1 setup channel mask
00059 #define AK_SPEAKER_SETUP_1POINT1        (AK_SPEAKER_FRONT_CENTER    | AK_SPEAKER_LOW_FREQUENCY) ///< 1.1 setup channel mask
00060 #define AK_SPEAKER_SETUP_STEREO         (AK_SPEAKER_FRONT_LEFT      | AK_SPEAKER_FRONT_RIGHT)   ///< 2.0 setup channel mask
00061 #define AK_SPEAKER_SETUP_2POINT1        (AK_SPEAKER_SETUP_STEREO    | AK_SPEAKER_LOW_FREQUENCY) ///< 2.1 setup channel mask
00062 #define AK_SPEAKER_SETUP_3STEREO        (AK_SPEAKER_SETUP_STEREO    | AK_SPEAKER_FRONT_CENTER)  ///< 3.0 setup channel mask
00063 #define AK_SPEAKER_SETUP_3POINT1        (AK_SPEAKER_SETUP_3STEREO   | AK_SPEAKER_LOW_FREQUENCY) ///< 3.1 setup channel mask
00064 #define AK_SPEAKER_SETUP_4              (AK_SPEAKER_SETUP_STEREO    | AK_SPEAKER_SIDE_LEFT | AK_SPEAKER_SIDE_RIGHT) ///< 4.0 setup channel mask
00065 #define AK_SPEAKER_SETUP_4POINT1        (AK_SPEAKER_SETUP_4         | AK_SPEAKER_LOW_FREQUENCY) ///< 4.1 setup channel mask
00066 #define AK_SPEAKER_SETUP_5              (AK_SPEAKER_SETUP_4         | AK_SPEAKER_FRONT_CENTER)  ///< 5.0 setup channel mask
00067 #define AK_SPEAKER_SETUP_5POINT1        (AK_SPEAKER_SETUP_5         | AK_SPEAKER_LOW_FREQUENCY) ///< 5.1 setup channel mask
00068 #define AK_SPEAKER_SETUP_6              (AK_SPEAKER_SETUP_4         | AK_SPEAKER_BACK_LEFT | AK_SPEAKER_BACK_RIGHT) ///< 6.0 setup channel mask
00069 #define AK_SPEAKER_SETUP_6POINT1        (AK_SPEAKER_SETUP_6         | AK_SPEAKER_LOW_FREQUENCY) ///< 6.1 setup channel mask
00070 #define AK_SPEAKER_SETUP_7              (AK_SPEAKER_SETUP_6         | AK_SPEAKER_FRONT_CENTER)  ///< 7.0 setup channel mask
00071 #define AK_SPEAKER_SETUP_7POINT1        (AK_SPEAKER_SETUP_7         | AK_SPEAKER_LOW_FREQUENCY) ///< 7.1 setup channel mask
00072 #define AK_SPEAKER_SETUP_SURROUND       (AK_SPEAKER_SETUP_STEREO    | AK_SPEAKER_BACK_CENTER)   ///< Legacy surround setup channel mask
00073 
00074 // Note. DPL2 does not really have 4 channels, but it is used by plugins to differentiate from stereo setup.
00075 #define AK_SPEAKER_SETUP_DPL2           (AK_SPEAKER_SETUP_4)        ///< Legacy DPL2 setup channel mask
00076 
00077 #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.
00078 #define AK_SPEAKER_SETUP_HEIGHT_5       (AK_SPEAKER_SETUP_HEIGHT_4 | AK_SPEAKER_HEIGHT_FRONT_CENTER)                                                                    ///< 5 speaker height layer.
00079 #define AK_SPEAKER_SETUP_HEIGHT_ALL     (AK_SPEAKER_SETUP_HEIGHT_5 | AK_SPEAKER_HEIGHT_BACK_CENTER)                                                                     ///< All height speaker layer.
00080 
00081 // Auro speaker setups
00082 #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
00083 #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
00084 #define AK_SPEAKER_SETUP_AURO_9             (AK_SPEAKER_SETUP_AURO_8    | AK_SPEAKER_FRONT_CENTER)                                          ///< Auro-9.0 setup channel mask
00085 #define AK_SPEAKER_SETUP_AURO_9POINT1       (AK_SPEAKER_SETUP_AURO_9    | AK_SPEAKER_LOW_FREQUENCY)                                         ///< Auro-9.1 setup channel mask
00086 #define AK_SPEAKER_SETUP_AURO_10            (AK_SPEAKER_SETUP_AURO_9    | AK_SPEAKER_TOP)                                                   ///< Auro-10.0 setup channel mask       
00087 #define AK_SPEAKER_SETUP_AURO_10POINT1      (AK_SPEAKER_SETUP_AURO_10   | AK_SPEAKER_LOW_FREQUENCY)                                         ///< Auro-10.1 setup channel mask   
00088 #define AK_SPEAKER_SETUP_AURO_11            (AK_SPEAKER_SETUP_AURO_10   | AK_SPEAKER_HEIGHT_FRONT_CENTER)                                   ///< Auro-11.0 setup channel mask
00089 #define AK_SPEAKER_SETUP_AURO_11POINT1      (AK_SPEAKER_SETUP_AURO_11   | AK_SPEAKER_LOW_FREQUENCY)                                         ///< Auro-11.1 setup channel mask   
00090 #define AK_SPEAKER_SETUP_AURO_11_740        (AK_SPEAKER_SETUP_7         | AK_SPEAKER_SETUP_HEIGHT_4)                                        ///< Auro-11.0 (7+4) setup channel mask
00091 #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
00092 #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
00093 #define AK_SPEAKER_SETUP_AURO_13POINT1_751  (AK_SPEAKER_SETUP_AURO_13_751   | AK_SPEAKER_LOW_FREQUENCY)                                     ///< Auro-13.1 setup channel mask
00094 
00095 // Dolby speaker setups: in Dolby nomenclature, [#plane].[lfe].[#height]
00096 #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
00097 #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
00098 #define AK_SPEAKER_SETUP_DOLBY_6_0_2        (AK_SPEAKER_SETUP_6         | AK_SPEAKER_HEIGHT_FRONT_LEFT  | AK_SPEAKER_HEIGHT_FRONT_RIGHT )   ///< Dolby 6.0.2 setup channel mask
00099 #define AK_SPEAKER_SETUP_DOLBY_6_1_2        (AK_SPEAKER_SETUP_DOLBY_6_0_2   | AK_SPEAKER_LOW_FREQUENCY )                                    ///< Dolby 6.1.2 setup channel mask
00100 #define AK_SPEAKER_SETUP_DOLBY_6_0_4        (AK_SPEAKER_SETUP_DOLBY_6_0_2   | AK_SPEAKER_HEIGHT_BACK_LEFT | AK_SPEAKER_HEIGHT_BACK_RIGHT )  ///< Dolby 6.0.4 setup channel mask
00101 #define AK_SPEAKER_SETUP_DOLBY_6_1_4        (AK_SPEAKER_SETUP_DOLBY_6_0_4   | AK_SPEAKER_LOW_FREQUENCY )                                    ///< Dolby 6.1.4 setup channel mask
00102 #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
00103 #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
00104 #define AK_SPEAKER_SETUP_DOLBY_7_0_4        (AK_SPEAKER_SETUP_DOLBY_7_0_2   | AK_SPEAKER_HEIGHT_BACK_LEFT | AK_SPEAKER_HEIGHT_BACK_RIGHT )  ///< Dolby 7.0.4 setup channel mask
00105 #define AK_SPEAKER_SETUP_DOLBY_7_1_4        (AK_SPEAKER_SETUP_DOLBY_7_0_4   | AK_SPEAKER_LOW_FREQUENCY )                                    ///< Dolby 7.1.4 setup channel mask
00106 
00107 #define AK_SPEAKER_SETUP_ALL_SPEAKERS       (AK_SPEAKER_SETUP_7POINT1 | AK_SPEAKER_BACK_CENTER | AK_SPEAKER_SETUP_HEIGHT_ALL | AK_SPEAKER_TOP)  ///< All speakers.
00108 
00109 // Channel indices.
00110 // ------------------------------------------------
00111 
00112 // Channel indices for standard setups on the plane.
00113 #define AK_IDX_SETUP_FRONT_LEFT             (0) ///< Index of front-left channel in all configurations.
00114 #define AK_IDX_SETUP_FRONT_RIGHT            (1) ///< Index of front-right channel in all configurations.
00115 #define AK_IDX_SETUP_CENTER                 (2) ///< Index of front-center channel in all configurations.
00116 
00117 #define AK_IDX_SETUP_NOCENTER_BACK_LEFT     (2) ///< Index of back-left channel in configurations with no front-center channel.
00118 #define AK_IDX_SETUP_NOCENTER_BACK_RIGHT    (3) ///< Index of back-right channel in configurations with no front-center channel.
00119 #define AK_IDX_SETUP_NOCENTER_SIDE_LEFT     (4) ///< Index of side-left channel in configurations with no front-center channel.
00120 #define AK_IDX_SETUP_NOCENTER_SIDE_RIGHT    (5) ///< Index of side-right channel in configurations with no front-center channel.
00121 
00122 #define AK_IDX_SETUP_WITHCENTER_BACK_LEFT   (3) ///< Index of back-left channel in configurations with a front-center channel.
00123 #define AK_IDX_SETUP_WITHCENTER_BACK_RIGHT  (4) ///< Index of back-right channel in configurations with a front-center channel.
00124 #define AK_IDX_SETUP_WITHCENTER_SIDE_LEFT   (5) ///< Index of side-left channel in configurations with a front-center channel.
00125 #define AK_IDX_SETUP_WITHCENTER_SIDE_RIGHT  (6) ///< Index of side-right channel in configurations with a front-center channel.
00126 
00127 // Channel indices for specific setups.
00128 #define AK_IDX_SETUP_0_LFE          (0) ///< Index of low-frequency channel in 0.1 setup (use with AkAudioBuffer::GetChannel())
00129 
00130 #define AK_IDX_SETUP_1_CENTER       (0) ///< Index of center channel in 1.x setups (use with AkAudioBuffer::GetChannel())
00131 #define AK_IDX_SETUP_1_LFE          (1) ///< Index of low-frequency channel in 1.1 setup (use with AkAudioBuffer::GetChannel())
00132 
00133 #define AK_IDX_SETUP_2_LEFT         (0) ///< Index of left channel in 2.x setups (use with AkAudioBuffer::GetChannel())
00134 #define AK_IDX_SETUP_2_RIGHT        (1) ///< Index of right channel in 2.x setups (use with AkAudioBuffer::GetChannel())
00135 #define AK_IDX_SETUP_2_LFE          (2) ///< Index of low-frequency channel in 2.1 setup (use with AkAudioBuffer::GetChannel())
00136 
00137 #define AK_IDX_SETUP_3_LEFT         (0) ///< Index of left channel in 3.x setups (use with AkAudioBuffer::GetChannel())
00138 #define AK_IDX_SETUP_3_RIGHT        (1) ///< Index of right channel in 3.x setups (use with AkAudioBuffer::GetChannel())
00139 #define AK_IDX_SETUP_3_CENTER       (2) ///< Index of center channel in 3.x setups (use with AkAudioBuffer::GetChannel())
00140 #define AK_IDX_SETUP_3_LFE          (3) ///< Index of low-frequency channel in 3.1 setup (use with AkAudioBuffer::GetChannel())
00141 
00142 #define AK_IDX_SETUP_4_FRONTLEFT    (0) ///< Index of front left channel in 4.x setups (use with AkAudioBuffer::GetChannel())
00143 #define AK_IDX_SETUP_4_FRONTRIGHT   (1) ///< Index of front right channel in 4.x setups (use with AkAudioBuffer::GetChannel())
00144 #define AK_IDX_SETUP_4_REARLEFT     (2) ///< Index of rear left channel in 4.x setups (use with AkAudioBuffer::GetChannel())
00145 #define AK_IDX_SETUP_4_REARRIGHT    (3) ///< Index of rear right channel in 4.x setups (use with AkAudioBuffer::GetChannel())
00146 #define AK_IDX_SETUP_4_LFE          (4) ///< Index of low-frequency channel in 4.1 setup (use with AkAudioBuffer::GetChannel())
00147 
00148 #define AK_IDX_SETUP_5_FRONTLEFT    (0) ///< Index of front left channel in 5.x setups (use with AkAudioBuffer::GetChannel())
00149 #define AK_IDX_SETUP_5_FRONTRIGHT   (1) ///< Index of front right channel in 5.x setups (use with AkAudioBuffer::GetChannel())
00150 #define AK_IDX_SETUP_5_CENTER       (2) ///< Index of center channel in 5.x setups (use with AkAudioBuffer::GetChannel())
00151 #define AK_IDX_SETUP_5_REARLEFT     (3) ///< Index of rear left channel in 5.x setups (use with AkAudioBuffer::GetChannel())
00152 #define AK_IDX_SETUP_5_REARRIGHT    (4) ///< Index of rear right channel in 5.x setups (use with AkAudioBuffer::GetChannel())
00153 #define AK_IDX_SETUP_5_LFE          (5) ///< Index of low-frequency channel in 5.1 setup (use with AkAudioBuffer::GetChannel())
00154 
00155 #ifdef AK_71AUDIO
00156 #define AK_IDX_SETUP_6_FRONTLEFT    (0) ///< Index of front left channel in 6.x setups (use with AkAudioBuffer::GetChannel())
00157 #define AK_IDX_SETUP_6_FRONTRIGHT   (1) ///< Index of front right channel in 6x setups (use with AkAudioBuffer::GetChannel())
00158 #define AK_IDX_SETUP_6_REARLEFT     (2) ///< Index of rear left channel in 6.x setups (use with AkAudioBuffer::GetChannel())
00159 #define AK_IDX_SETUP_6_REARRIGHT    (3) ///< Index of rear right channel in 6.x setups (use with AkAudioBuffer::GetChannel())
00160 #define AK_IDX_SETUP_6_SIDELEFT     (4) ///< Index of side left channel in 6.x setups (use with AkAudioBuffer::GetChannel())
00161 #define AK_IDX_SETUP_6_SIDERIGHT    (5) ///< Index of side right channel in 6.x setups (use with AkAudioBuffer::GetChannel())
00162 #define AK_IDX_SETUP_6_LFE          (6) ///< Index of low-frequency channel in 6.1 setup (use with AkAudioBuffer::GetChannel())
00163 
00164 #define AK_IDX_SETUP_7_FRONTLEFT    (0) ///< Index of front left channel in 7.x setups (use with AkAudioBuffer::GetChannel())
00165 #define AK_IDX_SETUP_7_FRONTRIGHT   (1) ///< Index of front right channel in 7.x setups (use with AkAudioBuffer::GetChannel())
00166 #define AK_IDX_SETUP_7_CENTER       (2) ///< Index of center channel in 7.x setups (use with AkAudioBuffer::GetChannel())
00167 #define AK_IDX_SETUP_7_REARLEFT     (3) ///< Index of rear left channel in 7.x setups (use with AkAudioBuffer::GetChannel())
00168 #define AK_IDX_SETUP_7_REARRIGHT    (4) ///< Index of rear right channel in 7.x setups (use with AkAudioBuffer::GetChannel())
00169 #define AK_IDX_SETUP_7_SIDELEFT     (5) ///< Index of side left channel in 7.x setups (use with AkAudioBuffer::GetChannel())
00170 #define AK_IDX_SETUP_7_SIDERIGHT    (6) ///< Index of side right channel in 7.x setups (use with AkAudioBuffer::GetChannel())
00171 #define AK_IDX_SETUP_7_LFE          (7) ///< Index of low-frequency channel in 7.1 setup (use with AkAudioBuffer::GetChannel())
00172 #endif
00173 
00174 //
00175 // Extra speaker setups. This is a more exhaustive list of speaker setups, which might not all be supported
00176 // by the Wwise Sound Engine audio pipeline.
00177 //
00178 
00179 #define AK_SPEAKER_SETUP_0_1        ( AK_SPEAKER_LOW_FREQUENCY )                            //0.1
00180 
00181 #define AK_SPEAKER_SETUP_1_0_CENTER ( AK_SPEAKER_FRONT_CENTER )                         //1.0 (C)
00182 #define AK_SPEAKER_SETUP_1_1_CENTER ( AK_SPEAKER_FRONT_CENTER   | AK_SPEAKER_LOW_FREQUENCY )    //1.1 (C)
00183 
00184 #define AK_SPEAKER_SETUP_2_0        ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_FRONT_RIGHT )                          //2.0
00185 #define AK_SPEAKER_SETUP_2_1        ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_FRONT_RIGHT | AK_SPEAKER_LOW_FREQUENCY )   //2.1
00186 
00187 #define AK_SPEAKER_SETUP_3_0        ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_FRONT_RIGHT | AK_SPEAKER_FRONT_CENTER )    //3.0
00188 #define AK_SPEAKER_SETUP_3_1        ( AK_SPEAKER_SETUP_3_0  | AK_SPEAKER_LOW_FREQUENCY )    //3.1
00189 
00190 #define AK_SPEAKER_SETUP_FRONT      ( AK_SPEAKER_SETUP_3_0 )
00191 
00192 #define AK_SPEAKER_SETUP_4_0        ( AK_SPEAKER_SETUP_4 )
00193 #define AK_SPEAKER_SETUP_4_1        ( AK_SPEAKER_SETUP_4POINT1 )
00194 #define AK_SPEAKER_SETUP_5_0        ( AK_SPEAKER_SETUP_5 )
00195 #define AK_SPEAKER_SETUP_5_1        ( AK_SPEAKER_SETUP_5POINT1 )
00196 
00197 #define AK_SPEAKER_SETUP_6_0        ( AK_SPEAKER_SETUP_6 )
00198 #define AK_SPEAKER_SETUP_6_1        ( AK_SPEAKER_SETUP_6POINT1 )
00199 #define AK_SPEAKER_SETUP_7_0        ( AK_SPEAKER_SETUP_7 )
00200 #define AK_SPEAKER_SETUP_7_1        ( AK_SPEAKER_SETUP_7POINT1 )
00201 
00202 // Per-platform standard/largest setup definitions.
00203 #if defined(AK_71AUDIO)
00204 #define AK_SPEAKER_SETUP_DEFAULT_PLANE          (AK_SPEAKER_SETUP_7POINT1)  ///< All speakers on the plane, supported on this platform.
00205 #define AK_SUPPORTED_STANDARD_CHANNEL_MASK      (AK_SPEAKER_SETUP_ALL_SPEAKERS) ///< Platform supports all standard channels.
00206 #define AK_STANDARD_MAX_NUM_CHANNELS            (8)                         ///< Legacy: Platform supports at least 7.1
00207 #elif defined(AK_LFECENTER) && defined(AK_REARCHANNELS)
00208 #define AK_SPEAKER_SETUP_DEFAULT_PLANE          (AK_SPEAKER_SETUP_5POINT1)  ///< All speakers on the plane, supported on this platform.
00209 #define AK_SUPPORTED_STANDARD_CHANNEL_MASK      (AK_SPEAKER_SETUP_DEFAULT_PLANE)    ///< Platform supports 5.1
00210 #define AK_VOICE_MAX_NUM_CHANNELS               (6)                         ///< Legacy: Platform supports up to 5.1 configuration.
00211 #define AK_STANDARD_MAX_NUM_CHANNELS            (AK_VOICE_MAX_NUM_CHANNELS) ///< Legacy: Platform supports 5.1
00212 #elif defined(AK_REARCHANNELS)
00213 #define AK_SPEAKER_SETUP_DEFAULT_PLANE  (AK_SPEAKER_SETUP_4 | AK_SPEAKER_FRONT_CENTER)      ///< All speakers on the plane, supported on this platform.
00214 #define AK_VOICE_MAX_NUM_CHANNELS       (4)                                     ///< Legacy: Platform supports up to 4.0 configuration.
00215 #define AK_SUPPORTED_STANDARD_CHANNEL_MASK  (AK_SPEAKER_SETUP_DEFAULT_PLANE)    ///< Most complete speaker configuration supported on this platform.
00216 #else
00217 #define AK_SPEAKER_SETUP_DEFAULT_PLANE          (AK_SPEAKER_SETUP_STEREO | AK_SPEAKER_FRONT_CENTER) ///< All speakers on the plane, supported on this platform.
00218 #define AK_SUPPORTED_STANDARD_CHANNEL_MASK      (AK_SPEAKER_SETUP_STEREO)   ///< Most complete speaker configuration supported on this platform.
00219 #define AK_VOICE_MAX_NUM_CHANNELS               (2)                         ///< Legacy: Platform supports up to stereo configuration.
00220 #define AK_STANDARD_MAX_NUM_CHANNELS            (AK_VOICE_MAX_NUM_CHANNELS) ///< Legacy: Platform supports stereo.
00221 
00222 #endif
00223 
00224 #define AK_NUM_SAMPLED_SPHERE_POINTS (32)
00225 
00226 // Helpers.
00227 inline void AK_SPEAKER_SETUP_FIX_LEFT_TO_CENTER( AkUInt32 &io_uChannelMask )
00228 {
00229     if( !(io_uChannelMask & AK_SPEAKER_FRONT_CENTER) 
00230         && !(io_uChannelMask & AK_SPEAKER_FRONT_RIGHT)
00231         && (io_uChannelMask & AK_SPEAKER_FRONT_LEFT) )
00232     {
00233         io_uChannelMask &= ~AK_SPEAKER_FRONT_LEFT;      // remove left
00234         io_uChannelMask |= AK_SPEAKER_FRONT_CENTER; // add center
00235     }
00236 }
00237 
00238 inline void AK_SPEAKER_SETUP_FIX_REAR_TO_SIDE( AkUInt32 &io_uChannelMask )
00239 {
00240     if( io_uChannelMask & ( AK_SPEAKER_BACK_LEFT ) && !( io_uChannelMask & AK_SPEAKER_SIDE_LEFT ) )
00241     {
00242         io_uChannelMask &= ~( AK_SPEAKER_BACK_LEFT | AK_SPEAKER_BACK_RIGHT );   // remove rears
00243         io_uChannelMask |= ( AK_SPEAKER_SIDE_LEFT | AK_SPEAKER_SIDE_RIGHT );    // add sides
00244     }
00245 }
00246 
00247 inline void AK_SPEAKER_SETUP_CONVERT_TO_SUPPORTED( AkUInt32 &io_uChannelMask )
00248 {
00249     AK_SPEAKER_SETUP_FIX_LEFT_TO_CENTER( io_uChannelMask );
00250     AK_SPEAKER_SETUP_FIX_REAR_TO_SIDE( io_uChannelMask );
00251 }
00252 
00253 /// Ambisonics configurations (corresponding to AkChannelConfig::eConfigType == AK_ChannelConfigType_Ambisonic).
00254 /// Convention: X points towards the front, and XYZ follow a right-hand rule, so Y is the side vector (pointing to the left).
00255 /// Channel presence and ordering are predefined according to the number of channels. The ordering convention is ACN,
00256 /// with the mapping of components to number of channels detailed below (source: https://en.wikipedia.org/wiki/Ambisonic_data_exchange_formats).
00257 /// Normalization natively used in Wwise is SN3D.
00258 ///
00259 /// <table cellspacing="0" cellpadding="1" border="1" width="800px">
00260 /// <tr><td rowspan="2" align="center"><b>Number of channels</b></td> <td colspan="2" align="center"><b>Order</b></td><td rowspan="2" align="center"><b>Description</b></td><td rowspan="2" align="center"><b>Layout of components</b></td></tr>
00261 /// <tr><td align="center">Horizontal</td><td align="center">Vertical</td></tr>
00262 /// <tr><td align="right">1 &nbsp;&nbsp;&nbsp;</td> <td align="right">0 &nbsp;&nbsp;&nbsp;</td><td align="right">0 &nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;mono</td><td>&nbsp;</td></tr>
00263 /// <tr><td align="right">4 &nbsp;&nbsp;&nbsp;</td> <td align="right">1 &nbsp;&nbsp;&nbsp;</td><td align="right">1 &nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;first-order full sphere</td><td>&nbsp;&nbsp;WYZX</td></tr>
00264 /// <tr><td align="right">9 &nbsp;&nbsp;&nbsp;</td> <td align="right">2 &nbsp;&nbsp;&nbsp;</td><td align="right">2 &nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;second-order full sphere</td><td>&nbsp;&nbsp;WYZXVTRSU</td></tr>
00265 /// <tr><td align="right">16 &nbsp;&nbsp;&nbsp;</td> <td align="right">3 &nbsp;&nbsp;&nbsp;</td><td align="right">3 &nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;third-order full sphere</td><td>&nbsp;&nbsp;WYZXVTRSUQOMKLNP</td></tr>
00266 /// </table>
00267 
00268 namespace AK
00269 {
00270 
00271 /// Returns the number of channels of a given channel configuration.
00272 static inline AkUInt8 ChannelMaskToNumChannels( AkChannelMask in_uChannelMask )
00273 {
00274     AkUInt8 num = 0;
00275     while( in_uChannelMask ){ ++num; in_uChannelMask &= in_uChannelMask-1; } // iterate max once per channel.
00276     return num;
00277 }
00278 
00279 /// Returns a 'best guess' channel configuration from a given number of channels.
00280 /// Will return 0 if no guess can be made.
00281 static inline AkChannelMask ChannelMaskFromNumChannels( unsigned int in_uNumChannels )
00282 {
00283     AkChannelMask uChannelMask = 0;
00284 
00285     switch ( in_uNumChannels )
00286     {
00287     case 1:
00288         uChannelMask = AK_SPEAKER_SETUP_1_0_CENTER;
00289         break;
00290     case 2:
00291         uChannelMask = AK_SPEAKER_SETUP_2_0;
00292         break;
00293     case 3:
00294         uChannelMask = AK_SPEAKER_SETUP_2_1;
00295         break;
00296     case 4:
00297         uChannelMask = AK_SPEAKER_SETUP_4_0;
00298         break;
00299     case 5:
00300         uChannelMask = AK_SPEAKER_SETUP_5_0;
00301         break;
00302     case 6:
00303         uChannelMask = AK_SPEAKER_SETUP_5_1;
00304         break;
00305     case 7:
00306         uChannelMask = AK_SPEAKER_SETUP_7;
00307         break;
00308     case 8:
00309         uChannelMask = AK_SPEAKER_SETUP_7POINT1;
00310         break;
00311     }
00312 
00313     return uChannelMask;
00314 }
00315 
00316 /// Converts a channel it to a channel index (in Wwise pipeline ordering - LFE at the end), given a channel mask in_uChannelMask.
00317 /// \return Channel index.
00318 static inline AkUInt8 ChannelBitToIndex(AkChannelMask in_uChannelBit, AkChannelMask in_uChannelMask)
00319 {
00320 #ifdef AKASSERT
00321     AKASSERT(ChannelMaskToNumChannels(in_uChannelBit) == 1);
00322 #endif
00323     if (in_uChannelBit == AK_SPEAKER_LOW_FREQUENCY)
00324         return ChannelMaskToNumChannels(in_uChannelMask) - 1;
00325     return ChannelMaskToNumChannels(in_uChannelMask & ((in_uChannelBit & ~AK_SPEAKER_LOW_FREQUENCY) - 1));
00326 }
00327 
00328 /// Returns true when the LFE channel is present in a given channel configuration.
00329 /// \return True if the LFE channel is present.
00330 AkForceInline bool HasLFE(AkChannelMask in_uChannelMask)
00331 {
00332     return (in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY) > 0;
00333 }
00334 
00335 /// Returns true when the center channel is present in a given channel configuration.
00336 /// Note that mono configurations have one channel which is arbitrary set to AK_SPEAKER_FRONT_CENTER,
00337 /// so HasCenter() returns true for mono signals.
00338 /// \return True if the center channel is present.
00339 AkForceInline bool HasCenter(AkChannelMask in_uChannelMask)
00340 {
00341     // All supported non-mono configurations have an AK_SPEAKER_FRONT_LEFT.
00342     return (in_uChannelMask & AK_SPEAKER_FRONT_CENTER) > 0;
00343 }
00344 
00345 /// Returns the number of angle values required to represent the given channel configuration.
00346 /// Use this function with supported 2D standard channel configurations only.
00347 /// \sa AK::SoundEngine::SetSpeakerAngles().
00348 AkForceInline AkUInt32 GetNumberOfAnglesForConfig(AkChannelMask in_uChannelMask)
00349 {
00350 #ifdef AKASSERT
00351     AKASSERT((in_uChannelMask & ~AK_SPEAKER_SETUP_DEFAULT_PLANE) == 0);
00352 #endif
00353 
00354     // LFE is irrelevant.
00355     in_uChannelMask &= ~AK_SPEAKER_LOW_FREQUENCY;
00356     // Center speaker is always in the center and thus does not require an angle.
00357     in_uChannelMask &= ~AK_SPEAKER_FRONT_CENTER;
00358     // We should have complete pairs at this point, unless there is a speaker at 180 degrees, 
00359     // in which case we need one more angle to specify it.
00360 #ifdef AKASSERT
00361     AKASSERT((in_uChannelMask & AK_SPEAKER_BACK_CENTER) || ((ChannelMaskToNumChannels(in_uChannelMask) % 2) == 0));
00362 #endif
00363     return ChannelMaskToNumChannels(in_uChannelMask) >> 1;
00364 }
00365 
00366 /// Channel ordering type. 
00367 enum AkChannelOrdering
00368 {
00369     ChannelOrdering_Standard,   // L-R-C-LFE-RL-RR-RC-SL-SR-HL-HR-HC-HRL-HRR-HRC-T
00370     ChannelOrdering_RunTime     // L-R-C-RL-RR-RC-SL-SR-HL-HR-HC-HRL-HRR-HRC-T-LFE
00371 };
00372 
00373 /// Returns true if standard configuration represented by channel mask has surround
00374 /// channels, either defined as side or back channels.
00375 AkForceInline bool HasSurroundChannels( AkChannelMask in_uChannelMask )
00376 {
00377     return ( in_uChannelMask & AK_SPEAKER_BACK_LEFT || in_uChannelMask & AK_SPEAKER_SIDE_LEFT );
00378 }
00379 
00380 /// Returns true if standard configuration represented by channel mask has strictly one
00381 /// pair of surround channels, either defined as side or back channels. 7.1 has two pairs
00382 /// of surround channels and would thus return false.
00383 AkForceInline bool HasStrictlyOnePairOfSurroundChannels( AkChannelMask in_uChannelMask )
00384 {
00385     return ( ( ( in_uChannelMask & AK_SPEAKER_BACK_LEFT ) != 0 ) ^ ( ( in_uChannelMask & AK_SPEAKER_SIDE_LEFT ) != 0 ) );
00386 }
00387 
00388 /// Returns true if standard configuration represented by channel mask has two
00389 /// pair of surround channels, that is, side and back channels. 7.1 has two pairs
00390 /// of surround channels and would thus return true, whereas 5.1 would return false.
00391 AkForceInline bool HasSideAndRearChannels( AkChannelMask in_uChannelMask )
00392 {
00393     return ( in_uChannelMask & AK_SPEAKER_BACK_LEFT && in_uChannelMask & AK_SPEAKER_SIDE_LEFT );
00394 }
00395 
00396 /// Returns true if standard configuration represented by channel mask has at least one "height" channel (above the plane).
00397 AkForceInline bool HasHeightChannels(AkChannelMask in_uChannelMask)
00398 {
00399     return (in_uChannelMask & ~AK_SPEAKER_SETUP_DEFAULT_PLANE) > 0;
00400 }
00401 
00402 /// Takes a channel mask and swap back channels with side channels if there is just
00403 /// one pair of surround channels.
00404 AkForceInline AkChannelMask BackToSideChannels( AkChannelMask in_uChannelMask )
00405 {
00406     if ( HasStrictlyOnePairOfSurroundChannels( in_uChannelMask ) )
00407     {
00408         in_uChannelMask &= ~( AK_SPEAKER_BACK_LEFT | AK_SPEAKER_BACK_RIGHT );   // remove rears
00409         in_uChannelMask |= ( AK_SPEAKER_SIDE_LEFT | AK_SPEAKER_SIDE_RIGHT );    // add sides
00410     }
00411     return in_uChannelMask;
00412 }
00413 
00414 /// Convert channel indices as they are ordered in standard (WAV) or Wwise sound engine (WEM) wave files 
00415 /// (which follow channel mask bit values, except that the LFE is at the end in the case of WEMs) 
00416 /// into display indices. Desired display order is L-R-C-SL-SR-RL-RR-HL-HR-HC-HRL-HRR-HRC-T-LFE. Note that 4-5.x configurations 
00417 /// may define back or side channels. Either way they are "Surround" channels and are assigned to "SL, SR" names.
00418 static inline unsigned int StdChannelIndexToDisplayIndex( AkChannelOrdering in_eOrdering, unsigned int in_uChannelMask, unsigned int in_uChannelIdx )
00419 {
00420     if ( in_eOrdering == ChannelOrdering_Standard )
00421     {
00422         unsigned int uNumChannelsFront = ChannelMaskToNumChannels( in_uChannelMask & AK_SPEAKER_SETUP_FRONT );
00423         if ( ( in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY )
00424             && ( in_uChannelIdx == uNumChannelsFront ) )
00425         {
00426             // Lfe. Return penultimate channel.
00427             in_uChannelIdx = ChannelMaskToNumChannels( in_uChannelMask ) - 1;
00428         }
00429         else if ( in_uChannelIdx >= uNumChannelsFront ) // strictly greater than uNumChannelsFront (lfe index) if lfe is present, greater or equal otherwise.
00430         {
00431             // Back channel. Return index or index-1 if there is an LFE (uLfeOffset==1).
00432             unsigned int uLfeOffset = ( in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY ) ? 1 : 0;
00433 
00434             // 6-7.x: Need to swap back and sides.
00435             if ( HasSideAndRearChannels( in_uChannelMask ) )
00436             {
00437                 unsigned int uRearIdx = uNumChannelsFront + uLfeOffset;
00438                 unsigned int uSideIdx = uRearIdx + 2;
00439                 unsigned int uAfterSideIdx = uSideIdx + 2;
00440                 if ( in_uChannelIdx < uAfterSideIdx )
00441                 {               
00442                     if ( in_uChannelIdx >= uSideIdx )
00443                         in_uChannelIdx -= 2;    // input is side, swap it with back.
00444                     else
00445                         in_uChannelIdx += 2;    // input is back, swap it with side.
00446                 }
00447             }
00448             in_uChannelIdx -= uLfeOffset;   // compensate for LFE if it was skipped above.
00449         }
00450     }
00451     else
00452     {
00453         // 6-7.x: Need to swap back and sides.
00454         if ( HasSideAndRearChannels( in_uChannelMask ) )
00455         {
00456             unsigned int uRearIdx = ChannelMaskToNumChannels( in_uChannelMask & AK_SPEAKER_SETUP_FRONT );
00457             unsigned int uMaxIdx = uRearIdx + 4;    // Side and rear channels.
00458 
00459             if ( in_uChannelIdx >= uRearIdx  
00460                 && in_uChannelIdx < uMaxIdx )
00461             {
00462                 // Surround channel (not LFE).
00463                 unsigned int uSideIdx = uRearIdx + 2;
00464                 if ( in_uChannelIdx >= uSideIdx )
00465                     in_uChannelIdx -= 2;    // input is side, swap it with back.
00466                 else
00467                     in_uChannelIdx += 2;    // input is back, swap it with side.
00468             }
00469         }
00470     }
00471 
00472     return in_uChannelIdx;
00473 }
00474 
00475 } // namespace AK
00476 
00477 /// Channel configuration type. 
00478 enum AkChannelConfigType
00479 {
00480     AK_ChannelConfigType_Anonymous = 0x0,   ///< Channel mask == 0 and channels are anonymous.
00481     AK_ChannelConfigType_Standard = 0x1,    ///< Channels must be identified with standard defines in AkSpeakerConfigs. 
00482     AK_ChannelConfigType_Ambisonic = 0x2    ///< Ambisonics. Channel mask == 0 and channels follow standard ambisonic order.
00483 };
00484 
00485 /// Defines a channel configuration.
00486 /// Examples:
00487 /// \code
00488 /// AkChannelConfig cfg;
00489 /// 
00490 /// // Create a stereo configuration.
00491 /// cfg.SetStandard(AK_SPEAKER_SETUP_STEREO);
00492 ///
00493 /// // Create a 7.1.4 configuration (7.1 plus 4 height channels).
00494 /// cfg.SetStandard(AK_SPEAKER_SETUP_AURO_11POINT1_740);
00495 /// // or
00496 /// cfg.SetStandard(AK_SPEAKER_SETUP_DOLBY_7_1_4);
00497 ///
00498 /// // Create a 3rd order ambisonic configuration.
00499 /// cfg.SetAmbisonic(16);   // pass in the number of spherical harmonics, (N+1)^2, where N is the ambisonics order.
00500 ///
00501 /// // Invalidate (usually means "As Parent")
00502 /// cfg.Clear();
00503 /// \endcode
00504 struct AkChannelConfig
00505 {
00506     // Channel config: 
00507     // - uChannelMask is a bit field, whose channel identifiers depend on AkChannelConfigType (up to 20). Channel bits are defined in AkSpeakerConfig.h.
00508     // - eConfigType is a code that completes the identification of channels by uChannelMask.
00509     // - uNumChannels is the number of channels, identified (deduced from channel mask) or anonymous (set directly). 
00510     AkUInt32    uNumChannels : 8;   ///< Number of channels.
00511     AkUInt32    eConfigType : 4;    ///< Channel config type (AkChannelConfigType).
00512     AkUInt32    uChannelMask : 20;///< Channel mask (configuration). 
00513 
00514     /// Constructor. Clears / sets the channel config in "invalid" state (IsValid() returns false).
00515     AkForceInline AkChannelConfig()
00516         : uNumChannels(0)
00517         , eConfigType(0)
00518         , uChannelMask(0)
00519     {
00520     }
00521 
00522     /// Constructor. Sets number of channels, and config type according to whether channel mask is defined or not. If defined, it must be consistent with the number of channels.
00523     AkForceInline AkChannelConfig(AkUInt32 in_uNumChannels, AkUInt32 in_uChannelMask)
00524     {
00525         // Input arguments should be consistent.
00526         SetStandardOrAnonymous(in_uNumChannels, in_uChannelMask);
00527     }
00528 
00529     /// Operator != with a 32-bit word.
00530     AkForceInline bool operator!=(AkUInt32 in_uBitField)
00531     {
00532         return (*((AkUInt32*)this) != in_uBitField);
00533     }
00534 
00535     /// Clear the channel config. Becomes "invalid" (IsValid() returns false).
00536     AkForceInline void Clear()
00537     {
00538         uNumChannels = 0;
00539         eConfigType = 0;
00540         uChannelMask = 0;
00541     }
00542 
00543     /// Set channel config as a standard configuration specified with given channel mask.
00544     AkForceInline void SetStandard(AkUInt32 in_uChannelMask)
00545     {
00546         uNumChannels = AK::ChannelMaskToNumChannels(in_uChannelMask);
00547         eConfigType = AK_ChannelConfigType_Standard;
00548         uChannelMask = in_uChannelMask;
00549     }
00550 
00551     /// Set channel config as either a standard or an anonymous configuration, specified with both a given channel mask (0 if anonymous) and a number of channels (which must match the channel mask if standard).
00552     AkForceInline void SetStandardOrAnonymous(AkUInt32 in_uNumChannels, AkUInt32 in_uChannelMask)
00553     {
00554 #ifdef AKASSERT
00555         AKASSERT(in_uChannelMask == 0 || in_uNumChannels == AK::ChannelMaskToNumChannels(in_uChannelMask));
00556 #endif
00557         uNumChannels = in_uNumChannels;
00558         eConfigType = (in_uChannelMask) ? AK_ChannelConfigType_Standard : AK_ChannelConfigType_Anonymous;
00559         uChannelMask = in_uChannelMask;
00560     }
00561 
00562     /// Set channel config as an anonymous configuration specified with given number of channels.
00563     AkForceInline void SetAnonymous(AkUInt32 in_uNumChannels)
00564     {
00565         uNumChannels = in_uNumChannels;
00566         eConfigType = AK_ChannelConfigType_Anonymous;
00567         uChannelMask = 0;
00568     }
00569 
00570     /// Set channel config as an ambisonic configuration specified with given number of channels.
00571     AkForceInline void SetAmbisonic(AkUInt32 in_uNumChannels)
00572     {
00573         uNumChannels = in_uNumChannels;
00574         eConfigType = AK_ChannelConfigType_Ambisonic;
00575         uChannelMask = 0;
00576     }
00577 
00578     /// Returns true if valid, false otherwise (as when it is constructed, or invalidated using Clear()).
00579     AkForceInline bool IsValid() const
00580     {
00581         return uNumChannels != 0;
00582     }
00583 
00584     /// Serialize channel config into a 32-bit word.
00585     AkForceInline AkUInt32 Serialize() const
00586     {
00587         return uNumChannels | (eConfigType << 8) | (uChannelMask << 12);
00588     }
00589 
00590     /// Deserialize channel config from a 32-bit word.
00591     AkForceInline void Deserialize(AkUInt32 in_uChannelConfig)
00592     {
00593         uNumChannels = in_uChannelConfig & 0x000000ff;
00594         eConfigType = (in_uChannelConfig >> 8) & 0x0000000f;
00595         uChannelMask = (in_uChannelConfig >> 12) & 0x000fffff;
00596     }
00597 
00598     /// Returns a new config based on 'this' with no LFE.
00599     AkForceInline AkChannelConfig RemoveLFE() const
00600     {
00601         AkChannelConfig newConfig = *this;
00602 #ifdef AK_LFECENTER
00603         AkUInt32 uNewChannelMask = newConfig.uChannelMask & ~AK_SPEAKER_LOW_FREQUENCY;
00604         AkUInt32 uNumLFEChannel = (newConfig.uChannelMask - uNewChannelMask) >> 3; // 0 or 1
00605 #ifdef AKASSERT
00606         AKASSERT(uNumLFEChannel == 0 || uNumLFEChannel == 1);
00607 #endif
00608         newConfig.uNumChannels -= uNumLFEChannel;
00609         newConfig.uChannelMask = uNewChannelMask;
00610 #endif
00611         return newConfig;
00612     }
00613 
00614     /// Returns a new config based on 'this' with no Front Center channel.
00615     AkForceInline AkChannelConfig RemoveCenter() const
00616     {
00617         AkChannelConfig newConfig = *this;
00618 #ifdef AK_LFECENTER
00619         AkUInt32 uNewChannelMask = newConfig.uChannelMask & ~AK_SPEAKER_FRONT_CENTER;
00620         AkUInt32 uNumCenterChannel = (newConfig.uChannelMask - uNewChannelMask) >> 2;   // 0 or 1.
00621 #ifdef AKASSERT
00622         AKASSERT(uNumCenterChannel == 0 || uNumCenterChannel == 1);
00623 #endif
00624         newConfig.uNumChannels -= uNumCenterChannel;
00625         newConfig.uChannelMask = uNewChannelMask;
00626 #endif
00627         return newConfig;
00628     }
00629 
00630     /// Operator ==
00631     AkForceInline bool operator==(const AkChannelConfig & in_other) const
00632     {
00633         return uNumChannels == in_other.uNumChannels
00634             && eConfigType == in_other.eConfigType
00635             && uChannelMask == in_other.uChannelMask;
00636     }
00637 
00638     /// Operator !=
00639     AkForceInline bool operator!=(const AkChannelConfig & in_other) const
00640     {
00641         return uNumChannels != in_other.uNumChannels
00642             || eConfigType != in_other.eConfigType
00643             || uChannelMask != in_other.uChannelMask;
00644     }
00645 
00646     /// Checks if the channel configuration is supported by the source pipeline.
00647     /// \return The interleaved type
00648     AkForceInline bool IsChannelConfigSupported() const
00649     {
00650 #ifdef AK_71AUDIO
00651         return true;
00652 #else
00653         if (eConfigType == AK_ChannelConfigType_Standard)
00654         {
00655             switch (uChannelMask)
00656             {
00657             case AK_SPEAKER_SETUP_MONO:
00658             case AK_SPEAKER_SETUP_STEREO:
00659 #ifdef AK_LFECENTER
00660             case AK_SPEAKER_SETUP_0POINT1:
00661             case AK_SPEAKER_SETUP_1POINT1:
00662             case AK_SPEAKER_SETUP_2POINT1:
00663             case AK_SPEAKER_SETUP_3STEREO:
00664             case AK_SPEAKER_SETUP_3POINT1:
00665 #ifdef AK_REARCHANNELS
00666             case AK_SPEAKER_SETUP_4:
00667             case AK_SPEAKER_SETUP_4POINT1:
00668             case AK_SPEAKER_SETUP_5:
00669             case AK_SPEAKER_SETUP_5POINT1:
00670 #endif
00671 #endif
00672                 return true;
00673             }
00674         }
00675         return false;
00676 #endif
00677     }
00678 
00679     /// Query if LFE channel is present.
00680     /// \return True when LFE channel is present
00681     AkForceInline bool HasLFE() const
00682     {
00683 #ifdef AK_LFECENTER
00684         return AK::HasLFE(uChannelMask);
00685 #else
00686         return false;
00687 #endif
00688     }
00689 
00690     /// Query if center channel is present.
00691     /// Note that mono configurations have one channel which is arbitrary set to AK_SPEAKER_FRONT_CENTER,
00692     /// so HasCenter() returns true for mono signals.
00693     /// \return True when center channel is present and configuration has more than 2 channels.
00694     AkForceInline bool HasCenter() const
00695     {
00696 #ifdef AK_LFECENTER
00697         return AK::HasCenter(uChannelMask);
00698 #else
00699         return false;
00700 #endif
00701     }
00702 };
00703 
00704 #endif //_AK_SPEAKERCONFIG_H_