バージョン
menu_open

include/AK/SoundEngine/Common/AkSpeakerConfig.h

説明を見る。
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 
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 
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)   ///< Wii 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)        ///< Wii 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 #define AK_SPEAKER_SETUP_1_0        ( AK_SPEAKER_FRONT_LEFT )                               //1.0 (L)
00181 #define AK_SPEAKER_SETUP_1_1        ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_LOW_FREQUENCY )    //1.1 (L)
00182 
00183 #define AK_SPEAKER_SETUP_1_0_CENTER ( AK_SPEAKER_FRONT_CENTER )                         //1.0 (C)
00184 #define AK_SPEAKER_SETUP_1_1_CENTER ( AK_SPEAKER_FRONT_CENTER   | AK_SPEAKER_LOW_FREQUENCY )    //1.1 (C)
00185 
00186 #define AK_SPEAKER_SETUP_2_0        ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_FRONT_RIGHT )                          //2.0
00187 #define AK_SPEAKER_SETUP_2_1        ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_FRONT_RIGHT | AK_SPEAKER_LOW_FREQUENCY )   //2.1
00188 
00189 #define AK_SPEAKER_SETUP_3_0        ( AK_SPEAKER_FRONT_LEFT | AK_SPEAKER_FRONT_RIGHT | AK_SPEAKER_FRONT_CENTER )    //3.0
00190 #define AK_SPEAKER_SETUP_3_1        ( AK_SPEAKER_SETUP_3_0  | AK_SPEAKER_LOW_FREQUENCY )    //3.1
00191 
00192 #define AK_SPEAKER_SETUP_FRONT      ( AK_SPEAKER_SETUP_3_0 )
00193 
00194 #define AK_SPEAKER_SETUP_4_0        ( AK_SPEAKER_SETUP_4 )
00195 #define AK_SPEAKER_SETUP_4_1        ( AK_SPEAKER_SETUP_4POINT1 )
00196 #define AK_SPEAKER_SETUP_5_0        ( AK_SPEAKER_SETUP_5 )
00197 #define AK_SPEAKER_SETUP_5_1        ( AK_SPEAKER_SETUP_5POINT1 )
00198 
00199 #define AK_SPEAKER_SETUP_6_0        ( AK_SPEAKER_SETUP_6 )
00200 #define AK_SPEAKER_SETUP_6_1        ( AK_SPEAKER_SETUP_6POINT1 )
00201 #define AK_SPEAKER_SETUP_7_0        ( AK_SPEAKER_SETUP_7 )
00202 #define AK_SPEAKER_SETUP_7_1        ( AK_SPEAKER_SETUP_7POINT1 )
00203 
00204 // Per-platform standard/largest setup definitions.
00205 #if defined(AK_71AUDIO)
00206 #define AK_SPEAKER_SETUP_DEFAULT_PLANE          (AK_SPEAKER_SETUP_7POINT1)  ///< All speakers on the plane, supported on this platform.
00207 #define AK_SUPPORTED_STANDARD_CHANNEL_MASK      (AK_SPEAKER_SETUP_ALL_SPEAKERS) ///< Platform supports all standard channels.
00208 #define AK_STANDARD_MAX_NUM_CHANNELS            (8)                         ///< Legacy: Platform supports at least 7.1
00209 #elif defined(AK_LFECENTER) && defined(AK_REARCHANNELS)
00210 #define AK_SPEAKER_SETUP_DEFAULT_PLANE          (AK_SPEAKER_SETUP_5POINT1)  ///< All speakers on the plane, supported on this platform.
00211 #define AK_SUPPORTED_STANDARD_CHANNEL_MASK      (AK_SPEAKER_SETUP_DEFAULT_PLANE)    ///< Platform supports 5.1
00212 #define AK_VOICE_MAX_NUM_CHANNELS               (6)                         ///< Legacy: Platform supports up to 5.1 configuration.
00213 #define AK_STANDARD_MAX_NUM_CHANNELS            (AK_VOICE_MAX_NUM_CHANNELS) ///< Legacy: Platform supports 5.1
00214 #elif defined(AK_REARCHANNELS)
00215 #ifdef AK_WII
00216 #define AK_SPEAKER_SETUP_DEFAULT_PLANE  (AK_SPEAKER_SETUP_DPL2 | AK_SPEAKER_FRONT_CENTER)   ///< All speakers on the plane, supported on this platform.
00217 #define AK_VOICE_MAX_NUM_CHANNELS       (2)                         ///< Legacy: Platform supports up to stereo configuration.
00218 #else
00219 #define AK_SPEAKER_SETUP_DEFAULT_PLANE  (AK_SPEAKER_SETUP_4 | AK_SPEAKER_FRONT_CENTER)      ///< All speakers on the plane, supported on this platform.
00220 #define AK_VOICE_MAX_NUM_CHANNELS       (4)                         ///< Legacy: Platform supports up to 4.0 configuration.
00221 #endif
00222 #define AK_SUPPORTED_STANDARD_CHANNEL_MASK  (AK_SPEAKER_SETUP_DEFAULT_PLANE)    ///< Most complete speaker configuration supported on this platform.
00223 #else 
00224 #define AK_SPEAKER_SETUP_DEFAULT_PLANE          (AK_SPEAKER_SETUP_STEREO | AK_SPEAKER_FRONT_CENTER) ///< All speakers on the plane, supported on this platform.
00225 #define AK_SUPPORTED_STANDARD_CHANNEL_MASK      (AK_SPEAKER_SETUP_STEREO)   ///< Most complete speaker configuration supported on this platform.
00226 #define AK_VOICE_MAX_NUM_CHANNELS               (2)                         ///< Legacy: Platform supports up to stereo configuration.
00227 #define AK_STANDARD_MAX_NUM_CHANNELS            (AK_VOICE_MAX_NUM_CHANNELS) ///< Legacy: Platform supports stereo.
00228 
00229 #endif
00230 
00231 // Helpers.
00232 inline void AK_SPEAKER_SETUP_FIX_LEFT_TO_CENTER( AkUInt32 &io_uChannelMask )
00233 {
00234     if( !(io_uChannelMask & AK_SPEAKER_FRONT_CENTER) 
00235         && !(io_uChannelMask & AK_SPEAKER_FRONT_RIGHT)
00236         && (io_uChannelMask & AK_SPEAKER_FRONT_LEFT) )
00237     {
00238         io_uChannelMask &= ~AK_SPEAKER_FRONT_LEFT;      // remove left
00239         io_uChannelMask |= AK_SPEAKER_FRONT_CENTER; // add center
00240     }
00241 }
00242 
00243 inline void AK_SPEAKER_SETUP_FIX_REAR_TO_SIDE( AkUInt32 &io_uChannelMask )
00244 {
00245     if( io_uChannelMask & ( AK_SPEAKER_BACK_LEFT ) && !( io_uChannelMask & AK_SPEAKER_SIDE_LEFT ) )
00246     {
00247         io_uChannelMask &= ~( AK_SPEAKER_BACK_LEFT | AK_SPEAKER_BACK_RIGHT );   // remove rears
00248         io_uChannelMask |= ( AK_SPEAKER_SIDE_LEFT | AK_SPEAKER_SIDE_RIGHT );    // add sides
00249     }
00250 }
00251 
00252 inline void AK_SPEAKER_SETUP_CONVERT_TO_SUPPORTED( AkUInt32 &io_uChannelMask )
00253 {
00254     AK_SPEAKER_SETUP_FIX_LEFT_TO_CENTER( io_uChannelMask );
00255     AK_SPEAKER_SETUP_FIX_REAR_TO_SIDE( io_uChannelMask );
00256 }
00257 
00272 
00273 namespace AK
00274 {
00275 
00277 static inline AkUInt8 ChannelMaskToNumChannels( AkChannelMask in_uChannelMask )
00278 {
00279     AkUInt8 num = 0;
00280     while( in_uChannelMask ){ ++num; in_uChannelMask &= in_uChannelMask-1; } // iterate max once per channel.
00281     return num;
00282 }
00283 
00286 static inline AkChannelMask ChannelMaskFromNumChannels( unsigned int in_uNumChannels )
00287 {
00288     AkChannelMask uChannelMask = 0;
00289 
00290     switch ( in_uNumChannels )
00291     {
00292     case 1:
00293         uChannelMask = AK_SPEAKER_SETUP_1_0_CENTER;
00294         break;
00295     case 2:
00296         uChannelMask = AK_SPEAKER_SETUP_2_0;
00297         break;
00298     case 3:
00299         uChannelMask = AK_SPEAKER_SETUP_2_1;
00300         break;
00301     case 4:
00302         uChannelMask = AK_SPEAKER_SETUP_4_0;
00303         break;
00304     case 5:
00305         uChannelMask = AK_SPEAKER_SETUP_5_0;
00306         break;
00307     case 6:
00308         uChannelMask = AK_SPEAKER_SETUP_5_1;
00309         break;
00310     case 7:
00311         uChannelMask = AK_SPEAKER_SETUP_7;
00312         break;
00313     case 8:
00314         uChannelMask = AK_SPEAKER_SETUP_7POINT1;
00315         break;
00316     }
00317 
00318     return uChannelMask;
00319 }
00320 
00323 static inline AkUInt8 ChannelBitToIndex(AkChannelMask in_uChannelBit, AkChannelMask in_uChannelMask)
00324 {
00325 #ifdef AKASSERT
00326     AKASSERT(ChannelMaskToNumChannels(in_uChannelBit) == 1);
00327 #endif
00328     if (in_uChannelBit == AK_SPEAKER_LOW_FREQUENCY)
00329         return ChannelMaskToNumChannels(in_uChannelMask) - 1;
00330     return ChannelMaskToNumChannels(in_uChannelMask & ((in_uChannelBit & ~AK_SPEAKER_LOW_FREQUENCY) - 1));
00331 }
00332 
00335 AkForceInline bool HasLFE(AkChannelMask in_uChannelMask)
00336 {
00337     return (in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY) > 0;
00338 }
00339 
00344 AkForceInline bool HasCenter(AkChannelMask in_uChannelMask)
00345 {
00346     // All supported non-mono configurations have an AK_SPEAKER_FRONT_LEFT.
00347     return (in_uChannelMask & AK_SPEAKER_FRONT_CENTER) > 0;
00348 }
00349 
00353 AkForceInline AkUInt32 GetNumberOfAnglesForConfig(AkChannelMask in_uChannelMask)
00354 {
00355 #ifdef AKASSERT
00356     AKASSERT((in_uChannelMask & ~AK_SPEAKER_SETUP_DEFAULT_PLANE) == 0);
00357 #endif
00358 
00359     // LFE is irrelevant.
00360     in_uChannelMask &= ~AK_SPEAKER_LOW_FREQUENCY;
00361     // Center speaker is always in the center and thus does not require an angle.
00362     in_uChannelMask &= ~AK_SPEAKER_FRONT_CENTER;
00363     // We should have complete pairs at this point, unless there is a speaker at 180 degrees, 
00364     // in which case we need one more angle to specify it.
00365 #ifdef AKASSERT
00366     AKASSERT((in_uChannelMask & AK_SPEAKER_BACK_CENTER) || ((ChannelMaskToNumChannels(in_uChannelMask) % 2) == 0));
00367 #endif
00368     return ChannelMaskToNumChannels(in_uChannelMask) >> 1;
00369 }
00370 
00372 enum AkChannelOrdering
00373 {
00374     ChannelOrdering_Standard,   // L-R-C-LFE-RL-RR-RC-SL-SR-HL-HR-HC-HRL-HRR-HRC-T
00375     ChannelOrdering_RunTime     // L-R-C-RL-RR-RC-SL-SR-HL-HR-HC-HRL-HRR-HRC-T-LFE
00376 };
00377 
00380 AkForceInline bool HasSurroundChannels( AkChannelMask in_uChannelMask )
00381 {
00382     return ( in_uChannelMask & AK_SPEAKER_BACK_LEFT || in_uChannelMask & AK_SPEAKER_SIDE_LEFT );
00383 }
00384 
00388 AkForceInline bool HasStrictlyOnePairOfSurroundChannels( AkChannelMask in_uChannelMask )
00389 {
00390     return ( ( ( in_uChannelMask & AK_SPEAKER_BACK_LEFT ) != 0 ) ^ ( ( in_uChannelMask & AK_SPEAKER_SIDE_LEFT ) != 0 ) );
00391 }
00392 
00396 AkForceInline bool HasSideAndRearChannels( AkChannelMask in_uChannelMask )
00397 {
00398     return ( in_uChannelMask & AK_SPEAKER_BACK_LEFT && in_uChannelMask & AK_SPEAKER_SIDE_LEFT );
00399 }
00400 
00402 AkForceInline bool HasHeightChannels(AkChannelMask in_uChannelMask)
00403 {
00404     return (in_uChannelMask & ~AK_SPEAKER_SETUP_DEFAULT_PLANE) > 0;
00405 }
00406 
00409 AkForceInline AkChannelMask BackToSideChannels( AkChannelMask in_uChannelMask )
00410 {
00411     if ( HasStrictlyOnePairOfSurroundChannels( in_uChannelMask ) )
00412     {
00413         in_uChannelMask &= ~( AK_SPEAKER_BACK_LEFT | AK_SPEAKER_BACK_RIGHT );   // remove rears
00414         in_uChannelMask |= ( AK_SPEAKER_SIDE_LEFT | AK_SPEAKER_SIDE_RIGHT );    // add sides
00415     }
00416     return in_uChannelMask;
00417 }
00418 
00423 static inline unsigned int StdChannelIndexToDisplayIndex( AkChannelOrdering in_eOrdering, unsigned int in_uChannelMask, unsigned int in_uChannelIdx )
00424 {
00425     if ( in_eOrdering == ChannelOrdering_Standard )
00426     {
00427         unsigned int uNumChannelsFront = ChannelMaskToNumChannels( in_uChannelMask & AK_SPEAKER_SETUP_FRONT );
00428         if ( ( in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY )
00429             && ( in_uChannelIdx == uNumChannelsFront ) )
00430         {
00431             // Lfe. Return penultimate channel.
00432             in_uChannelIdx = ChannelMaskToNumChannels( in_uChannelMask ) - 1;
00433         }
00434         else if ( in_uChannelIdx >= uNumChannelsFront ) // strictly greater than uNumChannelsFront (lfe index) if lfe is present, greater or equal otherwise.
00435         {
00436             // Back channel. Return index or index-1 if there is an LFE (uLfeOffset==1).
00437             unsigned int uLfeOffset = ( in_uChannelMask & AK_SPEAKER_LOW_FREQUENCY ) ? 1 : 0;
00438 
00439             // 6-7.x: Need to swap back and sides.
00440             if ( HasSideAndRearChannels( in_uChannelMask ) )
00441             {
00442                 unsigned int uRearIdx = uNumChannelsFront + uLfeOffset;
00443                 unsigned int uSideIdx = uRearIdx + 2;
00444                 unsigned int uAfterSideIdx = uSideIdx + 2;
00445                 if ( in_uChannelIdx < uAfterSideIdx )
00446                 {               
00447                     if ( in_uChannelIdx >= uSideIdx )
00448                         in_uChannelIdx -= 2;    // input is side, swap it with back.
00449                     else
00450                         in_uChannelIdx += 2;    // input is back, swap it with side.
00451                 }
00452             }
00453             in_uChannelIdx -= uLfeOffset;   // compensate for LFE if it was skipped above.
00454         }
00455     }
00456     else
00457     {
00458         // 6-7.x: Need to swap back and sides.
00459         if ( HasSideAndRearChannels( in_uChannelMask ) )
00460         {
00461             unsigned int uRearIdx = ChannelMaskToNumChannels( in_uChannelMask & AK_SPEAKER_SETUP_FRONT );
00462             unsigned int uMaxIdx = uRearIdx + 4;    // Side and rear channels.
00463 
00464             if ( in_uChannelIdx >= uRearIdx  
00465                 && in_uChannelIdx < uMaxIdx )
00466             {
00467                 // Surround channel (not LFE).
00468                 unsigned int uSideIdx = uRearIdx + 2;
00469                 if ( in_uChannelIdx >= uSideIdx )
00470                     in_uChannelIdx -= 2;    // input is side, swap it with back.
00471                 else
00472                     in_uChannelIdx += 2;    // input is back, swap it with side.
00473             }
00474         }
00475     }
00476 
00477     return in_uChannelIdx;
00478 }
00479 
00480 } // namespace AK
00481 
00483 enum AkChannelConfigType
00484 {
00485     AK_ChannelConfigType_Anonymous = 0x0,   
00486     AK_ChannelConfigType_Standard = 0x1,    
00487     AK_ChannelConfigType_Ambisonic = 0x2    
00488 };
00489 
00509 struct AkChannelConfig
00510 {
00511     // Channel config: 
00512     // - uChannelMask is a bit field, whose channel identifiers depend on AkChannelConfigType (up to 20). Channel bits are defined in AkSpeakerConfig.h.
00513     // - eConfigType is a code that completes the identification of channels by uChannelMask.
00514     // - uNumChannels is the number of channels, identified (deduced from channel mask) or anonymous (set directly). 
00515     AkUInt32    uNumChannels : 8;   
00516     AkUInt32    eConfigType : 4;    
00517     AkUInt32    uChannelMask : 20;
00518 
00520     AkForceInline AkChannelConfig()
00521         : uNumChannels(0)
00522         , eConfigType(0)
00523         , uChannelMask(0)
00524     {
00525     }
00526 
00528     AkForceInline AkChannelConfig(AkUInt32 in_uNumChannels, AkUInt32 in_uChannelMask)
00529     {
00530         // Input arguments should be consistent.
00531         SetStandardOrAnonymous(in_uNumChannels, in_uChannelMask);
00532     }
00533 
00535     AkForceInline bool operator!=(AkUInt32 in_uBitField)
00536     {
00537         return (*((AkUInt32*)this) != in_uBitField);
00538     }
00539 
00541     AkForceInline void Clear()
00542     {
00543         uNumChannels = 0;
00544         eConfigType = 0;
00545         uChannelMask = 0;
00546     }
00547 
00549     AkForceInline void SetStandard(AkUInt32 in_uChannelMask)
00550     {
00551         uNumChannels = AK::ChannelMaskToNumChannels(in_uChannelMask);
00552         eConfigType = AK_ChannelConfigType_Standard;
00553         uChannelMask = in_uChannelMask;
00554     }
00555 
00557     AkForceInline void SetStandardOrAnonymous(AkUInt32 in_uNumChannels, AkUInt32 in_uChannelMask)
00558     {
00559 #ifdef AKASSERT
00560         AKASSERT(in_uChannelMask == 0 || in_uNumChannels == AK::ChannelMaskToNumChannels(in_uChannelMask));
00561 #endif
00562         uNumChannels = in_uNumChannels;
00563         eConfigType = (in_uChannelMask) ? AK_ChannelConfigType_Standard : AK_ChannelConfigType_Anonymous;
00564         uChannelMask = in_uChannelMask;
00565     }
00566 
00568     AkForceInline void SetAnonymous(AkUInt32 in_uNumChannels)
00569     {
00570         uNumChannels = in_uNumChannels;
00571         eConfigType = AK_ChannelConfigType_Anonymous;
00572         uChannelMask = 0;
00573     }
00574 
00576     AkForceInline void SetAmbisonic(AkUInt32 in_uNumChannels)
00577     {
00578         uNumChannels = in_uNumChannels;
00579         eConfigType = AK_ChannelConfigType_Ambisonic;
00580         uChannelMask = 0;
00581     }
00582 
00584     AkForceInline bool IsValid() const
00585     {
00586         return uNumChannels != 0;
00587     }
00588 
00590     AkForceInline AkUInt32 Serialize() const
00591     {
00592         return uNumChannels | (eConfigType << 8) | (uChannelMask << 12);
00593     }
00594 
00596     AkForceInline void Deserialize(AkUInt32 in_uChannelConfig)
00597     {
00598         uNumChannels = in_uChannelConfig & 0x000000ff;
00599         eConfigType = (in_uChannelConfig >> 8) & 0x0000000f;
00600         uChannelMask = (in_uChannelConfig >> 12) & 0x000fffff;
00601     }
00602 
00604     AkForceInline AkChannelConfig RemoveLFE() const
00605     {
00606         AkChannelConfig newConfig = *this;
00607 #ifdef AK_LFECENTER
00608         AkUInt32 uNewChannelMask = newConfig.uChannelMask & ~AK_SPEAKER_LOW_FREQUENCY;
00609         AkUInt32 uNumLFEChannel = (newConfig.uChannelMask - uNewChannelMask) >> 3; // 0 or 1
00610 #ifdef AKASSERT
00611         AKASSERT(uNumLFEChannel == 0 || uNumLFEChannel == 1);
00612 #endif
00613         newConfig.uNumChannels -= uNumLFEChannel;
00614         newConfig.uChannelMask = uNewChannelMask;
00615 #endif
00616         return newConfig;
00617     }
00618 
00620     AkForceInline AkChannelConfig RemoveCenter() const
00621     {
00622         AkChannelConfig newConfig = *this;
00623 #ifdef AK_LFECENTER
00624         AkUInt32 uNewChannelMask = newConfig.uChannelMask & ~AK_SPEAKER_FRONT_CENTER;
00625         AkUInt32 uNumCenterChannel = (newConfig.uChannelMask - uNewChannelMask) >> 2;   // 0 or 1.
00626 #ifdef AKASSERT
00627         AKASSERT(uNumCenterChannel == 0 || uNumCenterChannel == 1);
00628 #endif
00629         newConfig.uNumChannels -= uNumCenterChannel;
00630         newConfig.uChannelMask = uNewChannelMask;
00631 #endif
00632         return newConfig;
00633     }
00634 
00636     AkForceInline bool operator==(const AkChannelConfig & in_other) const
00637     {
00638         return uNumChannels == in_other.uNumChannels
00639             && eConfigType == in_other.eConfigType
00640             && uChannelMask == in_other.uChannelMask;
00641     }
00642 
00644     AkForceInline bool operator!=(const AkChannelConfig & in_other) const
00645     {
00646         return uNumChannels != in_other.uNumChannels
00647             || eConfigType != in_other.eConfigType
00648             || uChannelMask != in_other.uChannelMask;
00649     }
00650 
00653     AkForceInline bool IsChannelConfigSupported() const
00654     {
00655 #ifdef AK_71AUDIO
00656         return true;
00657 #else
00658         if (eConfigType == AK_ChannelConfigType_Standard)
00659         {
00660             switch (uChannelMask)
00661             {
00662             case AK_SPEAKER_SETUP_MONO:
00663             case AK_SPEAKER_SETUP_STEREO:
00664 #ifdef AK_LFECENTER
00665             case AK_SPEAKER_SETUP_0POINT1:
00666             case AK_SPEAKER_SETUP_1POINT1:
00667             case AK_SPEAKER_SETUP_2POINT1:
00668             case AK_SPEAKER_SETUP_3STEREO:
00669             case AK_SPEAKER_SETUP_3POINT1:
00670 #ifdef AK_REARCHANNELS
00671             case AK_SPEAKER_SETUP_4:
00672             case AK_SPEAKER_SETUP_4POINT1:
00673             case AK_SPEAKER_SETUP_5:
00674             case AK_SPEAKER_SETUP_5POINT1:
00675 #endif
00676 #endif
00677                 return true;
00678             }
00679         }
00680         return false;
00681 #endif
00682     }
00683 
00686     AkForceInline bool HasLFE() const
00687     {
00688 #ifdef AK_LFECENTER
00689         return AK::HasLFE(uChannelMask);
00690 #else
00691         return false;
00692 #endif
00693     }
00694 
00699     AkForceInline bool HasCenter() const
00700     {
00701 #ifdef AK_LFECENTER
00702         return AK::HasCenter(uChannelMask);
00703 #else
00704         return false;
00705 #endif
00706     }
00707 };
00708 
00709 #endif //_AK_SPEAKERCONFIG_H_

このページはお役に立ちましたか?

サポートは必要ですか?

ご質問や問題、ご不明点はございますか?お気軽にお問い合わせください。

サポートページをご確認ください

あなたのプロジェクトについて教えてください。ご不明な点はありませんか。

プロジェクトを登録していただくことで、ご利用開始のサポートをいたします。

Wwiseからはじめよう