diff options
-rw-r--r-- | Alc/ALu.c | 31 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 2 | ||||
-rw-r--r-- | OpenAL32/alExtension.c | 2 |
4 files changed, 35 insertions, 4 deletions
@@ -59,11 +59,13 @@ __inline ALuint aluBytesFromFormat(ALenum format) case AL_FORMAT_MONO8: case AL_FORMAT_STEREO8: case AL_FORMAT_QUAD8: + case AL_FORMAT_51CHN8: return 1; case AL_FORMAT_MONO16: case AL_FORMAT_STEREO16: case AL_FORMAT_QUAD16: + case AL_FORMAT_51CHN16: return 2; default: @@ -87,6 +89,10 @@ __inline ALuint aluChannelsFromFormat(ALenum format) case AL_FORMAT_QUAD16: return 4; + case AL_FORMAT_51CHN8: + case AL_FORMAT_51CHN16: + return 6; + default: return 0; } @@ -340,6 +346,9 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource, break; case AL_FORMAT_QUAD8: case AL_FORMAT_QUAD16: + /* TODO: Add center/lfe channel in spatial calculations? */ + case AL_FORMAT_51CHN8: + case AL_FORMAT_51CHN16: // Apply a scalar so each individual speaker has more weight PanningLR = 0.5f + (0.5f*Position[0]*1.41421356f); PanningLR = __min(1.0f, PanningLR); @@ -367,10 +376,14 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource, drysend[1] = SourceVolume * 1.0f * ListenerGain; drysend[2] = SourceVolume * 1.0f * ListenerGain; drysend[3] = SourceVolume * 1.0f * ListenerGain; + drysend[4] = SourceVolume * 1.0f * ListenerGain; + drysend[5] = SourceVolume * 1.0f * ListenerGain; wetsend[0] = SourceVolume * 0.0f * ListenerGain; wetsend[1] = SourceVolume * 0.0f * ListenerGain; wetsend[2] = SourceVolume * 0.0f * ListenerGain; wetsend[3] = SourceVolume * 0.0f * ListenerGain; + wetsend[4] = SourceVolume * 0.0f * ListenerGain; + wetsend[5] = SourceVolume * 0.0f * ListenerGain; pitch[0] = Pitch; } @@ -380,8 +393,8 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma { static float DryBuffer[BUFFERSIZE][OUTPUTCHANNELS]; static float WetBuffer[BUFFERSIZE][OUTPUTCHANNELS]; - ALfloat DrySend[OUTPUTCHANNELS] = { 0.0f, 0.0f, 0.0f, 0.0f }; - ALfloat WetSend[OUTPUTCHANNELS] = { 0.0f, 0.0f, 0.0f, 0.0f }; + ALfloat DrySend[OUTPUTCHANNELS] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; + ALfloat WetSend[OUTPUTCHANNELS] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; ALuint BlockAlign,BufferSize; ALuint DataSize=0,DataPosInt=0,DataPosFrac=0; ALuint Channels,Bits,Frequency,ulExtraSamples; @@ -641,6 +654,13 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma buffer = ((ALubyte*)buffer) + 1; } break; + case AL_FORMAT_51CHN8: + for(i = 0;i < SamplesToDo*6;i++) + { + *((ALubyte*)buffer) = (ALubyte)((aluF2S(DryBuffer[i/6][i%6]+WetBuffer[i/6][i%6])>>8)+128); + buffer = ((ALubyte*)buffer) + 1; + } + break; case AL_FORMAT_MONO16: for(i = 0;i < SamplesToDo;i++) { @@ -663,6 +683,13 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma buffer = ((ALshort*)buffer) + 1; } break; + case AL_FORMAT_51CHN16: + for(i = 0;i < SamplesToDo*6;i++) + { + *((ALshort*)buffer) = aluF2S(DryBuffer[i/6][i%6]+WetBuffer[i/6][i%6]); + buffer = ((ALshort*)buffer) + 1; + } + break; } size -= SamplesToDo; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 1f62b535..30dd068f 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -92,9 +92,11 @@ extern char _alDebug[256]; #define AL_FORMAT_MONO_IMA4 0x1300 #define AL_FORMAT_STEREO_IMA4 0x1301 // These are from AL_EXT_MCFORMATS, which we don't support yet but the mixer -// can use 4-channel formats +// can use the extra formats #define AL_FORMAT_QUAD8 0x1204 #define AL_FORMAT_QUAD16 0x1205 +#define AL_FORMAT_51CHN8 0x120A +#define AL_FORMAT_51CHN16 0x120B #define SWMIXER_OUTPUT_RATE 44100 //#define OUTPUT_BUFFER_SIZE (32768*SWMIXER_OUTPUT_RATE/22050) diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index e4fe0dc3..ecf32e5c 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -5,7 +5,7 @@ #define FRACTIONBITS 14 #define FRACTIONMASK ((1L<<FRACTIONBITS)-1) #define MAX_PITCH 4 -#define OUTPUTCHANNELS 4 +#define OUTPUTCHANNELS 6 #include "AL/al.h" #include "AL/alc.h" diff --git a/OpenAL32/alExtension.c b/OpenAL32/alExtension.c index 269590e9..24ea48db 100644 --- a/OpenAL32/alExtension.c +++ b/OpenAL32/alExtension.c @@ -156,6 +156,8 @@ static ALenums enumeration[]={ { (ALchar *)"AL_FORMAT_STEREO_IMA4", AL_FORMAT_STEREO_IMA4 }, { (ALchar *)"AL_FORMAT_QUAD8", AL_FORMAT_QUAD8 }, { (ALchar *)"AL_FORMAT_QUAD16", AL_FORMAT_QUAD16 }, + { (ALchar *)"AL_FORMAT_51CHN8", AL_FORMAT_51CHN8 }, + { (ALchar *)"AL_FORMAT_51CHN16", AL_FORMAT_51CHN16 }, // Buffer attributes { (ALchar *)"AL_FREQUENCY", AL_FREQUENCY }, |