aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-09-10 22:15:40 -0700
committerChris Robinson <[email protected]>2015-09-10 22:15:40 -0700
commit87f3babe2ceb3e7223a82c487111a15c24a9e8a9 (patch)
tree5730286f4b53d26e3ffbd29cc1b14ff4bdb24a49 /Alc/backends
parent9469c4c79b8dd683f8f9c53239701b15bdbfc22d (diff)
Append "on OpenAL Soft" to mmdevapi, dsound, and winmm device names
Would be nicer to have a more backend-agnostic method of doing this, Perhaps even also only when the router is being used.
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/dsound.c11
-rw-r--r--Alc/backends/mmdevapi.c17
-rw-r--r--Alc/backends/winmm.c50
3 files changed, 46 insertions, 32 deletions
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index 174cc42f..4db4b557 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -60,6 +60,8 @@
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+#define DEVNAME_TAIL " on OpenAL Soft"
+
#ifdef HAVE_DYNLOAD
static void *ds_handle;
@@ -144,17 +146,18 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA
const DevMap *iter;
al_string_copy_wcstr(&entry.name, desc);
- if(count != 0)
+ if(count == 0)
+ al_string_append_cstr(&entry.name, DEVNAME_TAIL);
+ else
{
char str[64];
- snprintf(str, sizeof(str), " #%d", count+1);
+ snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1);
al_string_append_cstr(&entry.name, str);
}
#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0)
VECTOR_FIND_IF(iter, const DevMap, *devices, MATCH_ENTRY);
- if(iter == VECTOR_ITER_END(*devices))
- break;
+ if(iter == VECTOR_ITER_END(*devices)) break;
#undef MATCH_ENTRY
count++;
}
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index c5ac8512..a6a12980 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -62,6 +62,8 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_FormFactor, 0x1da5d803, 0xd492, 0x4edd, 0x
#define X7DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)
#define X7DOT1_WIDE (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_FRONT_LEFT_OF_CENTER|SPEAKER_FRONT_RIGHT_OF_CENTER)
+#define DEVNAME_TAIL " on OpenAL Soft"
+
typedef struct {
al_string name;
@@ -191,17 +193,18 @@ static void add_device(IMMDevice *device, LPCWSTR devid, vector_DevMap *list)
const DevMap *iter;
al_string_copy(&entry.name, tmpname);
- if(count != 0)
+ if(count == 0)
+ al_string_append_cstr(&entry.name, DEVNAME_TAIL);
+ else
{
char str[64];
- snprintf(str, sizeof(str), " #%d", count+1);
+ snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1);
al_string_append_cstr(&entry.name, str);
}
#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0)
VECTOR_FIND_IF(iter, const DevMap, *list, MATCH_ENTRY);
- if(iter == VECTOR_ITER_END(*list))
- break;
+ if(iter == VECTOR_ITER_END(*list)) break;
#undef MATCH_ENTRY
count++;
}
@@ -752,7 +755,10 @@ static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self)
{
self->client = ptr;
if(al_string_empty(device->DeviceName))
+ {
get_device_name(self->mmdev, &device->DeviceName);
+ al_string_append_cstr(&device->DeviceName, DEVNAME_TAIL);
+ }
}
if(FAILED(hr))
@@ -1406,7 +1412,10 @@ static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self)
{
self->client = ptr;
if(al_string_empty(device->DeviceName))
+ {
get_device_name(self->mmdev, &device->DeviceName);
+ al_string_append_cstr(&device->DeviceName, DEVNAME_TAIL);
+ }
}
if(FAILED(hr))
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index e4ea151e..0839818e 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -37,6 +37,8 @@
#define WAVE_FORMAT_IEEE_FLOAT 0x0003
#endif
+#define DEVNAME_TAIL " on OpenAL Soft"
+
TYPEDEF_VECTOR(al_string, vector_al_string)
static vector_al_string PlaybackDevices;
@@ -51,7 +53,6 @@ static void clear_devlist(vector_al_string *list)
static void ProbePlaybackDevices(void)
{
- al_string *iter, *end;
ALuint numdevs;
ALuint i;
@@ -62,30 +63,31 @@ static void ProbePlaybackDevices(void)
for(i = 0;i < numdevs;i++)
{
WAVEOUTCAPSW WaveCaps;
+ const al_string *iter;
al_string dname;
AL_STRING_INIT(dname);
if(waveOutGetDevCapsW(i, &WaveCaps, sizeof(WaveCaps)) == MMSYSERR_NOERROR)
{
ALuint count = 0;
- do {
+ while(1)
+ {
al_string_copy_wcstr(&dname, WaveCaps.szPname);
- if(count != 0)
+ if(count == 0)
+ al_string_append_cstr(&dname, DEVNAME_TAIL);
+ else
{
char str[64];
- snprintf(str, sizeof(str), " #%d", count+1);
+ snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1);
al_string_append_cstr(&dname, str);
}
count++;
- iter = VECTOR_ITER_BEGIN(PlaybackDevices);
- end = VECTOR_ITER_END(PlaybackDevices);
- for(;iter != end;iter++)
- {
- if(al_string_cmp(*iter, dname) == 0)
- break;
- }
- } while(iter != end);
+#define MATCH_ENTRY(i) (al_string_cmp(dname, *(i)) == 0)
+ VECTOR_FIND_IF(iter, const al_string, PlaybackDevices, MATCH_ENTRY);
+ if(iter == VECTOR_ITER_END(PlaybackDevices)) break;
+#undef MATCH_ENTRY
+ }
TRACE("Got device \"%s\", ID %u\n", al_string_get_cstr(dname), i);
}
@@ -95,7 +97,6 @@ static void ProbePlaybackDevices(void)
static void ProbeCaptureDevices(void)
{
- al_string *iter, *end;
ALuint numdevs;
ALuint i;
@@ -106,30 +107,31 @@ static void ProbeCaptureDevices(void)
for(i = 0;i < numdevs;i++)
{
WAVEINCAPSW WaveCaps;
+ const al_string *iter;
al_string dname;
AL_STRING_INIT(dname);
if(waveInGetDevCapsW(i, &WaveCaps, sizeof(WaveCaps)) == MMSYSERR_NOERROR)
{
ALuint count = 0;
- do {
+ while(1)
+ {
al_string_copy_wcstr(&dname, WaveCaps.szPname);
- if(count != 0)
+ if(count == 0)
+ al_string_append_cstr(&dname, DEVNAME_TAIL);
+ else
{
char str[64];
- snprintf(str, sizeof(str), " #%d", count+1);
+ snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1);
al_string_append_cstr(&dname, str);
}
count++;
- iter = VECTOR_ITER_BEGIN(CaptureDevices);
- end = VECTOR_ITER_END(CaptureDevices);
- for(;iter != end;iter++)
- {
- if(al_string_cmp(*iter, dname) == 0)
- break;
- }
- } while(iter != end);
+#define MATCH_ENTRY(i) (al_string_cmp(dname, *(i)) == 0)
+ VECTOR_FIND_IF(iter, const al_string, CaptureDevices, MATCH_ENTRY);
+ if(iter == VECTOR_ITER_END(CaptureDevices)) break;
+#undef MATCH_ENTRY
+ }
TRACE("Got device \"%s\", ID %u\n", al_string_get_cstr(dname), i);
}