aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c5
-rw-r--r--Alc/backends/alsa.c8
-rw-r--r--Alc/backends/coreaudio.c10
-rw-r--r--Alc/backends/dsound.c13
-rw-r--r--Alc/backends/loopback.c4
-rw-r--r--Alc/backends/mmdevapi.c13
-rw-r--r--Alc/backends/null.c6
-rw-r--r--Alc/backends/opensl.c13
-rw-r--r--Alc/backends/oss.c8
-rw-r--r--Alc/backends/portaudio.c10
-rw-r--r--Alc/backends/pulseaudio.c10
-rw-r--r--Alc/backends/sndio.c8
-rw-r--r--Alc/backends/solaris.c8
-rw-r--r--Alc/backends/wave.c10
-rw-r--r--Alc/backends/winmm.c13
15 files changed, 64 insertions, 75 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 548b05c8..0fe9d8a5 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2354,6 +2354,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
{
const ALCchar *fmt;
ALCdevice *device;
+ ALCenum err;
DO_INITCONFIG();
@@ -2431,7 +2432,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
// Find a playback device to open
LockLists();
- if(ALCdevice_OpenPlayback(device, deviceName))
+ if((err=ALCdevice_OpenPlayback(device, deviceName)) == ALC_NO_ERROR)
{
device->next = g_pDeviceList;
g_pDeviceList = device;
@@ -2443,7 +2444,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
DeleteCriticalSection(&device->Mutex);
free(device);
device = NULL;
- alcSetError(NULL, ALC_INVALID_VALUE);
+ alcSetError(NULL, err);
}
UnlockLists();
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c
index ffed94a8..fc873489 100644
--- a/Alc/backends/alsa.c
+++ b/Alc/backends/alsa.c
@@ -523,7 +523,7 @@ static ALuint ALSANoMMapProc(ALvoid *ptr)
return 0;
}
-static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum alsa_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
alsa_data *data;
char driver[128];
@@ -553,7 +553,7 @@ static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceNam
}
}
if(idx == numDevNames)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
data = (alsa_data*)calloc(1, sizeof(alsa_data));
@@ -569,12 +569,12 @@ static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceNam
{
free(data);
ERR("Could not open playback device '%s': %s\n", driver, snd_strerror(i));
- return ALC_FALSE;
+ return ALC_OUT_OF_MEMORY;
}
device->szDeviceName = strdup(deviceName);
device->ExtraData = data;
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void alsa_close_playback(ALCdevice *device)
diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c
index c84be846..4a042285 100644
--- a/Alc/backends/coreaudio.c
+++ b/Alc/backends/coreaudio.c
@@ -135,7 +135,7 @@ static OSStatus ca_capture_callback(void *inRefCon, AudioUnitRenderActionFlags *
return noErr;
}
-static ALCboolean ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
ComponentDescription desc;
Component comp;
@@ -145,7 +145,7 @@ static ALCboolean ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
if(!deviceName)
deviceName = ca_device;
else if(strcmp(deviceName, ca_device) != 0)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
/* open the default output unit */
desc.componentType = kAudioUnitType_Output;
@@ -158,7 +158,7 @@ static ALCboolean ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
if(comp == NULL)
{
ERR("FindNextComponent failed\n");
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
data = calloc(1, sizeof(*data));
@@ -170,10 +170,10 @@ static ALCboolean ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
ERR("OpenAComponent failed\n");
free(data);
device->ExtraData = NULL;
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void ca_close_playback(ALCdevice *device)
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index 8a8ce3bc..2b944adc 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -254,7 +254,7 @@ static ALuint DSoundProc(ALvoid *ptr)
return 0;
}
-static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceName)
{
DSoundData *pData = NULL;
LPGUID guid = NULL;
@@ -282,16 +282,13 @@ static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceNam
}
}
if(i == NumDevices)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
//Initialise requested device
pData = calloc(1, sizeof(DSoundData));
if(!pData)
- {
- alcSetError(device, ALC_OUT_OF_MEMORY);
- return ALC_FALSE;
- }
+ return ALC_OUT_OF_MEMORY;
hr = DS_OK;
pData->hNotifyEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -311,12 +308,12 @@ static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceNam
CloseHandle(pData->hNotifyEvent);
free(pData);
ERR("Device init failed: 0x%08lx\n", hr);
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
device->szDeviceName = strdup(deviceName);
device->ExtraData = pData;
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void DSoundClosePlayback(ALCdevice *device)
diff --git a/Alc/backends/loopback.c b/Alc/backends/loopback.c
index 86e53555..8a576361 100644
--- a/Alc/backends/loopback.c
+++ b/Alc/backends/loopback.c
@@ -26,10 +26,10 @@
#include "AL/alc.h"
-static ALCboolean loopback_open_playback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum loopback_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
device->szDeviceName = strdup(deviceName);
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void loopback_close_playback(ALCdevice *device)
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index 702569c6..5fe545a1 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -632,7 +632,7 @@ static BOOL MMDevApiLoad(void)
}
-static ALCboolean MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceName)
{
MMDevApiData *data = NULL;
HRESULT hr;
@@ -640,15 +640,12 @@ static ALCboolean MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceN
if(!deviceName)
deviceName = mmDevice;
else if(strcmp(deviceName, mmDevice) != 0)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
//Initialise requested device
data = calloc(1, sizeof(MMDevApiData));
if(!data)
- {
- alcSetError(device, ALC_OUT_OF_MEMORY);
- return ALC_FALSE;
- }
+ return ALC_OUT_OF_MEMORY;
device->ExtraData = data;
hr = S_OK;
@@ -679,11 +676,11 @@ static ALCboolean MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceN
device->ExtraData = NULL;
ERR("Device init failed: 0x%08lx\n", hr);
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
device->szDeviceName = strdup(deviceName);
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void MMDevApiClosePlayback(ALCdevice *device)
diff --git a/Alc/backends/null.c b/Alc/backends/null.c
index dd1ac216..7b501b58 100644
--- a/Alc/backends/null.c
+++ b/Alc/backends/null.c
@@ -73,20 +73,20 @@ static ALuint NullProc(ALvoid *ptr)
return 0;
}
-static ALCboolean null_open_playback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum null_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
null_data *data;
if(!deviceName)
deviceName = nullDevice;
else if(strcmp(deviceName, nullDevice) != 0)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
data = (null_data*)calloc(1, sizeof(*data));
device->szDeviceName = strdup(deviceName);
device->ExtraData = data;
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void null_close_playback(ALCdevice *device)
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c
index 88d05505..405f66af 100644
--- a/Alc/backends/opensl.c
+++ b/Alc/backends/opensl.c
@@ -178,7 +178,7 @@ static void opensl_callback(SLAndroidSimpleBufferQueueItf bq, void *context)
}
-static ALCboolean opensl_open_playback(ALCdevice *Device, const ALCchar *deviceName)
+static ALCenum opensl_open_playback(ALCdevice *Device, const ALCchar *deviceName)
{
osl_data *data = NULL;
SLresult result;
@@ -186,14 +186,11 @@ static ALCboolean opensl_open_playback(ALCdevice *Device, const ALCchar *deviceN
if(!deviceName)
deviceName = opensl_device;
else if(strcmp(deviceName, opensl_device) != 0)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
data = calloc(1, sizeof(*data));
if(!data)
- {
- alcSetError(Device, ALC_OUT_OF_MEMORY);
- return ALC_FALSE;
- }
+ return ALC_OUT_OF_MEMORY;
// create engine
result = slCreateEngine(&data->engineObject, 0, NULL, 0, NULL, NULL);
@@ -231,13 +228,13 @@ static ALCboolean opensl_open_playback(ALCdevice *Device, const ALCchar *deviceN
data->engine = NULL;
free(data);
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
Device->szDeviceName = strdup(deviceName);
Device->ExtraData = data;
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c
index 724b23c2..e361dff4 100644
--- a/Alc/backends/oss.c
+++ b/Alc/backends/oss.c
@@ -147,7 +147,7 @@ static ALuint OSSCaptureProc(ALvoid *ptr)
return 0;
}
-static ALCboolean oss_open_playback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum oss_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
char driver[64];
oss_data *data;
@@ -157,7 +157,7 @@ static ALCboolean oss_open_playback(ALCdevice *device, const ALCchar *deviceName
if(!deviceName)
deviceName = oss_device;
else if(strcmp(deviceName, oss_device) != 0)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
data = (oss_data*)calloc(1, sizeof(oss_data));
data->killNow = 0;
@@ -167,12 +167,12 @@ static ALCboolean oss_open_playback(ALCdevice *device, const ALCchar *deviceName
{
free(data);
ERR("Could not open %s: %s\n", driver, strerror(errno));
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
device->szDeviceName = strdup(deviceName);
device->ExtraData = data;
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void oss_close_playback(ALCdevice *device)
diff --git a/Alc/backends/portaudio.c b/Alc/backends/portaudio.c
index 4f3dfd5f..606d0633 100644
--- a/Alc/backends/portaudio.c
+++ b/Alc/backends/portaudio.c
@@ -152,7 +152,7 @@ static int pa_capture_cb(const void *inputBuffer, void *outputBuffer,
}
-static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
PaStreamParameters outParams;
pa_data *data;
@@ -161,7 +161,7 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
if(!deviceName)
deviceName = pa_device;
else if(strcmp(deviceName, pa_device) != 0)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
data = (pa_data*)calloc(1, sizeof(pa_data));
data->update_size = device->UpdateSize;
@@ -204,7 +204,7 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
ERR("Pa_OpenStream() returned an error: %s\n", Pa_GetErrorText(err));
device->ExtraData = NULL;
free(data);
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
device->szDeviceName = strdup(deviceName);
@@ -217,7 +217,7 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
Pa_CloseStream(data->stream);
device->ExtraData = NULL;
free(data);
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
if((device->Flags&DEVICE_CHANNELS_REQUEST))
ERR("Failed to set %s, got %u channels instead\n", DevFmtChannelsString(device->FmtChans), outParams.channelCount);
@@ -225,7 +225,7 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
device->FmtChans = ((outParams.channelCount==1) ? DevFmtMono : DevFmtStereo);
}
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void pa_close_playback(ALCdevice *device)
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c
index 787d6a58..5a39bacf 100644
--- a/Alc/backends/pulseaudio.c
+++ b/Alc/backends/pulseaudio.c
@@ -848,7 +848,7 @@ static void pulse_close(ALCdevice *device) //{{{
//}}}
// OpenAL {{{
-static ALCboolean pulse_open_playback(ALCdevice *device, const ALCchar *device_name) //{{{
+static ALCenum pulse_open_playback(ALCdevice *device, const ALCchar *device_name) //{{{
{
char *pulse_name = NULL;
pa_sample_spec spec;
@@ -872,11 +872,11 @@ static ALCboolean pulse_open_playback(ALCdevice *device, const ALCchar *device_n
}
}
if(i == numDevNames)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
if(pulse_open(device, device_name) == ALC_FALSE)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
data = device->ExtraData;
@@ -909,11 +909,11 @@ static ALCboolean pulse_open_playback(ALCdevice *device, const ALCchar *device_n
pa_threaded_mainloop_unlock(data->loop);
- return ALC_TRUE;
+ return ALC_NO_ERROR;
fail:
pulse_close(device);
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
} //}}}
static void pulse_close_playback(ALCdevice *device) //{{{
diff --git a/Alc/backends/sndio.c b/Alc/backends/sndio.c
index 5f9ad0cd..3a5e768f 100644
--- a/Alc/backends/sndio.c
+++ b/Alc/backends/sndio.c
@@ -165,14 +165,14 @@ static ALuint sndio_proc(ALvoid *ptr)
-static ALCboolean sndio_open_playback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum sndio_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
sndio_data *data;
if(!deviceName)
deviceName = sndio_device;
else if(strcmp(deviceName, sndio_device) != 0)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
data = calloc(1, sizeof(*data));
data->killNow = 0;
@@ -182,13 +182,13 @@ static ALCboolean sndio_open_playback(ALCdevice *device, const ALCchar *deviceNa
{
free(data);
ERR("Could not open device\n");
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
device->szDeviceName = strdup(deviceName);
device->ExtraData = data;
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void sndio_close_playback(ALCdevice *device)
diff --git a/Alc/backends/solaris.c b/Alc/backends/solaris.c
index b2b8196d..1ac1f9fb 100644
--- a/Alc/backends/solaris.c
+++ b/Alc/backends/solaris.c
@@ -91,7 +91,7 @@ static ALuint SolarisProc(ALvoid *ptr)
}
-static ALCboolean solaris_open_playback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum solaris_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
char driver[64];
solaris_data *data;
@@ -102,7 +102,7 @@ static ALCboolean solaris_open_playback(ALCdevice *device, const ALCchar *device
if(!deviceName)
deviceName = solaris_device;
else if(strcmp(deviceName, solaris_device) != 0)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
data = (solaris_data*)calloc(1, sizeof(solaris_data));
data->killNow = 0;
@@ -112,12 +112,12 @@ static ALCboolean solaris_open_playback(ALCdevice *device, const ALCchar *device
{
free(data);
ERR("Could not open %s: %s\n", driver, strerror(errno));
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
device->szDeviceName = strdup(deviceName);
device->ExtraData = data;
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void solaris_close_playback(ALCdevice *device)
diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c
index 465087ce..ae0ef2be 100644
--- a/Alc/backends/wave.c
+++ b/Alc/backends/wave.c
@@ -159,19 +159,19 @@ static ALuint WaveProc(ALvoid *ptr)
return 0;
}
-static ALCboolean wave_open_playback(ALCdevice *device, const ALCchar *deviceName)
+static ALCenum wave_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
wave_data *data;
const char *fname;
fname = GetConfigValue("wave", "file", "");
if(!fname[0])
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
if(!deviceName)
deviceName = waveDevice;
else if(strcmp(deviceName, waveDevice) != 0)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
data = (wave_data*)calloc(1, sizeof(wave_data));
@@ -180,12 +180,12 @@ static ALCboolean wave_open_playback(ALCdevice *device, const ALCchar *deviceNam
{
free(data);
ERR("Could not open file '%s': %s\n", fname, strerror(errno));
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
device->szDeviceName = strdup(deviceName);
device->ExtraData = data;
- return ALC_TRUE;
+ return ALC_NO_ERROR;
}
static void wave_close_playback(ALCdevice *device)
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index 445dd51e..cd61a156 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -292,7 +292,7 @@ static DWORD WINAPI CaptureThreadProc(LPVOID lpParameter)
}
-static ALCboolean WinMMOpenPlayback(ALCdevice *pDevice, const ALCchar *deviceName)
+static ALCenum WinMMOpenPlayback(ALCdevice *pDevice, const ALCchar *deviceName)
{
WAVEFORMATEX wfexFormat;
WinMMData *pData = NULL;
@@ -318,15 +318,12 @@ static ALCboolean WinMMOpenPlayback(ALCdevice *pDevice, const ALCchar *deviceNam
}
}
if(i == NumPlaybackDevices)
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
pData = calloc(1, sizeof(*pData));
if(!pData)
- {
- alcSetError(pDevice, ALC_OUT_OF_MEMORY);
- return ALC_FALSE;
- }
+ return ALC_OUT_OF_MEMORY;
pDevice->ExtraData = pData;
if(pDevice->FmtChans != DevFmtMono)
@@ -381,7 +378,7 @@ static ALCboolean WinMMOpenPlayback(ALCdevice *pDevice, const ALCchar *deviceNam
pDevice->szDeviceName = strdup((lDeviceID==WAVE_MAPPER) ? woDefault :
PlaybackDeviceList[lDeviceID]);
- return ALC_TRUE;
+ return ALC_NO_ERROR;
failure:
if(pData->hWaveThreadEvent)
@@ -392,7 +389,7 @@ failure:
free(pData);
pDevice->ExtraData = NULL;
- return ALC_FALSE;
+ return ALC_INVALID_VALUE;
}
static void WinMMClosePlayback(ALCdevice *device)