diff options
author | Chris Robinson <[email protected]> | 2015-08-28 14:10:39 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-08-28 14:10:39 -0700 |
commit | e5fa4ee25dae8b242761052641dca5a4f8091359 (patch) | |
tree | 87a4e70d7465ae651e671d62c2e6e399bb210a19 /Alc/backends | |
parent | bbc16e2c15b139cf2ef14eff9b3bcdb4933a5b0e (diff) |
Allow for device-specific config values
Diffstat (limited to 'Alc/backends')
-rw-r--r-- | Alc/backends/alsa.c | 14 | ||||
-rw-r--r-- | Alc/backends/jack.c | 6 | ||||
-rw-r--r-- | Alc/backends/oss.c | 4 | ||||
-rw-r--r-- | Alc/backends/portaudio.c | 4 | ||||
-rw-r--r-- | Alc/backends/pulseaudio.c | 8 | ||||
-rw-r--r-- | Alc/backends/solaris.c | 2 | ||||
-rw-r--r-- | Alc/backends/wave.c | 6 |
7 files changed, 22 insertions, 22 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c index e07f3ce5..97723cae 100644 --- a/Alc/backends/alsa.c +++ b/Alc/backends/alsa.c @@ -273,14 +273,14 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList) AL_STRING_INIT(entry.name); AL_STRING_INIT(entry.device_name); al_string_copy_cstr(&entry.name, alsaDevice); - al_string_copy_cstr(&entry.device_name, GetConfigValue("alsa", (stream==SND_PCM_STREAM_PLAYBACK) ? + al_string_copy_cstr(&entry.device_name, GetConfigValue(NULL, "alsa", (stream==SND_PCM_STREAM_PLAYBACK) ? "device" : "capture", "default")); VECTOR_PUSH_BACK(*DeviceList, entry); card = -1; if((err=snd_card_next(&card)) < 0) ERR("Failed to find a card: %s\n", snd_strerror(err)); - ConfigValueStr("alsa", prefix_name(stream), &main_prefix); + ConfigValueStr(NULL, "alsa", prefix_name(stream), &main_prefix); while(card >= 0) { const char *card_prefix = main_prefix; @@ -304,7 +304,7 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList) cardid = snd_ctl_card_info_get_id(info); snprintf(name, sizeof(name), "%s-%s", prefix_name(stream), cardid); - ConfigValueStr("alsa", name, &card_prefix); + ConfigValueStr(NULL, "alsa", name, &card_prefix); dev = -1; while(1) @@ -330,7 +330,7 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList) devname = snd_pcm_info_get_name(pcminfo); snprintf(name, sizeof(name), "%s-%s-%d", prefix_name(stream), cardid, dev); - ConfigValueStr("alsa", name, &device_prefix); + ConfigValueStr(NULL, "alsa", name, &device_prefix); snprintf(name, sizeof(name), "%s, %s (CARD=%s,DEV=%d)", cardname, devname, cardid, dev); @@ -640,7 +640,7 @@ static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name) else { name = alsaDevice; - driver = GetConfigValue("alsa", "device", "default"); + driver = GetConfigValue(NULL, "alsa", "device", "default"); } TRACE("Opening device \"%s\"\n", driver); @@ -704,7 +704,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) break; } - allowmmap = GetConfigValueBool("alsa", "mmap", 1); + allowmmap = GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "mmap", 1); periods = device->NumUpdates; periodLen = (ALuint64)device->UpdateSize * 1000000 / device->Frequency; bufferLen = periodLen * periods; @@ -965,7 +965,7 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) else { name = alsaDevice; - driver = GetConfigValue("alsa", "capture", "default"); + driver = GetConfigValue(NULL, "alsa", "capture", "default"); } TRACE("Opening device \"%s\"\n", driver); diff --git a/Alc/backends/jack.c b/Alc/backends/jack.c index fbf2e54b..69d1277a 100644 --- a/Alc/backends/jack.c +++ b/Alc/backends/jack.c @@ -207,7 +207,7 @@ static int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg) TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates); bufsize = device->UpdateSize; - if(ConfigValueUInt("jack", "buffer-size", &bufsize)) + if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize)) bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize); bufsize += device->UpdateSize; @@ -397,7 +397,7 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self) device->NumUpdates = 2; bufsize = device->UpdateSize; - if(ConfigValueUInt("jack", "buffer-size", &bufsize)) + if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize)) bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize); bufsize += device->UpdateSize; @@ -543,7 +543,7 @@ static ALCboolean ALCjackBackendFactory_init(ALCjackBackendFactory* UNUSED(self) if(!jack_load()) return ALC_FALSE; - if(!GetConfigValueBool("jack", "spawn-server", 0)) + if(!GetConfigValueBool(NULL, "jack", "spawn-server", 0)) ClientOptions |= JackNoStartServer; client = jack_client_open("alsoft", ClientOptions, &status, NULL); if(client == NULL) diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c index f3e68550..dce42e21 100644 --- a/Alc/backends/oss.c +++ b/Alc/backends/oss.c @@ -562,8 +562,8 @@ ALCbackendFactory *ALCossBackendFactory_getFactory(void) ALCboolean ALCossBackendFactory_init(ALCossBackendFactory* UNUSED(self)) { - ConfigValueStr("oss", "device", &oss_driver); - ConfigValueStr("oss", "capture", &oss_capture); + ConfigValueStr(NULL, "oss", "device", &oss_driver); + ConfigValueStr(NULL, "oss", "capture", &oss_capture); return ALC_TRUE; } diff --git a/Alc/backends/portaudio.c b/Alc/backends/portaudio.c index 7c0cf4a6..c54a2ab7 100644 --- a/Alc/backends/portaudio.c +++ b/Alc/backends/portaudio.c @@ -167,7 +167,7 @@ static ALCenum pa_open_playback(ALCdevice *device, const ALCchar *deviceName) data->update_size = device->UpdateSize; data->params.device = -1; - if(!ConfigValueInt("port", "device", &data->params.device) || + if(!ConfigValueInt(NULL, "port", "device", &data->params.device) || data->params.device < 0) data->params.device = Pa_GetDefaultOutputDevice(); data->params.suggestedLatency = (device->UpdateSize*device->NumUpdates) / @@ -319,7 +319,7 @@ static ALCenum pa_open_capture(ALCdevice *device, const ALCchar *deviceName) goto error; data->params.device = -1; - if(!ConfigValueInt("port", "capture", &data->params.device) || + if(!ConfigValueInt(NULL, "port", "capture", &data->params.device) || data->params.device < 0) data->params.device = Pa_GetDefaultInputDevice(); data->params.suggestedLatency = 0.0f; diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index 52b5d29c..c0012473 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -860,7 +860,7 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name flags = PA_STREAM_FIX_FORMAT | PA_STREAM_FIX_RATE | PA_STREAM_FIX_CHANNELS; - if(!GetConfigValueBool("pulse", "allow-moves", 0)) + if(!GetConfigValueBool(NULL, "pulse", "allow-moves", 0)) flags |= PA_STREAM_DONT_MOVE; spec.format = PA_SAMPLE_S16NE; @@ -932,7 +932,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) flags |= PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE; flags |= PA_STREAM_ADJUST_LATENCY; flags |= PA_STREAM_START_CORKED; - if(!GetConfigValueBool("pulse", "allow-moves", 0)) + if(!GetConfigValueBool(NULL, "pulse", "allow-moves", 0)) flags |= PA_STREAM_DONT_MOVE; switch(device->FmtType) @@ -1453,7 +1453,7 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) pa_frame_size(&self->spec); flags |= PA_STREAM_START_CORKED|PA_STREAM_ADJUST_LATENCY; - if(!GetConfigValueBool("pulse", "allow-moves", 0)) + if(!GetConfigValueBool(NULL, "pulse", "allow-moves", 0)) flags |= PA_STREAM_DONT_MOVE; TRACE("Connecting to \"%s\"\n", pulse_name ? pulse_name : "(default)"); @@ -1641,7 +1641,7 @@ static ALCboolean ALCpulseBackendFactory_init(ALCpulseBackendFactory* UNUSED(sel pa_threaded_mainloop *loop; pulse_ctx_flags = 0; - if(!GetConfigValueBool("pulse", "spawn-server", 1)) + if(!GetConfigValueBool(NULL, "pulse", "spawn-server", 1)) pulse_ctx_flags |= PA_CONTEXT_NOAUTOSPAWN; if((loop=pa_threaded_mainloop_new()) && diff --git a/Alc/backends/solaris.c b/Alc/backends/solaris.c index c3c2a86f..52ca9090 100644 --- a/Alc/backends/solaris.c +++ b/Alc/backends/solaris.c @@ -294,7 +294,7 @@ ALCbackendFactory *ALCsolarisBackendFactory_getFactory(void) static ALCboolean ALCsolarisBackendFactory_init(ALCsolarisBackendFactory* UNUSED(self)) { - ConfigValueStr("solaris", "device", &solaris_driver); + ConfigValueStr(NULL, "solaris", "device", &solaris_driver); return ALC_TRUE; } diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c index 728b4d91..6b47c611 100644 --- a/Alc/backends/wave.c +++ b/Alc/backends/wave.c @@ -210,7 +210,7 @@ static ALCenum ALCwaveBackend_open(ALCwaveBackend *self, const ALCchar *name) ALCdevice *device; const char *fname; - fname = GetConfigValue("wave", "file", ""); + fname = GetConfigValue(NULL, "wave", "file", ""); if(!fname[0]) return ALC_INVALID_VALUE; if(!name) @@ -248,7 +248,7 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) fseek(self->mFile, 0, SEEK_SET); clearerr(self->mFile); - if(GetConfigValueBool("wave", "bformat", 0)) + if(GetConfigValueBool(NULL, "wave", "bformat", 0)) device->FmtChans = DevFmtBFormat3D; switch(device->FmtType) @@ -412,7 +412,7 @@ static ALCboolean ALCwaveBackendFactory_init(ALCwaveBackendFactory* UNUSED(self) static ALCboolean ALCwaveBackendFactory_querySupport(ALCwaveBackendFactory* UNUSED(self), ALCbackend_Type type) { if(type == ALCbackend_Playback) - return !!ConfigValueExists("wave", "file"); + return !!ConfigValueExists(NULL, "wave", "file"); return ALC_FALSE; } |