From fe6e532c876bf3ec6776f76f9542038ac9c94d68 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 5 Mar 2012 07:11:09 -0800 Subject: Use a separate backend callback to start playback of the device This allows us to properly update the ALCdevice and its resources with the new parameters before starting playback, instead of expecting the mixer to block and wait after it has begun. This also lets us avoid holding the device lock while resetting and starting the device, which helps prevent lock inversion on some backends (ie, one thread locking A then B, and another thread locking B then A), ultimately allowing certain backends to asynchronously update the ALCdevice without risk of lockup. Capture still has issues here, however. --- Alc/backends/null.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Alc/backends/null.c') diff --git a/Alc/backends/null.c b/Alc/backends/null.c index 10068630..8fc60b66 100644 --- a/Alc/backends/null.c +++ b/Alc/backends/null.c @@ -99,9 +99,13 @@ static void null_close_playback(ALCdevice *device) static ALCboolean null_reset_playback(ALCdevice *device) { - null_data *data = (null_data*)device->ExtraData; - SetDefaultWFXChannelOrder(device); + return ALC_TRUE; +} + +static ALCboolean null_start_playback(ALCdevice *device) +{ + null_data *data = (null_data*)device->ExtraData; data->thread = StartThread(NullProc, device); if(data->thread == NULL) @@ -129,6 +133,7 @@ static const BackendFuncs null_funcs = { null_open_playback, null_close_playback, null_reset_playback, + null_start_playback, null_stop_playback, NULL, NULL, -- cgit v1.2.3