Allow for device-specific config values
This commit is contained in:
@@ -949,7 +949,7 @@ static void alc_initconfig(void)
|
||||
#ifdef HAVE_NEON
|
||||
capfilter |= CPU_CAP_NEON;
|
||||
#endif
|
||||
if(ConfigValueStr(NULL, "disable-cpu-exts", &str))
|
||||
if(ConfigValueStr(NULL, NULL, "disable-cpu-exts", &str))
|
||||
{
|
||||
if(strcasecmp(str, "all") == 0)
|
||||
capfilter = 0;
|
||||
@@ -990,9 +990,9 @@ static void alc_initconfig(void)
|
||||
#else
|
||||
RTPrioLevel = 0;
|
||||
#endif
|
||||
ConfigValueInt(NULL, "rt-prio", &RTPrioLevel);
|
||||
ConfigValueInt(NULL, NULL, "rt-prio", &RTPrioLevel);
|
||||
|
||||
if(ConfigValueStr(NULL, "resampler", &str))
|
||||
if(ConfigValueStr(NULL, NULL, "resampler", &str))
|
||||
{
|
||||
if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0)
|
||||
DefaultResampler = PointResampler;
|
||||
@@ -1024,21 +1024,21 @@ static void alc_initconfig(void)
|
||||
str = getenv("ALSOFT_TRAP_AL_ERROR");
|
||||
if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1))
|
||||
TrapALError = AL_TRUE;
|
||||
TrapALError = GetConfigValueBool(NULL, "trap-al-error", TrapALError);
|
||||
TrapALError = GetConfigValueBool(NULL, NULL, "trap-al-error", TrapALError);
|
||||
|
||||
str = getenv("ALSOFT_TRAP_ALC_ERROR");
|
||||
if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1))
|
||||
TrapALCError = ALC_TRUE;
|
||||
TrapALCError = GetConfigValueBool(NULL, "trap-alc-error", TrapALCError);
|
||||
TrapALCError = GetConfigValueBool(NULL, NULL, "trap-alc-error", TrapALCError);
|
||||
}
|
||||
|
||||
if(ConfigValueFloat("reverb", "boost", &valf))
|
||||
if(ConfigValueFloat(NULL, "reverb", "boost", &valf))
|
||||
ReverbBoost *= powf(10.0f, valf / 20.0f);
|
||||
|
||||
EmulateEAXReverb = GetConfigValueBool("reverb", "emulate-eax", AL_FALSE);
|
||||
EmulateEAXReverb = GetConfigValueBool(NULL, "reverb", "emulate-eax", AL_FALSE);
|
||||
|
||||
if(((devs=getenv("ALSOFT_DRIVERS")) && devs[0]) ||
|
||||
ConfigValueStr(NULL, "drivers", &devs))
|
||||
ConfigValueStr(NULL, NULL, "drivers", &devs))
|
||||
{
|
||||
int n;
|
||||
size_t len;
|
||||
@@ -1153,7 +1153,7 @@ static void alc_initconfig(void)
|
||||
V0(factory,init)();
|
||||
}
|
||||
|
||||
if(ConfigValueStr(NULL, "excludefx", &str))
|
||||
if(ConfigValueStr(NULL, NULL, "excludefx", &str))
|
||||
{
|
||||
size_t len;
|
||||
const char *next = str;
|
||||
@@ -1179,7 +1179,7 @@ static void alc_initconfig(void)
|
||||
|
||||
InitEffect(&DefaultEffect);
|
||||
str = getenv("ALSOFT_DEFAULT_REVERB");
|
||||
if((str && str[0]) || ConfigValueStr(NULL, "default-reverb", &str))
|
||||
if((str && str[0]) || ConfigValueStr(NULL, NULL, "default-reverb", &str))
|
||||
LoadReverbPreset(str, &DefaultEffect);
|
||||
}
|
||||
#define DO_INITCONFIG() alcall_once(&alc_config_once, alc_initconfig)
|
||||
@@ -1824,7 +1824,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
||||
return ALC_INVALID_VALUE;
|
||||
}
|
||||
|
||||
ConfigValueUInt(NULL, "sends", &numSends);
|
||||
ConfigValueUInt(NULL, NULL, "sends", &numSends);
|
||||
numSends = minu(MAX_SENDS, numSends);
|
||||
|
||||
if((device->Flags&DEVICE_RUNNING))
|
||||
@@ -1890,10 +1890,10 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
||||
attrIdx += 2;
|
||||
}
|
||||
|
||||
ConfigValueUInt(NULL, "frequency", &freq);
|
||||
ConfigValueUInt(al_string_get_cstr(device->DeviceName), NULL, "frequency", &freq);
|
||||
freq = maxu(freq, MIN_OUTPUT_RATE);
|
||||
|
||||
ConfigValueUInt(NULL, "sends", &numSends);
|
||||
ConfigValueUInt(al_string_get_cstr(device->DeviceName), NULL, "sends", &numSends);
|
||||
numSends = minu(MAX_SENDS, numSends);
|
||||
|
||||
UpdateClockBase(device);
|
||||
@@ -1919,7 +1919,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
||||
UpdateClockBase(device);
|
||||
|
||||
device->Hrtf_Status = ALC_HRTF_DISABLED_SOFT;
|
||||
if(device->Type != Loopback && ((device->Flags&DEVICE_HRTF_REQUEST_MASK) == Hrtf_Enable || GetConfigValueBool(NULL, "hrtf", 0)))
|
||||
if(device->Type != Loopback && ((device->Flags&DEVICE_HRTF_REQUEST_MASK) == Hrtf_Enable ||
|
||||
GetConfigValueBool(al_string_get_cstr(device->DeviceName), NULL, "hrtf", 0)))
|
||||
{
|
||||
if(!FindHrtfFormat(&device->FmtChans, &device->Frequency))
|
||||
{
|
||||
@@ -2005,7 +2006,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
||||
|
||||
if(device->Type != Loopback)
|
||||
{
|
||||
if(ConfigValueStr(NULL, "stereo-mode", &mode))
|
||||
if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "stereo-mode", &mode))
|
||||
{
|
||||
if(strcasecmp(mode, "headphones") == 0)
|
||||
headphones = true;
|
||||
@@ -2015,7 +2016,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
||||
ERR("Unexpected stereo-mode: %s\n", mode);
|
||||
}
|
||||
|
||||
if(ConfigValueStr(NULL, "hrtf-mode", &mode))
|
||||
if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "hrtf-mode", &mode))
|
||||
{
|
||||
if(strcasecmp(mode, "full") == 0)
|
||||
hrtf_mode = FullHrtf;
|
||||
@@ -2027,7 +2028,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
||||
}
|
||||
|
||||
|
||||
if(device->Type == Loopback || !ConfigValueBool(NULL, "hrtf", &usehrtf))
|
||||
if(device->Type == Loopback || !ConfigValueBool(al_string_get_cstr(device->DeviceName), NULL, "hrtf", &usehrtf))
|
||||
{
|
||||
usehrtf = (headphones && (device->Flags&DEVICE_HRTF_REQUEST_MASK) != Hrtf_Disable) ||
|
||||
((device->Flags&DEVICE_HRTF_REQUEST_MASK) == Hrtf_Enable);
|
||||
@@ -2067,7 +2068,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
||||
bs2blevel = ((headphones && (device->Flags&DEVICE_HRTF_REQUEST_MASK) != Hrtf_Disable) ||
|
||||
((device->Flags&DEVICE_HRTF_REQUEST_MASK) == Hrtf_Enable)) ? 5 : 0;
|
||||
if(device->Type != Loopback)
|
||||
ConfigValueInt(NULL, "cf_level", &bs2blevel);
|
||||
ConfigValueInt(al_string_get_cstr(device->DeviceName), NULL, "cf_level", &bs2blevel);
|
||||
if(bs2blevel > 0 && bs2blevel <= 6)
|
||||
{
|
||||
if(!device->Bs2b)
|
||||
@@ -3420,7 +3421,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
|
||||
}
|
||||
|
||||
|
||||
if(ConfigValueStr(NULL, "channels", &fmt))
|
||||
if(ConfigValueStr(deviceName, NULL, "channels", &fmt))
|
||||
{
|
||||
static const struct {
|
||||
const char name[16];
|
||||
@@ -3448,7 +3449,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
|
||||
if(i == COUNTOF(chanlist))
|
||||
ERR("Unsupported channels: %s\n", fmt);
|
||||
}
|
||||
if(ConfigValueStr(NULL, "sample-type", &fmt))
|
||||
if(ConfigValueStr(deviceName, NULL, "sample-type", &fmt))
|
||||
{
|
||||
static const struct {
|
||||
const char name[16];
|
||||
@@ -3477,7 +3478,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
|
||||
ERR("Unsupported sample-type: %s\n", fmt);
|
||||
}
|
||||
|
||||
if(ConfigValueUInt(NULL, "frequency", &device->Frequency))
|
||||
if(ConfigValueUInt(deviceName, NULL, "frequency", &device->Frequency))
|
||||
{
|
||||
device->Flags |= DEVICE_FREQUENCY_REQUEST;
|
||||
if(device->Frequency < MIN_OUTPUT_RATE)
|
||||
@@ -3485,21 +3486,21 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
|
||||
device->Frequency = maxu(device->Frequency, MIN_OUTPUT_RATE);
|
||||
}
|
||||
|
||||
ConfigValueUInt(NULL, "periods", &device->NumUpdates);
|
||||
ConfigValueUInt(deviceName, NULL, "periods", &device->NumUpdates);
|
||||
device->NumUpdates = clampu(device->NumUpdates, 2, 16);
|
||||
|
||||
ConfigValueUInt(NULL, "period_size", &device->UpdateSize);
|
||||
ConfigValueUInt(deviceName, NULL, "period_size", &device->UpdateSize);
|
||||
device->UpdateSize = clampu(device->UpdateSize, 64, 8192);
|
||||
if((CPUCapFlags&(CPU_CAP_SSE|CPU_CAP_NEON)) != 0)
|
||||
device->UpdateSize = (device->UpdateSize+3)&~3;
|
||||
|
||||
ConfigValueUInt(NULL, "sources", &device->MaxNoOfSources);
|
||||
ConfigValueUInt(deviceName, NULL, "sources", &device->MaxNoOfSources);
|
||||
if(device->MaxNoOfSources == 0) device->MaxNoOfSources = 256;
|
||||
|
||||
ConfigValueUInt(NULL, "slots", &device->AuxiliaryEffectSlotMax);
|
||||
ConfigValueUInt(deviceName, NULL, "slots", &device->AuxiliaryEffectSlotMax);
|
||||
if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 4;
|
||||
|
||||
ConfigValueUInt(NULL, "sends", &device->NumAuxSends);
|
||||
ConfigValueUInt(deviceName, NULL, "sends", &device->NumAuxSends);
|
||||
if(device->NumAuxSends > MAX_SENDS) device->NumAuxSends = MAX_SENDS;
|
||||
|
||||
device->NumStereoSources = 1;
|
||||
@@ -3867,13 +3868,13 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN
|
||||
device->FmtType = DevFmtTypeDefault;
|
||||
device->IsHeadphones = AL_FALSE;
|
||||
|
||||
ConfigValueUInt(NULL, "sources", &device->MaxNoOfSources);
|
||||
ConfigValueUInt(NULL, NULL, "sources", &device->MaxNoOfSources);
|
||||
if(device->MaxNoOfSources == 0) device->MaxNoOfSources = 256;
|
||||
|
||||
ConfigValueUInt(NULL, "slots", &device->AuxiliaryEffectSlotMax);
|
||||
ConfigValueUInt(NULL, NULL, "slots", &device->AuxiliaryEffectSlotMax);
|
||||
if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 4;
|
||||
|
||||
ConfigValueUInt(NULL, "sends", &device->NumAuxSends);
|
||||
ConfigValueUInt(NULL, NULL, "sends", &device->NumAuxSends);
|
||||
if(device->NumAuxSends > MAX_SENDS) device->NumAuxSends = MAX_SENDS;
|
||||
|
||||
device->NumStereoSources = 1;
|
||||
|
||||
+34
-20
@@ -444,7 +444,7 @@ void FreeALConfig(void)
|
||||
free(cfgBlock.entries);
|
||||
}
|
||||
|
||||
const char *GetConfigValue(const char *blockName, const char *keyName, const char *def)
|
||||
const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def)
|
||||
{
|
||||
unsigned int i;
|
||||
char key[256];
|
||||
@@ -453,11 +453,21 @@ const char *GetConfigValue(const char *blockName, const char *keyName, const cha
|
||||
return def;
|
||||
|
||||
if(blockName && strcasecmp(blockName, "general") != 0)
|
||||
snprintf(key, sizeof(key), "%s/%s", blockName, keyName);
|
||||
{
|
||||
if(devName)
|
||||
snprintf(key, sizeof(key), "%s/%s/%s", devName, blockName, keyName);
|
||||
else
|
||||
snprintf(key, sizeof(key), "%s/%s", blockName, keyName);
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(key, keyName, sizeof(key)-1);
|
||||
key[sizeof(key)-1] = 0;
|
||||
if(devName)
|
||||
snprintf(key, sizeof(key), "%s/%s", devName, keyName);
|
||||
else
|
||||
{
|
||||
strncpy(key, keyName, sizeof(key)-1);
|
||||
key[sizeof(key)-1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0;i < cfgBlock.entryCount;i++)
|
||||
@@ -471,46 +481,50 @@ const char *GetConfigValue(const char *blockName, const char *keyName, const cha
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("Key %s not found\n", key);
|
||||
return def;
|
||||
if(!devName)
|
||||
{
|
||||
TRACE("Key %s not found\n", key);
|
||||
return def;
|
||||
}
|
||||
return GetConfigValue(NULL, blockName, keyName, def);
|
||||
}
|
||||
|
||||
int ConfigValueExists(const char *blockName, const char *keyName)
|
||||
int ConfigValueExists(const char *devName, const char *blockName, const char *keyName)
|
||||
{
|
||||
const char *val = GetConfigValue(blockName, keyName, "");
|
||||
const char *val = GetConfigValue(devName, blockName, keyName, "");
|
||||
return !!val[0];
|
||||
}
|
||||
|
||||
int ConfigValueStr(const char *blockName, const char *keyName, const char **ret)
|
||||
int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret)
|
||||
{
|
||||
const char *val = GetConfigValue(blockName, keyName, "");
|
||||
const char *val = GetConfigValue(devName, blockName, keyName, "");
|
||||
if(!val[0]) return 0;
|
||||
|
||||
*ret = val;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ConfigValueInt(const char *blockName, const char *keyName, int *ret)
|
||||
int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret)
|
||||
{
|
||||
const char *val = GetConfigValue(blockName, keyName, "");
|
||||
const char *val = GetConfigValue(devName, blockName, keyName, "");
|
||||
if(!val[0]) return 0;
|
||||
|
||||
*ret = strtol(val, NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ConfigValueUInt(const char *blockName, const char *keyName, unsigned int *ret)
|
||||
int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret)
|
||||
{
|
||||
const char *val = GetConfigValue(blockName, keyName, "");
|
||||
const char *val = GetConfigValue(devName, blockName, keyName, "");
|
||||
if(!val[0]) return 0;
|
||||
|
||||
*ret = strtoul(val, NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ConfigValueFloat(const char *blockName, const char *keyName, float *ret)
|
||||
int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret)
|
||||
{
|
||||
const char *val = GetConfigValue(blockName, keyName, "");
|
||||
const char *val = GetConfigValue(devName, blockName, keyName, "");
|
||||
if(!val[0]) return 0;
|
||||
|
||||
#ifdef HAVE_STRTOF
|
||||
@@ -521,9 +535,9 @@ int ConfigValueFloat(const char *blockName, const char *keyName, float *ret)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ConfigValueBool(const char *blockName, const char *keyName, int *ret)
|
||||
int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret)
|
||||
{
|
||||
const char *val = GetConfigValue(blockName, keyName, "");
|
||||
const char *val = GetConfigValue(devName, blockName, keyName, "");
|
||||
if(!val[0]) return 0;
|
||||
|
||||
*ret = (strcasecmp(val, "true") == 0 || strcasecmp(val, "yes") == 0 ||
|
||||
@@ -531,9 +545,9 @@ int ConfigValueBool(const char *blockName, const char *keyName, int *ret)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetConfigValueBool(const char *blockName, const char *keyName, int def)
|
||||
int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def)
|
||||
{
|
||||
const char *val = GetConfigValue(blockName, keyName, "");
|
||||
const char *val = GetConfigValue(devName, blockName, keyName, "");
|
||||
|
||||
if(!val[0]) return !!def;
|
||||
return (strcasecmp(val, "true") == 0 || strcasecmp(val, "yes") == 0 ||
|
||||
|
||||
+7
-7
@@ -273,14 +273,14 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList)
|
||||
AL_STRING_INIT(entry.name);
|
||||
AL_STRING_INIT(entry.device_name);
|
||||
al_string_copy_cstr(&entry.name, alsaDevice);
|
||||
al_string_copy_cstr(&entry.device_name, GetConfigValue("alsa", (stream==SND_PCM_STREAM_PLAYBACK) ?
|
||||
al_string_copy_cstr(&entry.device_name, GetConfigValue(NULL, "alsa", (stream==SND_PCM_STREAM_PLAYBACK) ?
|
||||
"device" : "capture", "default"));
|
||||
VECTOR_PUSH_BACK(*DeviceList, entry);
|
||||
|
||||
card = -1;
|
||||
if((err=snd_card_next(&card)) < 0)
|
||||
ERR("Failed to find a card: %s\n", snd_strerror(err));
|
||||
ConfigValueStr("alsa", prefix_name(stream), &main_prefix);
|
||||
ConfigValueStr(NULL, "alsa", prefix_name(stream), &main_prefix);
|
||||
while(card >= 0)
|
||||
{
|
||||
const char *card_prefix = main_prefix;
|
||||
@@ -304,7 +304,7 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList)
|
||||
cardid = snd_ctl_card_info_get_id(info);
|
||||
|
||||
snprintf(name, sizeof(name), "%s-%s", prefix_name(stream), cardid);
|
||||
ConfigValueStr("alsa", name, &card_prefix);
|
||||
ConfigValueStr(NULL, "alsa", name, &card_prefix);
|
||||
|
||||
dev = -1;
|
||||
while(1)
|
||||
@@ -330,7 +330,7 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList)
|
||||
devname = snd_pcm_info_get_name(pcminfo);
|
||||
|
||||
snprintf(name, sizeof(name), "%s-%s-%d", prefix_name(stream), cardid, dev);
|
||||
ConfigValueStr("alsa", name, &device_prefix);
|
||||
ConfigValueStr(NULL, "alsa", name, &device_prefix);
|
||||
|
||||
snprintf(name, sizeof(name), "%s, %s (CARD=%s,DEV=%d)",
|
||||
cardname, devname, cardid, dev);
|
||||
@@ -640,7 +640,7 @@ static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name)
|
||||
else
|
||||
{
|
||||
name = alsaDevice;
|
||||
driver = GetConfigValue("alsa", "device", "default");
|
||||
driver = GetConfigValue(NULL, "alsa", "device", "default");
|
||||
}
|
||||
|
||||
TRACE("Opening device \"%s\"\n", driver);
|
||||
@@ -704,7 +704,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
|
||||
break;
|
||||
}
|
||||
|
||||
allowmmap = GetConfigValueBool("alsa", "mmap", 1);
|
||||
allowmmap = GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "mmap", 1);
|
||||
periods = device->NumUpdates;
|
||||
periodLen = (ALuint64)device->UpdateSize * 1000000 / device->Frequency;
|
||||
bufferLen = periodLen * periods;
|
||||
@@ -965,7 +965,7 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name)
|
||||
else
|
||||
{
|
||||
name = alsaDevice;
|
||||
driver = GetConfigValue("alsa", "capture", "default");
|
||||
driver = GetConfigValue(NULL, "alsa", "capture", "default");
|
||||
}
|
||||
|
||||
TRACE("Opening device \"%s\"\n", driver);
|
||||
|
||||
+3
-3
@@ -207,7 +207,7 @@ static int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg)
|
||||
TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates);
|
||||
|
||||
bufsize = device->UpdateSize;
|
||||
if(ConfigValueUInt("jack", "buffer-size", &bufsize))
|
||||
if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize))
|
||||
bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize);
|
||||
bufsize += device->UpdateSize;
|
||||
|
||||
@@ -397,7 +397,7 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self)
|
||||
device->NumUpdates = 2;
|
||||
|
||||
bufsize = device->UpdateSize;
|
||||
if(ConfigValueUInt("jack", "buffer-size", &bufsize))
|
||||
if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize))
|
||||
bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize);
|
||||
bufsize += device->UpdateSize;
|
||||
|
||||
@@ -543,7 +543,7 @@ static ALCboolean ALCjackBackendFactory_init(ALCjackBackendFactory* UNUSED(self)
|
||||
if(!jack_load())
|
||||
return ALC_FALSE;
|
||||
|
||||
if(!GetConfigValueBool("jack", "spawn-server", 0))
|
||||
if(!GetConfigValueBool(NULL, "jack", "spawn-server", 0))
|
||||
ClientOptions |= JackNoStartServer;
|
||||
client = jack_client_open("alsoft", ClientOptions, &status, NULL);
|
||||
if(client == NULL)
|
||||
|
||||
+2
-2
@@ -562,8 +562,8 @@ ALCbackendFactory *ALCossBackendFactory_getFactory(void)
|
||||
|
||||
ALCboolean ALCossBackendFactory_init(ALCossBackendFactory* UNUSED(self))
|
||||
{
|
||||
ConfigValueStr("oss", "device", &oss_driver);
|
||||
ConfigValueStr("oss", "capture", &oss_capture);
|
||||
ConfigValueStr(NULL, "oss", "device", &oss_driver);
|
||||
ConfigValueStr(NULL, "oss", "capture", &oss_capture);
|
||||
|
||||
return ALC_TRUE;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ static ALCenum pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
|
||||
data->update_size = device->UpdateSize;
|
||||
|
||||
data->params.device = -1;
|
||||
if(!ConfigValueInt("port", "device", &data->params.device) ||
|
||||
if(!ConfigValueInt(NULL, "port", "device", &data->params.device) ||
|
||||
data->params.device < 0)
|
||||
data->params.device = Pa_GetDefaultOutputDevice();
|
||||
data->params.suggestedLatency = (device->UpdateSize*device->NumUpdates) /
|
||||
@@ -319,7 +319,7 @@ static ALCenum pa_open_capture(ALCdevice *device, const ALCchar *deviceName)
|
||||
goto error;
|
||||
|
||||
data->params.device = -1;
|
||||
if(!ConfigValueInt("port", "capture", &data->params.device) ||
|
||||
if(!ConfigValueInt(NULL, "port", "capture", &data->params.device) ||
|
||||
data->params.device < 0)
|
||||
data->params.device = Pa_GetDefaultInputDevice();
|
||||
data->params.suggestedLatency = 0.0f;
|
||||
|
||||
@@ -860,7 +860,7 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name
|
||||
|
||||
flags = PA_STREAM_FIX_FORMAT | PA_STREAM_FIX_RATE |
|
||||
PA_STREAM_FIX_CHANNELS;
|
||||
if(!GetConfigValueBool("pulse", "allow-moves", 0))
|
||||
if(!GetConfigValueBool(NULL, "pulse", "allow-moves", 0))
|
||||
flags |= PA_STREAM_DONT_MOVE;
|
||||
|
||||
spec.format = PA_SAMPLE_S16NE;
|
||||
@@ -932,7 +932,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self)
|
||||
flags |= PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE;
|
||||
flags |= PA_STREAM_ADJUST_LATENCY;
|
||||
flags |= PA_STREAM_START_CORKED;
|
||||
if(!GetConfigValueBool("pulse", "allow-moves", 0))
|
||||
if(!GetConfigValueBool(NULL, "pulse", "allow-moves", 0))
|
||||
flags |= PA_STREAM_DONT_MOVE;
|
||||
|
||||
switch(device->FmtType)
|
||||
@@ -1453,7 +1453,7 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name)
|
||||
pa_frame_size(&self->spec);
|
||||
|
||||
flags |= PA_STREAM_START_CORKED|PA_STREAM_ADJUST_LATENCY;
|
||||
if(!GetConfigValueBool("pulse", "allow-moves", 0))
|
||||
if(!GetConfigValueBool(NULL, "pulse", "allow-moves", 0))
|
||||
flags |= PA_STREAM_DONT_MOVE;
|
||||
|
||||
TRACE("Connecting to \"%s\"\n", pulse_name ? pulse_name : "(default)");
|
||||
@@ -1641,7 +1641,7 @@ static ALCboolean ALCpulseBackendFactory_init(ALCpulseBackendFactory* UNUSED(sel
|
||||
pa_threaded_mainloop *loop;
|
||||
|
||||
pulse_ctx_flags = 0;
|
||||
if(!GetConfigValueBool("pulse", "spawn-server", 1))
|
||||
if(!GetConfigValueBool(NULL, "pulse", "spawn-server", 1))
|
||||
pulse_ctx_flags |= PA_CONTEXT_NOAUTOSPAWN;
|
||||
|
||||
if((loop=pa_threaded_mainloop_new()) &&
|
||||
|
||||
@@ -294,7 +294,7 @@ ALCbackendFactory *ALCsolarisBackendFactory_getFactory(void)
|
||||
|
||||
static ALCboolean ALCsolarisBackendFactory_init(ALCsolarisBackendFactory* UNUSED(self))
|
||||
{
|
||||
ConfigValueStr("solaris", "device", &solaris_driver);
|
||||
ConfigValueStr(NULL, "solaris", "device", &solaris_driver);
|
||||
return ALC_TRUE;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -210,7 +210,7 @@ static ALCenum ALCwaveBackend_open(ALCwaveBackend *self, const ALCchar *name)
|
||||
ALCdevice *device;
|
||||
const char *fname;
|
||||
|
||||
fname = GetConfigValue("wave", "file", "");
|
||||
fname = GetConfigValue(NULL, "wave", "file", "");
|
||||
if(!fname[0]) return ALC_INVALID_VALUE;
|
||||
|
||||
if(!name)
|
||||
@@ -248,7 +248,7 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self)
|
||||
fseek(self->mFile, 0, SEEK_SET);
|
||||
clearerr(self->mFile);
|
||||
|
||||
if(GetConfigValueBool("wave", "bformat", 0))
|
||||
if(GetConfigValueBool(NULL, "wave", "bformat", 0))
|
||||
device->FmtChans = DevFmtBFormat3D;
|
||||
|
||||
switch(device->FmtType)
|
||||
@@ -412,7 +412,7 @@ static ALCboolean ALCwaveBackendFactory_init(ALCwaveBackendFactory* UNUSED(self)
|
||||
static ALCboolean ALCwaveBackendFactory_querySupport(ALCwaveBackendFactory* UNUSED(self), ALCbackend_Type type)
|
||||
{
|
||||
if(type == ALCbackend_Playback)
|
||||
return !!ConfigValueExists("wave", "file");
|
||||
return !!ConfigValueExists(NULL, "wave", "file");
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -730,7 +730,7 @@ static struct Hrtf *LoadHrtf(ALuint deviceRate)
|
||||
{
|
||||
const char *fnamelist = "default-%r.mhr";
|
||||
|
||||
ConfigValueStr(NULL, "hrtf_tables", &fnamelist);
|
||||
ConfigValueStr(NULL, NULL, "hrtf_tables", &fnamelist);
|
||||
while(*fnamelist != '\0')
|
||||
{
|
||||
struct Hrtf *Hrtf = NULL;
|
||||
@@ -879,7 +879,7 @@ void FreeHrtfs(void)
|
||||
}
|
||||
}
|
||||
|
||||
ALuint GetHrtfIrSize (const struct Hrtf *Hrtf)
|
||||
ALuint GetHrtfIrSize(const struct Hrtf *Hrtf)
|
||||
{
|
||||
return Hrtf->irSize;
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ static ALboolean FSynth_init(FSynth *self, ALCdevice *device)
|
||||
{
|
||||
ALfloat vol;
|
||||
|
||||
if(ConfigValueFloat("midi", "volume", &vol))
|
||||
if(ConfigValueFloat(NULL, "midi", "volume", &vol))
|
||||
{
|
||||
if(!(vol <= 0.0f))
|
||||
{
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ MidiSynth *SSynth_create(ALCdevice *device)
|
||||
|
||||
/* This option is temporary. Once this synth is in a more usable state, a
|
||||
* more generic selector should be used. */
|
||||
if(!GetConfigValueBool("midi", "internal-synth", 0))
|
||||
if(!GetConfigValueBool(NULL, "midi", "internal-synth", 0))
|
||||
{
|
||||
TRACE("Not using internal MIDI synth\n");
|
||||
return NULL;
|
||||
|
||||
+2
-2
@@ -312,7 +312,7 @@ static bool LoadChannelSetup(ALCdevice *device)
|
||||
char eol;
|
||||
|
||||
snprintf(name, sizeof(name), "%s/type", layout);
|
||||
if(!ConfigValueStr("layouts", name, &type))
|
||||
if(!ConfigValueStr(al_string_get_cstr(device->DeviceName), "layouts", name, &type))
|
||||
return false;
|
||||
|
||||
if(sscanf(type, " %31[^: ] : %d%c", name, &order, &eol) != 2)
|
||||
@@ -360,7 +360,7 @@ static bool LoadChannelSetup(ALCdevice *device)
|
||||
channame = GetLabelFromChannel(channels[i]);
|
||||
|
||||
snprintf(chanlayout, sizeof(chanlayout), "%s/%s", layout, channame);
|
||||
if(!ConfigValueStr("layouts", chanlayout, &value))
|
||||
if(!ConfigValueStr(al_string_get_cstr(device->DeviceName), "layouts", chanlayout, &value))
|
||||
{
|
||||
ERR("Missing channel %s\n", channame);
|
||||
return false;
|
||||
|
||||
@@ -894,14 +894,14 @@ size_t ll_ringbuffer_write_space(const ll_ringbuffer_t *rb);
|
||||
|
||||
void ReadALConfig(void);
|
||||
void FreeALConfig(void);
|
||||
int ConfigValueExists(const char *blockName, const char *keyName);
|
||||
const char *GetConfigValue(const char *blockName, const char *keyName, const char *def);
|
||||
int GetConfigValueBool(const char *blockName, const char *keyName, int def);
|
||||
int ConfigValueStr(const char *blockName, const char *keyName, const char **ret);
|
||||
int ConfigValueInt(const char *blockName, const char *keyName, int *ret);
|
||||
int ConfigValueUInt(const char *blockName, const char *keyName, unsigned int *ret);
|
||||
int ConfigValueFloat(const char *blockName, const char *keyName, float *ret);
|
||||
int ConfigValueBool(const char *blockName, const char *keyName, int *ret);
|
||||
int ConfigValueExists(const char *devName, const char *blockName, const char *keyName);
|
||||
const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def);
|
||||
int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def);
|
||||
int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret);
|
||||
int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret);
|
||||
int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret);
|
||||
int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret);
|
||||
int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret);
|
||||
|
||||
void SetRTPriority(void);
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ ALsoundfont *ALsoundfont_getDefSoundfont(ALCcontext *context)
|
||||
|
||||
namelist = getenv("ALSOFT_SOUNDFONT");
|
||||
if(!namelist || !namelist[0])
|
||||
ConfigValueStr("midi", "soundfont", &namelist);
|
||||
ConfigValueStr(al_string_get_cstr(device->DeviceName), "midi", "soundfont", &namelist);
|
||||
while(namelist && namelist[0])
|
||||
{
|
||||
const char *next, *end;
|
||||
|
||||
Reference in New Issue
Block a user