Merge branch 'master' into efx-experiment

This commit is contained in:
Chris Robinson 2008-01-01 06:29:11 -08:00
commit 9ed574b399
2 changed files with 33 additions and 60 deletions

View File

@ -744,28 +744,6 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
if(Channels >= 4)
{
int i = 2;
if(Channels >= 7)
{
//First order interpolator (side left)
value = (ALfloat)((ALshort)(((Data[k*Channels+2]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+2]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][SIDE_LEFT] += value*DrySend[SIDE_LEFT];
WetBuffer[j][SIDE_LEFT] += value*WetSend[SIDE_LEFT];
//First order interpolator (side right)
value = (ALfloat)((ALshort)(((Data[k*Channels+3]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+3]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][SIDE_RIGHT] += value*DrySend[SIDE_RIGHT];
WetBuffer[j][SIDE_RIGHT] += value*WetSend[SIDE_RIGHT];
i += 2;
}
//First order interpolator (back left)
value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][BACK_LEFT] += value*DrySend[BACK_LEFT];
WetBuffer[j][BACK_LEFT] += value*WetSend[BACK_LEFT];
i++;
//First order interpolator (back right)
value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][BACK_RIGHT] += value*DrySend[BACK_RIGHT];
WetBuffer[j][BACK_RIGHT] += value*WetSend[BACK_RIGHT];
i++;
if(Channels >= 6)
{
if(Channels != 7)
@ -780,6 +758,30 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][LFE] += value*DrySend[LFE];
WetBuffer[j][LFE] += value*WetSend[LFE];
i++;
}
//First order interpolator (back left)
value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][BACK_LEFT] += value*DrySend[BACK_LEFT];
WetBuffer[j][BACK_LEFT] += value*WetSend[BACK_LEFT];
i++;
//First order interpolator (back right)
value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][BACK_RIGHT] += value*DrySend[BACK_RIGHT];
WetBuffer[j][BACK_RIGHT] += value*WetSend[BACK_RIGHT];
i++;
if(Channels >= 7)
{
//First order interpolator (side left)
value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][SIDE_LEFT] += value*DrySend[SIDE_LEFT];
WetBuffer[j][SIDE_LEFT] += value*WetSend[SIDE_LEFT];
i++;
//First order interpolator (side right)
value = (ALfloat)((ALshort)(((Data[k*Channels+i]*((1L<<FRACTIONBITS)-fraction))+(Data[(k+1)*Channels+i]*(fraction)))>>FRACTIONBITS));
DryBuffer[j][SIDE_RIGHT] += value*DrySend[SIDE_RIGHT];
WetBuffer[j][SIDE_RIGHT] += value*WetSend[SIDE_RIGHT];
i++;
}
}
}

View File

@ -215,49 +215,20 @@ static ALCboolean oss_open_playback(ALCdevice *device, const ALCchar *deviceName
}
#undef ok
device->Channels = numChannels;
device->Frequency = ossSpeed;
device->Format = 0;
if(ossFormat == AFMT_U8)
if((int)device->Channels != numChannels)
{
if(device->Channels == 1)
{
device->Format = AL_FORMAT_MONO8;
device->FrameSize = 1;
}
else if(device->Channels == 2)
{
device->Format = AL_FORMAT_STEREO8;
device->FrameSize = 2;
}
else if(device->Channels == 4)
{
device->Format = AL_FORMAT_QUAD8;
device->FrameSize = 4;
}
}
else if(ossFormat == AFMT_S16_NE)
{
if(device->Channels == 1)
{
device->Format = AL_FORMAT_MONO16;
device->FrameSize = 2;
}
else if(device->Channels == 2)
{
device->Format = AL_FORMAT_STEREO16;
device->FrameSize = 4;
}
else if(device->Channels == 4)
{
device->Format = AL_FORMAT_QUAD16;
device->FrameSize = 8;
}
AL_PRINT("Could not set %d channels, got %d instead\n", device->Channels, numChannels);
close(data->fd);
free(data);
return ALC_FALSE;
}
if(!device->Format)
if(!((ossFormat == AFMT_U8 && aluBytesFromFormat(device->Format) == 1) ||
(ossFormat == AFMT_S16_NE && aluBytesFromFormat(device->Format) == 2)))
{
AL_PRINT("returned unknown format: %#x %d!\n", ossFormat, numChannels);
AL_PRINT("Could not set %d-bit output, got format %#x\n", aluBytesFromFormat(device->Format)*8, ossFormat);
close(data->fd);
free(data);
return ALC_FALSE;