diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 81 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 4 |
2 files changed, 83 insertions, 2 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 69bd9d5b..4094d894 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -272,6 +272,8 @@ struct ALCdevice_struct // Dry path buffer mix float DryBuffer[BUFFERSIZE][OUTPUTCHANNELS]; + Channel DevChannels[OUTPUTCHANNELS]; + // Contexts created on this device ALCcontext **Contexts; ALuint NumContexts; @@ -364,6 +366,85 @@ void EnableRTPrio(ALint level); ALCboolean ALCAPIENTRY alcMakeCurrent(ALCcontext *context); ALCcontext* ALCAPIENTRY alcGetThreadContext(void); +// Sets the default channel order used by most non-WaveFormatEx-based APIs +static __inline void SetDefaultChannelOrder(ALCdevice *device) +{ + switch(aluChannelsFromFormat(device->Format)) + { + case 1: /* Mono is rendered as stereo; fall-through... */ + case 2: device->DevChannels[0] = FRONT_LEFT; + device->DevChannels[1] = FRONT_RIGHT; break; + + case 4: device->DevChannels[0] = FRONT_LEFT; + device->DevChannels[1] = FRONT_RIGHT; + device->DevChannels[2] = BACK_LEFT; + device->DevChannels[3] = BACK_RIGHT; break; + + case 6: device->DevChannels[0] = FRONT_LEFT; + device->DevChannels[1] = FRONT_RIGHT; + device->DevChannels[2] = BACK_LEFT; + device->DevChannels[3] = BACK_RIGHT; + device->DevChannels[4] = FRONT_CENTER; + device->DevChannels[5] = LFE; break; + + case 7: device->DevChannels[0] = FRONT_LEFT; + device->DevChannels[1] = FRONT_RIGHT; + device->DevChannels[2] = FRONT_CENTER; + device->DevChannels[3] = LFE; + device->DevChannels[4] = FRONT_CENTER; + device->DevChannels[5] = SIDE_LEFT; + device->DevChannels[6] = SIDE_RIGHT; break; + + case 8: device->DevChannels[0] = FRONT_LEFT; + device->DevChannels[1] = FRONT_RIGHT; + device->DevChannels[2] = BACK_LEFT; + device->DevChannels[3] = BACK_RIGHT; + device->DevChannels[4] = FRONT_CENTER; + device->DevChannels[5] = LFE; + device->DevChannels[6] = SIDE_LEFT; + device->DevChannels[7] = SIDE_RIGHT; break; + } +} +// Sets the default order used by WaveFormatEx +static __inline void SetDefaultWFXChannelOrder(ALCdevice *device) +{ + switch(aluChannelsFromFormat(device->Format)) + { + case 1: /* Mono is rendered as stereo; fall-through... */ + case 2: device->DevChannels[0] = FRONT_LEFT; + device->DevChannels[1] = FRONT_RIGHT; break; + + case 4: device->DevChannels[0] = FRONT_LEFT; + device->DevChannels[1] = FRONT_RIGHT; + device->DevChannels[2] = BACK_LEFT; + device->DevChannels[3] = BACK_RIGHT; break; + + case 6: device->DevChannels[0] = FRONT_LEFT; + device->DevChannels[1] = FRONT_RIGHT; + device->DevChannels[2] = FRONT_CENTER; + device->DevChannels[3] = LFE; + device->DevChannels[4] = BACK_LEFT; + device->DevChannels[5] = BACK_RIGHT; break; + + case 7: device->DevChannels[0] = FRONT_LEFT; + device->DevChannels[1] = FRONT_RIGHT; + device->DevChannels[2] = FRONT_CENTER; + device->DevChannels[3] = LFE; + device->DevChannels[4] = FRONT_CENTER; + device->DevChannels[5] = SIDE_LEFT; + device->DevChannels[6] = SIDE_RIGHT; break; + + case 8: device->DevChannels[0] = FRONT_LEFT; + device->DevChannels[1] = FRONT_RIGHT; + device->DevChannels[2] = FRONT_CENTER; + device->DevChannels[3] = LFE; + device->DevChannels[4] = BACK_LEFT; + device->DevChannels[5] = BACK_RIGHT; + device->DevChannels[6] = SIDE_LEFT; + device->DevChannels[7] = SIDE_RIGHT; break; + } +} + #ifdef __cplusplus } #endif diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 978527e5..acf1b480 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -54,7 +54,7 @@ extern "C" { #endif -enum { +typedef enum { FRONT_LEFT = 0, FRONT_RIGHT, FRONT_CENTER, @@ -66,7 +66,7 @@ enum { LFE, OUTPUTCHANNELS -}; +} Channel; #define BUFFERSIZE 24000 |