aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/alsa.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-19 11:29:18 -0700
committerChris Robinson <[email protected]>2011-09-19 11:29:18 -0700
commitedb386eb1edaed1661089064bab57c8d39c52a15 (patch)
treeb0551187a3003a117e591ff87d459ee95eb3be4c /Alc/backends/alsa.c
parentcc3dd648ace1f1276e909dcb07adf782a39f1cf3 (diff)
Add a ConfigValueStr function, to return the string through a parameter
Diffstat (limited to 'Alc/backends/alsa.c')
-rw-r--r--Alc/backends/alsa.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c
index 6d4528c1..b99fd147 100644
--- a/Alc/backends/alsa.c
+++ b/Alc/backends/alsa.c
@@ -525,12 +525,12 @@ static ALuint ALSANoMMapProc(ALvoid *ptr)
static ALCenum alsa_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
+ const char *driver = "default";
alsa_data *data;
- char driver[128];
+ char str[128];
int i;
- strncpy(driver, GetConfigValue("alsa", "device", "default"), sizeof(driver)-1);
- driver[sizeof(driver)-1] = 0;
+ ConfigValueStr("alsa", "device", &driver);
if(!deviceName)
deviceName = alsaDevice;
@@ -547,8 +547,11 @@ static ALCenum alsa_open_playback(ALCdevice *device, const ALCchar *deviceName)
strcmp(deviceName, allDevNameMap[idx].name) == 0)
{
if(idx > 0)
- snprintf(driver, sizeof(driver), "%sCARD=%s,DEV=%d", device_prefix,
- allDevNameMap[idx].card, allDevNameMap[idx].dev);
+ {
+ snprintf(str, sizeof(str), "%sCARD=%s,DEV=%d", device_prefix,
+ allDevNameMap[idx].card, allDevNameMap[idx].dev);
+ driver = str;
+ }
break;
}
}
@@ -801,18 +804,18 @@ static void alsa_stop_playback(ALCdevice *device)
static ALCenum alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
{
+ const char *driver = "default";
snd_pcm_hw_params_t *p;
snd_pcm_uframes_t bufferSizeInFrames;
snd_pcm_uframes_t periodSizeInFrames;
snd_pcm_format_t format;
ALuint frameSize;
alsa_data *data;
- char driver[128];
+ char str[128];
char *err;
int i;
- strncpy(driver, GetConfigValue("alsa", "capture", "default"), sizeof(driver)-1);
- driver[sizeof(driver)-1] = 0;
+ ConfigValueStr("alsa", "capture", &driver);
if(!allCaptureDevNameMap)
allCaptureDevNameMap = probe_devices(SND_PCM_STREAM_CAPTURE, &numCaptureDevNames);
@@ -829,8 +832,11 @@ static ALCenum alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
strcmp(deviceName, allCaptureDevNameMap[idx].name) == 0)
{
if(idx > 0)
- snprintf(driver, sizeof(driver), "%sCARD=%s,DEV=%d", capture_prefix,
+ {
+ snprintf(str, sizeof(str), "%sCARD=%s,DEV=%d", capture_prefix,
allCaptureDevNameMap[idx].card, allCaptureDevNameMap[idx].dev);
+ driver = str;
+ }
break;
}
}