aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c38
-rw-r--r--Alc/alcConfig.c38
-rw-r--r--Alc/alstring.h36
-rw-r--r--Alc/ambdec.c12
-rw-r--r--Alc/backends/alsa.c34
-rw-r--r--Alc/backends/coreaudio.c4
-rw-r--r--Alc/backends/dsound.c26
-rw-r--r--Alc/backends/jack.c12
-rw-r--r--Alc/backends/loopback.c2
-rw-r--r--Alc/backends/mmdevapi.c46
-rw-r--r--Alc/backends/null.c2
-rw-r--r--Alc/backends/opensl.c2
-rw-r--r--Alc/backends/oss.c4
-rw-r--r--Alc/backends/portaudio.c4
-rw-r--r--Alc/backends/pulseaudio.c80
-rw-r--r--Alc/backends/qsa.c4
-rw-r--r--Alc/backends/sndio.c2
-rw-r--r--Alc/backends/solaris.c2
-rw-r--r--Alc/backends/wave.c2
-rw-r--r--Alc/backends/winmm.c40
-rw-r--r--Alc/helpers.c152
-rw-r--r--Alc/hrtf.c108
-rw-r--r--Alc/panning.c48
23 files changed, 348 insertions, 350 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 12d0d608..f248a998 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1311,7 +1311,7 @@ static void ProbeDevices(al_string *list, struct BackendInfo *backendinfo, enum
DO_INITCONFIG();
LockLists();
- al_string_clear(list);
+ alstr_clear(list);
if(backendinfo->Probe)
backendinfo->Probe(type);
@@ -1331,7 +1331,7 @@ static void AppendDevice(const ALCchar *name, al_string *devnames)
{
size_t len = strlen(name);
if(len > 0)
- al_string_append_range(devnames, name, name+len+1);
+ alstr_append_range(devnames, name, name+len+1);
}
void AppendAllDevicesList(const ALCchar *name)
{ AppendDevice(name, &alcAllDevicesList); }
@@ -1985,7 +1985,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
}
#undef TRACE_ATTR
- ConfigValueUInt(al_string_get_cstr(device->DeviceName), NULL, "frequency", &freq);
+ ConfigValueUInt(alstr_get_cstr(device->DeviceName), NULL, "frequency", &freq);
freq = maxu(freq, MIN_OUTPUT_RATE);
device->UpdateSize = (ALuint64)device->UpdateSize * freq /
@@ -1998,7 +1998,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->NumMonoSources = numMono;
device->NumStereoSources = numStereo;
- if(ConfigValueInt(al_string_get_cstr(device->DeviceName), NULL, "sends", &new_sends))
+ if(ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "sends", &new_sends))
new_sends = mini(numSends, clampi(new_sends, 0, MAX_SENDS));
else
new_sends = numSends;
@@ -2037,7 +2037,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
if(device->Type != Loopback)
{
const char *hrtf;
- if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "hrtf", &hrtf))
+ if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "hrtf", &hrtf))
{
if(strcasecmp(hrtf, "true") == 0)
hrtf_userreq = Hrtf_Enable;
@@ -2869,26 +2869,26 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para
case ALC_ALL_DEVICES_SPECIFIER:
if(VerifyDevice(&Device))
{
- value = al_string_get_cstr(Device->DeviceName);
+ value = alstr_get_cstr(Device->DeviceName);
ALCdevice_DecRef(Device);
}
else
{
ProbeAllDevicesList();
- value = al_string_get_cstr(alcAllDevicesList);
+ value = alstr_get_cstr(alcAllDevicesList);
}
break;
case ALC_CAPTURE_DEVICE_SPECIFIER:
if(VerifyDevice(&Device))
{
- value = al_string_get_cstr(Device->DeviceName);
+ value = alstr_get_cstr(Device->DeviceName);
ALCdevice_DecRef(Device);
}
else
{
ProbeCaptureDeviceList();
- value = al_string_get_cstr(alcCaptureDeviceList);
+ value = alstr_get_cstr(alcCaptureDeviceList);
}
break;
@@ -2898,13 +2898,13 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para
break;
case ALC_DEFAULT_ALL_DEVICES_SPECIFIER:
- if(al_string_empty(alcAllDevicesList))
+ if(alstr_empty(alcAllDevicesList))
ProbeAllDevicesList();
VerifyDevice(&Device);
free(alcDefaultAllDevicesSpecifier);
- alcDefaultAllDevicesSpecifier = strdup(al_string_get_cstr(alcAllDevicesList));
+ alcDefaultAllDevicesSpecifier = strdup(alstr_get_cstr(alcAllDevicesList));
if(!alcDefaultAllDevicesSpecifier)
alcSetError(Device, ALC_OUT_OF_MEMORY);
@@ -2913,13 +2913,13 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para
break;
case ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER:
- if(al_string_empty(alcCaptureDeviceList))
+ if(alstr_empty(alcCaptureDeviceList))
ProbeCaptureDeviceList();
VerifyDevice(&Device);
free(alcCaptureDefaultDeviceSpecifier);
- alcCaptureDefaultDeviceSpecifier = strdup(al_string_get_cstr(alcCaptureDeviceList));
+ alcCaptureDefaultDeviceSpecifier = strdup(alstr_get_cstr(alcCaptureDeviceList));
if(!alcCaptureDefaultDeviceSpecifier)
alcSetError(Device, ALC_OUT_OF_MEMORY);
@@ -2943,7 +2943,7 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para
else
{
almtx_lock(&Device->BackendLock);
- value = (Device->HrtfHandle ? al_string_get_cstr(Device->HrtfName) : "");
+ value = (Device->HrtfHandle ? alstr_get_cstr(Device->HrtfName) : "");
almtx_unlock(&Device->BackendLock);
ALCdevice_DecRef(Device);
}
@@ -3578,7 +3578,7 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
ALCdevice_IncRef(ALContext->Device);
InitContext(ALContext);
- if(ConfigValueFloat(al_string_get_cstr(device->DeviceName), NULL, "volume-adjust", &valf))
+ if(ConfigValueFloat(alstr_get_cstr(device->DeviceName), NULL, "volume-adjust", &valf))
{
if(!isfinite(valf))
ERR("volume-adjust must be finite: %f\n", valf);
@@ -3937,7 +3937,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
}
almtx_init(&device->BackendLock, almtx_plain);
- if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "ambi-format", &fmt))
+ if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "ambi-format", &fmt))
{
if(strcasecmp(fmt, "fuma") == 0)
{
@@ -3985,7 +3985,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
} while(!ATOMIC_COMPARE_EXCHANGE_WEAK_SEQ(ALCdevice*, &DeviceList, &head, device));
}
- TRACE("Created device %p, \"%s\"\n", device, al_string_get_cstr(device->DeviceName));
+ TRACE("Created device %p, \"%s\"\n", device, alstr_get_cstr(device->DeviceName));
return device;
}
@@ -4155,7 +4155,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName,
} while(!ATOMIC_COMPARE_EXCHANGE_WEAK_SEQ(ALCdevice*, &DeviceList, &head, device));
}
- TRACE("Created device %p, \"%s\"\n", device, al_string_get_cstr(device->DeviceName));
+ TRACE("Created device %p, \"%s\"\n", device, alstr_get_cstr(device->DeviceName));
return device;
}
@@ -4519,7 +4519,7 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetStringiSOFT(ALCdevice *device, ALCenum
{
case ALC_HRTF_SPECIFIER_SOFT:
if(index >= 0 && (size_t)index < VECTOR_SIZE(device->HrtfList))
- str = al_string_get_cstr(VECTOR_ELEM(device->HrtfList, index).name);
+ str = alstr_get_cstr(VECTOR_ELEM(device->HrtfList, index).name);
else
alcSetError(device, ALC_INVALID_VALUE);
break;
diff --git a/Alc/alcConfig.c b/Alc/alcConfig.c
index 5224f0f5..6fd01746 100644
--- a/Alc/alcConfig.c
+++ b/Alc/alcConfig.c
@@ -373,25 +373,25 @@ void ReadALConfig(void)
if(SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, FALSE) != FALSE)
{
al_string filepath = AL_STRING_INIT_STATIC();
- al_string_copy_wcstr(&filepath, buffer);
- al_string_append_cstr(&filepath, "\\alsoft.ini");
+ alstr_copy_wcstr(&filepath, buffer);
+ alstr_append_cstr(&filepath, "\\alsoft.ini");
- TRACE("Loading config %s...\n", al_string_get_cstr(filepath));
- f = al_fopen(al_string_get_cstr(filepath), "rt");
+ TRACE("Loading config %s...\n", alstr_get_cstr(filepath));
+ f = al_fopen(alstr_get_cstr(filepath), "rt");
if(f)
{
LoadConfigFromFile(f);
fclose(f);
}
- al_string_deinit(&filepath);
+ alstr_reset(&filepath);
}
ppath = GetProcPath();
- if(!al_string_empty(ppath))
+ if(!alstr_empty(ppath))
{
- al_string_append_cstr(&ppath, "\\alsoft.ini");
- TRACE("Loading config %s...\n", al_string_get_cstr(ppath));
- f = al_fopen(al_string_get_cstr(ppath), "r");
+ alstr_append_cstr(&ppath, "\\alsoft.ini");
+ TRACE("Loading config %s...\n", alstr_get_cstr(ppath));
+ f = al_fopen(alstr_get_cstr(ppath), "r");
if(f)
{
LoadConfigFromFile(f);
@@ -402,19 +402,19 @@ void ReadALConfig(void)
if((str=_wgetenv(L"ALSOFT_CONF")) != NULL && *str)
{
al_string filepath = AL_STRING_INIT_STATIC();
- al_string_copy_wcstr(&filepath, str);
+ alstr_copy_wcstr(&filepath, str);
- TRACE("Loading config %s...\n", al_string_get_cstr(filepath));
- f = al_fopen(al_string_get_cstr(filepath), "rt");
+ TRACE("Loading config %s...\n", alstr_get_cstr(filepath));
+ f = al_fopen(alstr_get_cstr(filepath), "rt");
if(f)
{
LoadConfigFromFile(f);
fclose(f);
}
- al_string_deinit(&filepath);
+ alstr_reset(&filepath);
}
- al_string_deinit(&ppath);
+ alstr_reset(&ppath);
}
#else
void ReadALConfig(void)
@@ -502,11 +502,11 @@ void ReadALConfig(void)
}
ppath = GetProcPath();
- if(!al_string_empty(ppath))
+ if(!alstr_empty(ppath))
{
- al_string_append_cstr(&ppath, "/alsoft.conf");
- TRACE("Loading config %s...\n", al_string_get_cstr(ppath));
- f = al_fopen(al_string_get_cstr(ppath), "r");
+ alstr_append_cstr(&ppath, "/alsoft.conf");
+ TRACE("Loading config %s...\n", alstr_get_cstr(ppath));
+ f = al_fopen(alstr_get_cstr(ppath), "r");
if(f)
{
LoadConfigFromFile(f);
@@ -525,7 +525,7 @@ void ReadALConfig(void)
}
}
- al_string_deinit(&ppath);
+ alstr_reset(&ppath);
}
#endif
diff --git a/Alc/alstring.h b/Alc/alstring.h
index 6167f5ce..a7513516 100644
--- a/Alc/alstring.h
+++ b/Alc/alstring.h
@@ -10,40 +10,40 @@ typedef char al_string_char_type;
TYPEDEF_VECTOR(al_string_char_type, al_string)
TYPEDEF_VECTOR(al_string, vector_al_string)
-inline void al_string_deinit(al_string *str)
+inline void alstr_reset(al_string *str)
{ VECTOR_DEINIT(*str); }
#define AL_STRING_INIT(_x) do { (_x) = (al_string)NULL; } while(0)
#define AL_STRING_INIT_STATIC() ((al_string)NULL)
-#define AL_STRING_DEINIT(_x) al_string_deinit(&(_x))
+#define AL_STRING_DEINIT(_x) alstr_reset(&(_x))
-inline size_t al_string_length(const_al_string str)
+inline size_t alstr_length(const_al_string str)
{ return VECTOR_SIZE(str); }
-inline ALboolean al_string_empty(const_al_string str)
-{ return al_string_length(str) == 0; }
+inline ALboolean alstr_empty(const_al_string str)
+{ return alstr_length(str) == 0; }
-inline const al_string_char_type *al_string_get_cstr(const_al_string str)
+inline const al_string_char_type *alstr_get_cstr(const_al_string str)
{ return str ? &VECTOR_FRONT(str) : ""; }
-void al_string_clear(al_string *str);
+void alstr_clear(al_string *str);
-int al_string_cmp(const_al_string str1, const_al_string str2);
-int al_string_cmp_cstr(const_al_string str1, const al_string_char_type *str2);
+int alstr_cmp(const_al_string str1, const_al_string str2);
+int alstr_cmp_cstr(const_al_string str1, const al_string_char_type *str2);
-void al_string_copy(al_string *str, const_al_string from);
-void al_string_copy_cstr(al_string *str, const al_string_char_type *from);
-void al_string_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to);
+void alstr_copy(al_string *str, const_al_string from);
+void alstr_copy_cstr(al_string *str, const al_string_char_type *from);
+void alstr_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to);
-void al_string_append_char(al_string *str, const al_string_char_type c);
-void al_string_append_cstr(al_string *str, const al_string_char_type *from);
-void al_string_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to);
+void alstr_append_char(al_string *str, const al_string_char_type c);
+void alstr_append_cstr(al_string *str, const al_string_char_type *from);
+void alstr_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to);
#ifdef _WIN32
#include <wchar.h>
/* Windows-only methods to deal with WideChar strings. */
-void al_string_copy_wcstr(al_string *str, const wchar_t *from);
-void al_string_append_wcstr(al_string *str, const wchar_t *from);
-void al_string_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to);
+void alstr_copy_wcstr(al_string *str, const wchar_t *from);
+void alstr_append_wcstr(al_string *str, const wchar_t *from);
+void alstr_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to);
#endif
#endif /* ALSTRING_H */
diff --git a/Alc/ambdec.c b/Alc/ambdec.c
index 719b509c..da114335 100644
--- a/Alc/ambdec.c
+++ b/Alc/ambdec.c
@@ -164,7 +164,7 @@ static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t
const char *conn = my_strtok_r(NULL, " \t", saveptr);
if(!name) WARN("Name not specified for speaker %u\n", cur+1);
- else al_string_copy_cstr(&conf->Speakers[cur].Name, name);
+ else alstr_copy_cstr(&conf->Speakers[cur].Name, name);
if(!dist) WARN("Distance not specified for speaker %u\n", cur+1);
else read_float(&conf->Speakers[cur].Distance, dist);
if(!az) WARN("Azimuth not specified for speaker %u\n", cur+1);
@@ -172,7 +172,7 @@ static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t
if(!elev) WARN("Elevation not specified for speaker %u\n", cur+1);
else read_float(&conf->Speakers[cur].Elevation, elev);
if(!conn) TRACE("Connection not specified for speaker %u\n", cur+1);
- else al_string_copy_cstr(&conf->Speakers[cur].Connection, conn);
+ else alstr_copy_cstr(&conf->Speakers[cur].Connection, conn);
cur++;
}
@@ -293,11 +293,11 @@ void ambdec_deinit(AmbDecConf *conf)
{
ALsizei i;
- al_string_deinit(&conf->Description);
+ alstr_reset(&conf->Description);
for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
{
- al_string_deinit(&conf->Speakers[i].Name);
- al_string_deinit(&conf->Speakers[i].Connection);
+ alstr_reset(&conf->Speakers[i].Name);
+ alstr_reset(&conf->Speakers[i].Connection);
}
memset(conf, 0, sizeof(*conf));
}
@@ -331,7 +331,7 @@ int ambdec_load(AmbDecConf *conf, const char *fname)
if(strcmp(command, "description") == 0)
{
char *value = my_strtok_r(NULL, "", &saveptr);
- al_string_copy_cstr(&conf->Description, lstrip(value));
+ alstr_copy_cstr(&conf->Description, lstrip(value));
}
else if(strcmp(command, "version") == 0)
{
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c
index 2fa806ae..4a7b81ba 100644
--- a/Alc/backends/alsa.c
+++ b/Alc/backends/alsa.c
@@ -213,7 +213,7 @@ static ALCboolean alsa_load(void)
p##f = GetSymbol(alsa_handle, #f); \
if(p##f == NULL) { \
error = ALC_TRUE; \
- al_string_append_cstr(&missing_funcs, "\n" #f); \
+ alstr_append_cstr(&missing_funcs, "\n" #f); \
} \
} while(0)
ALSA_FUNCS(LOAD_FUNC);
@@ -221,11 +221,11 @@ static ALCboolean alsa_load(void)
if(error)
{
- WARN("Missing expected functions:%s\n", al_string_get_cstr(missing_funcs));
+ WARN("Missing expected functions:%s\n", alstr_get_cstr(missing_funcs));
CloseLib(alsa_handle);
alsa_handle = NULL;
}
- al_string_deinit(&missing_funcs);
+ alstr_reset(&missing_funcs);
}
#endif
@@ -276,8 +276,8 @@ 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(NULL, "alsa", (stream==SND_PCM_STREAM_PLAYBACK) ?
+ alstr_copy_cstr(&entry.name, alsaDevice);
+ alstr_copy_cstr(&entry.device_name, GetConfigValue(NULL, "alsa", (stream==SND_PCM_STREAM_PLAYBACK) ?
"device" : "capture", "default"));
VECTOR_PUSH_BACK(*DeviceList, entry);
@@ -344,8 +344,8 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList)
TRACE("Got device \"%s\", \"%s\"\n", name, device);
AL_STRING_INIT(entry.name);
AL_STRING_INIT(entry.device_name);
- al_string_copy_cstr(&entry.name, name);
- al_string_copy_cstr(&entry.device_name, device);
+ alstr_copy_cstr(&entry.name, name);
+ alstr_copy_cstr(&entry.device_name, device);
VECTOR_PUSH_BACK(*DeviceList, entry);
}
snd_ctl_close(handle);
@@ -636,12 +636,12 @@ static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name)
if(VECTOR_SIZE(PlaybackDevices) == 0)
probe_devices(SND_PCM_STREAM_PLAYBACK, &PlaybackDevices);
-#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, name) == 0)
+#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, name) == 0)
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME);
#undef MATCH_NAME
if(iter == VECTOR_END(PlaybackDevices))
return ALC_INVALID_VALUE;
- driver = al_string_get_cstr(iter->device_name);
+ driver = alstr_get_cstr(iter->device_name);
}
else
{
@@ -660,7 +660,7 @@ static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name)
/* Free alsa's global config tree. Otherwise valgrind reports a ton of leaks. */
snd_config_update_free_global();
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
@@ -711,7 +711,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
break;
}
- allowmmap = GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "mmap", 1);
+ allowmmap = GetConfigValueBool(alstr_get_cstr(device->DeviceName), "alsa", "mmap", 1);
periods = device->NumUpdates;
periodLen = (ALuint64)device->UpdateSize * 1000000 / device->Frequency;
bufferLen = periodLen * periods;
@@ -777,7 +777,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
}
CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans)));
/* set rate (implicitly constrains period/buffer parameters) */
- if(!GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "allow-resampler", 0) ||
+ if(!GetConfigValueBool(alstr_get_cstr(device->DeviceName), "alsa", "allow-resampler", 0) ||
!(device->Flags&DEVICE_FREQUENCY_REQUEST))
{
if(snd_pcm_hw_params_set_rate_resample(self->pcmHandle, hp, 0) < 0)
@@ -977,12 +977,12 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name)
if(VECTOR_SIZE(CaptureDevices) == 0)
probe_devices(SND_PCM_STREAM_CAPTURE, &CaptureDevices);
-#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, name) == 0)
+#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, name) == 0)
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME);
#undef MATCH_NAME
if(iter == VECTOR_END(CaptureDevices))
return ALC_INVALID_VALUE;
- driver = al_string_get_cstr(iter->device_name);
+ driver = alstr_get_cstr(iter->device_name);
}
else
{
@@ -1072,7 +1072,7 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name)
}
}
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
@@ -1314,9 +1314,9 @@ static ClockLatency ALCcaptureAlsa_getClockLatency(ALCcaptureAlsa *self)
static inline void AppendAllDevicesList2(const DevMap *entry)
-{ AppendAllDevicesList(al_string_get_cstr(entry->name)); }
+{ AppendAllDevicesList(alstr_get_cstr(entry->name)); }
static inline void AppendCaptureDeviceList2(const DevMap *entry)
-{ AppendCaptureDeviceList(al_string_get_cstr(entry->name)); }
+{ AppendCaptureDeviceList(alstr_get_cstr(entry->name)); }
typedef struct ALCalsaBackendFactory {
DERIVE_FROM_TYPE(ALCbackendFactory);
diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c
index eb93f9ea..5e0b03bd 100644
--- a/Alc/backends/coreaudio.c
+++ b/Alc/backends/coreaudio.c
@@ -183,7 +183,7 @@ static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
return ALC_INVALID_VALUE;
}
- al_string_copy_cstr(&device->DeviceName, deviceName);
+ alstr_copy_cstr(&device->DeviceName, deviceName);
device->ExtraData = data;
return ALC_NO_ERROR;
}
@@ -596,7 +596,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
);
if(!data->ring) goto error;
- al_string_copy_cstr(&device->DeviceName, deviceName);
+ alstr_copy_cstr(&device->DeviceName, deviceName);
return ALC_NO_ERROR;
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index 084d1125..3dc297ff 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -145,16 +145,16 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA
{
const DevMap *iter;
- al_string_copy_cstr(&entry.name, DEVNAME_HEAD);
- al_string_append_wcstr(&entry.name, desc);
+ alstr_copy_cstr(&entry.name, DEVNAME_HEAD);
+ alstr_append_wcstr(&entry.name, desc);
if(count != 0)
{
char str[64];
snprintf(str, sizeof(str), " #%d", count+1);
- al_string_append_cstr(&entry.name, str);
+ alstr_append_cstr(&entry.name, str);
}
-#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0)
+#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0)
VECTOR_FIND_IF(iter, const DevMap, *devices, MATCH_ENTRY);
if(iter == VECTOR_END(*devices)) break;
#undef MATCH_ENTRY
@@ -165,7 +165,7 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA
hr = StringFromCLSID(guid, &guidstr);
if(SUCCEEDED(hr))
{
- TRACE("Got device \"%s\", GUID \"%ls\"\n", al_string_get_cstr(entry.name), guidstr);
+ TRACE("Got device \"%s\", GUID \"%ls\"\n", alstr_get_cstr(entry.name), guidstr);
CoTaskMemFree(guidstr);
}
@@ -343,14 +343,14 @@ static ALCenum ALCdsoundPlayback_open(ALCdsoundPlayback *self, const ALCchar *de
if(!deviceName && VECTOR_SIZE(PlaybackDevices) > 0)
{
- deviceName = al_string_get_cstr(VECTOR_FRONT(PlaybackDevices).name);
+ deviceName = alstr_get_cstr(VECTOR_FRONT(PlaybackDevices).name);
guid = &VECTOR_FRONT(PlaybackDevices).guid;
}
else
{
const DevMap *iter;
-#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0)
+#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0)
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME);
#undef MATCH_NAME
if(iter == VECTOR_END(PlaybackDevices))
@@ -381,7 +381,7 @@ static ALCenum ALCdsoundPlayback_open(ALCdsoundPlayback *self, const ALCchar *de
return ALC_INVALID_VALUE;
}
- al_string_copy_cstr(&device->DeviceName, deviceName);
+ alstr_copy_cstr(&device->DeviceName, deviceName);
return ALC_NO_ERROR;
}
@@ -706,14 +706,14 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi
if(!deviceName && VECTOR_SIZE(CaptureDevices) > 0)
{
- deviceName = al_string_get_cstr(VECTOR_FRONT(CaptureDevices).name);
+ deviceName = alstr_get_cstr(VECTOR_FRONT(CaptureDevices).name);
guid = &VECTOR_FRONT(CaptureDevices).guid;
}
else
{
const DevMap *iter;
-#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0)
+#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0)
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME);
#undef MATCH_NAME
if(iter == VECTOR_END(CaptureDevices))
@@ -855,7 +855,7 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi
self->BufferBytes = DSCBDescription.dwBufferBytes;
SetDefaultWFXChannelOrder(device);
- al_string_copy_cstr(&device->DeviceName, deviceName);
+ alstr_copy_cstr(&device->DeviceName, deviceName);
return ALC_NO_ERROR;
}
@@ -958,9 +958,9 @@ done:
static inline void AppendAllDevicesList2(const DevMap *entry)
-{ AppendAllDevicesList(al_string_get_cstr(entry->name)); }
+{ AppendAllDevicesList(alstr_get_cstr(entry->name)); }
static inline void AppendCaptureDeviceList2(const DevMap *entry)
-{ AppendCaptureDeviceList(al_string_get_cstr(entry->name)); }
+{ AppendCaptureDeviceList(alstr_get_cstr(entry->name)); }
typedef struct ALCdsoundBackendFactory {
DERIVE_FROM_TYPE(ALCbackendFactory);
diff --git a/Alc/backends/jack.c b/Alc/backends/jack.c
index f1cd82bd..cce828e9 100644
--- a/Alc/backends/jack.c
+++ b/Alc/backends/jack.c
@@ -115,7 +115,7 @@ static ALCboolean jack_load(void)
p##f = GetSymbol(jack_handle, #f); \
if(p##f == NULL) { \
error = ALC_TRUE; \
- al_string_append_cstr(&missing_funcs, "\n" #f); \
+ alstr_append_cstr(&missing_funcs, "\n" #f); \
} \
} while(0)
JACK_FUNCS(LOAD_FUNC);
@@ -123,11 +123,11 @@ static ALCboolean jack_load(void)
if(error)
{
- WARN("Missing expected functions:%s\n", al_string_get_cstr(missing_funcs));
+ WARN("Missing expected functions:%s\n", alstr_get_cstr(missing_funcs));
CloseLib(jack_handle);
jack_handle = NULL;
}
- al_string_deinit(&missing_funcs);
+ alstr_reset(&missing_funcs);
}
#endif
@@ -220,7 +220,7 @@ static int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg)
device->NumUpdates = 2;
bufsize = device->UpdateSize;
- if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize))
+ if(ConfigValueUInt(alstr_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize))
bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize);
bufsize += device->UpdateSize;
device->NumUpdates = bufsize / device->UpdateSize;
@@ -373,7 +373,7 @@ static ALCenum ALCjackPlayback_open(ALCjackPlayback *self, const ALCchar *name)
jack_set_process_callback(self->Client, ALCjackPlayback_process, self);
jack_set_buffer_size_callback(self->Client, ALCjackPlayback_bufferSizeNotify, self);
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
@@ -415,7 +415,7 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self)
device->NumUpdates = 2;
bufsize = device->UpdateSize;
- if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize))
+ if(ConfigValueUInt(alstr_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize))
bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize);
bufsize += device->UpdateSize;
device->NumUpdates = bufsize / device->UpdateSize;
diff --git a/Alc/backends/loopback.c b/Alc/backends/loopback.c
index 0164bc5a..8f23aad9 100644
--- a/Alc/backends/loopback.c
+++ b/Alc/backends/loopback.c
@@ -59,7 +59,7 @@ static ALCenum ALCloopback_open(ALCloopback *self, const ALCchar *name)
{
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index 6ff9d931..339ea8d3 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -130,14 +130,14 @@ static void get_device_name_and_guid(IMMDevice *device, al_string *name, al_stri
PROPVARIANT pvguid;
HRESULT hr;
- al_string_copy_cstr(name, DEVNAME_HEAD);
+ alstr_copy_cstr(name, DEVNAME_HEAD);
hr = IMMDevice_OpenPropertyStore(device, STGM_READ, &ps);
if(FAILED(hr))
{
WARN("OpenPropertyStore failed: 0x%08lx\n", hr);
- al_string_append_cstr(name, "Unknown Device Name");
- if(guid!=NULL)al_string_copy_cstr(guid, "Unknown Device GUID");
+ alstr_append_cstr(name, "Unknown Device Name");
+ if(guid!=NULL)alstr_copy_cstr(guid, "Unknown Device GUID");
return;
}
@@ -147,14 +147,14 @@ static void get_device_name_and_guid(IMMDevice *device, al_string *name, al_stri
if(FAILED(hr))
{
WARN("GetValue Device_FriendlyName failed: 0x%08lx\n", hr);
- al_string_append_cstr(name, "Unknown Device Name");
+ alstr_append_cstr(name, "Unknown Device Name");
}
else if(pvname.vt == VT_LPWSTR)
- al_string_append_wcstr(name, pvname.pwszVal);
+ alstr_append_wcstr(name, pvname.pwszVal);
else
{
WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvname.vt);
- al_string_append_cstr(name, "Unknown Device Name");
+ alstr_append_cstr(name, "Unknown Device Name");
}
PropVariantClear(&pvname);
@@ -165,14 +165,14 @@ static void get_device_name_and_guid(IMMDevice *device, al_string *name, al_stri
if(FAILED(hr))
{
WARN("GetValue AudioEndpoint_GUID failed: 0x%08lx\n", hr);
- al_string_copy_cstr(guid, "Unknown Device GUID");
+ alstr_copy_cstr(guid, "Unknown Device GUID");
}
else if(pvguid.vt == VT_LPWSTR)
- al_string_copy_wcstr(guid, pvguid.pwszVal);
+ alstr_copy_wcstr(guid, pvguid.pwszVal);
else
{
WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvguid.vt);
- al_string_copy_cstr(guid, "Unknown Device GUID");
+ alstr_copy_cstr(guid, "Unknown Device GUID");
}
PropVariantClear(&pvguid);
@@ -228,22 +228,22 @@ static void add_device(IMMDevice *device, const WCHAR *devid, vector_DevMap *lis
{
const DevMap *iter;
- al_string_copy(&entry.name, tmpname);
+ alstr_copy(&entry.name, tmpname);
if(count != 0)
{
char str[64];
snprintf(str, sizeof(str), " #%d", count+1);
- al_string_append_cstr(&entry.name, str);
+ alstr_append_cstr(&entry.name, str);
}
-#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0)
+#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0)
VECTOR_FIND_IF(iter, const DevMap, *list, MATCH_ENTRY);
if(iter == VECTOR_END(*list)) break;
#undef MATCH_ENTRY
count++;
}
- TRACE("Got device \"%s\", \"%s\", \"%ls\"\n", al_string_get_cstr(entry.name), al_string_get_cstr(entry.endpoint_guid), entry.devid);
+ TRACE("Got device \"%s\", \"%s\", \"%ls\"\n", alstr_get_cstr(entry.name), alstr_get_cstr(entry.endpoint_guid), entry.devid);
VECTOR_PUSH_BACK(*list, entry);
AL_STRING_DEINIT(tmpname);
@@ -716,8 +716,8 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi
}
hr = E_FAIL;
-#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0 || \
- al_string_cmp_cstr((i)->endpoint_guid, deviceName) == 0)
+#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0 || \
+ alstr_cmp_cstr((i)->endpoint_guid, deviceName) == 0)
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME);
#undef MATCH_NAME
if(iter == VECTOR_END(PlaybackDevices))
@@ -739,7 +739,7 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi
{
ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice;
self->devid = strdupW(iter->devid);
- al_string_copy(&device->DeviceName, iter->name);
+ alstr_copy(&device->DeviceName, iter->name);
hr = S_OK;
}
}
@@ -797,7 +797,7 @@ static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self)
if(SUCCEEDED(hr))
{
self->client = ptr;
- if(al_string_empty(device->DeviceName))
+ if(alstr_empty(device->DeviceName))
get_device_name_and_guid(self->mmdev, &device->DeviceName, NULL);
}
@@ -1377,8 +1377,8 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device
}
hr = E_FAIL;
-#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0 || \
- al_string_cmp_cstr((i)->endpoint_guid, deviceName) == 0)
+#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0 || \
+ alstr_cmp_cstr((i)->endpoint_guid, deviceName) == 0)
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME);
#undef MATCH_NAME
if(iter == VECTOR_END(CaptureDevices))
@@ -1400,7 +1400,7 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device
{
ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice;
self->devid = strdupW(iter->devid);
- al_string_copy(&device->DeviceName, iter->name);
+ alstr_copy(&device->DeviceName, iter->name);
hr = S_OK;
}
}
@@ -1476,7 +1476,7 @@ static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self)
if(SUCCEEDED(hr))
{
self->client = ptr;
- if(al_string_empty(device->DeviceName))
+ if(alstr_empty(device->DeviceName))
get_device_name_and_guid(self->mmdev, &device->DeviceName, NULL);
}
@@ -1777,9 +1777,9 @@ ALCenum ALCmmdevCapture_captureSamples(ALCmmdevCapture *self, ALCvoid *buffer, A
static inline void AppendAllDevicesList2(const DevMap *entry)
-{ AppendAllDevicesList(al_string_get_cstr(entry->name)); }
+{ AppendAllDevicesList(alstr_get_cstr(entry->name)); }
static inline void AppendCaptureDeviceList2(const DevMap *entry)
-{ AppendCaptureDeviceList(al_string_get_cstr(entry->name)); }
+{ AppendCaptureDeviceList(alstr_get_cstr(entry->name)); }
typedef struct ALCmmdevBackendFactory {
DERIVE_FROM_TYPE(ALCbackendFactory);
diff --git a/Alc/backends/null.c b/Alc/backends/null.c
index 41636538..e8c43782 100644
--- a/Alc/backends/null.c
+++ b/Alc/backends/null.c
@@ -130,7 +130,7 @@ static ALCenum ALCnullBackend_open(ALCnullBackend *self, const ALCchar *name)
return ALC_INVALID_VALUE;
device = STATIC_CAST(ALCbackend, self)->mDevice;
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c
index b8d6d29a..41f55120 100644
--- a/Alc/backends/opensl.c
+++ b/Alc/backends/opensl.c
@@ -399,7 +399,7 @@ static ALCenum ALCopenslPlayback_open(ALCopenslPlayback *self, const ALCchar *na
return ALC_INVALID_VALUE;
}
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c
index b22e87ba..6706405d 100644
--- a/Alc/backends/oss.c
+++ b/Alc/backends/oss.c
@@ -374,7 +374,7 @@ static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name)
return ALC_INVALID_VALUE;
}
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
@@ -717,7 +717,7 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name)
return ALC_OUT_OF_MEMORY;
}
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
diff --git a/Alc/backends/portaudio.c b/Alc/backends/portaudio.c
index 129b0606..b713f330 100644
--- a/Alc/backends/portaudio.c
+++ b/Alc/backends/portaudio.c
@@ -245,7 +245,7 @@ retry_open:
return ALC_INVALID_VALUE;
}
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
@@ -445,7 +445,7 @@ static ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name)
return ALC_INVALID_VALUE;
}
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c
index 14b37ee6..79ca38e5 100644
--- a/Alc/backends/pulseaudio.c
+++ b/Alc/backends/pulseaudio.c
@@ -202,7 +202,7 @@ static ALCboolean pulse_load(void)
p##x = GetSymbol(pa_handle, #x); \
if(!(p##x)) { \
ret = ALC_FALSE; \
- al_string_append_cstr(&missing_funcs, "\n" #x); \
+ alstr_append_cstr(&missing_funcs, "\n" #x); \
} \
} while(0)
LOAD_FUNC(pa_context_unref);
@@ -276,11 +276,11 @@ static ALCboolean pulse_load(void)
if(ret == ALC_FALSE)
{
- WARN("Missing expected functions:%s\n", al_string_get_cstr(missing_funcs));
+ WARN("Missing expected functions:%s\n", alstr_get_cstr(missing_funcs));
CloseLib(pa_handle);
pa_handle = NULL;
}
- al_string_deinit(&missing_funcs);
+ alstr_reset(&missing_funcs);
}
#endif /* HAVE_DYNLOAD */
return ret;
@@ -533,7 +533,7 @@ static void ALCpulsePlayback_deviceCallback(pa_context *UNUSED(context), const p
return;
}
-#define MATCH_INFO_NAME(iter) (al_string_cmp_cstr((iter)->device_name, info->name) == 0)
+#define MATCH_INFO_NAME(iter) (alstr_cmp_cstr((iter)->device_name, info->name) == 0)
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_INFO_NAME);
if(iter != VECTOR_END(PlaybackDevices)) return;
#undef MATCH_INFO_NAME
@@ -541,27 +541,27 @@ static void ALCpulsePlayback_deviceCallback(pa_context *UNUSED(context), const p
AL_STRING_INIT(entry.name);
AL_STRING_INIT(entry.device_name);
- al_string_copy_cstr(&entry.device_name, info->name);
+ alstr_copy_cstr(&entry.device_name, info->name);
count = 0;
while(1)
{
- al_string_copy_cstr(&entry.name, info->description);
+ alstr_copy_cstr(&entry.name, info->description);
if(count != 0)
{
char str[64];
snprintf(str, sizeof(str), " #%d", count+1);
- al_string_append_cstr(&entry.name, str);
+ alstr_append_cstr(&entry.name, str);
}
-#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0)
+#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0)
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_ENTRY);
if(iter == VECTOR_END(PlaybackDevices)) break;
#undef MATCH_ENTRY
count++;
}
- TRACE("Got device \"%s\", \"%s\"\n", al_string_get_cstr(entry.name), al_string_get_cstr(entry.device_name));
+ TRACE("Got device \"%s\", \"%s\"\n", alstr_get_cstr(entry.name), alstr_get_cstr(entry.device_name));
VECTOR_PUSH_BACK(PlaybackDevices, entry);
}
@@ -737,7 +737,7 @@ static void ALCpulsePlayback_sinkNameCallback(pa_context *UNUSED(context), const
return;
}
- al_string_copy_cstr(&device->DeviceName, info->description);
+ alstr_copy_cstr(&device->DeviceName, info->description);
}
@@ -745,9 +745,9 @@ static void ALCpulsePlayback_streamMovedCallback(pa_stream *stream, void *pdata)
{
ALCpulsePlayback *self = pdata;
- al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(stream));
+ alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(stream));
- TRACE("Stream moved to %s\n", al_string_get_cstr(self->device_name));
+ TRACE("Stream moved to %s\n", alstr_get_cstr(self->device_name));
}
@@ -866,12 +866,12 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name
if(VECTOR_SIZE(PlaybackDevices) == 0)
ALCpulsePlayback_probeDevices();
-#define MATCH_NAME(iter) (al_string_cmp_cstr((iter)->name, name) == 0)
+#define MATCH_NAME(iter) (alstr_cmp_cstr((iter)->name, name) == 0)
VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME);
#undef MATCH_NAME
if(iter == VECTOR_END(PlaybackDevices))
return ALC_INVALID_VALUE;
- pulse_name = al_string_get_cstr(iter->device_name);
+ pulse_name = alstr_get_cstr(iter->device_name);
dev_name = iter->name;
}
@@ -902,11 +902,11 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name
}
pa_stream_set_moved_callback(self->stream, ALCpulsePlayback_streamMovedCallback, self);
- al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream));
- if(al_string_empty(dev_name))
+ alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream));
+ if(alstr_empty(dev_name))
{
pa_operation *o = pa_context_get_sink_info_by_name(
- self->context, al_string_get_cstr(self->device_name),
+ self->context, alstr_get_cstr(self->device_name),
ALCpulsePlayback_sinkNameCallback, self
);
wait_for_operation(o, self->loop);
@@ -914,7 +914,7 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name
else
{
ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice;
- al_string_copy(&device->DeviceName, dev_name);
+ alstr_copy(&device->DeviceName, dev_name);
}
pa_threaded_mainloop_unlock(self->loop);
@@ -929,7 +929,7 @@ static void ALCpulsePlayback_close(ALCpulsePlayback *self)
self->context = NULL;
self->stream = NULL;
- al_string_clear(&self->device_name);
+ alstr_clear(&self->device_name);
}
static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self)
@@ -954,11 +954,11 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self)
self->stream = NULL;
}
- o = pa_context_get_sink_info_by_name(self->context, al_string_get_cstr(self->device_name),
+ o = pa_context_get_sink_info_by_name(self->context, alstr_get_cstr(self->device_name),
ALCpulsePlayback_sinkInfoCallback, self);
wait_for_operation(o, self->loop);
- if(GetConfigValueBool(al_string_get_cstr(device->DeviceName), "pulse", "fix-rate", 0) ||
+ if(GetConfigValueBool(alstr_get_cstr(device->DeviceName), "pulse", "fix-rate", 0) ||
!(device->Flags&DEVICE_FREQUENCY_REQUEST))
flags |= PA_STREAM_FIX_RATE;
flags |= PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE;
@@ -1044,7 +1044,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self)
self->attr.tlength = self->attr.minreq * maxu(device->NumUpdates, 2);
self->attr.maxlength = -1;
- self->stream = ALCpulsePlayback_connectStream(al_string_get_cstr(self->device_name),
+ self->stream = ALCpulsePlayback_connectStream(alstr_get_cstr(self->device_name),
self->loop, self->context, flags,
&self->attr, &self->spec, &chanmap);
if(!self->stream)
@@ -1261,7 +1261,7 @@ static void ALCpulseCapture_deviceCallback(pa_context *UNUSED(context), const pa
return;
}
-#define MATCH_INFO_NAME(iter) (al_string_cmp_cstr((iter)->device_name, info->name) == 0)
+#define MATCH_INFO_NAME(iter) (alstr_cmp_cstr((iter)->device_name, info->name) == 0)
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_INFO_NAME);
if(iter != VECTOR_END(CaptureDevices)) return;
#undef MATCH_INFO_NAME
@@ -1269,27 +1269,27 @@ static void ALCpulseCapture_deviceCallback(pa_context *UNUSED(context), const pa
AL_STRING_INIT(entry.name);
AL_STRING_INIT(entry.device_name);
- al_string_copy_cstr(&entry.device_name, info->name);
+ alstr_copy_cstr(&entry.device_name, info->name);
count = 0;
while(1)
{
- al_string_copy_cstr(&entry.name, info->description);
+ alstr_copy_cstr(&entry.name, info->description);
if(count != 0)
{
char str[64];
snprintf(str, sizeof(str), " #%d", count+1);
- al_string_append_cstr(&entry.name, str);
+ alstr_append_cstr(&entry.name, str);
}
-#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0)
+#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0)
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_ENTRY);
if(iter == VECTOR_END(CaptureDevices)) break;
#undef MATCH_ENTRY
count++;
}
- TRACE("Got device \"%s\", \"%s\"\n", al_string_get_cstr(entry.name), al_string_get_cstr(entry.device_name));
+ TRACE("Got device \"%s\", \"%s\"\n", alstr_get_cstr(entry.name), alstr_get_cstr(entry.device_name));
VECTOR_PUSH_BACK(CaptureDevices, entry);
}
@@ -1382,7 +1382,7 @@ static void ALCpulseCapture_sourceNameCallback(pa_context *UNUSED(context), cons
return;
}
- al_string_copy_cstr(&device->DeviceName, info->description);
+ alstr_copy_cstr(&device->DeviceName, info->description);
}
@@ -1390,9 +1390,9 @@ static void ALCpulseCapture_streamMovedCallback(pa_stream *stream, void *pdata)
{
ALCpulseCapture *self = pdata;
- al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(stream));
+ alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(stream));
- TRACE("Stream moved to %s\n", al_string_get_cstr(self->device_name));
+ TRACE("Stream moved to %s\n", alstr_get_cstr(self->device_name));
}
@@ -1452,13 +1452,13 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name)
if(VECTOR_SIZE(CaptureDevices) == 0)
ALCpulseCapture_probeDevices();
-#define MATCH_NAME(iter) (al_string_cmp_cstr((iter)->name, name) == 0)
+#define MATCH_NAME(iter) (alstr_cmp_cstr((iter)->name, name) == 0)
VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME);
#undef MATCH_NAME
if(iter == VECTOR_END(CaptureDevices))
return ALC_INVALID_VALUE;
- pulse_name = al_string_get_cstr(iter->device_name);
- al_string_copy(&device->DeviceName, iter->name);
+ pulse_name = alstr_get_cstr(iter->device_name);
+ alstr_copy(&device->DeviceName, iter->name);
}
if(!pulse_open(&self->loop, &self->context, ALCpulseCapture_contextStateCallback, self))
@@ -1531,11 +1531,11 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name)
pa_stream_set_moved_callback(self->stream, ALCpulseCapture_streamMovedCallback, self);
pa_stream_set_state_callback(self->stream, ALCpulseCapture_streamStateCallback, self);
- al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream));
- if(al_string_empty(device->DeviceName))
+ alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream));
+ if(alstr_empty(device->DeviceName))
{
pa_operation *o = pa_context_get_source_info_by_name(
- self->context, al_string_get_cstr(self->device_name),
+ self->context, alstr_get_cstr(self->device_name),
ALCpulseCapture_sourceNameCallback, self
);
wait_for_operation(o, self->loop);
@@ -1560,7 +1560,7 @@ static void ALCpulseCapture_close(ALCpulseCapture *self)
self->context = NULL;
self->stream = NULL;
- al_string_clear(&self->device_name);
+ alstr_clear(&self->device_name);
}
static ALCboolean ALCpulseCapture_start(ALCpulseCapture *self)
@@ -1785,14 +1785,14 @@ static void ALCpulseBackendFactory_probe(ALCpulseBackendFactory* UNUSED(self), e
{
case ALL_DEVICE_PROBE:
ALCpulsePlayback_probeDevices();
-#define APPEND_ALL_DEVICES_LIST(e) AppendAllDevicesList(al_string_get_cstr((e)->name))
+#define APPEND_ALL_DEVICES_LIST(e) AppendAllDevicesList(alstr_get_cstr((e)->name))
VECTOR_FOR_EACH(const DevMap, PlaybackDevices, APPEND_ALL_DEVICES_LIST);
#undef APPEND_ALL_DEVICES_LIST
break;
case CAPTURE_DEVICE_PROBE:
ALCpulseCapture_probeDevices();
-#define APPEND_CAPTURE_DEVICE_LIST(e) AppendCaptureDeviceList(al_string_get_cstr((e)->name))
+#define APPEND_CAPTURE_DEVICE_LIST(e) AppendCaptureDeviceList(alstr_get_cstr((e)->name))
VECTOR_FOR_EACH(const DevMap, CaptureDevices, APPEND_CAPTURE_DEVICE_LIST);
#undef APPEND_CAPTURE_DEVICE_LIST
break;
diff --git a/Alc/backends/qsa.c b/Alc/backends/qsa.c
index dabe5ee9..9563a918 100644
--- a/Alc/backends/qsa.c
+++ b/Alc/backends/qsa.c
@@ -296,7 +296,7 @@ static ALCenum qsa_open_playback(ALCdevice* device, const ALCchar* deviceName)
return ALC_INVALID_DEVICE;
}
- al_string_copy_cstr(&device->DeviceName, deviceName);
+ alstr_copy_cstr(&device->DeviceName, deviceName);
device->ExtraData = data;
return ALC_NO_ERROR;
@@ -643,7 +643,7 @@ static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName)
return ALC_INVALID_DEVICE;
}
- al_string_copy_cstr(&device->DeviceName, deviceName);
+ alstr_copy_cstr(&device->DeviceName, deviceName);
device->ExtraData = data;
switch (device->FmtType)
diff --git a/Alc/backends/sndio.c b/Alc/backends/sndio.c
index 00d7c654..ac2dc03f 100644
--- a/Alc/backends/sndio.c
+++ b/Alc/backends/sndio.c
@@ -145,7 +145,7 @@ static ALCenum ALCsndioBackend_open(ALCsndioBackend *self, const ALCchar *name)
return ALC_INVALID_VALUE;
}
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
diff --git a/Alc/backends/solaris.c b/Alc/backends/solaris.c
index c70e0b46..98c00525 100644
--- a/Alc/backends/solaris.c
+++ b/Alc/backends/solaris.c
@@ -185,7 +185,7 @@ static ALCenum ALCsolarisBackend_open(ALCsolarisBackend *self, const ALCchar *na
}
device = STATIC_CAST(ALCbackend,self)->mDevice;
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c
index 1b13746e..36d7cbca 100644
--- a/Alc/backends/wave.c
+++ b/Alc/backends/wave.c
@@ -228,7 +228,7 @@ static ALCenum ALCwaveBackend_open(ALCwaveBackend *self, const ALCchar *name)
}
device = STATIC_CAST(ALCbackend, self)->mDevice;
- al_string_copy_cstr(&device->DeviceName, name);
+ alstr_copy_cstr(&device->DeviceName, name);
return ALC_NO_ERROR;
}
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index 2b6db4ad..da0d67a1 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -45,7 +45,7 @@ static vector_al_string CaptureDevices;
static void clear_devlist(vector_al_string *list)
{
- VECTOR_FOR_EACH(al_string, *list, al_string_deinit);
+ VECTOR_FOR_EACH(al_string, *list, alstr_reset);
VECTOR_RESIZE(*list, 0, 0);
}
@@ -71,23 +71,23 @@ static void ProbePlaybackDevices(void)
ALuint count = 0;
while(1)
{
- al_string_copy_cstr(&dname, DEVNAME_HEAD);
- al_string_append_wcstr(&dname, WaveCaps.szPname);
+ alstr_copy_cstr(&dname, DEVNAME_HEAD);
+ alstr_append_wcstr(&dname, WaveCaps.szPname);
if(count != 0)
{
char str[64];
snprintf(str, sizeof(str), " #%d", count+1);
- al_string_append_cstr(&dname, str);
+ alstr_append_cstr(&dname, str);
}
count++;
-#define MATCH_ENTRY(i) (al_string_cmp(dname, *(i)) == 0)
+#define MATCH_ENTRY(i) (alstr_cmp(dname, *(i)) == 0)
VECTOR_FIND_IF(iter, const al_string, PlaybackDevices, MATCH_ENTRY);
if(iter == VECTOR_END(PlaybackDevices)) break;
#undef MATCH_ENTRY
}
- TRACE("Got device \"%s\", ID %u\n", al_string_get_cstr(dname), i);
+ TRACE("Got device \"%s\", ID %u\n", alstr_get_cstr(dname), i);
}
VECTOR_PUSH_BACK(PlaybackDevices, dname);
}
@@ -114,23 +114,23 @@ static void ProbeCaptureDevices(void)
ALuint count = 0;
while(1)
{
- al_string_copy_cstr(&dname, DEVNAME_HEAD);
- al_string_append_wcstr(&dname, WaveCaps.szPname);
+ alstr_copy_cstr(&dname, DEVNAME_HEAD);
+ alstr_append_wcstr(&dname, WaveCaps.szPname);
if(count != 0)
{
char str[64];
snprintf(str, sizeof(str), " #%d", count+1);
- al_string_append_cstr(&dname, str);
+ alstr_append_cstr(&dname, str);
}
count++;
-#define MATCH_ENTRY(i) (al_string_cmp(dname, *(i)) == 0)
+#define MATCH_ENTRY(i) (alstr_cmp(dname, *(i)) == 0)
VECTOR_FIND_IF(iter, const al_string, CaptureDevices, MATCH_ENTRY);
if(iter == VECTOR_END(CaptureDevices)) break;
#undef MATCH_ENTRY
}
- TRACE("Got device \"%s\", ID %u\n", al_string_get_cstr(dname), i);
+ TRACE("Got device \"%s\", ID %u\n", alstr_get_cstr(dname), i);
}
VECTOR_PUSH_BACK(CaptureDevices, dname);
}
@@ -257,8 +257,8 @@ static ALCenum ALCwinmmPlayback_open(ALCwinmmPlayback *self, const ALCchar *devi
ProbePlaybackDevices();
// Find the Device ID matching the deviceName if valid
-#define MATCH_DEVNAME(iter) (!al_string_empty(*(iter)) && \
- (!deviceName || al_string_cmp_cstr(*(iter), deviceName) == 0))
+#define MATCH_DEVNAME(iter) (!alstr_empty(*(iter)) && \
+ (!deviceName || alstr_cmp_cstr(*(iter), deviceName) == 0))
VECTOR_FIND_IF(iter, const al_string, PlaybackDevices, MATCH_DEVNAME);
if(iter == VECTOR_END(PlaybackDevices))
return ALC_INVALID_VALUE;
@@ -300,7 +300,7 @@ retry_open:
goto failure;
}
- al_string_copy(&device->DeviceName, VECTOR_ELEM(PlaybackDevices, DeviceID));
+ alstr_copy(&device->DeviceName, VECTOR_ELEM(PlaybackDevices, DeviceID));
return ALC_NO_ERROR;
failure:
@@ -544,7 +544,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name)
ProbeCaptureDevices();
// Find the Device ID matching the deviceName if valid
-#define MATCH_DEVNAME(iter) (!al_string_empty(*(iter)) && (!name || al_string_cmp_cstr(*iter, name) == 0))
+#define MATCH_DEVNAME(iter) (!alstr_empty(*(iter)) && (!name || alstr_cmp_cstr(*iter, name) == 0))
VECTOR_FIND_IF(iter, const al_string, CaptureDevices, MATCH_DEVNAME);
if(iter == VECTOR_END(CaptureDevices))
return ALC_INVALID_VALUE;
@@ -638,7 +638,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name)
if(althrd_create(&self->thread, ALCwinmmCapture_captureProc, self) != althrd_success)
goto failure;
- al_string_copy(&device->DeviceName, VECTOR_ELEM(CaptureDevices, DeviceID));
+ alstr_copy(&device->DeviceName, VECTOR_ELEM(CaptureDevices, DeviceID));
return ALC_NO_ERROR;
failure:
@@ -715,13 +715,13 @@ static ALCuint ALCwinmmCapture_availableSamples(ALCwinmmCapture *self)
static inline void AppendAllDevicesList2(const al_string *name)
{
- if(!al_string_empty(*name))
- AppendAllDevicesList(al_string_get_cstr(*name));
+ if(!alstr_empty(*name))
+ AppendAllDevicesList(alstr_get_cstr(*name));
}
static inline void AppendCaptureDeviceList2(const al_string *name)
{
- if(!al_string_empty(*name))
- AppendCaptureDeviceList(al_string_get_cstr(*name));
+ if(!alstr_empty(*name))
+ AppendCaptureDeviceList(alstr_get_cstr(*name));
}
typedef struct ALCwinmmBackendFactory {
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 1ce567b2..5d23c3a7 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -358,7 +358,7 @@ void RestoreFPUMode(const FPUCtl *ctl)
static int StringSortCompare(const void *str1, const void *str2)
{
- return al_string_cmp(*(const_al_string*)str1, *(const_al_string*)str2);
+ return alstr_cmp(*(const_al_string*)str1, *(const_al_string*)str2);
}
#ifdef _WIN32
@@ -406,10 +406,10 @@ al_string GetProcPath(void)
}
else if((sep = strrchrW(pathname, '/')))
*sep = 0;
- al_string_copy_wcstr(&ret, pathname);
+ alstr_copy_wcstr(&ret, pathname);
free(pathname);
- TRACE("Got: %s\n", al_string_get_cstr(ret));
+ TRACE("Got: %s\n", alstr_get_cstr(ret));
return ret;
}
@@ -526,13 +526,13 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string
WCHAR *wpath;
HANDLE hdl;
- al_string_copy_cstr(&pathstr, path);
- al_string_append_cstr(&pathstr, "\\*");
- al_string_append_cstr(&pathstr, ext);
+ alstr_copy_cstr(&pathstr, path);
+ alstr_append_cstr(&pathstr, "\\*");
+ alstr_append_cstr(&pathstr, ext);
- TRACE("Searching %s\n", al_string_get_cstr(pathstr));
+ TRACE("Searching %s\n", alstr_get_cstr(pathstr));
- wpath = FromUTF8(al_string_get_cstr(pathstr));
+ wpath = FromUTF8(alstr_get_cstr(pathstr));
hdl = FindFirstFileW(wpath, &fdata);
if(hdl != INVALID_HANDLE_VALUE)
@@ -540,10 +540,10 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string
size_t base = VECTOR_SIZE(*results);
do {
al_string str = AL_STRING_INIT_STATIC();
- al_string_copy_cstr(&str, path);
- al_string_append_char(&str, '\\');
- al_string_append_wcstr(&str, fdata.cFileName);
- TRACE("Got result %s\n", al_string_get_cstr(str));
+ alstr_copy_cstr(&str, path);
+ alstr_append_char(&str, '\\');
+ alstr_append_wcstr(&str, fdata.cFileName);
+ TRACE("Got result %s\n", alstr_get_cstr(str));
VECTOR_PUSH_BACK(*results, str);
} while(FindNextFileW(hdl, &fdata));
FindClose(hdl);
@@ -554,7 +554,7 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string
}
free(wpath);
- al_string_deinit(&pathstr);
+ alstr_reset(&pathstr);
}
vector_al_string SearchDataFiles(const char *ext, const char *subdir)
@@ -571,14 +571,14 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
if(isalpha(subdir[0]) && subdir[1] == ':' && is_slash(subdir[2]))
{
al_string path = AL_STRING_INIT_STATIC();
- al_string_copy_cstr(&path, subdir);
+ alstr_copy_cstr(&path, subdir);
#define FIX_SLASH(i) do { if(*(i) == '/') *(i) = '\\'; } while(0)
VECTOR_FOR_EACH(char, path, FIX_SLASH);
#undef FIX_SLASH
- DirectorySearch(al_string_get_cstr(path), ext, &results);
+ DirectorySearch(alstr_get_cstr(path), ext, &results);
- al_string_deinit(&path);
+ alstr_reset(&path);
}
else if(subdir[0] == '\\' && subdir[1] == '\\' && subdir[2] == '?' && subdir[3] == '\\')
DirectorySearch(subdir, ext, &results);
@@ -590,7 +590,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
/* Search the app-local directory. */
if((cwdbuf=_wgetenv(L"ALSOFT_LOCAL_PATH")) && *cwdbuf != '\0')
{
- al_string_copy_wcstr(&path, cwdbuf);
+ alstr_copy_wcstr(&path, cwdbuf);
if(is_slash(VECTOR_BACK(path)))
{
VECTOR_POP_BACK(path);
@@ -598,10 +598,10 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
}
}
else if(!(cwdbuf=_wgetcwd(NULL, 0)))
- al_string_copy_cstr(&path, ".");
+ alstr_copy_cstr(&path, ".");
else
{
- al_string_copy_wcstr(&path, cwdbuf);
+ alstr_copy_wcstr(&path, cwdbuf);
if(is_slash(VECTOR_BACK(path)))
{
VECTOR_POP_BACK(path);
@@ -612,7 +612,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
#define FIX_SLASH(i) do { if(*(i) == '/') *(i) = '\\'; } while(0)
VECTOR_FOR_EACH(char, path, FIX_SLASH);
#undef FIX_SLASH
- DirectorySearch(al_string_get_cstr(path), ext, &results);
+ DirectorySearch(alstr_get_cstr(path), ext, &results);
/* Search the local and global data dirs. */
for(i = 0;i < COUNTOF(ids);i++)
@@ -620,19 +620,19 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
WCHAR buffer[PATH_MAX];
if(SHGetSpecialFolderPathW(NULL, buffer, ids[i], FALSE) != FALSE)
{
- al_string_copy_wcstr(&path, buffer);
+ alstr_copy_wcstr(&path, buffer);
if(!is_slash(VECTOR_BACK(path)))
- al_string_append_char(&path, '\\');
- al_string_append_cstr(&path, subdir);
+ alstr_append_char(&path, '\\');
+ alstr_append_cstr(&path, subdir);
#define FIX_SLASH(i) do { if(*(i) == '/') *(i) = '\\'; } while(0)
VECTOR_FOR_EACH(char, path, FIX_SLASH);
#undef FIX_SLASH
- DirectorySearch(al_string_get_cstr(path), ext, &results);
+ DirectorySearch(alstr_get_cstr(path), ext, &results);
}
}
- al_string_deinit(&path);
+ alstr_reset(&path);
}
ATOMIC_STORE_SEQ(&search_lock, 0);
@@ -740,12 +740,12 @@ al_string GetProcPath(void)
pathname[len] = 0;
sep = strrchr(pathname, '/');
if(sep)
- al_string_copy_range(&ret, pathname, sep);
+ alstr_copy_range(&ret, pathname, sep);
else
- al_string_copy_cstr(&ret, pathname);
+ alstr_copy_cstr(&ret, pathname);
free(pathname);
- TRACE("Got: %s\n", al_string_get_cstr(ret));
+ TRACE("Got: %s\n", alstr_get_cstr(ret));
return ret;
}
@@ -820,11 +820,11 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string
continue;
AL_STRING_INIT(str);
- al_string_copy_cstr(&str, path);
+ alstr_copy_cstr(&str, path);
if(VECTOR_BACK(str) != '/')
- al_string_append_char(&str, '/');
- al_string_append_cstr(&str, dirent->d_name);
- TRACE("Got result %s\n", al_string_get_cstr(str));
+ alstr_append_char(&str, '/');
+ alstr_append_cstr(&str, dirent->d_name);
+ TRACE("Got result %s\n", alstr_get_cstr(str));
VECTOR_PUSH_BACK(*results, str);
}
closedir(dir);
@@ -862,23 +862,23 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
// Search local data dir
if((str=getenv("XDG_DATA_HOME")) != NULL && str[0] != '\0')
{
- al_string_copy_cstr(&path, str);
+ alstr_copy_cstr(&path, str);
if(VECTOR_BACK(path) != '/')
- al_string_append_char(&path, '/');
- al_string_append_cstr(&path, subdir);
- DirectorySearch(al_string_get_cstr(path), ext, &results);
+ alstr_append_char(&path, '/');
+ alstr_append_cstr(&path, subdir);
+ DirectorySearch(alstr_get_cstr(path), ext, &results);
}
else if((str=getenv("HOME")) != NULL && str[0] != '\0')
{
- al_string_copy_cstr(&path, str);
+ alstr_copy_cstr(&path, str);
if(VECTOR_BACK(path) == '/')
{
VECTOR_POP_BACK(path);
*VECTOR_END(path) = 0;
}
- al_string_append_cstr(&path, "/.local/share/");
- al_string_append_cstr(&path, subdir);
- DirectorySearch(al_string_get_cstr(path), ext, &results);
+ alstr_append_cstr(&path, "/.local/share/");
+ alstr_append_cstr(&path, subdir);
+ DirectorySearch(alstr_get_cstr(path), ext, &results);
}
// Search global data dirs
@@ -890,23 +890,23 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir)
{
next = strchr(str, ':');
if(!next)
- al_string_copy_cstr(&path, str);
+ alstr_copy_cstr(&path, str);
else
{
- al_string_copy_range(&path, str, next);
+ alstr_copy_range(&path, str, next);
++next;
}
- if(!al_string_empty(path))
+ if(!alstr_empty(path))
{
if(VECTOR_BACK(path) != '/')
- al_string_append_char(&path, '/');
- al_string_append_cstr(&path, subdir);
+ alstr_append_char(&path, '/');
+ alstr_append_cstr(&path, subdir);
- DirectorySearch(al_string_get_cstr(path), ext, &results);
+ DirectorySearch(alstr_get_cstr(path), ext, &results);
}
}
- al_string_deinit(&path);
+ alstr_reset(&path);
}
ATOMIC_STORE_SEQ(&search_lock, 0);
@@ -983,14 +983,14 @@ void SetRTPriority(void)
}
-extern inline void al_string_deinit(al_string *str);
-extern inline size_t al_string_length(const_al_string str);
-extern inline ALboolean al_string_empty(const_al_string str);
-extern inline const al_string_char_type *al_string_get_cstr(const_al_string str);
+extern inline void alstr_reset(al_string *str);
+extern inline size_t alstr_length(const_al_string str);
+extern inline ALboolean alstr_empty(const_al_string str);
+extern inline const al_string_char_type *alstr_get_cstr(const_al_string str);
-void al_string_clear(al_string *str)
+void alstr_clear(al_string *str)
{
- if(!al_string_empty(*str))
+ if(!alstr_empty(*str))
{
/* Reserve one more character than the total size of the string. This
* is to ensure we have space to add a null terminator in the string
@@ -1001,8 +1001,8 @@ void al_string_clear(al_string *str)
}
}
-static inline int al_string_compare(const al_string_char_type *str1, size_t str1len,
- const al_string_char_type *str2, size_t str2len)
+static inline int alstr_compare(const al_string_char_type *str1, size_t str1len,
+ const al_string_char_type *str2, size_t str2len)
{
size_t complen = (str1len < str2len) ? str1len : str2len;
int ret = memcmp(str1, str2, complen);
@@ -1013,20 +1013,20 @@ static inline int al_string_compare(const al_string_char_type *str1, size_t str1
}
return ret;
}
-int al_string_cmp(const_al_string str1, const_al_string str2)
+int alstr_cmp(const_al_string str1, const_al_string str2)
{
- return al_string_compare(&VECTOR_FRONT(str1), al_string_length(str1),
- &VECTOR_FRONT(str2), al_string_length(str2));
+ return alstr_compare(&VECTOR_FRONT(str1), alstr_length(str1),
+ &VECTOR_FRONT(str2), alstr_length(str2));
}
-int al_string_cmp_cstr(const_al_string str1, const al_string_char_type *str2)
+int alstr_cmp_cstr(const_al_string str1, const al_string_char_type *str2)
{
- return al_string_compare(&VECTOR_FRONT(str1), al_string_length(str1),
- str2, strlen(str2));
+ return alstr_compare(&VECTOR_FRONT(str1), alstr_length(str1),
+ str2, strlen(str2));
}
-void al_string_copy(al_string *str, const_al_string from)
+void alstr_copy(al_string *str, const_al_string from)
{
- size_t len = al_string_length(from);
+ size_t len = alstr_length(from);
size_t i;
VECTOR_RESIZE(*str, len, len+1);
@@ -1035,7 +1035,7 @@ void al_string_copy(al_string *str, const_al_string from)
VECTOR_ELEM(*str, i) = 0;
}
-void al_string_copy_cstr(al_string *str, const al_string_char_type *from)
+void alstr_copy_cstr(al_string *str, const al_string_char_type *from)
{
size_t len = strlen(from);
size_t i;
@@ -1046,7 +1046,7 @@ void al_string_copy_cstr(al_string *str, const al_string_char_type *from)
VECTOR_ELEM(*str, i) = 0;
}
-void al_string_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to)
+void alstr_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to)
{
size_t len = to - from;
size_t i;
@@ -1057,20 +1057,20 @@ void al_string_copy_range(al_string *str, const al_string_char_type *from, const
VECTOR_ELEM(*str, i) = 0;
}
-void al_string_append_char(al_string *str, const al_string_char_type c)
+void alstr_append_char(al_string *str, const al_string_char_type c)
{
- size_t len = al_string_length(*str);
+ size_t len = alstr_length(*str);
VECTOR_RESIZE(*str, len, len+2);
VECTOR_PUSH_BACK(*str, c);
VECTOR_ELEM(*str, len+1) = 0;
}
-void al_string_append_cstr(al_string *str, const al_string_char_type *from)
+void alstr_append_cstr(al_string *str, const al_string_char_type *from)
{
size_t len = strlen(from);
if(len != 0)
{
- size_t base = al_string_length(*str);
+ size_t base = alstr_length(*str);
size_t i;
VECTOR_RESIZE(*str, base+len, base+len+1);
@@ -1080,12 +1080,12 @@ void al_string_append_cstr(al_string *str, const al_string_char_type *from)
}
}
-void al_string_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to)
+void alstr_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to)
{
size_t len = to - from;
if(len != 0)
{
- size_t base = al_string_length(*str);
+ size_t base = alstr_length(*str);
size_t i;
VECTOR_RESIZE(*str, base+len, base+len+1);
@@ -1096,7 +1096,7 @@ void al_string_append_range(al_string *str, const al_string_char_type *from, con
}
#ifdef _WIN32
-void al_string_copy_wcstr(al_string *str, const wchar_t *from)
+void alstr_copy_wcstr(al_string *str, const wchar_t *from)
{
int len;
if((len=WideCharToMultiByte(CP_UTF8, 0, from, -1, NULL, 0, NULL, NULL)) > 0)
@@ -1107,24 +1107,24 @@ void al_string_copy_wcstr(al_string *str, const wchar_t *from)
}
}
-void al_string_append_wcstr(al_string *str, const wchar_t *from)
+void alstr_append_wcstr(al_string *str, const wchar_t *from)
{
int len;
if((len=WideCharToMultiByte(CP_UTF8, 0, from, -1, NULL, 0, NULL, NULL)) > 0)
{
- size_t base = al_string_length(*str);
+ size_t base = alstr_length(*str);
VECTOR_RESIZE(*str, base+len-1, base+len);
WideCharToMultiByte(CP_UTF8, 0, from, -1, &VECTOR_ELEM(*str, base), len, NULL, NULL);
VECTOR_ELEM(*str, base+len-1) = 0;
}
}
-void al_string_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to)
+void alstr_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to)
{
int len;
if((len=WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), NULL, 0, NULL, NULL)) > 0)
{
- size_t base = al_string_length(*str);
+ size_t base = alstr_length(*str);
VECTOR_RESIZE(*str, base+len, base+len+1);
WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), &VECTOR_ELEM(*str, base), len+1, NULL, NULL);
VECTOR_ELEM(*str, base+len) = 0;
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index 2f6e9983..4634e6eb 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -252,7 +252,7 @@ static struct Hrtf *CreateHrtfStore(ALuint rate, ALsizei irSize, ALsizei evCount
total = RoundUp(total, sizeof(ALfloat)); /* Align for float fields */
total += sizeof(Hrtf->coeffs[0])*irSize*irCount;
total += sizeof(Hrtf->delays[0])*irCount;
- total += al_string_length(filename)+1;
+ total += alstr_length(filename)+1;
Hrtf = al_calloc(16, total);
if(Hrtf == NULL)
@@ -288,7 +288,7 @@ static struct Hrtf *CreateHrtfStore(ALuint rate, ALsizei irSize, ALsizei evCount
offset += sizeof(_delays[0])*irCount;
_name = (char*)(base + offset); Hrtf->filename = _name;
- offset += sizeof(_name[0])*(al_string_length(filename)+1);
+ offset += sizeof(_name[0])*(alstr_length(filename)+1);
Hrtf->next = NULL;
@@ -298,7 +298,7 @@ static struct Hrtf *CreateHrtfStore(ALuint rate, ALsizei irSize, ALsizei evCount
for(i = 0;i < irSize*irCount;i++)
_coeffs[i] = coeffs[i] / 32768.0f;
for(i = 0;i < irCount;i++) _delays[i] = delays[i];
- for(i = 0;i < (ALsizei)al_string_length(filename);i++)
+ for(i = 0;i < (ALsizei)alstr_length(filename);i++)
_name[i] = VECTOR_ELEM(filename, i);
_name[i] = '\0';
@@ -325,7 +325,7 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str
if(datalen < 9)
{
ERR("Unexpected end of %s data (req %d, rem "SZFMT")\n",
- al_string_get_cstr(filename), 9, datalen);
+ alstr_get_cstr(filename), 9, datalen);
return NULL;
}
@@ -364,7 +364,7 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str
if(datalen < evCount*2)
{
ERR("Unexpected end of %s data (req %d, rem "SZFMT")\n",
- al_string_get_cstr(filename), evCount*2, datalen);
+ alstr_get_cstr(filename), evCount*2, datalen);
return NULL;
}
@@ -433,7 +433,7 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str
if(datalen < reqsize)
{
ERR("Unexpected end of %s data (req "SZFMT", rem "SZFMT")\n",
- al_string_get_cstr(filename), reqsize, datalen);
+ alstr_get_cstr(filename), reqsize, datalen);
failed = AL_TRUE;
}
}
@@ -489,7 +489,7 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str
if(datalen < 6)
{
ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n",
- al_string_get_cstr(filename), 6, datalen);
+ alstr_get_cstr(filename), 6, datalen);
return NULL;
}
@@ -523,7 +523,7 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str
if(datalen < evCount)
{
ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n",
- al_string_get_cstr(filename), evCount, datalen);
+ alstr_get_cstr(filename), evCount, datalen);
return NULL;
}
@@ -575,7 +575,7 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str
if(datalen < reqsize)
{
ERR("Unexpected end of %s data (req "SZFMT", rem "SZFMT"\n",
- al_string_get_cstr(filename), reqsize, datalen);
+ alstr_get_cstr(filename), reqsize, datalen);
failed = AL_TRUE;
}
}
@@ -626,11 +626,11 @@ static void AddFileEntry(vector_HrtfEntry *list, const_al_string filename)
const char *ext;
int i;
-#define MATCH_FNAME(i) (al_string_cmp_cstr(filename, (i)->hrtf->filename) == 0)
+#define MATCH_FNAME(i) (alstr_cmp_cstr(filename, (i)->hrtf->filename) == 0)
VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_FNAME);
if(iter != VECTOR_END(*list))
{
- TRACE("Skipping duplicate file entry %s\n", al_string_get_cstr(filename));
+ TRACE("Skipping duplicate file entry %s\n", alstr_get_cstr(filename));
return;
}
#undef MATCH_FNAME
@@ -638,24 +638,24 @@ static void AddFileEntry(vector_HrtfEntry *list, const_al_string filename)
entry.hrtf = LoadedHrtfs;
while(entry.hrtf)
{
- if(al_string_cmp_cstr(filename, entry.hrtf->filename) == 0)
+ if(alstr_cmp_cstr(filename, entry.hrtf->filename) == 0)
{
- TRACE("Skipping load of already-loaded file %s\n", al_string_get_cstr(filename));
+ TRACE("Skipping load of already-loaded file %s\n", alstr_get_cstr(filename));
goto skip_load;
}
entry.hrtf = entry.hrtf->next;
}
- TRACE("Loading %s...\n", al_string_get_cstr(filename));
- fmap = MapFileToMem(al_string_get_cstr(filename));
+ TRACE("Loading %s...\n", alstr_get_cstr(filename));
+ fmap = MapFileToMem(alstr_get_cstr(filename));
if(fmap.ptr == NULL)
{
- ERR("Could not open %s\n", al_string_get_cstr(filename));
+ ERR("Could not open %s\n", alstr_get_cstr(filename));
return;
}
if(fmap.len < sizeof(magicMarker01))
- ERR("%s data is too short ("SZFMT" bytes)\n", al_string_get_cstr(filename), fmap.len);
+ ERR("%s data is too short ("SZFMT" bytes)\n", alstr_get_cstr(filename), fmap.len);
else if(memcmp(fmap.ptr, magicMarker01, sizeof(magicMarker01)) == 0)
{
TRACE("Detected data set format v1\n");
@@ -671,12 +671,12 @@ static void AddFileEntry(vector_HrtfEntry *list, const_al_string filename)
);
}
else
- ERR("Invalid header in %s: \"%.8s\"\n", al_string_get_cstr(filename), (const char*)fmap.ptr);
+ ERR("Invalid header in %s: \"%.8s\"\n", alstr_get_cstr(filename), (const char*)fmap.ptr);
UnmapFileMem(&fmap);
if(!hrtf)
{
- ERR("Failed to load %s\n", al_string_get_cstr(filename));
+ ERR("Failed to load %s\n", alstr_get_cstr(filename));
return;
}
@@ -689,9 +689,9 @@ static void AddFileEntry(vector_HrtfEntry *list, const_al_string filename)
skip_load:
/* TODO: Get a human-readable name from the HRTF data (possibly coming in a
* format update). */
- name = strrchr(al_string_get_cstr(filename), '/');
- if(!name) name = strrchr(al_string_get_cstr(filename), '\\');
- if(!name) name = al_string_get_cstr(filename);
+ name = strrchr(alstr_get_cstr(filename), '/');
+ if(!name) name = strrchr(alstr_get_cstr(filename), '\\');
+ if(!name) name = alstr_get_cstr(filename);
else ++name;
ext = strrchr(name, '.');
@@ -699,24 +699,24 @@ skip_load:
i = 0;
do {
if(!ext)
- al_string_copy_cstr(&entry.name, name);
+ alstr_copy_cstr(&entry.name, name);
else
- al_string_copy_range(&entry.name, name, ext);
+ alstr_copy_range(&entry.name, name, ext);
if(i != 0)
{
char str[64];
snprintf(str, sizeof(str), " #%d", i+1);
- al_string_append_cstr(&entry.name, str);
+ alstr_append_cstr(&entry.name, str);
}
++i;
-#define MATCH_NAME(i) (al_string_cmp(entry.name, (i)->name) == 0)
+#define MATCH_NAME(i) (alstr_cmp(entry.name, (i)->name) == 0)
VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_NAME);
#undef MATCH_NAME
} while(iter != VECTOR_END(*list));
- TRACE("Adding entry \"%s\" from file \"%s\"\n", al_string_get_cstr(entry.name),
- al_string_get_cstr(filename));
+ TRACE("Adding entry \"%s\" from file \"%s\"\n", alstr_get_cstr(entry.name),
+ alstr_get_cstr(filename));
VECTOR_PUSH_BACK(*list, entry);
}
@@ -730,11 +730,11 @@ static void AddBuiltInEntry(vector_HrtfEntry *list, const ALubyte *data, size_t
const HrtfEntry *iter;
int i;
-#define MATCH_FNAME(i) (al_string_cmp_cstr(filename, (i)->hrtf->filename) == 0)
+#define MATCH_FNAME(i) (alstr_cmp_cstr(filename, (i)->hrtf->filename) == 0)
VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_FNAME);
if(iter != VECTOR_END(*list))
{
- TRACE("Skipping duplicate file entry %s\n", al_string_get_cstr(filename));
+ TRACE("Skipping duplicate file entry %s\n", alstr_get_cstr(filename));
return;
}
#undef MATCH_FNAME
@@ -742,18 +742,18 @@ static void AddBuiltInEntry(vector_HrtfEntry *list, const ALubyte *data, size_t
entry.hrtf = LoadedHrtfs;
while(entry.hrtf)
{
- if(al_string_cmp_cstr(filename, entry.hrtf->filename) == 0)
+ if(alstr_cmp_cstr(filename, entry.hrtf->filename) == 0)
{
- TRACE("Skipping load of already-loaded file %s\n", al_string_get_cstr(filename));
+ TRACE("Skipping load of already-loaded file %s\n", alstr_get_cstr(filename));
goto skip_load;
}
entry.hrtf = entry.hrtf->next;
}
- TRACE("Loading %s...\n", al_string_get_cstr(filename));
+ TRACE("Loading %s...\n", alstr_get_cstr(filename));
if(datalen < sizeof(magicMarker01))
{
- ERR("%s data is too short ("SZFMT" bytes)\n", al_string_get_cstr(filename), datalen);
+ ERR("%s data is too short ("SZFMT" bytes)\n", alstr_get_cstr(filename), datalen);
return;
}
@@ -772,11 +772,11 @@ static void AddBuiltInEntry(vector_HrtfEntry *list, const ALubyte *data, size_t
);
}
else
- ERR("Invalid header in %s: \"%.8s\"\n", al_string_get_cstr(filename), data);
+ ERR("Invalid header in %s: \"%.8s\"\n", alstr_get_cstr(filename), data);
if(!hrtf)
{
- ERR("Failed to load %s\n", al_string_get_cstr(filename));
+ ERR("Failed to load %s\n", alstr_get_cstr(filename));
return;
}
@@ -789,21 +789,21 @@ static void AddBuiltInEntry(vector_HrtfEntry *list, const ALubyte *data, size_t
skip_load:
i = 0;
do {
- al_string_copy(&entry.name, filename);
+ alstr_copy(&entry.name, filename);
if(i != 0)
{
char str[64];
snprintf(str, sizeof(str), " #%d", i+1);
- al_string_append_cstr(&entry.name, str);
+ alstr_append_cstr(&entry.name, str);
}
++i;
-#define MATCH_NAME(i) (al_string_cmp(entry.name, (i)->name) == 0)
+#define MATCH_NAME(i) (alstr_cmp(entry.name, (i)->name) == 0)
VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_NAME);
#undef MATCH_NAME
} while(iter != VECTOR_END(*list));
- TRACE("Adding built-in entry \"%s\"\n", al_string_get_cstr(entry.name));
+ TRACE("Adding built-in entry \"%s\"\n", alstr_get_cstr(entry.name));
VECTOR_PUSH_BACK(*list, entry);
}
@@ -909,7 +909,7 @@ vector_HrtfEntry EnumerateHrtf(const_al_string devname)
const char *pathlist = "";
bool usedefaults = true;
- if(ConfigValueStr(al_string_get_cstr(devname), NULL, "hrtf-paths", &pathlist))
+ if(ConfigValueStr(alstr_get_cstr(devname), NULL, "hrtf-paths", &pathlist))
{
al_string pname = AL_STRING_INIT_STATIC();
while(pathlist && *pathlist)
@@ -937,21 +937,21 @@ vector_HrtfEntry EnumerateHrtf(const_al_string devname)
vector_al_string flist;
size_t i;
- al_string_append_range(&pname, pathlist, end);
+ alstr_append_range(&pname, pathlist, end);
- flist = SearchDataFiles(".mhr", al_string_get_cstr(pname));
+ flist = SearchDataFiles(".mhr", alstr_get_cstr(pname));
for(i = 0;i < VECTOR_SIZE(flist);i++)
AddFileEntry(&list, VECTOR_ELEM(flist, i));
- VECTOR_FOR_EACH(al_string, flist, al_string_deinit);
+ VECTOR_FOR_EACH(al_string, flist, alstr_reset);
VECTOR_DEINIT(flist);
}
pathlist = next;
}
- al_string_deinit(&pname);
+ alstr_reset(&pname);
}
- else if(ConfigValueExists(al_string_get_cstr(devname), NULL, "hrtf_tables"))
+ else if(ConfigValueExists(alstr_get_cstr(devname), NULL, "hrtf_tables"))
ERR("The hrtf_tables option is deprecated, please use hrtf-paths instead.\n");
if(usedefaults)
@@ -964,30 +964,30 @@ vector_HrtfEntry EnumerateHrtf(const_al_string devname)
flist = SearchDataFiles(".mhr", "openal/hrtf");
for(i = 0;i < VECTOR_SIZE(flist);i++)
AddFileEntry(&list, VECTOR_ELEM(flist, i));
- VECTOR_FOR_EACH(al_string, flist, al_string_deinit);
+ VECTOR_FOR_EACH(al_string, flist, alstr_reset);
VECTOR_DEINIT(flist);
rdata = GetResource(IDR_DEFAULT_44100_MHR, &rsize);
if(rdata != NULL && rsize > 0)
{
- al_string_copy_cstr(&ename, "Built-In 44100hz");
+ alstr_copy_cstr(&ename, "Built-In 44100hz");
AddBuiltInEntry(&list, rdata, rsize, ename);
}
rdata = GetResource(IDR_DEFAULT_48000_MHR, &rsize);
if(rdata != NULL && rsize > 0)
{
- al_string_copy_cstr(&ename, "Built-In 48000hz");
+ alstr_copy_cstr(&ename, "Built-In 48000hz");
AddBuiltInEntry(&list, rdata, rsize, ename);
}
- al_string_deinit(&ename);
+ alstr_reset(&ename);
}
- if(VECTOR_SIZE(list) > 1 && ConfigValueStr(al_string_get_cstr(devname), NULL, "default-hrtf", &defaulthrtf))
+ if(VECTOR_SIZE(list) > 1 && ConfigValueStr(alstr_get_cstr(devname), NULL, "default-hrtf", &defaulthrtf))
{
const HrtfEntry *iter;
/* Find the preferred HRTF and move it to the front of the list. */
-#define FIND_ENTRY(i) (al_string_cmp_cstr((i)->name, defaulthrtf) == 0)
+#define FIND_ENTRY(i) (alstr_cmp_cstr((i)->name, defaulthrtf) == 0)
VECTOR_FIND_IF(iter, const HrtfEntry, list, FIND_ENTRY);
#undef FIND_ENTRY
if(iter == VECTOR_END(list))
@@ -1006,9 +1006,7 @@ vector_HrtfEntry EnumerateHrtf(const_al_string devname)
void FreeHrtfList(vector_HrtfEntry *list)
{
-#define CLEAR_ENTRY(i) do { \
- al_string_deinit(&(i)->name); \
-} while(0)
+#define CLEAR_ENTRY(i) alstr_reset(&(i)->name)
VECTOR_FOR_EACH(HrtfEntry, *list, CLEAR_ENTRY);
VECTOR_DEINIT(*list);
#undef CLEAR_ENTRY
diff --git a/Alc/panning.c b/Alc/panning.c
index 0ff58c3a..ce86a561 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -386,45 +386,45 @@ static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALsizei sp
* use the side channels when the device is configured for back,
* and vice-versa.
*/
- if(al_string_cmp_cstr(conf->Speakers[i].Name, "LF") == 0)
+ if(alstr_cmp_cstr(conf->Speakers[i].Name, "LF") == 0)
c = GetChannelIdxByName(device->RealOut, FrontLeft);
- else if(al_string_cmp_cstr(conf->Speakers[i].Name, "RF") == 0)
+ else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RF") == 0)
c = GetChannelIdxByName(device->RealOut, FrontRight);
- else if(al_string_cmp_cstr(conf->Speakers[i].Name, "CE") == 0)
+ else if(alstr_cmp_cstr(conf->Speakers[i].Name, "CE") == 0)
c = GetChannelIdxByName(device->RealOut, FrontCenter);
- else if(al_string_cmp_cstr(conf->Speakers[i].Name, "LS") == 0)
+ else if(alstr_cmp_cstr(conf->Speakers[i].Name, "LS") == 0)
{
if(device->FmtChans == DevFmtX51Rear)
c = GetChannelIdxByName(device->RealOut, BackLeft);
else
c = GetChannelIdxByName(device->RealOut, SideLeft);
}
- else if(al_string_cmp_cstr(conf->Speakers[i].Name, "RS") == 0)
+ else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RS") == 0)
{
if(device->FmtChans == DevFmtX51Rear)
c = GetChannelIdxByName(device->RealOut, BackRight);
else
c = GetChannelIdxByName(device->RealOut, SideRight);
}
- else if(al_string_cmp_cstr(conf->Speakers[i].Name, "LB") == 0)
+ else if(alstr_cmp_cstr(conf->Speakers[i].Name, "LB") == 0)
{
if(device->FmtChans == DevFmtX51)
c = GetChannelIdxByName(device->RealOut, SideLeft);
else
c = GetChannelIdxByName(device->RealOut, BackLeft);
}
- else if(al_string_cmp_cstr(conf->Speakers[i].Name, "RB") == 0)
+ else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RB") == 0)
{
if(device->FmtChans == DevFmtX51)
c = GetChannelIdxByName(device->RealOut, SideRight);
else
c = GetChannelIdxByName(device->RealOut, BackRight);
}
- else if(al_string_cmp_cstr(conf->Speakers[i].Name, "CB") == 0)
+ else if(alstr_cmp_cstr(conf->Speakers[i].Name, "CB") == 0)
c = GetChannelIdxByName(device->RealOut, BackCenter);
else
{
- const char *name = al_string_get_cstr(conf->Speakers[i].Name);
+ const char *name = alstr_get_cstr(conf->Speakers[i].Name);
unsigned int n;
char ch;
@@ -439,7 +439,7 @@ static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALsizei sp
if(c == -1)
{
ERR("Failed to lookup AmbDec speaker label %s\n",
- al_string_get_cstr(conf->Speakers[i].Name));
+ alstr_get_cstr(conf->Speakers[i].Name));
return false;
}
speakermap[i] = c;
@@ -489,7 +489,7 @@ static const ChannelMap MonoCfg[1] = {
static void InitNearFieldCtrl(ALCdevice *device, ALfloat ctrl_dist, ALsizei order, bool periphonic)
{
- const char *devname = al_string_get_cstr(device->DeviceName);
+ const char *devname = alstr_get_cstr(device->DeviceName);
ALsizei i;
if(GetConfigValueBool(devname, "decoder", "nfc", 1) && ctrl_dist > 0.0f)
@@ -514,7 +514,7 @@ static void InitNearFieldCtrl(ALCdevice *device, ALfloat ctrl_dist, ALsizei orde
static void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf, const ALsizei speakermap[MAX_OUTPUT_CHANNELS])
{
- const char *devname = al_string_get_cstr(device->DeviceName);
+ const char *devname = alstr_get_cstr(device->DeviceName);
ALfloat maxdist = 0.0f;
ALsizei total = 0;
ALsizei i;
@@ -540,14 +540,14 @@ static void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf, const AL
srate + 0.5f);
if(delay >= (ALfloat)MAX_DELAY_LENGTH)
ERR("Delay for speaker \"%s\" exceeds buffer length (%f >= %u)\n",
- al_string_get_cstr(conf->Speakers[i].Name), delay, MAX_DELAY_LENGTH);
+ alstr_get_cstr(conf->Speakers[i].Name), delay, MAX_DELAY_LENGTH);
device->ChannelDelay[chan].Length = (ALsizei)clampf(
delay, 0.0f, (ALfloat)(MAX_DELAY_LENGTH-1)
);
device->ChannelDelay[chan].Gain = conf->Speakers[i].Distance / maxdist;
TRACE("Channel %u \"%s\" distance compensation: %d samples, %f gain\n", chan,
- al_string_get_cstr(conf->Speakers[i].Name), device->ChannelDelay[chan].Length,
+ alstr_get_cstr(conf->Speakers[i].Name), device->ChannelDelay[chan].Length,
device->ChannelDelay[chan].Gain
);
@@ -628,7 +628,7 @@ static void InitPanning(ALCdevice *device)
if(device->FmtChans >= DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3)
{
- const char *devname = al_string_get_cstr(device->DeviceName);
+ const char *devname = alstr_get_cstr(device->DeviceName);
const ALsizei *acnmap = (device->AmbiLayout == AmbiLayout_FuMa) ? FuMa2ACN : ACN2ACN;
const ALfloat *n3dscale = (device->AmbiScale == AmbiNorm_FuMa) ? FuMa2N3DScale :
(device->AmbiScale == AmbiNorm_SN3D) ? SN3D2N3DScale :
@@ -1005,7 +1005,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
al_free(device->Hrtf);
device->Hrtf = NULL;
device->HrtfHandle = NULL;
- al_string_clear(&device->HrtfName);
+ alstr_clear(&device->HrtfName);
device->Render_Mode = NormalRender;
memset(&device->Dry.Ambi, 0, sizeof(device->Dry.Ambi));
@@ -1033,7 +1033,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
ambdec_init(&conf);
- devname = al_string_get_cstr(device->DeviceName);
+ devname = alstr_get_cstr(device->DeviceName);
switch(device->FmtChans)
{
case DevFmtQuad: layout = "quad"; break;
@@ -1110,7 +1110,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
if(device->Type != Loopback)
{
const char *mode;
- if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "stereo-mode", &mode))
+ if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "stereo-mode", &mode))
{
if(strcasecmp(mode, "headphones") == 0)
headphones = true;
@@ -1154,7 +1154,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
if(entry->hrtf->sampleRate == device->Frequency)
{
device->HrtfHandle = entry->hrtf;
- al_string_copy(&device->HrtfName, entry->name);
+ alstr_copy(&device->HrtfName, entry->name);
}
}
@@ -1164,7 +1164,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
if(entry->hrtf->sampleRate == device->Frequency)
{
device->HrtfHandle = entry->hrtf;
- al_string_copy(&device->HrtfName, entry->name);
+ alstr_copy(&device->HrtfName, entry->name);
}
}
@@ -1173,7 +1173,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
bool hoa_mode;
device->Render_Mode = HrtfRender;
- if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "hrtf-mode", &mode))
+ if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "hrtf-mode", &mode))
{
if(strcasecmp(mode, "full") == 0)
device->Render_Mode = HrtfRender;
@@ -1201,7 +1201,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
TRACE("%s HRTF rendering enabled, using \"%s\"\n",
((device->Render_Mode == HrtfRender) ? "Full" : "Basic"),
- al_string_get_cstr(device->HrtfName)
+ alstr_get_cstr(device->HrtfName)
);
InitHrtfPanning(device, hoa_mode);
return;
@@ -1219,7 +1219,7 @@ no_hrtf:
bs2blevel = ((headphones && hrtf_appreq != Hrtf_Disable) ||
(hrtf_appreq == Hrtf_Enable)) ? 5 : 0;
if(device->Type != Loopback)
- ConfigValueInt(al_string_get_cstr(device->DeviceName), NULL, "cf_level", &bs2blevel);
+ ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "cf_level", &bs2blevel);
if(bs2blevel > 0 && bs2blevel <= 6)
{
device->Bs2b = al_calloc(16, sizeof(*device->Bs2b));
@@ -1231,7 +1231,7 @@ no_hrtf:
TRACE("BS2B disabled\n");
- if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "stereo-encoding", &mode))
+ if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "stereo-encoding", &mode))
{
if(strcasecmp(mode, "uhj") == 0)
device->Render_Mode = NormalRender;