mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
- consider the volume control of all Windows MIDI mapper devices broken, because it may be the GS synth, which is not detectable.
This commit is contained in:
parent
c681d6eff0
commit
66b5c26352
1 changed files with 28 additions and 14 deletions
|
@ -659,33 +659,47 @@ void CALLBACK WinMIDIDevice::CallbackFunc(HMIDIOUT hOut, UINT uMsg, DWORD_PTR dw
|
||||||
|
|
||||||
static bool IgnoreMIDIVolume(UINT id)
|
static bool IgnoreMIDIVolume(UINT id)
|
||||||
{
|
{
|
||||||
#ifndef __GNUC__
|
|
||||||
MIDIOUTCAPS caps;
|
MIDIOUTCAPS caps;
|
||||||
|
bool mustcheck = false;
|
||||||
|
|
||||||
if (MMSYSERR_NOERROR == midiOutGetDevCaps(id, &caps, sizeof(caps)))
|
if (MMSYSERR_NOERROR == midiOutGetDevCaps(id, &caps, sizeof(caps)))
|
||||||
{
|
{
|
||||||
|
if (caps.wTechnology == MIDIDEV_MAPPER)
|
||||||
|
{
|
||||||
|
// We cannot determine what this is so we have to assume the worst, as the default
|
||||||
|
// devive's volume control is irreparably broken.
|
||||||
|
mustcheck = true;
|
||||||
|
}
|
||||||
// The Microsoft GS Wavetable Synth advertises itself as MIDIDEV_SWSYNTH with a VOLUME control.
|
// The Microsoft GS Wavetable Synth advertises itself as MIDIDEV_SWSYNTH with a VOLUME control.
|
||||||
// If the one we're using doesn't match that, we don't need to bother checking the name.
|
// If the one we're using doesn't match that, we don't need to bother checking the name.
|
||||||
if (caps.wTechnology == MIDIDEV_SWSYNTH && (caps.dwSupport & MIDICAPS_VOLUME))
|
if (caps.wTechnology == MIDIDEV_SWSYNTH && (caps.dwSupport & MIDICAPS_VOLUME))
|
||||||
{
|
{
|
||||||
if (strncmp(caps.szPname, "Microsoft GS", 12) == 0)
|
if (strncmp(caps.szPname, "Microsoft GS", 12) == 0)
|
||||||
{
|
{
|
||||||
IMMDeviceEnumerator *enumerator;
|
mustcheck = true;
|
||||||
|
|
||||||
// Now try to create an IMMDeviceEnumerator interface. If it succeeds,
|
|
||||||
// we know we're using the new audio stack introduced with Vista and
|
|
||||||
// should ignore this MIDI device's volume control.
|
|
||||||
if (SUCCEEDED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL,
|
|
||||||
__uuidof(IMMDeviceEnumerator), (void**)&enumerator))
|
|
||||||
&& enumerator != nullptr)
|
|
||||||
{
|
|
||||||
enumerator->Release();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (mustcheck)
|
||||||
|
{
|
||||||
|
#ifndef __GNUC__
|
||||||
|
IMMDeviceEnumerator *enumerator;
|
||||||
|
|
||||||
|
// Now try to create an IMMDeviceEnumerator interface. If it succeeds,
|
||||||
|
// we know we're using the new audio stack introduced with Vista and
|
||||||
|
// should ignore this MIDI device's volume control.
|
||||||
|
if (SUCCEEDED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL,
|
||||||
|
__uuidof(IMMDeviceEnumerator), (void**)&enumerator))
|
||||||
|
&& enumerator != nullptr)
|
||||||
|
{
|
||||||
|
enumerator->Release();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// assume the worst and consider volume control broken.
|
||||||
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue