aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/alMain.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-12-02 04:03:51 -0800
committerChris Robinson <[email protected]>2009-12-02 04:03:51 -0800
commitb5270e0bb300f090c159803e79b50ba15b821b2e (patch)
tree3acfd1add6598701dbb4350649339fcf1a853b8a /OpenAL32/Include/alMain.h
parent6cfc31777b7cca6714cf926fbc6e491c00a3f836 (diff)
Use a channel-map to specify the output device channel order
Diffstat (limited to 'OpenAL32/Include/alMain.h')
-rw-r--r--OpenAL32/Include/alMain.h81
1 files changed, 81 insertions, 0 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