aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2007-12-14 08:51:45 -0800
committerChris Robinson <[email protected]>2007-12-14 08:51:45 -0800
commit5f4659534abfc3a27cdae32606f699f189275ec8 (patch)
tree93a9e9978b28d1548b880c7169fb53ba161f0a31 /Alc
parent5da394ab617ab7d11e5b11610bb8dd83033e3920 (diff)
Store a persistant name string with the device struct
Diffstat (limited to 'Alc')
-rw-r--r--Alc/alsa.c13
-rw-r--r--Alc/dsound.c12
-rw-r--r--Alc/oss.c6
-rw-r--r--Alc/winmm.c3
4 files changed, 14 insertions, 20 deletions
diff --git a/Alc/alsa.c b/Alc/alsa.c
index a888843a..2a46eff0 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -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;
}
diff --git a/Alc/oss.c b/Alc/oss.c
index e1aba0b3..3742d83f 100644
--- a/Alc/oss.c
+++ b/Alc/oss.c
@@ -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;