Don't check explicitly against formats, but rather their byte/channel count
This commit is contained in:
parent
ab8d342df0
commit
8011ad97b5
14
Alc/ALu.c
14
Alc/ALu.c
@ -327,28 +327,24 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
|
||||
|
||||
//6. Convert normalized position into pannings, then into channel volumes
|
||||
aluNormalize(Position);
|
||||
switch(OutputFormat)
|
||||
switch(aluChannelsFromFormat(OutputFormat))
|
||||
{
|
||||
case AL_FORMAT_MONO8:
|
||||
case AL_FORMAT_MONO16:
|
||||
case 1:
|
||||
drysend[0] = ConeVolume * ListenerGain * DryMix * aluSqrt(1.0f); //Direct
|
||||
drysend[1] = ConeVolume * ListenerGain * DryMix * aluSqrt(1.0f); //Direct
|
||||
wetsend[0] = ListenerGain * WetMix * aluSqrt(1.0f); //Room
|
||||
wetsend[1] = ListenerGain * WetMix * aluSqrt(1.0f); //Room
|
||||
break;
|
||||
case AL_FORMAT_STEREO8:
|
||||
case AL_FORMAT_STEREO16:
|
||||
case 2:
|
||||
PanningLR = 0.5f + 0.5f*Position[0];
|
||||
drysend[0] = ConeVolume * ListenerGain * DryMix * aluSqrt(1.0f-PanningLR); //L Direct
|
||||
drysend[1] = ConeVolume * ListenerGain * DryMix * aluSqrt( PanningLR); //R Direct
|
||||
wetsend[0] = ListenerGain * WetMix * aluSqrt(1.0f-PanningLR); //L Room
|
||||
wetsend[1] = ListenerGain * WetMix * aluSqrt( PanningLR); //R Room
|
||||
break;
|
||||
case AL_FORMAT_QUAD8:
|
||||
case AL_FORMAT_QUAD16:
|
||||
case 4:
|
||||
/* TODO: Add center/lfe channel in spatial calculations? */
|
||||
case AL_FORMAT_51CHN8:
|
||||
case AL_FORMAT_51CHN16:
|
||||
case 6:
|
||||
// Apply a scalar so each individual speaker has more weight
|
||||
PanningLR = 0.5f + (0.5f*Position[0]*1.41421356f);
|
||||
PanningLR = __min(1.0f, PanningLR);
|
||||
|
10
Alc/alsa.c
10
Alc/alsa.c
@ -324,16 +324,12 @@ open_alsa:
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
switch(device->Format)
|
||||
switch(aluBytesFromFormat(device->Format))
|
||||
{
|
||||
case AL_FORMAT_MONO8:
|
||||
case AL_FORMAT_STEREO8:
|
||||
case AL_FORMAT_QUAD8:
|
||||
case 1:
|
||||
data->format = SND_PCM_FORMAT_U8;
|
||||
break;
|
||||
case AL_FORMAT_MONO16:
|
||||
case AL_FORMAT_STEREO16:
|
||||
case AL_FORMAT_QUAD16:
|
||||
case 2:
|
||||
data->format = SND_PCM_FORMAT_S16;
|
||||
break;
|
||||
default:
|
||||
|
@ -129,7 +129,7 @@ static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceNam
|
||||
memset(&OutputType, 0, sizeof(WAVEFORMATEX));
|
||||
OutputType.wFormatTag = WAVE_FORMAT_PCM;
|
||||
OutputType.nChannels = device->Channels;
|
||||
OutputType.wBitsPerSample = (((device->Format==AL_FORMAT_MONO16)||(device->Format==AL_FORMAT_STEREO16)||(device->Format==AL_FORMAT_QUAD16))?16:8);
|
||||
OutputType.wBitsPerSample = aluBytesFromFormat(device->Format) * 8;
|
||||
OutputType.nBlockAlign = OutputType.nChannels*OutputType.wBitsPerSample/8;
|
||||
OutputType.nSamplesPerSec = device->Frequency;
|
||||
OutputType.nAvgBytesPerSec = OutputType.nSamplesPerSec*OutputType.nBlockAlign;
|
||||
|
20
Alc/oss.c
20
Alc/oss.c
@ -174,17 +174,13 @@ static ALCboolean oss_open_playback(ALCdevice *device, const ALCchar *deviceName
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
switch(device->Format)
|
||||
switch(aluBytesFromFormat(device->Format))
|
||||
{
|
||||
case AL_FORMAT_MONO8:
|
||||
case AL_FORMAT_STEREO8:
|
||||
case AL_FORMAT_QUAD8:
|
||||
case 1:
|
||||
data->silence = 0x80;
|
||||
ossFormat = AFMT_U8;
|
||||
break;
|
||||
case AL_FORMAT_MONO16:
|
||||
case AL_FORMAT_STEREO16:
|
||||
case AL_FORMAT_QUAD16:
|
||||
case 2:
|
||||
data->silence = 0;
|
||||
ossFormat = AFMT_S16_NE;
|
||||
break;
|
||||
@ -337,17 +333,13 @@ static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName,
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
switch(format)
|
||||
switch(aluBytesFromFormat(format))
|
||||
{
|
||||
case AL_FORMAT_MONO8:
|
||||
case AL_FORMAT_STEREO8:
|
||||
case AL_FORMAT_QUAD8:
|
||||
case 1:
|
||||
data->silence = 0x80;
|
||||
ossFormat = AFMT_U8;
|
||||
break;
|
||||
case AL_FORMAT_MONO16:
|
||||
case AL_FORMAT_STEREO16:
|
||||
case AL_FORMAT_QUAD16:
|
||||
case 2:
|
||||
data->silence = 0;
|
||||
ossFormat = AFMT_S16_NE;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user