aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/portaudio.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-08-13 12:28:46 -0700
committerChris Robinson <[email protected]>2009-08-13 12:28:46 -0700
commit243939f94f26b1840255590b2454e931374de73f (patch)
tree2739c389486d703c5d31ab262aecb1be02d11b5c /Alc/portaudio.c
parent739385bd89c4eaae662ee1e017f74ba0da31f350 (diff)
Allow delaying playback start until context creation, and don't use UpdateSize to store the buffer size
This will make it possible to support the context attributes (frequency, refresh, etc) for some backends
Diffstat (limited to 'Alc/portaudio.c')
-rw-r--r--Alc/portaudio.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/Alc/portaudio.c b/Alc/portaudio.c
index 47333c8f..ccc8647c 100644
--- a/Alc/portaudio.c
+++ b/Alc/portaudio.c
@@ -97,7 +97,7 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
outParams.device = GetConfigValueInt("port", "device", -1);
if(outParams.device < 0)
outParams.device = pPa_GetDefaultOutputDevice();
- outParams.suggestedLatency = (float)device->UpdateSize /
+ outParams.suggestedLatency = (float)device->BufferSize /
(float)device->Frequency;
outParams.hostApiSpecificStreamInfo = NULL;
@@ -120,8 +120,8 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
outParams.channelCount = aluChannelsFromFormat(device->Format);
err = pPa_OpenStream(&data->stream, NULL, &outParams, device->Frequency,
- device->UpdateSize/periods, paNoFlag,
- pa_callback, device);
+ device->BufferSize/periods, paNoFlag,
+ pa_callback, device);
if(err != paNoError)
{
AL_PRINT("Pa_OpenStream() returned an error: %s\n", pPa_GetErrorText(err));
@@ -140,7 +140,7 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
return ALC_FALSE;
}
- device->UpdateSize /= periods;
+ device->UpdateSize = device->BufferSize/periods;
return ALC_TRUE;
}
@@ -161,6 +161,19 @@ static void pa_close_playback(ALCdevice *device)
device->ExtraData = NULL;
}
+static ALCboolean pa_start_context(ALCdevice *device, ALCcontext *context)
+{
+ return ALC_TRUE;
+ (void)device;
+ (void)context;
+}
+
+static void pa_stop_context(ALCdevice *device, ALCcontext *context)
+{
+ (void)device;
+ (void)context;
+}
+
static ALCboolean pa_open_capture(ALCdevice *device, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
{
@@ -177,6 +190,8 @@ static ALCboolean pa_open_capture(ALCdevice *device, const ALCchar *deviceName,
static const BackendFuncs pa_funcs = {
pa_open_playback,
pa_close_playback,
+ pa_start_context,
+ pa_stop_context,
pa_open_capture,
NULL,
NULL,