From: <man...@us...> - 2015-05-04 08:01:22
|
Revision: 5041 http://sourceforge.net/p/modplug/code/5041 Author: manxorist Date: 2015-05-04 08:01:15 +0000 (Mon, 04 May 2015) Log Message: ----------- [Mod] sounddev: Remove [Sound Settings]Enable* hidden settings. Allow switching off individual sound device backends via Components.Block* instead. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp trunk/OpenMPT/sounddev/SoundDeviceASIO.h trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp trunk/OpenMPT/sounddev/SoundDeviceDirectSound.h trunk/OpenMPT/sounddev/SoundDeviceManager.cpp trunk/OpenMPT/sounddev/SoundDeviceManager.h trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp trunk/OpenMPT/sounddev/SoundDeviceWaveout.h Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2015-05-04 08:01:15 UTC (rev 5041) @@ -201,7 +201,7 @@ delete CMainFrame::GetMainFrame()->gpSoundDevice; CMainFrame::GetMainFrame()->gpSoundDevice = nullptr; } - theApp.GetSoundDevicesManager()->ReEnumerate(TrackerSettings::Instance().GetEnabledSoundDeviceTypes()); + theApp.GetSoundDevicesManager()->ReEnumerate(); SetDevice(m_CurrentDeviceInfo.GetIdentifier(), true); UpdateEverything(); } Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2015-05-04 08:01:15 UTC (rev 5041) @@ -999,7 +999,7 @@ m_pMainWnd->DragAcceptFiles(); // Load sound APIs - m_pSoundDevicesManager = new SoundDevice::Manager(SoundDevice::AppInfo().SetName(MPT_USTRING("OpenMPT")).SetHWND(*m_pMainWnd), TrackerSettings::Instance().GetEnabledSoundDeviceTypes()); + m_pSoundDevicesManager = new SoundDevice::Manager(SoundDevice::AppInfo().SetName(MPT_USTRING("OpenMPT")).SetHWND(*m_pMainWnd)); if(TrackerSettings::Instance().m_SoundDeviceSettingsUseOldDefaults) { // get the old default device Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2015-05-04 08:01:15 UTC (rev 5041) @@ -725,19 +725,6 @@ } -SoundDevice::TypesSet TrackerSettings::GetEnabledSoundDeviceTypes() const -//----------------------------------------------------------------------- -{ - SoundDevice::TypesSet result; - for(int i = 0; i < SoundDevice::TypeNUM_DEVTYPES; ++i) - { - SoundDevice::Type type = static_cast<SoundDevice::Type>(i); - result[i] = conf.Read<bool>(MPT_USTRING("Sound Settings"), MPT_USTRING("Enable") + SoundDevice::TypeToString(type, true), true); - } - return result; -} - - MixerSettings TrackerSettings::GetMixerSettings() const //----------------------------------------------------- { Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2015-05-04 08:01:15 UTC (rev 5041) @@ -453,8 +453,6 @@ SoundDevice::Settings GetSoundDeviceSettings(const SoundDevice::Identifier &device) const; void SetSoundDeviceSettings(const SoundDevice::Identifier &device, const SoundDevice::Settings &settings); - SoundDevice::TypesSet GetEnabledSoundDeviceTypes() const; - Setting<uint32> MixerMaxChannels; Setting<uint32> MixerDSPMask; Setting<uint32> MixerFlags; Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2015-05-04 08:01:15 UTC (rev 5041) @@ -31,6 +31,9 @@ #ifndef NO_ASIO +MPT_REGISTERED_COMPONENT(ComponentASIO) + + static const double AsioSampleRateTolerance = 0.05; Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2015-05-04 08:01:15 UTC (rev 5041) @@ -13,6 +13,8 @@ #include "SoundDevice.h" +#include "../common/ComponentManager.h" + #include "../common/FlagSet.h" #ifndef NO_ASIO @@ -30,6 +32,16 @@ #ifndef NO_ASIO +class ComponentASIO : public ComponentBuiltin +{ + MPT_DECLARE_COMPONENT_MEMBERS +public: + ComponentASIO() { } + virtual ~ComponentASIO() { } + std::string GetSettingsKey() const { return "ASIO"; } + virtual bool DoInitialize() { return true; } +}; + enum AsioFeatures { AsioFeatureResetRequest = 1<<0, Modified: trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp 2015-05-04 08:01:15 UTC (rev 5041) @@ -34,6 +34,9 @@ #ifndef NO_DSOUND +MPT_REGISTERED_COMPONENT(ComponentDirectSound) + + static BOOL WINAPI DSEnumCallbackW(GUID * lpGuid, LPCWSTR lpstrDescription, LPCWSTR, LPVOID lpContext) //---------------------------------------------------------------------------------------------------- { Modified: trunk/OpenMPT/sounddev/SoundDeviceDirectSound.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceDirectSound.h 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/sounddev/SoundDeviceDirectSound.h 2015-05-04 08:01:15 UTC (rev 5041) @@ -14,6 +14,8 @@ #include "SoundDevice.h" #include "SoundDeviceUtilities.h" +#include "../common/ComponentManager.h" + #ifndef NO_DSOUND #include <dsound.h> #endif @@ -29,6 +31,16 @@ #ifndef NO_DSOUND +class ComponentDirectSound : public ComponentBuiltin +{ + MPT_DECLARE_COMPONENT_MEMBERS +public: + ComponentDirectSound() { } + virtual ~ComponentDirectSound() { } + std::string GetSettingsKey() const { return "DirectSound"; } + virtual bool DoInitialize() { return true; } +}; + //================================================ class CDSoundDevice: public CSoundDeviceWithThread //================================================ Modified: trunk/OpenMPT/sounddev/SoundDeviceManager.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceManager.cpp 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/sounddev/SoundDeviceManager.cpp 2015-05-04 08:01:15 UTC (rev 5041) @@ -25,15 +25,15 @@ namespace SoundDevice { - + /////////////////////////////////////////////////////////////////////////////////////// // // Global Functions // -void Manager::ReEnumerate(SoundDevice::TypesSet enabledTypes) -//----------------------------------------------------------- +void Manager::ReEnumerate() +//------------------------- { m_SoundDevices.clear(); m_DeviceUnavailable.clear(); @@ -47,25 +47,27 @@ } #endif // NO_PORTAUDIO - if(enabledTypes[SoundDevice::TypeWAVEOUT]) + if(IsComponentAvailable(m_WaveOut)) { const std::vector<SoundDevice::Info> infos = CWaveDevice::EnumerateDevices(); m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } + #ifndef NO_ASIO - if(enabledTypes[SoundDevice::TypeASIO]) + if(IsComponentAvailable(m_ASIO)) { const std::vector<SoundDevice::Info> infos = CASIODevice::EnumerateDevices(); m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } #endif // NO_ASIO + #ifndef NO_PORTAUDIO - if(IsComponentAvailable(m_PortAudio) && enabledTypes[SoundDevice::TypePORTAUDIO_WASAPI]) + if(IsComponentAvailable(m_PortAudio)) { const std::vector<SoundDevice::Info> infos = CPortaudioDevice::EnumerateDevices(TypePORTAUDIO_WASAPI); m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } - if(IsComponentAvailable(m_PortAudio) && enabledTypes[SoundDevice::TypePORTAUDIO_WDMKS]) + if(IsComponentAvailable(m_PortAudio)) { const std::vector<SoundDevice::Info> infos = CPortaudioDevice::EnumerateDevices(TypePORTAUDIO_WDMKS); m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); @@ -74,7 +76,7 @@ // kind of deprecated by now #ifndef NO_DSOUND - if(enabledTypes[SoundDevice::TypeDSOUND]) + if(IsComponentAvailable(m_DirectSound)) { const std::vector<SoundDevice::Info> infos = CDSoundDevice::EnumerateDevices(); m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); @@ -83,17 +85,17 @@ // duplicate devices, only used if [Sound Settings]MorePortaudio=1 #ifndef NO_PORTAUDIO - if(IsComponentAvailable(m_PortAudio) && enabledTypes[SoundDevice::TypePORTAUDIO_WMME]) + if(IsComponentAvailable(m_PortAudio)) { const std::vector<SoundDevice::Info> infos = CPortaudioDevice::EnumerateDevices(TypePORTAUDIO_WMME); m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } - if(IsComponentAvailable(m_PortAudio) && enabledTypes[SoundDevice::TypePORTAUDIO_ASIO]) + if(IsComponentAvailable(m_PortAudio)) { const std::vector<SoundDevice::Info> infos = CPortaudioDevice::EnumerateDevices(TypePORTAUDIO_ASIO); m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); } - if(IsComponentAvailable(m_PortAudio) && enabledTypes[SoundDevice::TypePORTAUDIO_DS]) + if(IsComponentAvailable(m_PortAudio)) { const std::vector<SoundDevice::Info> infos = CPortaudioDevice::EnumerateDevices(TypePORTAUDIO_DS); m_SoundDevices.insert(m_SoundDevices.end(), infos.begin(), infos.end()); @@ -343,11 +345,11 @@ } -Manager::Manager(SoundDevice::AppInfo appInfo, SoundDevice::TypesSet enabledTypes) -//-------------------------------------------------------------------------------- +Manager::Manager(SoundDevice::AppInfo appInfo) +//-------------------------------------------- : m_AppInfo(appInfo) { - ReEnumerate(enabledTypes); + ReEnumerate(); } Modified: trunk/OpenMPT/sounddev/SoundDeviceManager.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceManager.h 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/sounddev/SoundDeviceManager.h 2015-05-04 08:01:15 UTC (rev 5041) @@ -22,6 +22,9 @@ namespace SoundDevice { +class ComponentWaveOut; +class ComponentDirectSound; +class ComponentASIO; class ComponentPortAudio; @@ -33,6 +36,13 @@ const SoundDevice::AppInfo m_AppInfo; + ComponentHandle<ComponentWaveOut> m_WaveOut; +#ifndef NO_DSOUND + ComponentHandle<ComponentDirectSound> m_DirectSound; +#endif // NO_DSOUND +#ifndef NO_ASIO + ComponentHandle<ComponentASIO> m_ASIO; +#endif // NO_ASIO #ifndef NO_PORTAUDIO ComponentHandle<ComponentPortAudio> m_PortAudio; #endif // NO_PORTAUDIO @@ -43,12 +53,12 @@ std::map<SoundDevice::Identifier, SoundDevice::DynamicCaps> m_DeviceDynamicCaps; public: - Manager(SoundDevice::AppInfo appInfo, SoundDevice::TypesSet enabledTypes); + Manager(SoundDevice::AppInfo appInfo); ~Manager(); public: - void ReEnumerate(SoundDevice::TypesSet enabledTypes); + void ReEnumerate(); std::vector<SoundDevice::Info>::const_iterator begin() const { return m_SoundDevices.begin(); } std::vector<SoundDevice::Info>::const_iterator end() const { return m_SoundDevices.end(); } Modified: trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp 2015-05-04 08:01:15 UTC (rev 5041) @@ -24,13 +24,16 @@ namespace SoundDevice { - + /////////////////////////////////////////////////////////////////////////////////////// // // MMSYSTEM WaveOut Device // +MPT_REGISTERED_COMPONENT(ComponentWaveOut) + + static const std::size_t WAVEOUT_MINBUFFERS = 3; static const std::size_t WAVEOUT_MAXBUFFERS = 4096; static const std::size_t WAVEOUT_MINBUFFERFRAMECOUNT = 8; Modified: trunk/OpenMPT/sounddev/SoundDeviceWaveout.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceWaveout.h 2015-05-03 21:15:20 UTC (rev 5040) +++ trunk/OpenMPT/sounddev/SoundDeviceWaveout.h 2015-05-04 08:01:15 UTC (rev 5041) @@ -14,6 +14,8 @@ #include "SoundDevice.h" #include "SoundDeviceUtilities.h" +#include "../common/ComponentManager.h" + #include <MMSystem.h> @@ -28,6 +30,18 @@ // MMSYSTEM WaveOut device // + +class ComponentWaveOut : public ComponentBuiltin +{ + MPT_DECLARE_COMPONENT_MEMBERS +public: + ComponentWaveOut() { } + virtual ~ComponentWaveOut() { } + std::string GetSettingsKey() const { return "WaveOut"; } + virtual bool DoInitialize() { return true; } +}; + + //============================================== class CWaveDevice: public CSoundDeviceWithThread //============================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |