aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-08-19 00:23:26 -0700
committerChris Robinson <[email protected]>2011-08-19 00:30:05 -0700
commit6ba5128f722293a48b58c42385a5e1ff09f26e94 (patch)
treedf52b083b722d5d66ed894807ae155686eb226ae /Alc
parentc96a6c2b1bb90317fd95dfddbec4f492c17fef50 (diff)
Use separate lists for playback and capture backends
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c53
-rw-r--r--Alc/dsound.c48
-rw-r--r--Alc/mmdevapi.c10
-rw-r--r--Alc/null.c10
-rw-r--r--Alc/opensl.c9
-rw-r--r--Alc/sndio.c10
-rw-r--r--Alc/solaris.c48
-rw-r--r--Alc/wave.c10
8 files changed, 58 insertions, 140 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 320a6301..0584672b 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -117,6 +117,11 @@ static struct BackendInfo BackendLoopback = {
};
#undef EmptyFuncs
+static struct BackendInfo PlaybackBackend[sizeof(BackendList)/sizeof(BackendList[0])];
+static ALCuint NumPlaybackBackends;
+static struct BackendInfo CaptureBackend[sizeof(BackendList)/sizeof(BackendList[0])];
+static ALCuint NumCaptureBackends;
+
///////////////////////////////////////////////////////
// STRING and EXTENSIONS
@@ -533,6 +538,9 @@ static void alc_deinit(void)
ReleaseALC(ALC_TRUE);
+ memset(PlaybackBackend, 0, sizeof(PlaybackBackend));
+ memset(CaptureBackend, 0, sizeof(CaptureBackend));
+
for(i = 0;BackendList[i].Deinit;i++)
BackendList[i].Deinit();
BackendLoopback.Deinit();
@@ -542,7 +550,7 @@ static void alc_deinit(void)
static void alc_initconfig(void)
{
- int i;
+ int i, n;
const char *devs, *str;
str = getenv("ALSOFT_LOGLEVEL");
@@ -645,10 +653,24 @@ static void alc_initconfig(void)
while(BackendList[i].Init)
{
if(BackendList[i].Init(&BackendList[i].Funcs))
+ {
+ TRACE("Initialized backend \"%s\"\n", BackendList[i].name);
+ if(BackendList[i].Funcs.OpenPlayback)
+ {
+ PlaybackBackend[NumPlaybackBackends++] = BackendList[i];
+ TRACE("Added \"%s\" for playback\n", BackendList[i].name);
+ }
+ if(BackendList[i].Funcs.OpenCapture)
+ {
+ CaptureBackend[NumCaptureBackends++] = BackendList[i];
+ TRACE("Added \"%s\" for capture\n", BackendList[i].name);
+ }
i++;
+ }
else
{
- int n = i;
+ TRACE("Failed to initialize backend \"%s\"\n", BackendList[i].name);
+ n = i;
do {
BackendList[n] = BackendList[n+1];
++n;
@@ -660,7 +682,6 @@ static void alc_initconfig(void)
str = GetConfigValue(NULL, "excludefx", "");
if(str[0])
{
- int n;
size_t len;
const char *next = str;
@@ -703,15 +724,23 @@ static pthread_once_t once_control = PTHREAD_ONCE_INIT;
static void ProbeList(ALCchar **list, size_t *listsize, int type)
{
- ALint i;
+ ALCuint i;
free(*list);
*list = NULL;
*listsize = 0;
DO_INITCONFIG();
- for(i = 0;BackendList[i].Probe;i++)
- BackendList[i].Probe(type);
+ if(type == CAPTURE_DEVICE_PROBE)
+ {
+ for(i = 0;i < NumCaptureBackends;i++)
+ CaptureBackend[i].Probe(type);
+ }
+ else
+ {
+ for(i = 0;i < NumPlaybackBackends;i++)
+ PlaybackBackend[i].Probe(type);
+ }
}
static void ProbeDeviceList()
@@ -1621,7 +1650,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName,
{
ALCboolean DeviceFound = ALC_FALSE;
ALCdevice *device = NULL;
- ALCint i;
+ ALCuint i;
DO_INITCONFIG();
@@ -1664,9 +1693,9 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName,
device->NumUpdates = 1;
LockLists();
- for(i = 0;BackendList[i].Init;i++)
+ for(i = 0;i < NumCaptureBackends;i++)
{
- device->Funcs = &BackendList[i].Funcs;
+ device->Funcs = &CaptureBackend[i].Funcs;
if(ALCdevice_OpenCapture(device, deviceName))
{
device->next = g_pDeviceList;
@@ -2681,7 +2710,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
ALboolean bDeviceFound = AL_FALSE;
const ALCchar *fmt;
ALCdevice *device;
- ALint i;
+ ALCuint i;
DO_INITCONFIG();
@@ -2752,9 +2781,9 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
// Find a playback device to open
LockLists();
- for(i = 0;BackendList[i].Init;i++)
+ for(i = 0;i < NumPlaybackBackends;i++)
{
- device->Funcs = &BackendList[i].Funcs;
+ device->Funcs = &PlaybackBackend[i].Funcs;
if(ALCdevice_OpenPlayback(device, deviceName))
{
device->next = g_pDeviceList;
diff --git a/Alc/dsound.c b/Alc/dsound.c
index aac9abad..d34e5409 100644
--- a/Alc/dsound.c
+++ b/Alc/dsound.c
@@ -556,53 +556,17 @@ static void DSoundStopPlayback(ALCdevice *device)
}
-static ALCboolean DSoundOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- (void)pDevice;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-static void DSoundCloseCapture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void DSoundStartCapture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void DSoundStopCapture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void DSoundCaptureSamples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
-{
- (void)pDevice;
- (void)pBuffer;
- (void)lSamples;
-}
-
-static ALCuint DSoundAvailableSamples(ALCdevice *pDevice)
-{
- (void)pDevice;
- return 0;
-}
-
-
static const BackendFuncs DSoundFuncs = {
DSoundOpenPlayback,
DSoundClosePlayback,
DSoundResetPlayback,
DSoundStopPlayback,
- DSoundOpenCapture,
- DSoundCloseCapture,
- DSoundStartCapture,
- DSoundStopCapture,
- DSoundCaptureSamples,
- DSoundAvailableSamples
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
};
diff --git a/Alc/mmdevapi.c b/Alc/mmdevapi.c
index 5abb22c9..702569c6 100644
--- a/Alc/mmdevapi.c
+++ b/Alc/mmdevapi.c
@@ -726,20 +726,12 @@ static void MMDevApiStopPlayback(ALCdevice *device)
}
-static ALCboolean MMDevApiOpenCapture(ALCdevice *device, const ALCchar *deviceName)
-{
- (void)device;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-
static const BackendFuncs MMDevApiFuncs = {
MMDevApiOpenPlayback,
MMDevApiClosePlayback,
MMDevApiResetPlayback,
MMDevApiStopPlayback,
- MMDevApiOpenCapture,
+ NULL,
NULL,
NULL,
NULL,
diff --git a/Alc/null.c b/Alc/null.c
index 76c5af1c..dd1ac216 100644
--- a/Alc/null.c
+++ b/Alc/null.c
@@ -125,20 +125,12 @@ static void null_stop_playback(ALCdevice *device)
}
-static ALCboolean null_open_capture(ALCdevice *device, const ALCchar *deviceName)
-{
- (void)device;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-
static const BackendFuncs null_funcs = {
null_open_playback,
null_close_playback,
null_reset_playback,
null_stop_playback,
- null_open_capture,
+ NULL,
NULL,
NULL,
NULL,
diff --git a/Alc/opensl.c b/Alc/opensl.c
index 744548fb..88d05505 100644
--- a/Alc/opensl.c
+++ b/Alc/opensl.c
@@ -384,20 +384,13 @@ static void opensl_stop_playback(ALCdevice *Device)
data->bufferSize = 0;
}
-static ALCboolean opensl_open_capture(ALCdevice *Device, const ALCchar *deviceName)
-{
- return ALC_FALSE;
- (void)Device;
- (void)deviceName;
-}
-
static const BackendFuncs opensl_funcs = {
opensl_open_playback,
opensl_close_playback,
opensl_reset_playback,
opensl_stop_playback,
- opensl_open_capture,
+ NULL,
NULL,
NULL,
NULL,
diff --git a/Alc/sndio.c b/Alc/sndio.c
index aa6ac0e4..5f9ad0cd 100644
--- a/Alc/sndio.c
+++ b/Alc/sndio.c
@@ -335,20 +335,12 @@ static void sndio_stop_playback(ALCdevice *device)
}
-static ALCboolean sndio_open_capture(ALCdevice *device, const ALCchar *deviceName)
-{
- (void)device;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-
static const BackendFuncs sndio_funcs = {
sndio_open_playback,
sndio_close_playback,
sndio_reset_playback,
sndio_stop_playback,
- sndio_open_capture,
+ NULL,
NULL,
NULL,
NULL,
diff --git a/Alc/solaris.c b/Alc/solaris.c
index 9ddc1dc6..b2b8196d 100644
--- a/Alc/solaris.c
+++ b/Alc/solaris.c
@@ -237,53 +237,17 @@ static void solaris_stop_playback(ALCdevice *device)
}
-static ALCboolean solaris_open_capture(ALCdevice *device, const ALCchar *deviceName)
-{
- (void)device;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-static void solaris_close_capture(ALCdevice *device)
-{
- (void)device;
-}
-
-static void solaris_start_capture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void solaris_stop_capture(ALCdevice *pDevice)
-{
- (void)pDevice;
-}
-
-static void solaris_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples)
-{
- (void)pDevice;
- (void)pBuffer;
- (void)lSamples;
-}
-
-static ALCuint solaris_available_samples(ALCdevice *pDevice)
-{
- (void)pDevice;
- return 0;
-}
-
-
static const BackendFuncs solaris_funcs = {
solaris_open_playback,
solaris_close_playback,
solaris_reset_playback,
solaris_stop_playback,
- solaris_open_capture,
- solaris_close_capture,
- solaris_start_capture,
- solaris_stop_capture,
- solaris_capture_samples,
- solaris_available_samples
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
};
ALCboolean alc_solaris_init(BackendFuncs *func_list)
diff --git a/Alc/wave.c b/Alc/wave.c
index 689bd7cb..465087ce 100644
--- a/Alc/wave.c
+++ b/Alc/wave.c
@@ -313,20 +313,12 @@ static void wave_stop_playback(ALCdevice *device)
}
-static ALCboolean wave_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
-{
- (void)pDevice;
- (void)deviceName;
- return ALC_FALSE;
-}
-
-
static const BackendFuncs wave_funcs = {
wave_open_playback,
wave_close_playback,
wave_reset_playback,
wave_stop_playback,
- wave_open_capture,
+ NULL,
NULL,
NULL,
NULL,