diff options
author | Chris Robinson <[email protected]> | 2007-12-14 08:51:45 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2007-12-14 08:51:45 -0800 |
commit | 5f4659534abfc3a27cdae32606f699f189275ec8 (patch) | |
tree | 93a9e9978b28d1548b880c7169fb53ba161f0a31 | |
parent | 5da394ab617ab7d11e5b11610bb8dd83033e3920 (diff) |
Store a persistant name string with the device struct
-rw-r--r-- | Alc/alsa.c | 13 | ||||
-rw-r--r-- | Alc/dsound.c | 12 | ||||
-rw-r--r-- | Alc/oss.c | 6 | ||||
-rw-r--r-- | Alc/winmm.c | 3 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 |
5 files changed, 15 insertions, 21 deletions
@@ -280,6 +280,7 @@ 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; if(idx > 0) sprintf(driver, "hw:%d,%d", allDevNameMap[idx].card, allDevNameMap[idx].dev); goto open_alsa; @@ -290,6 +291,7 @@ static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceNam if(alsaDeviceList[idx] && strcmp(deviceName, alsaDeviceList[idx]) == 0) { + device->szDeviceName = alsaDeviceList[idx]; if(idx > 0) sprintf(driver, "hw:%zd,0", idx-1); goto open_alsa; @@ -297,11 +299,8 @@ static ALCboolean alsa_open_playback(ALCdevice *device, const ALCchar *deviceNam } return ALC_FALSE; } - - if(deviceName) - strcpy(device->szDeviceName, deviceName); else - strcpy(device->szDeviceName, alsaDeviceList[0]); + device->szDeviceName = alsaDeviceList[0]; open_alsa: data = (alsa_data*)calloc(1, sizeof(alsa_data)); @@ -444,6 +443,7 @@ static ALCboolean alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceNam if(alsaCaptureDeviceList[idx] && strcmp(deviceName, alsaCaptureDeviceList[idx]) == 0) { + pDevice->szDeviceName = alsaCaptureDeviceList[idx]; if(idx > 0) sprintf(driver, "hw:%zd,0", idx-1); goto open_alsa; @@ -451,11 +451,8 @@ static ALCboolean alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceNam } return ALC_FALSE; } - - if(deviceName) - strcpy(pDevice->szDeviceName, deviceName); else - strcpy(pDevice->szDeviceName, alsaCaptureDeviceList[0]); + pDevice->szDeviceName = alsaCaptureDeviceList[0]; open_alsa: data = (alsa_data*)calloc(1, sizeof(alsa_data)); diff --git a/Alc/dsound.c b/Alc/dsound.c index c65637c8..a2b036a1 100644 --- a/Alc/dsound.c +++ b/Alc/dsound.c @@ -114,11 +114,16 @@ static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceNam for(i = 0;DeviceList[i];i++) { if(strcmp(deviceName, DeviceList[i]) == 0) - break; + { + device->szDeviceName = DeviceList[i]; + break; + } } if(!DeviceList[i]) return ALC_FALSE; } + else + device->szDeviceName = DeviceList[0]; //Platform specific memset(&OutputType, 0, sizeof(WAVEFORMATEX)); @@ -188,11 +193,6 @@ static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceNam pData->ulDSTimerID = timeSetEvent(25, 0, (LPTIMECALLBACK)DirectSoundProc, (DWORD)device, (UINT)TIME_CALLBACK_FUNCTION|TIME_PERIODIC); device->MaxNoOfSources = 256; - if(deviceName) - strcpy(device->szDeviceName, deviceName); - else - strcpy(device->szDeviceName, DeviceList[0]); - device->ExtraData = pData; return ALC_TRUE; } @@ -124,12 +124,10 @@ static ALCboolean oss_open_playback(ALCdevice *device, const ALCchar *deviceName { if(strcmp(deviceName, oss_device)) return ALC_FALSE; + device->szDeviceName = oss_device; } - - if(deviceName) - strcpy(device->szDeviceName, deviceName); else - strcpy(device->szDeviceName, oss_device); + device->szDeviceName = oss_device; data = (oss_data*)calloc(1, sizeof(oss_data)); data->killNow = 0; diff --git a/Alc/winmm.c b/Alc/winmm.c index 26f40db2..7018f098 100644 --- a/Alc/winmm.c +++ b/Alc/winmm.c @@ -196,6 +196,7 @@ static ALCboolean WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName if(!CaptureDeviceList[i]) return ALC_FALSE; } + pDevice->szDeviceName = CaptureDeviceList[lDeviceID]; pData = calloc(1, sizeof(*pData)); if(!pData) @@ -262,8 +263,6 @@ static ALCboolean WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName pData->ulReadCapturedDataPos = 0; pData->ulWriteCapturedDataPos = 0; - strcpy(pDevice->szDeviceName, CaptureDeviceList[lDeviceID]); - pDevice->ExtraData = pData; return ALC_TRUE; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index edd9a19f..26761bb1 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -128,7 +128,7 @@ struct ALCdevice_struct ALuint Channels; ALenum Format; - ALCchar szDeviceName[256]; + ALCchar *szDeviceName; // Maximum number of sources that can be created ALuint MaxNoOfSources; |