Fix the Solaris backend

This commit is contained in:
Chris Robinson
2009-08-16 13:16:41 -07:00
parent 0b5a0d1e79
commit 2d1191697a
+27 -3
View File
@@ -129,6 +129,17 @@ static ALCboolean solaris_open_playback(ALCdevice *device, const ALCchar *device
info.play.precision = 8;
info.play.encoding = AUDIO_ENCODING_LINEAR8;
break;
case 4:
switch(numChannels)
{
case 1: device->Format = AL_FORMAT_MONO16; break;
case 2: device->Format = AL_FORMAT_STEREO16; break;
case 4: device->Format = AL_FORMAT_QUAD16; break;
case 6: device->Format = AL_FORMAT_51CHN16; break;
case 7: device->Format = AL_FORMAT_61CHN16; break;
case 8: device->Format = AL_FORMAT_71CHN16; break;
}
/* fall-through */
case 2:
info.play.precision = 16;
info.play.encoding = AUDIO_ENCODING_LINEAR;
@@ -138,7 +149,7 @@ static ALCboolean solaris_open_playback(ALCdevice *device, const ALCchar *device
}
frameSize = numChannels * aluBytesFromFormat(device->Format);
info.play.buffer_size = device->UpdateSize * frameSize;
info.play.buffer_size = device->BufferSize * frameSize;
if(ioctl(data->fd, AUDIO_SETINFO, &info) < 0)
{
@@ -148,8 +159,6 @@ static ALCboolean solaris_open_playback(ALCdevice *device, const ALCchar *device
return ALC_FALSE;
}
device->Frequency = info.play.sample_rate;
if(aluChannelsFromFormat(device->Format) != info.play.channels)
{
AL_PRINT("Could not set %d channels, got %d instead\n", aluChannelsFromFormat(device->Format), info.play.channels);
@@ -167,6 +176,7 @@ static ALCboolean solaris_open_playback(ALCdevice *device, const ALCchar *device
return ALC_FALSE;
}
device->Frequency = info.play.sample_rate;
device->UpdateSize = info.play.buffer_size / 4;
data->data_size = device->UpdateSize * frameSize;
@@ -198,6 +208,18 @@ static void solaris_close_playback(ALCdevice *device)
device->ExtraData = NULL;
}
static ALCboolean solaris_start_context(ALCdevice *device, ALCcontext *context)
{
device->Frequency = context->fFrequency;
return ALC_TRUE;
}
static void solaris_stop_context(ALCdevice *device, ALCcontext *context)
{
(void)device;
(void)context;
}
static ALCboolean solaris_open_capture(ALCdevice *device, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
{
@@ -241,6 +263,8 @@ static ALCuint solaris_available_samples(ALCdevice *pDevice)
BackendFuncs solaris_funcs = {
solaris_open_playback,
solaris_close_playback,
solaris_start_context,
solaris_stop_context,
solaris_open_capture,
solaris_close_capture,
solaris_start_capture,