diff options
author | Chris Robinson <[email protected]> | 2009-08-27 02:53:09 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-08-27 02:53:09 -0700 |
commit | 6bb14e45cee9d8d7da37675cc6933146f7a95155 (patch) | |
tree | 238b8354671a87e00867af28424a4bf23b813e1c /Alc/alsa.c | |
parent | 45dc8048193162edbb886921cfcf2955c5232626 (diff) |
Store a copy of the device name in the device
Diffstat (limited to 'Alc/alsa.c')
-rw-r--r-- | Alc/alsa.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -352,6 +352,7 @@ static ALuint ALSANoMMapCaptureProc(ALvoid *ptr) static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceName) { + const char *devName = alsaDevice; alsa_data *data; char driver[64]; int i; @@ -370,21 +371,16 @@ static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceNam if(allDevNameMap[idx].name && strcmp(deviceName, allDevNameMap[idx].name) == 0) { - device->szDeviceName = allDevNameMap[idx].name; + devName = allDevNameMap[idx].name; if(idx > 0) sprintf(driver, "hw:%d,%d", allDevNameMap[idx].card, allDevNameMap[idx].dev); goto open_alsa; } } if(strcmp(deviceName, alsaDevice) == 0) - { - device->szDeviceName = alsaDevice; goto open_alsa; - } return ALC_FALSE; } - else - device->szDeviceName = alsaDevice; open_alsa: data = (alsa_data*)calloc(1, sizeof(alsa_data)); @@ -408,6 +404,7 @@ open_alsa: return ALC_FALSE; } + device->szDeviceName = strdup(devName); device->ExtraData = data; return ALC_TRUE; } @@ -582,6 +579,7 @@ static void alsa_stop_context(ALCdevice *device, ALCcontext *context) static ALCboolean alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName) { + const char *devName; snd_pcm_hw_params_t *p; snd_pcm_uframes_t bufferSizeInFrames; ALuint frameSize; @@ -604,7 +602,7 @@ static ALCboolean alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceNam if(allCaptureDevNameMap[idx].name && strcmp(deviceName, allCaptureDevNameMap[idx].name) == 0) { - pDevice->szDeviceName = allCaptureDevNameMap[idx].name; + devName = allCaptureDevNameMap[idx].name; if(idx > 0) sprintf(driver, "plughw:%d,%d", allCaptureDevNameMap[idx].card, allCaptureDevNameMap[idx].dev); goto open_alsa; @@ -613,7 +611,7 @@ static ALCboolean alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceNam return ALC_FALSE; } else - pDevice->szDeviceName = allCaptureDevNameMap[0].name; + devName = allCaptureDevNameMap[0].name; open_alsa: data = (alsa_data*)calloc(1, sizeof(alsa_data)); @@ -730,6 +728,7 @@ open_alsa: return ALC_FALSE; } + pDevice->szDeviceName = strdup(devName); return ALC_TRUE; } |