From: <sag...@us...> - 2011-10-21 22:19:08
|
Revision: 1117 http://modplug.svn.sourceforge.net/modplug/?rev=1117&view=rev Author: saga-games Date: 2011-10-21 22:19:01 +0000 (Fri, 21 Oct 2011) Log Message: ----------- [Mod] Compatibility hints are now hideable [Mod] Removed MOD compatibility export, it is now always used (but only oneshot samples are modified, and they are not modified in memory anymore) [Fix] MP3 Export shortcut was broken (http://bugs.openmpt.org/view.php?id=201) Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/dlg_misc.h trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-10-21 20:45:15 UTC (rev 1116) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-10-21 22:19:01 UTC (rev 1117) @@ -2371,6 +2371,7 @@ case kcFileSaveAs: case kcFileSaveAsWave: + case kcFileSaveAsMP3: case kcFileSaveMidi: case kcFileExportCompat: case kcFileClose: @@ -2651,20 +2652,18 @@ void AddPluginNamesToCombobox(CComboBox& CBox, SNDMIXPLUGIN* plugarray, const bool librarynames) //---------------------------------------------------------------------------------------------- { -#ifndef NO_VST - for (UINT iPlug=0; iPlug<MAX_MIXPLUGINS; iPlug++) + for (PLUGINDEX iPlug = 0; iPlug < MAX_MIXPLUGINS; iPlug++) { PSNDMIXPLUGIN p = &plugarray[iPlug]; CString str; str.Preallocate(80); - str.Format(_T("FX%d: "), iPlug+1); + str.Format(_T("FX%d: "), iPlug + 1); const int size0 = str.GetLength(); str += (librarynames) ? p->GetLibraryName() : p->GetName(); if(str.GetLength() <= size0) str += _T("undefined"); CBox.SetItemData(CBox.AddString(str), iPlug + 1); } -#endif // NO_VST } Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-21 20:45:15 UTC (rev 1116) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-21 22:19:01 UTC (rev 1117) @@ -567,7 +567,7 @@ switch(m_SndFile.GetType()) { case MOD_TYPE_MOD: - MsgBoxHidable(ModCompatibilityExportTip); + MsgBoxHidable(ModSaveHint); break; case MOD_TYPE_S3M: break; @@ -1830,26 +1830,16 @@ if ((!pMainFrm) || (!m_SndFile.GetType())) return; switch (type) { - case MOD_TYPE_MOD: - pattern = FileFilterMOD; - if(Reporting::Confirm(GetStrI18N(TEXT( - "Compared to regular MOD save, compatibility export adjusts the beginning of oneshot samples " - "in order to make the file compatible with ProTracker and other Amiga-based trackers. " - "Note that this feature does not remove effects \"invented\" by other PC-based trackers (f.e. panning commands)." - "\n\n Proceed?"))) != cnfYes - ) - return; - break; case MOD_TYPE_IT: pattern = FileFilterIT; - Reporting::Information("Warning: the exported file will not contain any of MPT's file-format hacks.", "Compatibility export warning."); + MsgBoxHidable(CompatExportDefaultWarning); break; case MOD_TYPE_XM: pattern = FileFilterXM; - Reporting::Information("Warning: the exported file will not contain any of MPT's file-format hacks.", "Compatibility export warning."); + MsgBoxHidable(CompatExportDefaultWarning); break; default: - Reporting::Information("Compatibility export is currently only available for MOD, XM and IT modules.", "Can't do compatibility export."); + // Not available for this format. return; } ext = m_SndFile.GetModSpecifications().fileExtension; @@ -1871,11 +1861,6 @@ FixNullStrings(); switch (type) { - case MOD_TYPE_MOD: - m_SndFile.SaveMod(files.first_file.c_str(), 0, true); - SetModified(); // Compatibility save may adjust samples so set modified... - m_ShowSavedialog = true; // ...and force save dialog to appear when saving. - break; case MOD_TYPE_XM: m_SndFile.SaveXM(files.first_file.c_str(), 0, true); break; @@ -2120,7 +2105,7 @@ //--------------------------------------------------- { if (p) - p->Enable((m_SndFile.GetType() & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MOD)) ? TRUE : FALSE); + p->Enable((m_SndFile.GetType() & (MOD_TYPE_XM|MOD_TYPE_IT)) ? TRUE : FALSE); } @@ -3312,7 +3297,7 @@ case sfx_drywet: return _T("Set Plugin Dry/Wet Ratio"); case sfx_plug: - return _T("Control Plugin Param..."); + return _T("Control Plugin Parameter..."); case sfx_cc: return _T("MIDI CC..."); case sfx_custom: Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-10-21 20:45:15 UTC (rev 1116) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-10-21 22:19:01 UTC (rev 1117) @@ -764,14 +764,10 @@ m_CbnSFx.AddString(s); } m_CbnSFx.SetCurSel(0); - m_CbnSFxPreset.AddString("Unused"); - m_CbnSFxPreset.AddString("Set Filter Cutoff"); - m_CbnSFxPreset.AddString("Set Filter Resonance"); - m_CbnSFxPreset.AddString("Set Filter Mode"); - m_CbnSFxPreset.AddString("Plugin Dry/Wet Ratio"); - m_CbnSFxPreset.AddString("Control Plugin Param..."); - m_CbnSFxPreset.AddString("MIDI CC..."); - m_CbnSFxPreset.AddString("Custom"); + for(int i = 0; i < sfx_max; i++) + { + m_CbnSFxPreset.SetItemData(m_CbnSFxPreset.AddString(CModDoc::GetMacroName(static_cast<enmParameteredMacroType>(i))), i); + } OnSFxChanged(); for (UINT cc=MIDICC_start; cc<=MIDICC_end; cc++) @@ -902,7 +898,7 @@ UINT sfx, sfx_preset, zxx; sfx = m_CbnSFx.GetCurSel(); - sfx_preset = m_CbnSFxPreset.GetCurSel(); + sfx_preset = m_CbnSFxPreset.GetItemData(m_CbnSFxPreset.GetCurSel()); if (sfx < 16) { ToggleBoxes(sfx_preset, sfx); @@ -984,7 +980,7 @@ //---------------------------------------- { UINT sfx = m_CbnSFx.GetCurSel(); - UINT sfx_preset = m_CbnSFxPreset.GetCurSel(); + UINT sfx_preset = m_CbnSFxPreset.GetItemData(m_CbnSFxPreset.GetCurSel()); if (sfx < 16) { @@ -1767,10 +1763,11 @@ const MsgBoxHidableMessage HidableMessages[] = { - {TEXT("Tip: To create ProTracker compatible MOD-files, try compatibility export from File-menu."), 1, true}, - {TEXT("Tip: To create IT-files without MPT-specific extensions included, try compatibility export from File-menu."), 1 << 1, true}, + {TEXT("Note: First two bytes of oneshot samples is silenced for ProTracker compatibility."), 1, true}, + {TEXT("Hint: To create IT-files without MPT-specific extensions included, try compatibility export from File-menu."), 1 << 1, true}, {TEXT("Press OK to apply signed/unsigned conversion\n (note: this often significantly increases volume level)"), 1 << 2, false}, - {TEXT("Tip: To create XM-files without MPT-specific extensions included, try compatibility export from File-menu."), 1 << 1, true}, + {TEXT("Hint: To create XM-files without MPT-specific extensions included, try compatibility export from File-menu."), 1 << 3, true}, + {TEXT("Warning: the exported file will not contain any of MPT's file format hacks."), 1 << 4, true}, }; STATIC_ASSERT(ARRAYELEMCOUNT(HidableMessages) == enMsgBoxHidableMessage_count); Modified: trunk/OpenMPT/mptrack/dlg_misc.h =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.h 2011-10-21 20:45:15 UTC (rev 1116) +++ trunk/OpenMPT/mptrack/dlg_misc.h 2011-10-21 22:19:01 UTC (rev 1117) @@ -283,10 +283,11 @@ // Enums for message entries. See dlg_misc.cpp for the array of entries. enum enMsgBoxHidableMessage { - ModCompatibilityExportTip = 0, + ModSaveHint = 0, ItCompatibilityExportTip = 1, ConfirmSignUnsignWhenPlaying = 2, XMCompatibilityExportTip = 3, + CompatExportDefaultWarning = 4, enMsgBoxHidableMessage_count }; Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2011-10-21 20:45:15 UTC (rev 1116) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2011-10-21 22:19:01 UTC (rev 1117) @@ -553,8 +553,8 @@ #include "../mptrack/moddoc.h" #endif // MODPLUG_TRACKER -bool CSoundFile::SaveMod(LPCSTR lpszFileName, UINT nPacking, const bool bCompatibilityExport) -//------------------------------------------------------------------------------------------- +bool CSoundFile::SaveMod(LPCSTR lpszFileName, UINT nPacking) +//---------------------------------------------------------- { BYTE insmap[32]; UINT inslen[32]; @@ -703,12 +703,8 @@ // Writing instruments for (UINT ismpd = 1; ismpd <= 31; ismpd++) if (inslen[ismpd]) { - MODSAMPLE *pSmp = &Samples[insmap[ismpd]]; - if(bCompatibilityExport == true) // first two bytes have to be 0 due to PT's one-shot loop ("no loop") - { - size_t iOverwriteLen = 2 * pSmp->GetBytesPerSample(); - memset(pSmp->pSample, 0, min(iOverwriteLen, pSmp->GetSampleSizeInBytes())); - } + const MODSAMPLE *pSmp = &Samples[insmap[ismpd]]; + UINT flags = RS_PCM8S; #ifndef NO_PACKING if (!(pSmp->uFlags & (CHN_16BIT|CHN_STEREO))) @@ -720,7 +716,20 @@ } } #endif - WriteSample(f, pSmp, flags, inslen[ismpd]); + const long sampleStart = ftell(f); + + const UINT writtenBytes = WriteSample(f, pSmp, flags, inslen[ismpd]); + + if((pSmp->uFlags & CHN_LOOP) == 0) + { + // First two bytes of oneshot samples have to be 0 due to PT's one-shot loop + const long sampleEnd = ftell(f); + fseek(f, sampleStart, SEEK_SET); + int8 silence[] = { 0, 0 }; + fwrite(&silence, 1, min(writtenBytes, 2), f); + fseek(f, sampleEnd, SEEK_SET); + } + // write padding byte if the sample size is odd. if((pSmp->nLength & 1) && !nPacking) { Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2011-10-21 20:45:15 UTC (rev 1116) +++ trunk/OpenMPT/soundlib/Sndfile.h 2011-10-21 22:19:01 UTC (rev 1117) @@ -862,7 +862,7 @@ UINT WriteSample(FILE *f, const MODSAMPLE *pSmp, UINT nFlags, UINT nMaxLen=0) const; bool SaveXM(LPCSTR lpszFileName, UINT nPacking=0, const bool bCompatibilityExport = false); bool SaveS3M(LPCSTR lpszFileName, UINT nPacking=0); - bool SaveMod(LPCSTR lpszFileName, UINT nPacking=0, const bool bCompatibilityExport = false); + bool SaveMod(LPCSTR lpszFileName, UINT nPacking=0); bool SaveIT(LPCSTR lpszFileName, UINT nPacking=0, const bool compatExport = false); bool SaveITProject(LPCSTR lpszFileName); // -> CODE#0023 -> DESC="IT project files (.itp)" -! NEW_FEATURE#0023 UINT SaveMixPlugins(FILE *f=NULL, BOOL bUpdate=TRUE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |