Use std::string instead of al_string for enumerating
This commit is contained in:
parent
d4f64b9e29
commit
1971d0f5c6
35
Alc/alc.cpp
35
Alc/alc.cpp
@ -707,8 +707,8 @@ constexpr ALCchar alcErrOutOfMemory[] = "Out of Memory";
|
||||
/* Enumerated device names */
|
||||
constexpr ALCchar alcDefaultName[] = "OpenAL Soft\0";
|
||||
|
||||
al_string alcAllDevicesList;
|
||||
al_string alcCaptureDeviceList;
|
||||
std::string alcAllDevicesList;
|
||||
std::string alcCaptureDeviceList;
|
||||
|
||||
/* Default is always the first in the list */
|
||||
std::string alcDefaultAllDevicesSpecifier;
|
||||
@ -878,9 +878,6 @@ static void alc_init(void)
|
||||
|
||||
LogFile = stderr;
|
||||
|
||||
AL_STRING_INIT(alcAllDevicesList);
|
||||
AL_STRING_INIT(alcCaptureDeviceList);
|
||||
|
||||
str = getenv("__ALSOFT_HALF_ANGLE_CONES");
|
||||
if(str && (strcasecmp(str, "true") == 0 || strtol(str, nullptr, 0) == 1))
|
||||
ConeScale *= 0.5f;
|
||||
@ -1173,8 +1170,8 @@ static void alc_initconfig(void)
|
||||
************************************************/
|
||||
static void alc_cleanup(void)
|
||||
{
|
||||
AL_STRING_DEINIT(alcAllDevicesList);
|
||||
AL_STRING_DEINIT(alcCaptureDeviceList);
|
||||
alcAllDevicesList.clear();
|
||||
alcCaptureDeviceList.clear();
|
||||
|
||||
alcDefaultAllDevicesSpecifier.clear();
|
||||
alcCaptureDefaultDeviceSpecifier.clear();
|
||||
@ -1232,12 +1229,12 @@ static void alc_deinit(void)
|
||||
/************************************************
|
||||
* Device enumeration
|
||||
************************************************/
|
||||
static void ProbeDevices(al_string *list, struct BackendInfo *backendinfo, enum DevProbe type)
|
||||
static void ProbeDevices(std::string *list, struct BackendInfo *backendinfo, enum DevProbe type)
|
||||
{
|
||||
DO_INITCONFIG();
|
||||
|
||||
std::lock_guard<std::recursive_mutex> _{ListLock};
|
||||
alstr_clear(list);
|
||||
list->clear();
|
||||
if(backendinfo->getFactory)
|
||||
{
|
||||
ALCbackendFactory *factory = backendinfo->getFactory();
|
||||
@ -3077,7 +3074,7 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para
|
||||
else
|
||||
{
|
||||
ProbeAllDevicesList();
|
||||
value = alstr_get_cstr(alcAllDevicesList);
|
||||
value = alcAllDevicesList.c_str();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -3090,7 +3087,7 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para
|
||||
else
|
||||
{
|
||||
ProbeCaptureDeviceList();
|
||||
value = alstr_get_cstr(alcCaptureDeviceList);
|
||||
value = alcCaptureDeviceList.c_str();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -3100,25 +3097,21 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para
|
||||
break;
|
||||
|
||||
case ALC_DEFAULT_ALL_DEVICES_SPECIFIER:
|
||||
if(alstr_empty(alcAllDevicesList))
|
||||
if(alcAllDevicesList.empty())
|
||||
ProbeAllDevicesList();
|
||||
|
||||
VerifyDevice(&Device);
|
||||
|
||||
alcDefaultAllDevicesSpecifier = alstr_get_cstr(alcAllDevicesList);
|
||||
/* Copy first entry as default. */
|
||||
alcDefaultAllDevicesSpecifier = alcAllDevicesList.c_str();
|
||||
value = alcDefaultAllDevicesSpecifier.c_str();
|
||||
if(Device) ALCdevice_DecRef(Device);
|
||||
break;
|
||||
|
||||
case ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER:
|
||||
if(alstr_empty(alcCaptureDeviceList))
|
||||
if(alcCaptureDeviceList.empty())
|
||||
ProbeCaptureDeviceList();
|
||||
|
||||
VerifyDevice(&Device);
|
||||
|
||||
alcCaptureDefaultDeviceSpecifier = alstr_get_cstr(alcCaptureDeviceList);
|
||||
/* Copy first entry as default. */
|
||||
alcCaptureDefaultDeviceSpecifier = alcCaptureDeviceList.c_str();
|
||||
value = alcCaptureDefaultDeviceSpecifier.c_str();
|
||||
if(Device) ALCdevice_DecRef(Device);
|
||||
break;
|
||||
|
||||
case ALC_EXTENSIONS:
|
||||
|
@ -1327,16 +1327,14 @@ static ALCboolean ALCalsaBackendFactory_querySupport(ALCalsaBackendFactory* UNUS
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCalsaBackendFactory_probe(ALCalsaBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCalsaBackendFactory_probe(ALCalsaBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
auto add_device = [outnames](const DevMap &entry) -> void
|
||||
{
|
||||
const char *name{entry.name.c_str()};
|
||||
size_t namelen{entry.name.length()};
|
||||
/* +1 to also append the null char (to ensure a null-separated list and
|
||||
* double-null terminated list).
|
||||
*/
|
||||
alstr_append_range(outnames, name, name + namelen+1);
|
||||
outnames->append(entry.name.c_str(), entry.name.length()+1);
|
||||
};
|
||||
switch(type)
|
||||
{
|
||||
|
@ -2,10 +2,10 @@
|
||||
#define AL_BACKENDS_BASE_H
|
||||
|
||||
#include "alMain.h"
|
||||
#include "alstring.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
struct ClockLatency {
|
||||
@ -119,7 +119,7 @@ struct ALCbackendFactoryVtable {
|
||||
|
||||
ALCboolean (*const querySupport)(ALCbackendFactory *self, ALCbackend_Type type);
|
||||
|
||||
void (*const probe)(ALCbackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
void (*const probe)(ALCbackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
|
||||
ALCbackend* (*const createBackend)(ALCbackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
};
|
||||
@ -128,7 +128,7 @@ struct ALCbackendFactoryVtable {
|
||||
DECLARE_THUNK(T, ALCbackendFactory, ALCboolean, init) \
|
||||
DECLARE_THUNK(T, ALCbackendFactory, void, deinit) \
|
||||
DECLARE_THUNK1(T, ALCbackendFactory, ALCboolean, querySupport, ALCbackend_Type) \
|
||||
DECLARE_THUNK2(T, ALCbackendFactory, void, probe, enum DevProbe, al_string*) \
|
||||
DECLARE_THUNK2(T, ALCbackendFactory, void, probe, enum DevProbe, std::string*) \
|
||||
DECLARE_THUNK2(T, ALCbackendFactory, ALCbackend*, createBackend, ALCdevice*, ALCbackend_Type) \
|
||||
\
|
||||
static const struct ALCbackendFactoryVtable T##_ALCbackendFactory_vtable = { \
|
||||
|
@ -760,7 +760,7 @@ ALCbackendFactory *ALCcoreAudioBackendFactory_getFactory(void);
|
||||
static ALCboolean ALCcoreAudioBackendFactory_init(ALCcoreAudioBackendFactory *self);
|
||||
static DECLARE_FORWARD(ALCcoreAudioBackendFactory, ALCbackendFactory, void, deinit)
|
||||
static ALCboolean ALCcoreAudioBackendFactory_querySupport(ALCcoreAudioBackendFactory *self, ALCbackend_Type type);
|
||||
static void ALCcoreAudioBackendFactory_probe(ALCcoreAudioBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCcoreAudioBackendFactory_probe(ALCcoreAudioBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCcoreAudioBackendFactory_createBackend(ALCcoreAudioBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCcoreAudioBackendFactory);
|
||||
|
||||
@ -788,13 +788,14 @@ static ALCboolean ALCcoreAudioBackendFactory_querySupport(ALCcoreAudioBackendFac
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCcoreAudioBackendFactory_probe(ALCcoreAudioBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCcoreAudioBackendFactory_probe(ALCcoreAudioBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case ALL_DEVICE_PROBE:
|
||||
case CAPTURE_DEVICE_PROBE:
|
||||
alstr_append_range(outnames, ca_device, ca_device+sizeof(ca_device));
|
||||
/* Includes null char. */
|
||||
outnames->append(ca_device, sizeof(ca_device));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -951,7 +951,7 @@ ALCbackendFactory *ALCdsoundBackendFactory_getFactory(void);
|
||||
static ALCboolean ALCdsoundBackendFactory_init(ALCdsoundBackendFactory *self);
|
||||
static void ALCdsoundBackendFactory_deinit(ALCdsoundBackendFactory *self);
|
||||
static ALCboolean ALCdsoundBackendFactory_querySupport(ALCdsoundBackendFactory *self, ALCbackend_Type type);
|
||||
static void ALCdsoundBackendFactory_probe(ALCdsoundBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCdsoundBackendFactory_probe(ALCdsoundBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCdsoundBackendFactory_createBackend(ALCdsoundBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCdsoundBackendFactory);
|
||||
|
||||
@ -994,16 +994,14 @@ static ALCboolean ALCdsoundBackendFactory_querySupport(ALCdsoundBackendFactory*
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCdsoundBackendFactory_probe(ALCdsoundBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCdsoundBackendFactory_probe(ALCdsoundBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
auto add_device = [outnames](const DevMap &entry) -> void
|
||||
{
|
||||
const char *name{entry.name.c_str()};
|
||||
size_t namelen{entry.name.length()};
|
||||
/* +1 to also append the null char (to ensure a null-separated list and
|
||||
* double-null terminated list).
|
||||
*/
|
||||
alstr_append_range(outnames, name, name + namelen+1);
|
||||
outnames->append(entry.name.c_str(), entry.name.length()+1);
|
||||
};
|
||||
|
||||
/* Initialize COM to prevent name truncation */
|
||||
|
@ -568,12 +568,13 @@ static ALCboolean ALCjackBackendFactory_querySupport(ALCjackBackendFactory* UNUS
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCjackBackendFactory_probe(ALCjackBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCjackBackendFactory_probe(ALCjackBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case ALL_DEVICE_PROBE:
|
||||
alstr_append_range(outnames, jackDevice, jackDevice+sizeof(jackDevice));
|
||||
/* Includes null char. */
|
||||
outnames->append(jackDevice, sizeof(jackDevice));
|
||||
break;
|
||||
|
||||
case CAPTURE_DEVICE_PROBE:
|
||||
|
@ -90,7 +90,7 @@ ALCbackendFactory *ALCloopbackFactory_getFactory(void);
|
||||
static ALCboolean ALCloopbackFactory_init(ALCloopbackFactory *self);
|
||||
static DECLARE_FORWARD(ALCloopbackFactory, ALCbackendFactory, void, deinit)
|
||||
static ALCboolean ALCloopbackFactory_querySupport(ALCloopbackFactory *self, ALCbackend_Type type);
|
||||
static void ALCloopbackFactory_probe(ALCloopbackFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCloopbackFactory_probe(ALCloopbackFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCloopbackFactory_createBackend(ALCloopbackFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCloopbackFactory);
|
||||
|
||||
@ -111,7 +111,7 @@ static ALCboolean ALCloopbackFactory_querySupport(ALCloopbackFactory* UNUSED(sel
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCloopbackFactory_probe(ALCloopbackFactory* UNUSED(self), enum DevProbe UNUSED(type), al_string* UNUSED(outnames))
|
||||
static void ALCloopbackFactory_probe(ALCloopbackFactory* UNUSED(self), enum DevProbe UNUSED(type), std::string* UNUSED(outnames))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ ALCbackendFactory *ALCnullBackendFactory_getFactory(void);
|
||||
static ALCboolean ALCnullBackendFactory_init(ALCnullBackendFactory *self);
|
||||
static DECLARE_FORWARD(ALCnullBackendFactory, ALCbackendFactory, void, deinit)
|
||||
static ALCboolean ALCnullBackendFactory_querySupport(ALCnullBackendFactory *self, ALCbackend_Type type);
|
||||
static void ALCnullBackendFactory_probe(ALCnullBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCnullBackendFactory_probe(ALCnullBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCnullBackendFactory_createBackend(ALCnullBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCnullBackendFactory);
|
||||
|
||||
@ -214,13 +214,15 @@ static ALCboolean ALCnullBackendFactory_querySupport(ALCnullBackendFactory* UNUS
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCnullBackendFactory_probe(ALCnullBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCnullBackendFactory_probe(ALCnullBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case ALL_DEVICE_PROBE:
|
||||
/* Includes null char. */
|
||||
outnames->append(nullDevice, sizeof(nullDevice));
|
||||
break;
|
||||
case CAPTURE_DEVICE_PROBE:
|
||||
alstr_append_range(outnames, nullDevice, nullDevice+sizeof(nullDevice));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1029,13 +1029,14 @@ static ALCboolean ALCopenslBackendFactory_querySupport(ALCopenslBackendFactory*
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCopenslBackendFactory_probe(ALCopenslBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCopenslBackendFactory_probe(ALCopenslBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case ALL_DEVICE_PROBE:
|
||||
case CAPTURE_DEVICE_PROBE:
|
||||
alstr_append_range(outnames, opensl_device, opensl_device+sizeof(opensl_device));
|
||||
/* Includes null char. */
|
||||
outnames->append(opensl_device, sizeof(opensl_device));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ ALCbackendFactory *ALCossBackendFactory_getFactory(void);
|
||||
static ALCboolean ALCossBackendFactory_init(ALCossBackendFactory *self);
|
||||
static void ALCossBackendFactory_deinit(ALCossBackendFactory *self);
|
||||
static ALCboolean ALCossBackendFactory_querySupport(ALCossBackendFactory *self, ALCbackend_Type type);
|
||||
static void ALCossBackendFactory_probe(ALCossBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCossBackendFactory_probe(ALCossBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCossBackendFactory_createBackend(ALCossBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCossBackendFactory);
|
||||
|
||||
@ -812,7 +812,7 @@ ALCboolean ALCossBackendFactory_querySupport(ALCossBackendFactory* UNUSED(self),
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
void ALCossBackendFactory_probe(ALCossBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
void ALCossBackendFactory_probe(ALCossBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
auto add_device = [outnames](const DevMap &entry) -> void
|
||||
{
|
||||
@ -821,8 +821,8 @@ void ALCossBackendFactory_probe(ALCossBackendFactory* UNUSED(self), enum DevProb
|
||||
if(stat(entry.device_name.c_str(), &buf) == 0)
|
||||
#endif
|
||||
{
|
||||
const char *name{entry.name.c_str()};
|
||||
alstr_append_range(outnames, name, name+entry.name.length()+1);
|
||||
/* Includes null char. */
|
||||
outnames->append(entry.name.c_str(), entry.name.length()+1);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -484,7 +484,7 @@ struct ALCportBackendFactory final : public ALCbackendFactory {
|
||||
static ALCboolean ALCportBackendFactory_init(ALCportBackendFactory *self);
|
||||
static void ALCportBackendFactory_deinit(ALCportBackendFactory *self);
|
||||
static ALCboolean ALCportBackendFactory_querySupport(ALCportBackendFactory *self, ALCbackend_Type type);
|
||||
static void ALCportBackendFactory_probe(ALCportBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCportBackendFactory_probe(ALCportBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCportBackendFactory_createBackend(ALCportBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCportBackendFactory);
|
||||
|
||||
@ -521,13 +521,14 @@ static ALCboolean ALCportBackendFactory_querySupport(ALCportBackendFactory* UNUS
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCportBackendFactory_probe(ALCportBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCportBackendFactory_probe(ALCportBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case ALL_DEVICE_PROBE:
|
||||
case CAPTURE_DEVICE_PROBE:
|
||||
alstr_append_range(outnames, pa_device, pa_device+sizeof(pa_device));
|
||||
/* Includes null char. */
|
||||
outnames->append(pa_device, sizeof(pa_device));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1741,7 +1741,7 @@ struct PulseBackendFactory final : public ALCbackendFactory {
|
||||
static ALCboolean PulseBackendFactory_init(PulseBackendFactory *self);
|
||||
static void PulseBackendFactory_deinit(PulseBackendFactory *self);
|
||||
static ALCboolean PulseBackendFactory_querySupport(PulseBackendFactory *self, ALCbackend_Type type);
|
||||
static void PulseBackendFactory_probe(PulseBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void PulseBackendFactory_probe(PulseBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* PulseBackendFactory_createBackend(PulseBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(PulseBackendFactory);
|
||||
|
||||
@ -1810,16 +1810,14 @@ static ALCboolean PulseBackendFactory_querySupport(PulseBackendFactory* UNUSED(s
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void PulseBackendFactory_probe(PulseBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void PulseBackendFactory_probe(PulseBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
auto add_device = [outnames](const DevMap &entry) -> void
|
||||
{
|
||||
const char *name{entry.name.c_str()};
|
||||
size_t namelen{entry.name.length()};
|
||||
/* +1 to also append the null char (to ensure a null-separated list and
|
||||
* double-null terminated list).
|
||||
*/
|
||||
alstr_append_range(outnames, name, name + namelen+1);
|
||||
outnames->append(entry.name.c_str(), entry.name.length()+1);
|
||||
};
|
||||
switch(type)
|
||||
{
|
||||
|
@ -997,7 +997,7 @@ struct ALCqsaBackendFactory final : public ALCbackendFactory {
|
||||
static ALCboolean ALCqsaBackendFactory_init(ALCqsaBackendFactory* UNUSED(self));
|
||||
static void ALCqsaBackendFactory_deinit(ALCqsaBackendFactory* UNUSED(self));
|
||||
static ALCboolean ALCqsaBackendFactory_querySupport(ALCqsaBackendFactory* UNUSED(self), ALCbackend_Type type);
|
||||
static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames);
|
||||
static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCqsaBackendFactory_createBackend(ALCqsaBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCqsaBackendFactory);
|
||||
|
||||
@ -1029,14 +1029,14 @@ static ALCboolean ALCqsaBackendFactory_querySupport(ALCqsaBackendFactory* UNUSED
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
#define APPEND_OUTNAME(e) do { \
|
||||
const char *n_ = (e)->name; \
|
||||
if(n_ && n_[0]) \
|
||||
alstr_append_range(outnames, n_, n_+strlen(n_)+1); \
|
||||
outnames->append(n_, strlen(n_)+1); \
|
||||
} while(0)
|
||||
case ALL_DEVICE_PROBE:
|
||||
deviceList(SND_PCM_CHANNEL_PLAYBACK, &DeviceNameMap);
|
||||
|
@ -222,7 +222,7 @@ ALCbackendFactory *ALCsdl2BackendFactory_getFactory(void);
|
||||
static ALCboolean ALCsdl2BackendFactory_init(ALCsdl2BackendFactory *self);
|
||||
static void ALCsdl2BackendFactory_deinit(ALCsdl2BackendFactory *self);
|
||||
static ALCboolean ALCsdl2BackendFactory_querySupport(ALCsdl2BackendFactory *self, ALCbackend_Type type);
|
||||
static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCsdl2BackendFactory_createBackend(ALCsdl2BackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCsdl2BackendFactory);
|
||||
|
||||
@ -257,23 +257,21 @@ static ALCboolean ALCsdl2BackendFactory_querySupport(ALCsdl2BackendFactory* UNUS
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
if(type != ALL_DEVICE_PROBE)
|
||||
return;
|
||||
|
||||
int num_devices{SDL_GetNumAudioDevices(SDL_FALSE)};
|
||||
|
||||
alstr_append_range(outnames, defaultDeviceName, defaultDeviceName+sizeof(defaultDeviceName));
|
||||
/* Includes null char. */
|
||||
outnames->append(defaultDeviceName, sizeof(defaultDeviceName));
|
||||
for(int i{0};i < num_devices;++i)
|
||||
{
|
||||
std::string name{DEVNAME_PREFIX};
|
||||
name += SDL_GetAudioDeviceName(i, SDL_FALSE);
|
||||
if(!name.empty())
|
||||
{
|
||||
const char *namestr{name.c_str()};
|
||||
alstr_append_range(outnames, namestr, namestr+name.length()+1);
|
||||
}
|
||||
outnames->append(name.c_str(), name.length()+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ ALCbackendFactory *SndioBackendFactory_getFactory(void);
|
||||
static ALCboolean SndioBackendFactory_init(SndioBackendFactory *self);
|
||||
static DECLARE_FORWARD(SndioBackendFactory, ALCbackendFactory, void, deinit)
|
||||
static ALCboolean SndioBackendFactory_querySupport(SndioBackendFactory *self, ALCbackend_Type type);
|
||||
static void SndioBackendFactory_probe(SndioBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void SndioBackendFactory_probe(SndioBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* SndioBackendFactory_createBackend(SndioBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(SndioBackendFactory);
|
||||
|
||||
@ -571,13 +571,14 @@ static ALCboolean SndioBackendFactory_querySupport(SndioBackendFactory* UNUSED(s
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void SndioBackendFactory_probe(SndioBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void SndioBackendFactory_probe(SndioBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case ALL_DEVICE_PROBE:
|
||||
case CAPTURE_DEVICE_PROBE:
|
||||
alstr_append_range(outnames, sndio_device, sndio_device+sizeof(sndio_device));
|
||||
/* Includes null char. */
|
||||
outnames->append(sndio_device, sizeof(sndio_device));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ ALCbackendFactory *ALCsolarisBackendFactory_getFactory(void);
|
||||
static ALCboolean ALCsolarisBackendFactory_init(ALCsolarisBackendFactory *self);
|
||||
static DECLARE_FORWARD(ALCsolarisBackendFactory, ALCbackendFactory, void, deinit)
|
||||
static ALCboolean ALCsolarisBackendFactory_querySupport(ALCsolarisBackendFactory *self, ALCbackend_Type type);
|
||||
static void ALCsolarisBackendFactory_probe(ALCsolarisBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCsolarisBackendFactory_probe(ALCsolarisBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCsolarisBackendFactory_createBackend(ALCsolarisBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCsolarisBackendFactory);
|
||||
|
||||
@ -330,7 +330,7 @@ static ALCboolean ALCsolarisBackendFactory_querySupport(ALCsolarisBackendFactory
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCsolarisBackendFactory_probe(ALCsolarisBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCsolarisBackendFactory_probe(ALCsolarisBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
@ -340,7 +340,7 @@ static void ALCsolarisBackendFactory_probe(ALCsolarisBackendFactory* UNUSED(self
|
||||
struct stat buf;
|
||||
if(stat(solaris_driver, &buf) == 0)
|
||||
#endif
|
||||
alstr_append_range(outnames, solaris_device, solaris_device+sizeof(solaris_device));
|
||||
outnames->append(solaris_device, sizeof(solaris_device));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1824,7 +1824,7 @@ struct ALCwasapiBackendFactory final : public ALCbackendFactory {
|
||||
static ALCboolean ALCwasapiBackendFactory_init(ALCwasapiBackendFactory *self);
|
||||
static void ALCwasapiBackendFactory_deinit(ALCwasapiBackendFactory *self);
|
||||
static ALCboolean ALCwasapiBackendFactory_querySupport(ALCwasapiBackendFactory *self, ALCbackend_Type type);
|
||||
static void ALCwasapiBackendFactory_probe(ALCwasapiBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCwasapiBackendFactory_probe(ALCwasapiBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCwasapiBackendFactory_createBackend(ALCwasapiBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCwasapiBackendFactory);
|
||||
@ -1880,7 +1880,7 @@ static ALCboolean ALCwasapiBackendFactory_querySupport(ALCwasapiBackendFactory*
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCwasapiBackendFactory_probe(ALCwasapiBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCwasapiBackendFactory_probe(ALCwasapiBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
ThreadRequest req{ nullptr, 0 };
|
||||
|
||||
@ -1891,12 +1891,10 @@ static void ALCwasapiBackendFactory_probe(ALCwasapiBackendFactory* UNUSED(self),
|
||||
{
|
||||
auto add_device = [outnames](const DevMap &entry) -> void
|
||||
{
|
||||
const char *name{entry.name.c_str()};
|
||||
size_t namelen{entry.name.length()};
|
||||
/* +1 to also append the null char (to ensure a null-separated list
|
||||
* and double-null terminated list).
|
||||
*/
|
||||
alstr_append_range(outnames, name, name + namelen+1);
|
||||
outnames->append(entry.name.c_str(), entry.name.length()+1);
|
||||
};
|
||||
HRESULT hr = E_FAIL;
|
||||
if(PostThreadMessage(ThreadID, WM_USER_Enumerate, (WPARAM)&req, type))
|
||||
|
@ -396,7 +396,7 @@ ALCbackendFactory *ALCwaveBackendFactory_getFactory(void);
|
||||
static ALCboolean ALCwaveBackendFactory_init(ALCwaveBackendFactory *self);
|
||||
static DECLARE_FORWARD(ALCwaveBackendFactory, ALCbackendFactory, void, deinit)
|
||||
static ALCboolean ALCwaveBackendFactory_querySupport(ALCwaveBackendFactory *self, ALCbackend_Type type);
|
||||
static void ALCwaveBackendFactory_probe(ALCwaveBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCwaveBackendFactory_probe(ALCwaveBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCwaveBackendFactory_createBackend(ALCwaveBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCwaveBackendFactory);
|
||||
|
||||
@ -419,12 +419,13 @@ static ALCboolean ALCwaveBackendFactory_querySupport(ALCwaveBackendFactory* UNUS
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCwaveBackendFactory_probe(ALCwaveBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCwaveBackendFactory_probe(ALCwaveBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case ALL_DEVICE_PROBE:
|
||||
alstr_append_range(outnames, waveDevice, waveDevice+sizeof(waveDevice));
|
||||
/* Includes null char. */
|
||||
outnames->append(waveDevice, sizeof(waveDevice));
|
||||
break;
|
||||
case CAPTURE_DEVICE_PROBE:
|
||||
break;
|
||||
|
@ -672,7 +672,7 @@ struct ALCwinmmBackendFactory final : public ALCbackendFactory {
|
||||
static ALCboolean ALCwinmmBackendFactory_init(ALCwinmmBackendFactory *self);
|
||||
static void ALCwinmmBackendFactory_deinit(ALCwinmmBackendFactory *self);
|
||||
static ALCboolean ALCwinmmBackendFactory_querySupport(ALCwinmmBackendFactory *self, ALCbackend_Type type);
|
||||
static void ALCwinmmBackendFactory_probe(ALCwinmmBackendFactory *self, enum DevProbe type, al_string *outnames);
|
||||
static void ALCwinmmBackendFactory_probe(ALCwinmmBackendFactory *self, enum DevProbe type, std::string *outnames);
|
||||
static ALCbackend* ALCwinmmBackendFactory_createBackend(ALCwinmmBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||
|
||||
DEFINE_ALCBACKENDFACTORY_VTABLE(ALCwinmmBackendFactory);
|
||||
@ -700,16 +700,15 @@ static ALCboolean ALCwinmmBackendFactory_querySupport(ALCwinmmBackendFactory* UN
|
||||
return ALC_FALSE;
|
||||
}
|
||||
|
||||
static void ALCwinmmBackendFactory_probe(ALCwinmmBackendFactory* UNUSED(self), enum DevProbe type, al_string *outnames)
|
||||
static void ALCwinmmBackendFactory_probe(ALCwinmmBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
|
||||
{
|
||||
auto add_device = [outnames](const std::string &dname) -> void
|
||||
{
|
||||
const char *name{dname.c_str()};
|
||||
size_t namelen{dname.length()};
|
||||
/* +1 to also append the null char (to ensure a null-separated list and
|
||||
* double-null terminated list).
|
||||
*/
|
||||
alstr_append_range(outnames, name, name + namelen+1);
|
||||
if(!dname.empty())
|
||||
outnames->append(dname.c_str(), dname.length()+1);
|
||||
};
|
||||
switch(type)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user