From: <man...@us...> - 2014-03-14 12:55:47
|
Revision: 3882 http://sourceforge.net/p/modplug/code/3882 Author: manxorist Date: 2014-03-14 12:55:35 +0000 (Fri, 14 Mar 2014) Log Message: ----------- [Fix] sounddev: Do not support "keep device open" for non-ASIO devices because they currently do not clear the remaining output buffer when stopping. [Mod] sounddev: Merge "keep device open" and "keep runnig" GUI options. Internally, keep the "keep runnig" option device-specific because the implementation is device-specific. [Mod] OpenMPT: Version is now 1.22.07.30 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mpdlgs.h trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDeviceASIO.h Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/common/versionNumber.h 2014-03-14 12:55:35 UTC (rev 3882) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 07 -#define VER_MINORMINOR 29 +#define VER_MINORMINOR 30 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-14 12:55:35 UTC (rev 3882) @@ -1215,7 +1215,7 @@ m_NotifyTimer = 0; } ResetNotificationBuffer(); - if(!TrackerSettings::Instance().m_SoundSettingsKeepDeviceOpen) + if(!gpSoundDevice->CanStopMode() || TrackerSettings::Instance().m_SoundSettingsStopMode == SoundDeviceStopModeClosed) { audioCloseDevice(); } @@ -1656,14 +1656,18 @@ BOOL CMainFrame::ResetSoundCard() //------------------------------- { - return CMainFrame::SetupSoundCard(TrackerSettings::Instance().GetSoundDeviceSettings(TrackerSettings::Instance().GetSoundDeviceID()), TrackerSettings::Instance().GetSoundDeviceID(), true); + return CMainFrame::SetupSoundCard(TrackerSettings::Instance().GetSoundDeviceSettings(TrackerSettings::Instance().GetSoundDeviceID()), TrackerSettings::Instance().GetSoundDeviceID(), TrackerSettings::Instance().m_SoundSettingsStopMode, true); } -BOOL CMainFrame::SetupSoundCard(const SoundDeviceSettings &deviceSettings, SoundDeviceID deviceID, bool forceReset) -//----------------------------------------------------------------------------------------------------------------- +BOOL CMainFrame::SetupSoundCard(SoundDeviceSettings deviceSettings, SoundDeviceID deviceID, SoundDeviceStopMode stoppedMode, bool forceReset) +//------------------------------------------------------------------------------------------------------------------------------------------- { - if(forceReset || (TrackerSettings::Instance().GetSoundDeviceID() != deviceID) || (TrackerSettings::Instance().GetSoundDeviceSettings(deviceID) != deviceSettings)) + if(forceReset + || (TrackerSettings::Instance().GetSoundDeviceID() != deviceID) + || (TrackerSettings::Instance().GetSoundDeviceSettings(deviceID) != deviceSettings) + || (TrackerSettings::Instance().m_SoundSettingsStopMode != stoppedMode) + ) { CModDoc *pActiveMod = nullptr; if(IsPlaying()) @@ -1675,6 +1679,19 @@ { gpSoundDevice->Close(); } + TrackerSettings::Instance().m_SoundSettingsStopMode = stoppedMode; + switch(stoppedMode) + { + case SoundDeviceStopModeClosed: + deviceSettings.KeepDeviceRunning = true; + break; + case SoundDeviceStopModeStopped: + deviceSettings.KeepDeviceRunning = false; + break; + case SoundDeviceStopModePlaying: + deviceSettings.KeepDeviceRunning = true; + break; + } TrackerSettings::Instance().SetSoundDeviceID(deviceID); TrackerSettings::Instance().SetSoundDeviceSettings(deviceID, deviceSettings); TrackerSettings::Instance().MixerOutputChannels = deviceSettings.Channels; Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2014-03-14 12:55:35 UTC (rev 3882) @@ -468,7 +468,7 @@ void IdleHandlerSounddevice(); BOOL ResetSoundCard(); - BOOL SetupSoundCard(const SoundDeviceSettings &deviceSettings, SoundDeviceID deviceID, bool forceReset = false); + BOOL SetupSoundCard(SoundDeviceSettings deviceSettings, SoundDeviceID deviceID, SoundDeviceStopMode stoppedMode, bool forceReset = false); BOOL SetupMiscOptions(); BOOL SetupPlayer(); Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-03-14 12:55:35 UTC (rev 3882) @@ -61,9 +61,7 @@ ON_WM_VSCROLL() ON_COMMAND(IDC_CHECK4, OnSettingsChanged) ON_COMMAND(IDC_CHECK5, OnSettingsChanged) - ON_COMMAND(IDC_CHECK6, OnSettingsChanged) ON_COMMAND(IDC_CHECK7, OnSettingsChanged) - ON_COMMAND(IDC_CHECK8, OnSettingsChanged) ON_COMMAND(IDC_CHECK9, OnSettingsChanged) ON_CBN_SELCHANGE(IDC_COMBO1, OnDeviceChanged) ON_CBN_SELCHANGE(IDC_COMBO2, OnSettingsChanged) @@ -75,6 +73,7 @@ ON_CBN_SELCHANGE(IDC_COMBO10, OnSettingsChanged) ON_CBN_EDITCHANGE(IDC_COMBO2, OnSettingsChanged) ON_CBN_EDITCHANGE(IDC_COMBO_UPDATEINTERVAL, OnSettingsChanged) + ON_CBN_SELCHANGE(IDC_COMBO11, OnSettingsChanged) ON_COMMAND(IDC_BUTTON1, OnSoundCardRescan) ON_COMMAND(IDC_BUTTON2, OnSoundCardDriverPanel) ON_CBN_SELCHANGE(IDC_COMBO_CHANNEL_FRONTLEFT, OnChannel1Changed) @@ -106,6 +105,7 @@ DDX_Control(pDX, IDC_COMBO10, m_CbnDither); DDX_Control(pDX, IDC_BUTTON2, m_BtnDriverPanel); DDX_Control(pDX, IDC_COMBO6, m_CbnSampleFormat); + DDX_Control(pDX, IDC_COMBO11, m_CbnStoppedMode); DDX_Control(pDX, IDC_STATIC_CHANNEL_FRONTLEFT , m_StaticChannelMapping[0]); DDX_Control(pDX, IDC_STATIC_CHANNEL_FRONTRIGHT, m_StaticChannelMapping[1]); DDX_Control(pDX, IDC_STATIC_CHANNEL_REARLEFT , m_StaticChannelMapping[2]); @@ -217,15 +217,36 @@ } -void COptionsSoundcard::UpdateEverything() -//---------------------------------------- +void COptionsSoundcard::UpdateGeneral() +//------------------------------------- { // General { - CheckDlgButton(IDC_CHECK6, TrackerSettings::Instance().m_SoundSettingsKeepDeviceOpen ? BST_CHECKED : BST_UNCHECKED); + if(m_CurrentDeviceCaps.CanKeepDeviceRunning) + { + m_CbnStoppedMode.EnableWindow(TRUE); + m_CbnStoppedMode.ResetContent(); + m_CbnStoppedMode.AddString("Close driver"); + m_CbnStoppedMode.AddString("Pause driver"); + m_CbnStoppedMode.AddString("Play silence"); + m_CbnStoppedMode.SetCurSel(TrackerSettings::Instance().m_SoundSettingsStopMode); + } else + { + m_CbnStoppedMode.EnableWindow(FALSE); + m_CbnStoppedMode.ResetContent(); + m_CbnStoppedMode.AddString("Close driver"); + m_CbnStoppedMode.AddString("Close driver"); + m_CbnStoppedMode.AddString("Close driver"); + m_CbnStoppedMode.SetCurSel(TrackerSettings::Instance().m_SoundSettingsStopMode); + } CheckDlgButton(IDC_CHECK7, TrackerSettings::Instance().m_SoundSettingsOpenDeviceAtStartup ? BST_CHECKED : BST_UNCHECKED); } +} + +void COptionsSoundcard::UpdateEverything() +//---------------------------------------- +{ // Sound Device { m_CbnDevice.ResetContent(); @@ -311,6 +332,7 @@ void COptionsSoundcard::UpdateDevice() //------------------------------------ { + UpdateGeneral(); UpdateControls(); UpdateLatency(); UpdateUpdateInterval(); @@ -571,14 +593,12 @@ m_BtnDriverPanel.EnableWindow(m_CurrentDeviceCaps.CanDriverPanel ? TRUE : FALSE); GetDlgItem(IDC_CHECK4)->EnableWindow(m_CurrentDeviceCaps.CanExclusiveMode ? TRUE : FALSE); GetDlgItem(IDC_CHECK5)->EnableWindow(m_CurrentDeviceCaps.CanBoostThreadPriority ? TRUE : FALSE); - GetDlgItem(IDC_CHECK8)->EnableWindow(m_CurrentDeviceCaps.CanKeepDeviceRunning ? TRUE : FALSE); GetDlgItem(IDC_CHECK9)->EnableWindow(m_CurrentDeviceCaps.CanUseHardwareTiming ? TRUE : FALSE); GetDlgItem(IDC_STATIC_UPDATEINTERVAL)->EnableWindow(m_CurrentDeviceCaps.CanUpdateInterval ? TRUE : FALSE); GetDlgItem(IDC_COMBO_UPDATEINTERVAL)->EnableWindow(m_CurrentDeviceCaps.CanUpdateInterval ? TRUE : FALSE); GetDlgItem(IDC_CHECK4)->SetWindowText(mpt::ToCString(m_CurrentDeviceCaps.ExclusiveModeDescription)); CheckDlgButton(IDC_CHECK4, m_CurrentDeviceCaps.CanExclusiveMode && m_Settings.ExclusiveMode ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_CHECK5, m_CurrentDeviceCaps.CanBoostThreadPriority && m_Settings.BoostThreadPriority ? MF_CHECKED : MF_UNCHECKED); - CheckDlgButton(IDC_CHECK8, m_CurrentDeviceCaps.CanKeepDeviceRunning && m_Settings.KeepDeviceRunning ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_CHECK9, m_CurrentDeviceCaps.CanUseHardwareTiming && m_Settings.UseHardwareTiming ? MF_CHECKED : MF_UNCHECKED); } @@ -596,12 +616,10 @@ { // General { - TrackerSettings::Instance().m_SoundSettingsKeepDeviceOpen = IsDlgButtonChecked(IDC_CHECK6) ? true : false; TrackerSettings::Instance().m_SoundSettingsOpenDeviceAtStartup = IsDlgButtonChecked(IDC_CHECK7) ? true : false; } m_Settings.ExclusiveMode = IsDlgButtonChecked(IDC_CHECK4) ? true : false; m_Settings.BoostThreadPriority = IsDlgButtonChecked(IDC_CHECK5) ? true : false; - m_Settings.KeepDeviceRunning = IsDlgButtonChecked(IDC_CHECK8) ? true : false; m_Settings.UseHardwareTiming = IsDlgButtonChecked(IDC_CHECK9) ? true : false; // Mixing Freq { @@ -664,7 +682,7 @@ m_Settings.ChannelMapping = SoundChannelMapping(); } } - CMainFrame::GetMainFrame()->SetupSoundCard(m_Settings, m_CurrentDeviceInfo.id); + CMainFrame::GetMainFrame()->SetupSoundCard(m_Settings, m_CurrentDeviceInfo.id, (SoundDeviceStopMode)m_CbnStoppedMode.GetCurSel()); SetDevice(m_CurrentDeviceInfo.id, true); // Poll changed ASIO sample format and channel names UpdateDevice(); UpdateStatistics(); Modified: trunk/OpenMPT/mptrack/Mpdlgs.h =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.h 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/mptrack/Mpdlgs.h 2014-03-14 12:55:35 UTC (rev 3882) @@ -25,6 +25,8 @@ CEdit m_EditStatistics; CButton m_BtnDriverPanel; + CComboBox m_CbnStoppedMode; + CStatic m_StaticChannelMapping[NUM_CHANNELCOMBOBOXES]; CComboBox m_CbnChannelMapping[NUM_CHANNELCOMBOBOXES]; @@ -41,6 +43,7 @@ private: void UpdateEverything(); void UpdateDevice(); + void UpdateGeneral(); void UpdateLatency(); void UpdateUpdateInterval(); void UpdateSampleRates(); Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-03-14 12:55:35 UTC (rev 3882) @@ -164,7 +164,7 @@ , m_SoundSampleRates(conf, "Sound Settings", "SampleRates", GetDefaultSampleRates()) , m_MorePortaudio(conf, "Sound Settings", "MorePortaudio", false) , m_SoundSettingsOpenDeviceAtStartup(conf, "Sound Settings", "OpenDeviceAtStartup", false) - , m_SoundSettingsKeepDeviceOpen(conf, "Sound Settings", "KeepDeviceOpen", false) + , m_SoundSettingsStopMode(conf, "Sound Settings", "StopMode", SoundDeviceStopModeClosed) , m_SoundDeviceSettingsUseOldDefaults(false) , m_SoundDeviceIdentifier(conf, "Sound Settings", "Device", std::wstring()) , MixerMaxChannels(conf, "Sound Settings", "MixChannels", MixerSettings().m_nMaxMixChannels) @@ -376,6 +376,16 @@ } // Sound Settings + if(storedVersion < MAKE_VERSION_NUMERIC(1,22,07,30)) + { + if(conf.Read<bool>("Sound Settings", "KeepDeviceOpen", false)) + { + m_SoundSettingsStopMode = SoundDeviceStopModePlaying; + } else + { + m_SoundSettingsStopMode = SoundDeviceStopModeStopped; + } + } if(storedVersion < MAKE_VERSION_NUMERIC(1,22,07,04)) { std::vector<uint32> sampleRates = m_SoundSampleRates; Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2014-03-14 12:55:35 UTC (rev 3882) @@ -303,7 +303,16 @@ return dfFLAC; } +template<> inline SettingValue ToSettingValue(const SoundDeviceStopMode &val) +{ + return SettingValue(static_cast<int32>(val)); +} +template<> inline SoundDeviceStopMode FromSettingValue(const SettingValue &val) +{ + return static_cast<SoundDeviceStopMode>(static_cast<int32>(val)); +} + //=================== class TrackerSettings //=================== @@ -357,7 +366,7 @@ Setting<std::vector<uint32> > m_SoundSampleRates; Setting<bool> m_MorePortaudio; Setting<bool> m_SoundSettingsOpenDeviceAtStartup; - Setting<bool> m_SoundSettingsKeepDeviceOpen; + Setting<SoundDeviceStopMode> m_SoundSettingsStopMode; bool m_SoundDeviceSettingsUseOldDefaults; SoundDeviceID m_SoundDeviceID_DEPRECATED; Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-03-14 12:55:35 UTC (rev 3882) @@ -1306,10 +1306,9 @@ COMBOBOX IDC_COMBO5,108,90,42,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO6,156,90,42,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO10,204,90,72,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Use device exclusively",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,54,90,12 - CONTROL "Keep running",IDC_CHECK8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,54,66,12 - CONTROL "&Boost thread priority",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,72,90,12 - CONTROL "Hardware timing",IDC_CHECK9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,72,66,12 + CONTROL "Use device exclusively",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,54,84,12 + CONTROL "&Boost thread priority",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,72,84,12 + CONTROL "Hardware timing",IDC_CHECK9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,198,72,66,12 LTEXT "Channel &Mapping:",IDC_STATIC,12,108,60,12,SS_CENTERIMAGE CTEXT "Front Left",IDC_STATIC_CHANNEL_FRONTLEFT,78,108,48,12,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_COMBO_CHANNEL_FRONTLEFT,132,108,144,72,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -1320,11 +1319,11 @@ CTEXT "Rear Right",IDC_STATIC_CHANNEL_REARRIGHT,78,162,48,12,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_COMBO_CHANNEL_REARRIGHT,132,162,144,72,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "General",IDC_STATIC,6,186,276,30 - CONTROL "Keep device &open when playback is stopped",IDC_CHECK6, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,198,156,12 - CONTROL "Open device at &startup",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,198,90,12 + COMBOBOX IDC_COMBO11,108,198,60,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Open device at &startup",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,198,90,12 GROUPBOX "Stat&istics",IDC_STATIC,6,222,276,55 EDITTEXT IDC_EDIT_STATISTICS,12,233,264,38,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP + LTEXT "When playback is &stoppped:",IDC_STATIC,12,198,90,12,SS_CENTERIMAGE END IDD_MIDIMACRO DIALOGEX 0, 0, 358, 354 Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/mptrack/resource.h 2014-03-14 12:55:35 UTC (rev 3882) @@ -198,6 +198,7 @@ #define IDC_COMBO6 1206 #define IDC_COMBO9 1207 #define IDC_COMBO10 1208 +#define IDC_COMBO11 1209 #define IDC_NOTEMAP 1213 #define IDC_TEXT1 1301 #define IDC_TEXT2 1302 Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2014-03-14 12:55:35 UTC (rev 3882) @@ -232,6 +232,14 @@ }; +enum SoundDeviceStopMode +{ + SoundDeviceStopModeClosed = 0, + SoundDeviceStopModeStopped = 1, + SoundDeviceStopModePlaying = 2, +}; + + struct SoundDeviceSettings { HWND hWnd; @@ -458,6 +466,7 @@ std::wstring GetDeviceInternalID() const { return m_InternalID; } virtual SoundDeviceCaps GetDeviceCaps(const std::vector<uint32> &baseSampleRates); + virtual bool CanStopMode() const { return false; } bool Open(const SoundDeviceSettings &settings); bool Close(); Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2014-03-14 11:22:52 UTC (rev 3881) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2014-03-14 12:55:35 UTC (rev 3882) @@ -109,6 +109,7 @@ bool OnIdle() { return HandleRequests(); } SoundDeviceCaps GetDeviceCaps(const std::vector<uint32> &baseSampleRates); + bool CanStopMode() const { return true; } bool OpenDriverSettings(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |