Version
menu_open
link

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 // Helpers.
00225 inline void AK_SPEAKER_SETUP_FIX_LEFT_TO_CENTER( AkUInt32 &io_uChannelMask )
00226 {
00227     if( !(io_uChannelMask & AK_SPEAKER_FRONT_CENTER) 
00228         && !(io_uChannelMask & AK_SPEAKER_FRONT_RIGHT)
00229         && (io_uChannelMask & AK_SPEAKER_FRONT_LEFT) )
00230     {
00231         io_uChannelMask &= ~AK_SPEAKER_FRONT_LEFT;      // remove left
00232         io_uChannelMask |= AK_SPEAKER_FRONT_CENTER; // add center
00233     }
00234 }
00235 
00236 inline void AK_SPEAKER_SETUP_FIX_REAR_TO_SIDE( AkUInt32 &io_uChannelMask )
00237 {
00238     if( io_uChannelMask & ( AK_SPEAKER_BACK_LEFT ) && !( io_uChannelMask & AK_SPEAKER_SIDE_LEFT ) )
00239     {
00240         io_uChannelMask &= ~( AK_SPEAKER_BACK_LEFT | AK_SPEAKER_BACK_RIGHT );   // remove rears
00241         io_uChannelMask |= ( AK_SPEAKER_SIDE_LEFT | AK_SPEAKER_SIDE_RIGHT );    // add sides
00242     }
00243 }
00244 
00245 inline void AK_SPEAKER_SETUP_CONVERT_TO_SUPPORTED( AkUInt32 &io_uChannelMask )
00246 {
00247     AK_SPEAKER_SETUP_FIX_LEFT_TO_CENTER( io_uChannelMask );
00248     AK_SPEAKER_SETUP_FIX_REAR_TO_SIDE( io_uChannelMask );
00249 }
00250 
00251 /// Ambisonics configurations (corresponding to AkChannelConfig::eConfigType == AK_ChannelConfigType_Ambisonic).
00252 /// Convention: X points towards the front, and XYZ follow a right-hand rule, so Y is the side vector (pointing to the left).
00253 /// Channel presence and ordering are predefined according to the number of channels. The ordering convention is ACN,
00254 /// with the mapping of components to number of channels detailed below (source: https://en.wikipedia.org/wiki/Ambisonic_data_exchange_formats).
00255 /// Normalization natively used in Wwise is SN3D.
00256 ///
00257 /// <table cellspacing="0" cellpadding="1" border="1" width="800px">
00258 /// <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>
00259 /// <tr><td align="center">Horizontal</td><td align="center">Vertical</td></tr>
00260 /// <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>
00261 /// <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>
00262 /// <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>
00263 /// <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>
00264 /// </table>
00265 
00266 namespace AK
00267 {
00268 
00269 /// Returns the number of channels of a given channel configuration.
00270 static inline AkUInt8 ChannelMaskToNumChannels( AkChannelMask in_uChannelMask )
00271 {
00272     AkUInt8 num = 0;
00273     while( in_uChannelMask ){ ++num; in_uChannelMask &= in_uChannelMask-1; } // iterate max once per channel.
00274     return num;
00275 }
00276 
00277 /// Returns a 'best guess' channel configuration from a given number of channels.
00278 /// Will return 0 if no guess can be made.
00279 static inline AkChannelMask ChannelMaskFromNumChannels( unsigned int in_uNumChannels )
00280 {
00281     AkChannelMask uChannelMask = 0;
00282 
00283     switch ( in_uNumChannels )
00284     {
00285     case 1:
00286         uChannelMask = AK_SPEAKER_SETUP_1_0_CENTER;
00287         break;
00288     case 2:
00289         uChannelMask = AK_SPEAKER_SETUP_2_0;
00290         break;
00291     case 3:
00292         uChannelMask = AK_SPEAKER_SETUP_2_1;
00293         break;
00294     case 4:
00295         uChannelMask = AK_SPEAKER_SETUP_4_0;
00296         break;
00297     case 5:
00298         uChannelMask = AK_SPEAKER_SETUP_5_0;
00299         break;
00300     case 6:
00301         uChannelMask = AK_SPEAKER_SETUP_5_1;
00302         break;
00303     case 7:
00304         uChannelMask = AK_SPEAKER_SETUP_7;
00305         break;
00306     case 8:
00307         uChannelMask = AK_SPEAKER_SETUP_7POINT1;
00308         break;
00309     }
00310 
00311     return uChannelMask;
00312 }
00313 
00314 /// Converts a channel it to a channel index (in Wwise pipeline ordering - LFE at the end), given a channel mask in_uChannelMask.
00315 /// \return Channel index.
00316 static inline AkUInt8 ChannelBitToIndex(AkChannelMask in_uChannelBit, AkChannelMask in_uChannelMask)
00317 {
00318 #ifdef AKASSERT
00319     AKASSERT(ChannelMaskToNumChannels(in_uChannelBit) == 1);
00320 #endif
00321     if (in_uChannelBit == AK_SPEAKER_LOW_FREQUENCY)
00322         return ChannelMaskToNumChannels(in_uChannelMask) - 1;
00323     return ChannelMaskToNumChannels(in_uChannelMask & ((in_uChannelBit & ~AK_SPEAKER_LOW_FREQUENCY) - 1));
00324 }
00325 
00326 /// Returns true when the LFE channel is present in a given channel configuration.
00327 /// \return True if the LFE channel is present.
00328 AkForceInline bool HasLFE(AkChannelMask in_uChannelMask)
00329 {
00330     return (in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY) > 0;
00331 }
00332 
00333 /// Returns true when the center channel is present in a given channel configuration.
00334 /// Note that mono configurations have one channel which is arbitrary set to AK_SPEAKER_FRONT_CENTER,
00335 /// so HasCenter() returns true for mono signals.
00336 /// \return True if the center channel is present.
00337 AkForceInline bool HasCenter(AkChannelMask in_uChannelMask)
00338 {
00339     // All supported non-mono configurations have an AK_SPEAKER_FRONT_LEFT.
00340     return (in_uChannelMask & AK_SPEAKER_FRONT_CENTER) > 0;
00341 }
00342 
00343 /// Returns the number of angle values required to represent the given channel configuration.
00344 /// Use this function with supported 2D standard channel configurations only.
00345 /// \sa AK::SoundEngine::SetSpeakerAngles().
00346 AkForceInline AkUInt32 GetNumberOfAnglesForConfig(AkChannelMask in_uChannelMask)
00347 {
00348 #ifdef AKASSERT
00349     AKASSERT((in_uChannelMask & ~AK_SPEAKER_SETUP_DEFAULT_PLANE) == 0);
00350 #endif
00351 
00352     // LFE is irrelevant.
00353     in_uChannelMask &= ~AK_SPEAKER_LOW_FREQUENCY;
00354     // Center speaker is always in the center and thus does not require an angle.
00355     in_uChannelMask &= ~AK_SPEAKER_FRONT_CENTER;
00356     // We should have complete pairs at this point, unless there is a speaker at 180 degrees, 
00357     // in which case we need one more angle to specify it.
00358 #ifdef AKASSERT
00359     AKASSERT((in_uChannelMask & AK_SPEAKER_BACK_CENTER) || ((ChannelMaskToNumChannels(in_uChannelMask) % 2) == 0));
00360 #endif
00361     return ChannelMaskToNumChannels(in_uChannelMask) >> 1;
00362 }
00363 
00364 /// Channel ordering type. 
00365 enum AkChannelOrdering
00366 {
00367     ChannelOrdering_Standard,   // L-R-C-LFE-RL-RR-RC-SL-SR-HL-HR-HC-HRL-HRR-HRC-T
00368     ChannelOrdering_RunTime     // L-R-C-RL-RR-RC-SL-SR-HL-HR-HC-HRL-HRR-HRC-T-LFE
00369 };
00370 
00371 /// Returns true if standard configuration represented by channel mask has surround
00372 /// channels, either defined as side or back channels.
00373 AkForceInline bool HasSurroundChannels( AkChannelMask in_uChannelMask )
00374 {
00375     return ( in_uChannelMask & AK_SPEAKER_BACK_LEFT || in_uChannelMask & AK_SPEAKER_SIDE_LEFT );
00376 }
00377 
00378 /// Returns true if standard configuration represented by channel mask has strictly one
00379 /// pair of surround channels, either defined as side or back channels. 7.1 has two pairs
00380 /// of surround channels and would thus return false.
00381 AkForceInline bool HasStrictlyOnePairOfSurroundChannels( AkChannelMask in_uChannelMask )
00382 {
00383     return ( ( ( in_uChannelMask & AK_SPEAKER_BACK_LEFT ) != 0 ) ^ ( ( in_uChannelMask & AK_SPEAKER_SIDE_LEFT ) != 0 ) );
00384 }
00385 
00386 /// Returns true if standard configuration represented by channel mask has two
00387 /// pair of surround channels, that is, side and back channels. 7.1 has two pairs
00388 /// of surround channels and would thus return true, whereas 5.1 would return false.
00389 AkForceInline bool HasSideAndRearChannels( AkChannelMask in_uChannelMask )
00390 {
00391     return ( in_uChannelMask & AK_SPEAKER_BACK_LEFT && in_uChannelMask & AK_SPEAKER_SIDE_LEFT );
00392 }
00393 
00394 /// Returns true if standard configuration represented by channel mask has at least one "height" channel (above the plane).
00395 AkForceInline bool HasHeightChannels(AkChannelMask in_uChannelMask)
00396 {
00397     return (in_uChannelMask & ~AK_SPEAKER_SETUP_DEFAULT_PLANE) > 0;
00398 }
00399 
00400 /// Takes a channel mask and swap back channels with side channels if there is just
00401 /// one pair of surround channels.
00402 AkForceInline AkChannelMask BackToSideChannels( AkChannelMask in_uChannelMask )
00403 {
00404     if ( HasStrictlyOnePairOfSurroundChannels( in_uChannelMask ) )
00405     {
00406         in_uChannelMask &= ~( AK_SPEAKER_BACK_LEFT | AK_SPEAKER_BACK_RIGHT );   // remove rears
00407         in_uChannelMask |= ( AK_SPEAKER_SIDE_LEFT | AK_SPEAKER_SIDE_RIGHT );    // add sides
00408     }
00409     return in_uChannelMask;
00410 }
00411 
00412 /// Convert channel indices as they are ordered in standard (WAV) or Wwise sound engine (WEM) wave files 
00413 /// (which follow channel mask bit values, except that the LFE is at the end in the case of WEMs) 
00414 /// 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 
00415 /// may define back or side channels. Either way they are "Surround" channels and are assigned to "SL, SR" names.
00416 static inline unsigned int StdChannelIndexToDisplayIndex( AkChannelOrdering in_eOrdering, unsigned int in_uChannelMask, unsigned int in_uChannelIdx )
00417 {
00418     if ( in_eOrdering == ChannelOrdering_Standard )
00419     {
00420         unsigned int uNumChannelsFront = ChannelMaskToNumChannels( in_uChannelMask & AK_SPEAKER_SETUP_FRONT );
00421         if ( ( in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY )
00422             && ( in_uChannelIdx == uNumChannelsFront ) )
00423         {
00424             // Lfe. Return penultimate channel.
00425             in_uChannelIdx = ChannelMaskToNumChannels( in_uChannelMask ) - 1;
00426         }
00427         else if ( in_uChannelIdx >= uNumChannelsFront ) // strictly greater than uNumChannelsFront (lfe index) if lfe is present, greater or equal otherwise.
00428         {
00429             // Back channel. Return index or index-1 if there is an LFE (uLfeOffset==1).
00430             unsigned int uLfeOffset = ( in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY ) ? 1 : 0;
00431 
00432             // 6-7.x: Need to swap back and sides.
00433             if ( HasSideAndRearChannels( in_uChannelMask ) )
00434             {
00435                 unsigned int uRearIdx = uNumChannelsFront + uLfeOffset;
00436                 unsigned int uSideIdx = uRearIdx + 2;
00437                 unsigned int uAfterSideIdx = uSideIdx + 2;
00438                 if ( in_uChannelIdx < uAfterSideIdx )
00439                 {               
00440                     if ( in_uChannelIdx >= uSideIdx )
00441                         in_uChannelIdx -= 2;    // input is side, swap it with back.
00442                     else
00443                         in_uChannelIdx += 2;    // input is back, swap it with side.
00444                 }
00445             }
00446             in_uChannelIdx -= uLfeOffset;   // compensate for LFE if it was skipped above.
00447         }
00448     }
00449     else
00450     {
00451         // 6-7.x: Need to swap back and sides.
00452         if ( HasSideAndRearChannels( in_uChannelMask ) )
00453         {
00454             unsigned int uRearIdx = ChannelMaskToNumChannels( in_uChannelMask & AK_SPEAKER_SETUP_FRONT );
00455             unsigned int uMaxIdx = uRearIdx + 4;    // Side and rear channels.
00456 
00457             if ( in_uChannelIdx >= uRearIdx  
00458                 && in_uChannelIdx < uMaxIdx )
00459             {
00460                 // Surround channel (not LFE).
00461                 unsigned int uSideIdx = uRearIdx + 2;
00462                 if ( in_uChannelIdx >= uSideIdx )
00463                     in_uChannelIdx -= 2;    // input is side, swap it with back.
00464                 else
00465                     in_uChannelIdx += 2;    // input is back, swap it with side.
00466             }
00467         }
00468     }
00469 
00470     return in_uChannelIdx;
00471 }
00472 
00473 } // namespace AK
00474 
00475 /// Channel configuration type. 
00476 enum AkChannelConfigType
00477 {
00478     AK_ChannelConfigType_Anonymous = 0x0,   ///< Channel mask == 0 and channels are anonymous.
00479     AK_ChannelConfigType_Standard = 0x1,    ///< Channels must be identified with standard defines in AkSpeakerConfigs. 
00480     AK_ChannelConfigType_Ambisonic = 0x2    ///< Ambisonics. Channel mask == 0 and channels follow standard ambisonic order.
00481 };
00482 
00483 /// Defines a channel configuration.
00484 /// Examples:
00485 /// \code
00486 /// AkChannelConfig cfg;
00487 /// 
00488 /// // Create a stereo configuration.
00489 /// cfg.SetStandard(AK_SPEAKER_SETUP_STEREO);
00490 ///
00491 /// // Create a 7.1.4 configuration (7.1 plus 4 height channels).
00492 /// cfg.SetStandard(AK_SPEAKER_SETUP_AURO_11POINT1_740);
00493 /// // or
00494 /// cfg.SetStandard(AK_SPEAKER_SETUP_DOLBY_7_1_4);
00495 ///
00496 /// // Create a 3rd order ambisonic configuration.
00497 /// cfg.SetAmbisonic(16);   // pass in the number of spherical harmonics, (N+1)^2, where N is the ambisonics order.
00498 ///
00499 /// // Invalidate (usually means "As Parent")
00500 /// cfg.Clear();
00501 /// \endcode
00502 struct AkChannelConfig
00503 {
00504     // Channel config: 
00505     // - uChannelMask is a bit field, whose channel identifiers depend on AkChannelConfigType (up to 20). Channel bits are defined in AkSpeakerConfig.h.
00506     // - eConfigType is a code that completes the identification of channels by uChannelMask.
00507     // - uNumChannels is the number of channels, identified (deduced from channel mask) or anonymous (set directly). 
00508     AkUInt32    uNumChannels : 8;   ///< Number of channels.
00509     AkUInt32    eConfigType : 4;    ///< Channel config type (AkChannelConfigType).
00510     AkUInt32    uChannelMask : 20;///< Channel mask (configuration). 
00511 
00512     /// Constructor. Clears / sets the channel config in "invalid" state (IsValid() returns false).
00513     AkForceInline AkChannelConfig()
00514         : uNumChannels(0)
00515         , eConfigType(0)
00516         , uChannelMask(0)
00517     {
00518     }
00519 
00520     /// 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.
00521     AkForceInline AkChannelConfig(AkUInt32 in_uNumChannels, AkUInt32 in_uChannelMask)
00522     {
00523         // Input arguments should be consistent.
00524         SetStandardOrAnonymous(in_uNumChannels, in_uChannelMask);
00525     }
00526 
00527     /// Operator != with a 32-bit word.
00528     AkForceInline bool operator!=(AkUInt32 in_uBitField)
00529     {
00530         return (*((AkUInt32*)this) != in_uBitField);
00531     }
00532 
00533     /// Clear the channel config. Becomes "invalid" (IsValid() returns false).
00534     AkForceInline void Clear()
00535     {
00536         uNumChannels = 0;
00537         eConfigType = 0;
00538         uChannelMask = 0;
00539     }
00540 
00541     /// Set channel config as a standard configuration specified with given channel mask.
00542     AkForceInline void SetStandard(AkUInt32 in_uChannelMask)
00543     {
00544         uNumChannels = AK::ChannelMaskToNumChannels(in_uChannelMask);
00545         eConfigType = AK_ChannelConfigType_Standard;
00546         uChannelMask = in_uChannelMask;
00547     }
00548 
00549     /// 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).
00550     AkForceInline void SetStandardOrAnonymous(AkUInt32 in_uNumChannels, AkUInt32 in_uChannelMask)
00551     {
00552 #ifdef AKASSERT
00553         AKASSERT(in_uChannelMask == 0 || in_uNumChannels == AK::ChannelMaskToNumChannels(in_uChannelMask));
00554 #endif
00555         uNumChannels = in_uNumChannels;
00556         eConfigType = (in_uChannelMask) ? AK_ChannelConfigType_Standard : AK_ChannelConfigType_Anonymous;
00557         uChannelMask = in_uChannelMask;
00558     }
00559 
00560     /// Set channel config as an anonymous configuration specified with given number of channels.
00561     AkForceInline void SetAnonymous(AkUInt32 in_uNumChannels)
00562     {
00563         uNumChannels = in_uNumChannels;
00564         eConfigType = AK_ChannelConfigType_Anonymous;
00565         uChannelMask = 0;
00566     }
00567 
00568     /// Set channel config as an ambisonic configuration specified with given number of channels.
00569     AkForceInline void SetAmbisonic(AkUInt32 in_uNumChannels)
00570     {
00571         uNumChannels = in_uNumChannels;
00572         eConfigType = AK_ChannelConfigType_Ambisonic;
00573         uChannelMask = 0;
00574     }
00575 
00576     /// Returns true if valid, false otherwise (as when it is constructed, or invalidated using Clear()).
00577     AkForceInline bool IsValid() const
00578     {
00579         return uNumChannels != 0;
00580     }
00581 
00582     /// Serialize channel config into a 32-bit word.
00583     AkForceInline AkUInt32 Serialize() const
00584     {
00585         return uNumChannels | (eConfigType << 8) | (uChannelMask << 12);
00586     }
00587 
00588     /// Deserialize channel config from a 32-bit word.
00589     AkForceInline void Deserialize(AkUInt32 in_uChannelConfig)
00590     {
00591         uNumChannels = in_uChannelConfig & 0x000000ff;
00592         eConfigType = (in_uChannelConfig >> 8) & 0x0000000f;
00593         uChannelMask = (in_uChannelConfig >> 12) & 0x000fffff;
00594     }
00595 
00596     /// Returns a new config based on 'this' with no LFE.
00597     AkForceInline AkChannelConfig RemoveLFE() const
00598     {
00599         AkChannelConfig newConfig = *this;
00600 #ifdef AK_LFECENTER
00601         AkUInt32 uNewChannelMask = newConfig.uChannelMask & ~AK_SPEAKER_LOW_FREQUENCY;
00602         AkUInt32 uNumLFEChannel = (newConfig.uChannelMask - uNewChannelMask) >> 3; // 0 or 1
00603 #ifdef AKASSERT
00604         AKASSERT(uNumLFEChannel == 0 || uNumLFEChannel == 1);
00605 #endif
00606         newConfig.uNumChannels -= uNumLFEChannel;
00607         newConfig.uChannelMask = uNewChannelMask;
00608 #endif
00609         return newConfig;
00610     }
00611 
00612     /// Returns a new config based on 'this' with no Front Center channel.
00613     AkForceInline AkChannelConfig RemoveCenter() const
00614     {
00615         AkChannelConfig newConfig = *this;
00616 #ifdef AK_LFECENTER
00617         AkUInt32 uNewChannelMask = newConfig.uChannelMask & ~AK_SPEAKER_FRONT_CENTER;
00618         AkUInt32 uNumCenterChannel = (newConfig.uChannelMask - uNewChannelMask) >> 2;   // 0 or 1.
00619 #ifdef AKASSERT
00620         AKASSERT(uNumCenterChannel == 0 || uNumCenterChannel == 1);
00621 #endif
00622         newConfig.uNumChannels -= uNumCenterChannel;
00623         newConfig.uChannelMask = uNewChannelMask;
00624 #endif
00625         return newConfig;
00626     }
00627 
00628     /// Operator ==
00629     AkForceInline bool operator==(const AkChannelConfig & in_other) const
00630     {
00631         return uNumChannels == in_other.uNumChannels
00632             && eConfigType == in_other.eConfigType
00633             && uChannelMask == in_other.uChannelMask;
00634     }
00635 
00636     /// Operator !=
00637     AkForceInline bool operator!=(const AkChannelConfig & in_other) const
00638     {
00639         return uNumChannels != in_other.uNumChannels
00640             || eConfigType != in_other.eConfigType
00641             || uChannelMask != in_other.uChannelMask;
00642     }
00643 
00644     /// Checks if the channel configuration is supported by the source pipeline.
00645     /// \return The interleaved type
00646     AkForceInline bool IsChannelConfigSupported() const
00647     {
00648 #ifdef AK_71AUDIO
00649         return true;
00650 #else
00651         if (eConfigType == AK_ChannelConfigType_Standard)
00652         {
00653             switch (uChannelMask)
00654             {
00655             case AK_SPEAKER_SETUP_MONO:
00656             case AK_SPEAKER_SETUP_STEREO:
00657 #ifdef AK_LFECENTER
00658             case AK_SPEAKER_SETUP_0POINT1:
00659             case AK_SPEAKER_SETUP_1POINT1:
00660             case AK_SPEAKER_SETUP_2POINT1:
00661             case AK_SPEAKER_SETUP_3STEREO:
00662             case AK_SPEAKER_SETUP_3POINT1:
00663 #ifdef AK_REARCHANNELS
00664             case AK_SPEAKER_SETUP_4:
00665             case AK_SPEAKER_SETUP_4POINT1:
00666             case AK_SPEAKER_SETUP_5:
00667             case AK_SPEAKER_SETUP_5POINT1:
00668 #endif
00669 #endif
00670                 return true;
00671             }
00672         }
00673         return false;
00674 #endif
00675     }
00676 
00677     /// Query if LFE channel is present.
00678     /// \return True when LFE channel is present
00679     AkForceInline bool HasLFE() const
00680     {
00681 #ifdef AK_LFECENTER
00682         return AK::HasLFE(uChannelMask);
00683 #else
00684         return false;
00685 #endif
00686     }
00687 
00688     /// Query if center channel is present.
00689     /// Note that mono configurations have one channel which is arbitrary set to AK_SPEAKER_FRONT_CENTER,
00690     /// so HasCenter() returns true for mono signals.
00691     /// \return True when center channel is present and configuration has more than 2 channels.
00692     AkForceInline bool HasCenter() const
00693     {
00694 #ifdef AK_LFECENTER
00695         return AK::HasCenter(uChannelMask);
00696 #else
00697         return false;
00698 #endif
00699     }
00700 };
00701 
00702 #endif //_AK_SPEAKERCONFIG_H_

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise