From: <sag...@us...> - 2015-05-26 15:29:15
|
Revision: 5192 http://sourceforge.net/p/modplug/code/5192 Author: saga-games Date: 2015-05-26 15:29:09 +0000 (Tue, 26 May 2015) Log Message: ----------- [Fix] Changing the default artist name didn't set the settings dialog as modified. [Reg] No longer allow a tempo of 256+ BPM in IT files (except for legacy files of course) Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Ctrl_gen.h trunk/OpenMPT/mptrack/GeneralConfigDlg.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2015-05-26 10:50:41 UTC (rev 5191) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2015-05-26 15:29:09 UTC (rev 5192) @@ -93,31 +93,17 @@ // Song Title m_EditTitle.SetLimitText(specs.modNameLengthMax); -// -> CODE#0016 -// -> DESC="default tempo update" -// m_SpinTempo.SetRange(32, 255); // 255 bpm max - - if(m_sndFile.GetType() & MOD_TYPE_S3M) - { - // S3M HACK: ST3 will ignore speed 255, even though it can be used with Axx. - m_SpinSpeed.SetRange(1, 254); - } else - { - m_SpinSpeed.SetRange((short)specs.speedMin, (short)specs.speedMax); - } - m_SpinTempo.SetRange((short)specs.tempoMin, (short)specs.tempoMax); - -// -! BEHAVIOUR_CHANGE#0016 - m_SpinGlobalVol.SetRange(0, (short)(256 / GetGlobalVolumeFactor())); m_SpinSamplePA.SetRange(0, 2000); m_SpinVSTiVol.SetRange(0, 2000); m_SpinRestartPos.SetRange(0, 255); - m_SliderTempo.SetRange(0, specs.tempoMax - specs.tempoMin); m_SliderGlobalVol.SetRange(0, MAX_SLIDER_GLOBAL_VOL); m_SliderVSTiVol.SetRange(0, MAX_SLIDER_VSTI_VOL); m_SliderSamplePreAmp.SetRange(0, MAX_SLIDER_SAMPLE_VOL); + + m_SliderTempo.SetLineSize(1); + m_SliderTempo.SetPageSize(10); m_bEditsLocked=false; UpdateView(GeneralHint().ModType()); @@ -198,8 +184,9 @@ } newTempo /= delay; - const CModSpecifications specs = m_sndFile.GetModSpecifications(); - Limit(newTempo, specs.tempoMin, specs.tempoMax); + int tempoMin, tempoMax; + m_SpinTempo.GetRange32(tempoMin, tempoMax); + Limit(newTempo, TEMPO(tempoMin), TEMPO(tempoMax)); SetDlgItemInt(IDC_EDIT_TEMPO, newTempo, FALSE); } } @@ -211,62 +198,49 @@ if (pHint == this) return; FlagSet<HintType> hintType = hint.GetType(); const bool updateAll = hintType[HINT_MODTYPE]; + + const struct + { + const TCHAR *name; + ResamplingMode mode; + } interpolationTypes[] = + { + { _T("No Interpolation"), SRCMODE_NEAREST }, + { _T("Linear"), SRCMODE_LINEAR }, + { _T("Cubic Spline"), SRCMODE_SPLINE }, + { _T("Polyphase"), SRCMODE_POLYPHASE }, + { _T("XMMS-ModPlug"), SRCMODE_FIRFILTER }, + }; + if (hintType == HINT_MPTOPTIONS || updateAll) { m_CbnResampling.ResetContent(); - const struct - { - const TCHAR *name; - ResamplingMode mode; - } interpolationTypes[] = - { - { _T("No Interpolation"), SRCMODE_NEAREST }, - { _T("Linear"), SRCMODE_LINEAR }, - { _T("Cubic Spline"), SRCMODE_SPLINE }, - { _T("Polyphase"), SRCMODE_POLYPHASE }, - { _T("XMMS-ModPlug"), SRCMODE_FIRFILTER }, - }; m_CbnResampling.SetItemData(m_CbnResampling.AddString(_T("Default (") + CString(interpolationTypes[TrackerSettings::Instance().ResamplerMode].name) + _T(")")), SRCMODE_DEFAULT); - int selection = 0; for(int i = 0; i < CountOf(interpolationTypes); i++) { - if(m_sndFile.m_nResampling == interpolationTypes[i].mode) selection = i + 1; m_CbnResampling.SetItemData(m_CbnResampling.AddString(interpolationTypes[i].name), interpolationTypes[i].mode); } - - m_CbnResampling.SetCurSel(selection); m_CbnResampling.Invalidate(FALSE); } - if (updateAll || (hint.GetCategory() == HINTCAT_SEQUENCE && hintType[HINT_MODSEQUENCE])) - { - // Set max valid restart position - m_SpinRestartPos.SetRange32(0, m_sndFile.Order.GetLengthTailTrimmed() - 1); - } - if (updateAll || (hint.GetCategory() == HINTCAT_GENERAL && hintType[HINT_MODGENERAL])) - { - if (!m_bEditsLocked) - { - m_EditTitle.SetWindowText(m_sndFile.GetTitle().c_str()); - ::SetWindowTextW(m_EditArtist.m_hWnd, mpt::ToWide(m_sndFile.songArtist).c_str()); - SetDlgItemInt(IDC_EDIT_TEMPO, m_sndFile.m_nDefaultTempo, FALSE); - SetDlgItemInt(IDC_EDIT_SPEED, m_sndFile.m_nDefaultSpeed, FALSE); - SetDlgItemInt(IDC_EDIT_GLOBALVOL, m_sndFile.m_nDefaultGlobalVolume / GetGlobalVolumeFactor(), FALSE); - SetDlgItemInt(IDC_EDIT_RESTARTPOS, m_sndFile.m_nRestartPos, FALSE); - SetDlgItemInt(IDC_EDIT_VSTIVOL, m_sndFile.m_nVSTiVolume, FALSE); - SetDlgItemInt(IDC_EDIT_SAMPLEPA, m_sndFile.m_nSamplePreAmp, FALSE); - } - m_SliderGlobalVol.SetPos(MAX_SLIDER_GLOBAL_VOL-m_sndFile.m_nDefaultGlobalVolume); - m_SliderVSTiVol.SetPos(MAX_SLIDER_VSTI_VOL-m_sndFile.m_nVSTiVolume); - m_SliderSamplePreAmp.SetPos(MAX_SLIDER_SAMPLE_VOL-m_sndFile.m_nSamplePreAmp); - m_SliderTempo.SetPos(m_sndFile.GetModSpecifications().tempoMax - m_sndFile.m_nDefaultTempo); - } - if (updateAll) { CModSpecifications specs = m_sndFile.GetModSpecifications(); - m_SpinTempo.SetRange(specs.tempoMin, specs.tempoMax); - m_SliderTempo.SetRange(0, specs.tempoMax - specs.tempoMin); + + // S3M HACK: ST3 will ignore speed 255, even though it can be used with Axx. + if(m_sndFile.GetType() == MOD_TYPE_S3M) + m_SpinSpeed.SetRange32(1, 254); + else + m_SpinSpeed.SetRange32(specs.speedMin, specs.speedMax); + + TEMPO tempoMin = specs.tempoMin; + tempoMax = specs.tempoMax; + // IT Hack: There are legacy OpenMPT-made ITs out there which use a higher default speed than 255. + // Changing the upper tempo limit in the mod specs would break them, so do it here instead. + if(m_sndFile.GetType() == MOD_TYPE_IT && m_sndFile.m_nDefaultTempo <= 255) + tempoMax = 255; + m_SliderTempo.SetRange(0, tempoMax - tempoMin); + m_SpinTempo.SetRange(tempoMin, tempoMax); const BOOL bIsNotMOD = (m_sndFile.GetType() != MOD_TYPE_MOD); const BOOL bIsNotMOD_S3M = ((bIsNotMOD) && (m_sndFile.GetType() != MOD_TYPE_S3M)); @@ -307,7 +281,40 @@ wsprintf(s, _T("%s, %d channel%s"), modType, m_sndFile.GetNumChannels(), (m_sndFile.GetNumChannels() != 1) ? _T("s") : _T("")); m_BtnModType.SetWindowText(s); } - CheckDlgButton(IDC_CHECK_LOOPSONG, (TrackerSettings::Instance().gbLoopSong) ? TRUE : FALSE); + + if (updateAll || (hint.GetCategory() == HINTCAT_SEQUENCE && hintType[HINT_MODSEQUENCE])) + { + // Set max valid restart position + m_SpinRestartPos.SetRange32(0, m_sndFile.Order.GetLengthTailTrimmed() - 1); + } + if (updateAll || (hint.GetCategory() == HINTCAT_GENERAL && hintType[HINT_MODGENERAL])) + { + if (!m_bEditsLocked) + { + m_EditTitle.SetWindowText(m_sndFile.GetTitle().c_str()); + ::SetWindowTextW(m_EditArtist.m_hWnd, mpt::ToWide(m_sndFile.songArtist).c_str()); + SetDlgItemInt(IDC_EDIT_TEMPO, m_sndFile.m_nDefaultTempo, FALSE); + SetDlgItemInt(IDC_EDIT_SPEED, m_sndFile.m_nDefaultSpeed, FALSE); + SetDlgItemInt(IDC_EDIT_GLOBALVOL, m_sndFile.m_nDefaultGlobalVolume / GetGlobalVolumeFactor(), FALSE); + SetDlgItemInt(IDC_EDIT_RESTARTPOS, m_sndFile.m_nRestartPos, FALSE); + SetDlgItemInt(IDC_EDIT_VSTIVOL, m_sndFile.m_nVSTiVolume, FALSE); + SetDlgItemInt(IDC_EDIT_SAMPLEPA, m_sndFile.m_nSamplePreAmp, FALSE); + } + + m_SliderGlobalVol.SetPos(MAX_SLIDER_GLOBAL_VOL - m_sndFile.m_nDefaultGlobalVolume); + m_SliderVSTiVol.SetPos(MAX_SLIDER_VSTI_VOL - m_sndFile.m_nVSTiVolume); + m_SliderSamplePreAmp.SetPos(MAX_SLIDER_SAMPLE_VOL - m_sndFile.m_nSamplePreAmp); + m_SliderTempo.SetPos(tempoMax - m_sndFile.m_nDefaultTempo); + + int srcMode = 0; + for(int i = 0; i < CountOf(interpolationTypes); i++) + { + if(m_sndFile.m_nResampling == interpolationTypes[i].mode) srcMode = i + 1; + } + m_CbnResampling.SetCurSel(srcMode); + } + + CheckDlgButton(IDC_CHECK_LOOPSONG, (TrackerSettings::Instance().gbLoopSong) ? TRUE : FALSE); if (hintType[HINT_MPTOPTIONS]) { m_VuMeterLeft.InvalidateRect(NULL, FALSE); @@ -327,9 +334,7 @@ if (pSlider==&m_SliderTempo) { - int min, max; - m_SpinTempo.GetRange(min, max); - const UINT tempo = max - m_SliderTempo.GetPos(); + const TEMPO tempo = tempoMax - TEMPO(m_SliderTempo.GetPos()); if ((tempo >= m_sndFile.GetModSpecifications().tempoMin) && (tempo <= m_sndFile.GetModSpecifications().tempoMax) && (tempo != m_sndFile.m_nDefaultTempo)) { m_sndFile.m_nDefaultTempo = tempo; @@ -423,8 +428,10 @@ m_EditTempo.GetWindowText(s, sizeof(s)); if (s[0]) { - UINT n = atoi(s); - n = Clamp(n, m_sndFile.GetModSpecifications().tempoMin, m_sndFile.GetModSpecifications().tempoMax); + TEMPO n = TEMPO(atoi(s)); + int tempoMin, tempoMax; + m_SpinTempo.GetRange32(tempoMin, tempoMax); + n = Clamp(n, TEMPO(tempoMin), TEMPO(tempoMax)); if (n != m_sndFile.m_nDefaultTempo) { m_bEditsLocked=true; @@ -663,6 +670,7 @@ if(m_sndFile.GetModSpecifications().hasDefaultResampling) { m_modDoc.SetModified(); + m_modDoc.UpdateAllViews(nullptr, GeneralHint().General(), this); } } } Modified: trunk/OpenMPT/mptrack/Ctrl_gen.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.h 2015-05-26 10:50:41 UTC (rev 5191) +++ trunk/OpenMPT/mptrack/Ctrl_gen.h 2015-05-26 15:29:09 UTC (rev 5192) @@ -72,6 +72,8 @@ CSliderCtrl m_SliderTempo, m_SliderSamplePreAmp, m_SliderGlobalVol, m_SliderVSTiVol; CVuMeter m_VuMeterLeft, m_VuMeterRight; + + TEMPO tempoMax; //}}AFX_DATA //{{AFX_VIRTUAL(CCtrlGeneral) virtual BOOL OnInitDialog(); Modified: trunk/OpenMPT/mptrack/GeneralConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/GeneralConfigDlg.cpp 2015-05-26 10:50:41 UTC (rev 5191) +++ trunk/OpenMPT/mptrack/GeneralConfigDlg.cpp 2015-05-26 15:29:09 UTC (rev 5192) @@ -25,6 +25,7 @@ ON_COMMAND(IDC_RADIO1, OnSettingsChanged) ON_COMMAND(IDC_RADIO2, OnSettingsChanged) ON_COMMAND(IDC_RADIO3, OnSettingsChanged) + ON_EN_CHANGE(IDC_EDIT1, OnSettingsChanged) ON_CBN_SELCHANGE(IDC_COMBO1, OnDefaultTypeChanged) ON_CBN_SELCHANGE(IDC_COMBO2, OnTemplateChanged) ON_CBN_EDITCHANGE(IDC_COMBO2, OnTemplateChanged) Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-05-26 10:50:41 UTC (rev 5191) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-05-26 15:29:09 UTC (rev 5192) @@ -536,11 +536,14 @@ memory.state.m_nMusicTempo = 0; } } + + TEMPO tempoMin = GetModSpecifications().tempoMin, tempoMax = GetModSpecifications().tempoMax; + if(IsCompatibleMode(TRK_ALLTRACKERS)) // clamp tempo correctly in compatible mode + { + tempoMax = 255; + } + Limit(memory.state.m_nMusicTempo, tempoMin, tempoMax); } - if(IsCompatibleMode(TRK_ALLTRACKERS)) // clamp tempo correctly in compatible mode - memory.state.m_nMusicTempo = Clamp(memory.state.m_nMusicTempo, 32u, 255u); - else - memory.state.m_nMusicTempo = Clamp(memory.state.m_nMusicTempo, GetModSpecifications().tempoMin, GetModSpecifications().tempoMax); break; case CMD_S3MCMDEX: @@ -5024,6 +5027,7 @@ //------------------------------------------------------------ { const CModSpecifications& specs = GetModSpecifications(); + if(setAsNonModcommand) { // Set tempo from UI - ignore slide commands and such. @@ -5040,10 +5044,12 @@ else m_PlayState.m_nMusicTempo -= (param & 0x0F); + TEMPO tempoMin = GetModSpecifications().tempoMin, tempoMax = GetModSpecifications().tempoMax; if(IsCompatibleMode(TRK_ALLTRACKERS)) // clamp tempo correctly in compatible mode - m_PlayState.m_nMusicTempo = Clamp(m_PlayState.m_nMusicTempo, 32u, 255u); - else - m_PlayState.m_nMusicTempo = Clamp(m_PlayState.m_nMusicTempo, specs.tempoMin, specs.tempoMax); + { + tempoMax = 255; + } + Limit(m_PlayState.m_nMusicTempo, tempoMin, tempoMax); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |