aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-02 14:56:10 -0700
committerChris Robinson <[email protected]>2018-11-02 14:56:10 -0700
commita7dcc1c6d107e5c5401151c50c89e137f2bb0c0b (patch)
tree832dabd7e2eb843313cd3c93934744589053a427 /Alc/backends
parentb54c4b02c796a1762705f51985c467a041f2d579 (diff)
Expand the anonymous namespaces
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/pulseaudio.cpp32
-rw-r--r--Alc/backends/wasapi.cpp27
2 files changed, 28 insertions, 31 deletions
diff --git a/Alc/backends/pulseaudio.cpp b/Alc/backends/pulseaudio.cpp
index 719205c4..e2845032 100644
--- a/Alc/backends/pulseaudio.cpp
+++ b/Alc/backends/pulseaudio.cpp
@@ -41,9 +41,11 @@
#if PA_API_VERSION == 12
+namespace {
+
#ifdef HAVE_DYNLOAD
-static void *pa_handle;
-#define MAKE_FUNC(x) static decltype(x) * p##x
+void *pa_handle;
+#define MAKE_FUNC(x) decltype(x) * p##x
MAKE_FUNC(pa_context_unref);
MAKE_FUNC(pa_sample_spec_valid);
MAKE_FUNC(pa_frame_size);
@@ -185,7 +187,7 @@ MAKE_FUNC(pa_stream_begin_write);
#endif
-static ALCboolean pulse_load(void)
+ALCboolean pulse_load(void)
{
ALCboolean ret{ALC_TRUE};
#ifdef HAVE_DYNLOAD
@@ -312,8 +314,6 @@ inline pa_context_flags_t operator|=(pa_context_flags_t &lhs, pa_context_flags_t
}
-namespace {
-
class palock_guard {
pa_threaded_mainloop *mLoop;
@@ -363,16 +363,14 @@ public:
}
};
-} // namespace
-
/* Global flags and properties */
-static pa_context_flags_t pulse_ctx_flags;
-static pa_proplist *prop_filter;
+pa_context_flags_t pulse_ctx_flags;
+pa_proplist *prop_filter;
/* PulseAudio Event Callbacks */
-static void context_state_callback(pa_context *context, void *pdata)
+void context_state_callback(pa_context *context, void *pdata)
{
auto loop = reinterpret_cast<pa_threaded_mainloop*>(pdata);
pa_context_state_t state{pa_context_get_state(context)};
@@ -380,7 +378,7 @@ static void context_state_callback(pa_context *context, void *pdata)
pa_threaded_mainloop_signal(loop, 0);
}
-static void stream_state_callback(pa_stream *stream, void *pdata)
+void stream_state_callback(pa_stream *stream, void *pdata)
{
auto loop = reinterpret_cast<pa_threaded_mainloop*>(pdata);
pa_stream_state_t state{pa_stream_get_state(stream)};
@@ -388,13 +386,13 @@ static void stream_state_callback(pa_stream *stream, void *pdata)
pa_threaded_mainloop_signal(loop, 0);
}
-static void stream_success_callback(pa_stream *UNUSED(stream), int UNUSED(success), void *pdata)
+void stream_success_callback(pa_stream *UNUSED(stream), int UNUSED(success), void *pdata)
{
auto loop = reinterpret_cast<pa_threaded_mainloop*>(pdata);
pa_threaded_mainloop_signal(loop, 0);
}
-static void wait_for_operation(pa_operation *op, pa_threaded_mainloop *loop)
+void wait_for_operation(pa_operation *op, pa_threaded_mainloop *loop)
{
if(op)
{
@@ -405,7 +403,7 @@ static void wait_for_operation(pa_operation *op, pa_threaded_mainloop *loop)
}
-static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent)
+pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent)
{
const char *name{"OpenAL Soft"};
al_string binname{AL_STRING_INIT_STATIC()};
@@ -456,7 +454,7 @@ static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent)
using MainloopContextPair = std::pair<pa_threaded_mainloop*,pa_context*>;
-static MainloopContextPair pulse_open(void(*state_cb)(pa_context*,void*), void *ptr)
+MainloopContextPair pulse_open(void(*state_cb)(pa_context*,void*), void *ptr)
{
pa_threaded_mainloop *loop{pa_threaded_mainloop_new()};
if(UNLIKELY(!loop))
@@ -484,7 +482,7 @@ static MainloopContextPair pulse_open(void(*state_cb)(pa_context*,void*), void *
return {loop, context};
}
-static void pulse_close(pa_threaded_mainloop *loop, pa_context *context, pa_stream *stream)
+void pulse_close(pa_threaded_mainloop *loop, pa_context *context, pa_stream *stream)
{
{ palock_guard _{loop};
if(stream)
@@ -506,8 +504,6 @@ static void pulse_close(pa_threaded_mainloop *loop, pa_context *context, pa_stre
}
-namespace {
-
struct DevMap {
std::string name;
std::string device_name;
diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp
index 8310974f..2dc44c87 100644
--- a/Alc/backends/wasapi.cpp
+++ b/Alc/backends/wasapi.cpp
@@ -69,6 +69,9 @@ DEFINE_DEVPROPKEY(DEVPKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80,
DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_FormFactor, 0x1da5d803, 0xd492, 0x4edd, 0x8c,0x23, 0xe0,0xc0,0xff,0xee,0x7f,0x0e, 0);
DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23,0xe0, 0xc0,0xff,0xee,0x7f,0x0e, 4 );
+
+namespace {
+
#define MONO SPEAKER_FRONT_CENTER
#define STEREO (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT)
#define QUAD (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT)
@@ -84,14 +87,12 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x
/* Scales the given value using 64-bit integer math, ceiling the result. */
-static inline ALint64 ScaleCeil(ALint64 val, ALint64 new_scale, ALint64 old_scale)
+inline ALint64 ScaleCeil(ALint64 val, ALint64 new_scale, ALint64 old_scale)
{
return (val*new_scale + old_scale-1) / old_scale;
}
-namespace {
-
struct PropVariant {
PROPVARIANT mProp;
@@ -159,8 +160,6 @@ struct ThreadRequest {
HRESULT result;
};
-} // namespace
-
#define WM_USER_First (WM_USER+0)
#define WM_USER_OpenDevice (WM_USER+0)
@@ -180,13 +179,13 @@ static const char MessageStr[WM_USER_Last+1-WM_USER][20] = {
"Enumerate Devices",
};
-static inline void ReturnMsgResponse(ThreadRequest *req, HRESULT res)
+inline void ReturnMsgResponse(ThreadRequest *req, HRESULT res)
{
req->result = res;
SetEvent(req->FinishedEvt);
}
-static HRESULT WaitForResponse(ThreadRequest *req)
+HRESULT WaitForResponse(ThreadRequest *req)
{
if(WaitForSingleObject(req->FinishedEvt, INFINITE) == WAIT_OBJECT_0)
return req->result;
@@ -196,7 +195,7 @@ static HRESULT WaitForResponse(ThreadRequest *req)
using NameGUIDPair = std::pair<std::string,std::string>;
-static NameGUIDPair get_device_name_and_guid(IMMDevice *device)
+NameGUIDPair get_device_name_and_guid(IMMDevice *device)
{
std::string name{DEVNAME_HEAD};
std::string guid;
@@ -244,7 +243,7 @@ static NameGUIDPair get_device_name_and_guid(IMMDevice *device)
return {name, guid};
}
-static void get_device_formfactor(IMMDevice *device, EndpointFormFactor *formfactor)
+void get_device_formfactor(IMMDevice *device, EndpointFormFactor *formfactor)
{
IPropertyStore *ps;
HRESULT hr = device->OpenPropertyStore(STGM_READ, &ps);
@@ -269,7 +268,7 @@ static void get_device_formfactor(IMMDevice *device, EndpointFormFactor *formfac
}
-static void add_device(IMMDevice *device, const WCHAR *devid, std::vector<DevMap> &list)
+void add_device(IMMDevice *device, const WCHAR *devid, std::vector<DevMap> &list)
{
std::string basename, guidstr;
std::tie(basename, guidstr) = get_device_name_and_guid(device);
@@ -289,7 +288,7 @@ static void add_device(IMMDevice *device, const WCHAR *devid, std::vector<DevMap
newentry.endpoint_guid.c_str(), newentry.devid.c_str());
}
-static WCHAR *get_device_id(IMMDevice *device)
+WCHAR *get_device_id(IMMDevice *device)
{
WCHAR *devid;
@@ -303,7 +302,7 @@ static WCHAR *get_device_id(IMMDevice *device)
return devid;
}
-static HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, std::vector<DevMap> &list)
+HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, std::vector<DevMap> &list)
{
IMMDeviceCollection *coll;
HRESULT hr = devenum->EnumAudioEndpoints(flowdir, DEVICE_STATE_ACTIVE, &coll);
@@ -365,7 +364,7 @@ struct WasapiProxy {
virtual void stopProxy() = 0;
};
-static DWORD CALLBACK WasapiProxy_messageHandler(void *ptr)
+DWORD CALLBACK WasapiProxy_messageHandler(void *ptr)
{
auto req = reinterpret_cast<ThreadRequest*>(ptr);
@@ -507,6 +506,8 @@ static DWORD CALLBACK WasapiProxy_messageHandler(void *ptr)
return 0;
}
+} // namespace
+
struct ALCwasapiPlayback final : public ALCbackend, WasapiProxy {
HRESULT openProxy() override;