From: <man...@us...> - 2013-11-23 09:28:37
|
Revision: 3296 http://sourceforge.net/p/modplug/code/3296 Author: manxorist Date: 2013-11-23 09:28:26 +0000 (Sat, 23 Nov 2013) Log Message: ----------- [Ref] sounddev: Do not encode whether a device is a default device by appending "(Default)" to the name. Use a separate flag instead. [Ref] WaveOut: Use the system-provided name for the default wave mapper device instead of our own string. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-11-23 08:59:55 UTC (rev 3295) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-11-23 09:28:26 UTC (rev 3296) @@ -275,6 +275,10 @@ cbi.iImage = IMAGE_WAVEOUT; break; } + if(it->isDefault) + { + name += " (Default)"; + } cbi.iSelectedImage = cbi.iImage; cbi.iOverlay = cbi.iImage; cbi.iIndent = 0; Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2013-11-23 08:59:55 UTC (rev 3295) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2013-11-23 09:28:26 UTC (rev 3296) @@ -440,12 +440,14 @@ std::wstring name; std::wstring apiName; std::wstring internalID; + bool isDefault; SoundDeviceInfo() : id(SNDDEV_INVALID, 0) { } SoundDeviceInfo(SoundDeviceID id, const std::wstring &name, const std::wstring &apiName, const std::wstring &internalID = std::wstring()) : id(id) , name(name) , apiName(apiName) , internalID(internalID) + , isDefault(false) { return; } Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-11-23 08:59:55 UTC (rev 3295) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-11-23 09:28:26 UTC (rev 3296) @@ -322,8 +322,9 @@ if(!Pa_GetDeviceInfo(dev)) return false; result.id = SoundDeviceID(HostApiToSndDevType(hostapi), index); - result.name = mpt::ToWide(mpt::CharsetUTF8, std::string(Pa_GetDeviceInfo(dev)->name) + std::string(Pa_GetHostApiInfo(Pa_GetDeviceInfo(dev)->hostApi)->defaultOutputDevice == (PaDeviceIndex)dev ? " (Default)" : "")); + result.name = mpt::ToWide(mpt::CharsetUTF8, Pa_GetDeviceInfo(dev)->name); result.apiName = mpt::ToWide(mpt::CharsetUTF8, HostApiToString(Pa_GetDeviceInfo(dev)->hostApi)); + result.isDefault = (Pa_GetHostApiInfo(Pa_GetDeviceInfo(dev)->hostApi)->defaultOutputDevice == (PaDeviceIndex)dev); return true; } Modified: trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp 2013-11-23 08:59:55 UTC (rev 3295) +++ trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp 2013-11-23 09:28:26 UTC (rev 3296) @@ -244,15 +244,24 @@ SoundDeviceInfo info; info.id = SoundDeviceID(SNDDEV_WAVEOUT, static_cast<SoundDeviceIndex>(index)); info.apiName = L"WaveOut"; + WAVEOUTCAPSW woc; + MemsetZero(woc); if(index == 0) { - info.name = L"Auto (Wave Mapper)"; + if(waveOutGetDevCapsW(WAVE_MAPPER, &woc, sizeof(woc)) == MMSYSERR_NOERROR) + { + info.name = woc.szPname; + } else + { + info.name = L"Auto (Wave Mapper)"; + } + info.isDefault = true; } else { - WAVEOUTCAPSW woc; - MemsetZero(woc); - waveOutGetDevCapsW(index-1, &woc, sizeof(woc)); - info.name = woc.szPname; + if(waveOutGetDevCapsW(index-1, &woc, sizeof(woc)) == MMSYSERR_NOERROR) + { + info.name = woc.szPname; + } } devices.push_back(info); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |