aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/solaris.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-02-29 21:45:44 -0800
committerChris Robinson <[email protected]>2012-02-29 21:45:44 -0800
commitf5435aa2de17f9f5b2de9cda0efcf725905b40e6 (patch)
tree53de01e79d2d4ae53ba356c124c97a9e399c2269 /Alc/backends/solaris.c
parente88f954cbf8549e78d477de1588608c10a2487a2 (diff)
Minor cleanups for OSS and Solaris
Diffstat (limited to 'Alc/backends/solaris.c')
-rw-r--r--Alc/backends/solaris.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/Alc/backends/solaris.c b/Alc/backends/solaris.c
index 02a6c9a5..bf0f57f5 100644
--- a/Alc/backends/solaris.c
+++ b/Alc/backends/solaris.c
@@ -39,6 +39,8 @@
static const ALCchar solaris_device[] = "Solaris Default";
+static const char *solaris_driver = "/dev/audio";
+
typedef struct {
int fd;
volatile int killNow;
@@ -93,12 +95,8 @@ static ALuint SolarisProc(ALvoid *ptr)
static ALCenum solaris_open_playback(ALCdevice *device, const ALCchar *deviceName)
{
- char driver[64];
solaris_data *data;
- strncpy(driver, GetConfigValue("solaris", "device", "/dev/audio"), sizeof(driver)-1);
- driver[sizeof(driver)-1] = 0;
-
if(!deviceName)
deviceName = solaris_device;
else if(strcmp(deviceName, solaris_device) != 0)
@@ -107,11 +105,11 @@ static ALCenum solaris_open_playback(ALCdevice *device, const ALCchar *deviceNam
data = (solaris_data*)calloc(1, sizeof(solaris_data));
data->killNow = 0;
- data->fd = open(driver, O_WRONLY);
+ data->fd = open(solaris_driver, O_WRONLY);
if(data->fd == -1)
{
free(data);
- ERR("Could not open %s: %s\n", driver, strerror(errno));
+ ERR("Could not open %s: %s\n", solaris_driver, strerror(errno));
return ALC_INVALID_VALUE;
}
@@ -182,17 +180,13 @@ static ALCboolean solaris_reset_playback(ALCdevice *device)
return ALC_FALSE;
}
- if(!((info.play.precision == 8 && info.play.encoding == AUDIO_ENCODING_LINEAR &&
- device->FmtType == DevFmtByte) ||
- (info.play.precision == 8 && info.play.encoding == AUDIO_ENCODING_LINEAR8 &&
- device->FmtType == DevFmtUByte) ||
- (info.play.precision == 16 && info.play.encoding == AUDIO_ENCODING_LINEAR &&
- device->FmtType == DevFmtShort) ||
- (info.play.precision == 32 && info.play.encoding == AUDIO_ENCODING_LINEAR &&
- device->FmtType == DevFmtInt)))
+ if(!((info.play.precision == 8 && info.play.encoding == AUDIO_ENCODING_LINEAR8 && device->FmtType == DevFmtUByte) ||
+ (info.play.precision == 8 && info.play.encoding == AUDIO_ENCODING_LINEAR && device->FmtType == DevFmtByte) ||
+ (info.play.precision == 16 && info.play.encoding == AUDIO_ENCODING_LINEAR && device->FmtType == DevFmtShort) ||
+ (info.play.precision == 32 && info.play.encoding == AUDIO_ENCODING_LINEAR && device->FmtType == DevFmtInt)))
{
- ERR("Could not set %#x sample type, got %d (%#x)\n",
- device->FmtType, info.play.precision, info.play.encoding);
+ ERR("Could not set %s samples, got %d (0x%x)\n", DevFmtTypeString(device->FmtType),
+ info.play.precision, info.play.encoding);
return ALC_FALSE;
}
@@ -250,6 +244,8 @@ static const BackendFuncs solaris_funcs = {
ALCboolean alc_solaris_init(BackendFuncs *func_list)
{
+ ConfigValueStr("solaris", "device", &solaris_driver);
+
*func_list = solaris_funcs;
return ALC_TRUE;
}
@@ -260,17 +256,18 @@ void alc_solaris_deinit(void)
void alc_solaris_probe(enum DevProbe type)
{
-#ifdef HAVE_STAT
- struct stat buf;
- if(stat(GetConfigValue("solaris", "device", "/dev/audio"), &buf) != 0)
- return;
-#endif
-
switch(type)
{
case ALL_DEVICE_PROBE:
- AppendAllDeviceList(solaris_device);
- break;
+ {
+#ifdef HAVE_STAT
+ struct stat buf;
+ if(stat(solaris_driver, &buf) == 0)
+#endif
+ AppendAllDeviceList(solaris_device);
+ }
+ break;
+
case CAPTURE_DEVICE_PROBE:
break;
}