diff options
author | Chris Robinson <[email protected]> | 2015-12-04 15:52:43 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-12-04 15:52:43 -0800 |
commit | e45ff473618f3400def59fc3a06cec9fdc62452b (patch) | |
tree | b1163f1e3c195098424652b5c061df3c7ed2d292 /Alc/backends | |
parent | 63567526b0a17449baf57053d11688aa277a7e40 (diff) |
Reformat Windows device name dressing
Diffstat (limited to 'Alc/backends')
-rw-r--r-- | Alc/backends/dsound.c | 11 | ||||
-rw-r--r-- | Alc/backends/mmdevapi.c | 25 | ||||
-rw-r--r-- | Alc/backends/winmm.c | 20 |
3 files changed, 27 insertions, 29 deletions
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c index 4db4b557..f27ab37b 100644 --- a/Alc/backends/dsound.c +++ b/Alc/backends/dsound.c @@ -60,7 +60,7 @@ 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" +#define DEVNAME_HEAD "OpenAL Soft on " #ifdef HAVE_DYNLOAD @@ -145,13 +145,12 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA { const DevMap *iter; - al_string_copy_wcstr(&entry.name, desc); - if(count == 0) - al_string_append_cstr(&entry.name, DEVNAME_TAIL); - else + al_string_copy_cstr(&entry.name, DEVNAME_HEAD); + al_string_append_wcstr(&entry.name, desc); + if(count != 0) { char str[64]; - snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1); + snprintf(str, sizeof(str), " #%d", count+1); al_string_append_cstr(&entry.name, str); } diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c index e8563d33..0134a46c 100644 --- a/Alc/backends/mmdevapi.c +++ b/Alc/backends/mmdevapi.c @@ -62,7 +62,7 @@ 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" +#define DEVNAME_HEAD "OpenAL Soft on " typedef struct { @@ -125,10 +125,13 @@ static void get_device_name(IMMDevice *device, al_string *name) PROPVARIANT pvname; HRESULT hr; + al_string_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"); return; } @@ -136,11 +139,17 @@ static void get_device_name(IMMDevice *device, al_string *name) hr = IPropertyStore_GetValue(ps, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pvname); if(FAILED(hr)) + { WARN("GetValue Device_FriendlyName failed: 0x%08lx\n", hr); + al_string_append_cstr(name, "Unknown Device Name"); + } else if(pvname.vt == VT_LPWSTR) - al_string_copy_wcstr(name, pvname.pwszVal); + al_string_append_wcstr(name, pvname.pwszVal); else + { WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvname.vt); + al_string_append_cstr(name, "Unknown Device Name"); + } PropVariantClear(&pvname); IPropertyStore_Release(ps); @@ -193,12 +202,10 @@ static void add_device(IMMDevice *device, LPCWSTR devid, vector_DevMap *list) const DevMap *iter; al_string_copy(&entry.name, tmpname); - if(count == 0) - al_string_append_cstr(&entry.name, DEVNAME_TAIL); - else + if(count != 0) { char str[64]; - snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1); + snprintf(str, sizeof(str), " #%d", count+1); al_string_append_cstr(&entry.name, str); } @@ -755,10 +762,7 @@ 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)) @@ -1412,10 +1416,7 @@ 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 bf97ef2e..3508ec49 100644 --- a/Alc/backends/winmm.c +++ b/Alc/backends/winmm.c @@ -37,7 +37,7 @@ #define WAVE_FORMAT_IEEE_FLOAT 0x0003 #endif -#define DEVNAME_TAIL " on OpenAL Soft" +#define DEVNAME_HEAD "OpenAL Soft on " static vector_al_string PlaybackDevices; @@ -71,13 +71,12 @@ static void ProbePlaybackDevices(void) ALuint count = 0; while(1) { - al_string_copy_wcstr(&dname, WaveCaps.szPname); - if(count == 0) - al_string_append_cstr(&dname, DEVNAME_TAIL); - else + al_string_copy_cstr(&dname, DEVNAME_HEAD); + al_string_append_wcstr(&dname, WaveCaps.szPname); + if(count != 0) { char str[64]; - snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1); + snprintf(str, sizeof(str), " #%d", count+1); al_string_append_cstr(&dname, str); } count++; @@ -115,13 +114,12 @@ static void ProbeCaptureDevices(void) ALuint count = 0; while(1) { - al_string_copy_wcstr(&dname, WaveCaps.szPname); - if(count == 0) - al_string_append_cstr(&dname, DEVNAME_TAIL); - else + al_string_copy_cstr(&dname, DEVNAME_HEAD); + al_string_append_wcstr(&dname, WaveCaps.szPname); + if(count != 0) { char str[64]; - snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1); + snprintf(str, sizeof(str), " #%d", count+1); al_string_append_cstr(&dname, str); } count++; |