aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/portaudio.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-12-04 19:50:00 -0800
committerChris Robinson <[email protected]>2010-12-04 19:50:00 -0800
commit88e3a2277235fe173d4d0ff3f10c0becdc9c82cd (patch)
tree3cfad0017b809fc08e69cc9ec99fe622d26a2606 /Alc/portaudio.c
parent191803ad53c156d3f056b649c76e441042a385fb (diff)
Separate device format into 'channel config' and 'sample type' components
Diffstat (limited to 'Alc/portaudio.c')
-rw-r--r--Alc/portaudio.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/Alc/portaudio.c b/Alc/portaudio.c
index 2b8e0fa4..77c7236f 100644
--- a/Alc/portaudio.c
+++ b/Alc/portaudio.c
@@ -190,24 +190,25 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
(float)device->Frequency;
outParams.hostApiSpecificStreamInfo = NULL;
- switch(aluBytesFromFormat(device->Format))
+ switch(device->FmtType)
{
- case 1:
+ case DevFmtByte:
+ outParams.sampleFormat = paInt8;
+ break;
+ case DevFmtUByte:
outParams.sampleFormat = paUInt8;
break;
- case 2:
+ case DevFmtUShort:
+ device->FmtType = DevFmtShort;
+ /* fall-through */
+ case DevFmtShort:
outParams.sampleFormat = paInt16;
break;
- case 4:
+ case DevFmtFloat:
outParams.sampleFormat = paFloat32;
break;
- default:
- AL_PRINT("Unknown format: 0x%x\n", device->Format);
- device->ExtraData = NULL;
- free(data);
- return ALC_FALSE;
}
- outParams.channelCount = aluChannelsFromFormat(device->Format);
+ outParams.channelCount = ChannelsFromDevFmt(device->FmtChans);
SetDefaultChannelOrder(device);
@@ -294,7 +295,7 @@ static ALCboolean pa_open_capture(ALCdevice *device, const ALCchar *deviceName)
return ALC_FALSE;
}
- frame_size = aluFrameSizeFromFormat(device->Format);
+ frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
data->ring = CreateRingBuffer(frame_size, device->UpdateSize*device->NumUpdates);
if(data->ring == NULL)
{
@@ -308,22 +309,25 @@ static ALCboolean pa_open_capture(ALCdevice *device, const ALCchar *deviceName)
inParams.suggestedLatency = 0.0f;
inParams.hostApiSpecificStreamInfo = NULL;
- switch(aluBytesFromFormat(device->Format))
+ switch(device->FmtType)
{
- case 1:
+ case DevFmtByte:
+ inParams.sampleFormat = paInt8;
+ break;
+ case DevFmtUByte:
inParams.sampleFormat = paUInt8;
break;
- case 2:
+ case DevFmtShort:
inParams.sampleFormat = paInt16;
break;
- case 4:
+ case DevFmtFloat:
inParams.sampleFormat = paFloat32;
break;
- default:
- AL_PRINT("Unknown format: 0x%x\n", device->Format);
+ case DevFmtUShort:
+ AL_PRINT("Unsigned short not supported\n");
goto error;
}
- inParams.channelCount = aluChannelsFromFormat(device->Format);
+ inParams.channelCount = ChannelsFromDevFmt(device->FmtChans);
err = pPa_OpenStream(&data->stream, &inParams, NULL, device->Frequency,
paFramesPerBufferUnspecified, paNoFlag, pa_capture_cb, device);