aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-01-15 16:27:17 -0800
committerChris Robinson <[email protected]>2014-01-15 16:27:17 -0800
commit56899716d6c73585b5fec3c2e9280cfe780e08dc (patch)
tree392bcc2de0912c7ba3e63a46d565b4a6f9227aa7 /Alc
parent443e6b73b25bd60ae23a6be52540bd8a60a3b473 (diff)
Add an extension to pause audio processing
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c57
1 files changed, 56 insertions, 1 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 3237dcd8..7b08134c 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -150,6 +150,9 @@ static const ALCfunction alcFunctions[] = {
DECL(alcIsRenderFormatSupportedSOFT),
DECL(alcRenderSamplesSOFT),
+ DECL(alcDevicePauseSOFT),
+ DECL(alcDeviceResumeSOFT),
+
DECL(alEnable),
DECL(alDisable),
DECL(alIsEnabled),
@@ -742,7 +745,7 @@ static const ALCchar alcExtensionList[] =
"ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE "
"ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX "
"ALC_EXT_thread_local_context ALC_SOFTX_HRTF ALC_SOFT_loopback "
- "ALC_SOFTX_midi_interface";
+ "ALC_SOFTX_midi_interface ALC_SOFTX_pause_device";
static const ALCint alcMajorVersion = 1;
static const ALCint alcMinorVersion = 1;
@@ -3492,3 +3495,55 @@ FORCE_ALIGN ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, AL
aluMixData(device, buffer, samples);
if(device) ALCdevice_DecRef(device);
}
+
+
+/************************************************
+ * ALC DSP pause/resume functions
+ ************************************************/
+
+/* alcDevicePauseSOFT
+ *
+ * Pause the DSP to stop audio processing.
+ */
+ALC_API void ALC_APIENTRY alcDevicePauseSOFT(ALCdevice *device)
+{
+ if(!(device=VerifyDevice(device)) || device->Type != Playback)
+ alcSetError(device, ALC_INVALID_DEVICE);
+ else
+ {
+ LockLists();
+ if((device->Flags&DEVICE_RUNNING))
+ V0(device->Backend,stop)();
+ device->Flags &= ~DEVICE_RUNNING;
+ UnlockLists();
+ }
+ if(device) ALCdevice_DecRef(device);
+}
+
+/* alcDeviceResumeSOFT
+ *
+ * Resume the DSP to restart audio processing.
+ */
+ALC_API void ALC_APIENTRY alcDeviceResumeSOFT(ALCdevice *device)
+{
+ if(!(device=VerifyDevice(device)) || device->Type != Playback)
+ alcSetError(device, ALC_INVALID_DEVICE);
+ else
+ {
+ LockLists();
+ if(device->ContextList)
+ {
+ if(V0(device->Backend,start)() != ALC_FALSE)
+ device->Flags |= DEVICE_RUNNING;
+ else
+ {
+ alcSetError(device, ALC_INVALID_DEVICE);
+ ALCdevice_Lock(device);
+ aluHandleDisconnect(device);
+ ALCdevice_Unlock(device);
+ }
+ }
+ UnlockLists();
+ }
+ if(device) ALCdevice_DecRef(device);
+}