From: <sag...@us...> - 2010-11-05 23:07:03
|
Revision: 756 http://modplug.svn.sourceforge.net/modplug/?rev=756&view=rev Author: saga-games Date: 2010-11-05 23:06:56 +0000 (Fri, 05 Nov 2010) Log Message: ----------- [New] New mix mode: Compatible. This is used for MOD/S3M/XM/IT by default and has more appropriate mixing levels for those formats (same levels as Schism Tracker) than mix mode RC3. It also forces soft panning to be *off*. Slight changes in volume levels are possible until the final release of OpenMPT 1.19, so don't rely on the levels too much (this should actually only bother you when using VST, which you should only do in the MPTM format) [Mod] OpenMPT: Version is now 1.19.00.11 Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/MPTHacks.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/ModConvert.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/SoundFilePlayConfig.cpp trunk/OpenMPT/mptrack/SoundFilePlayConfig.h trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/mod_specifications.h Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-11-05 23:06:56 UTC (rev 756) @@ -927,7 +927,7 @@ // convert to IT... m_pModDoc->ChangeModType(MOD_TYPE_IT); - pSndFile->m_nMixLevels = mixLevels_original; + pSndFile->m_nMixLevels = mixLevels_compatible; pSndFile->m_nTempoMode = tempo_mode_classic; pSndFile->m_dwSongFlags = SONG_LINEARSLIDES; Modified: trunk/OpenMPT/mptrack/MPTHacks.cpp =================================================================== --- trunk/OpenMPT/mptrack/MPTHacks.cpp 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/mptrack/MPTHacks.cpp 2010-11-05 23:06:56 UTC (rev 756) @@ -354,6 +354,14 @@ m_SndFile.m_nRestartPos = 0; } + if(m_SndFile.m_nMixLevels != mixLevels_compatible) + { + AddToLog("Found incorrect mix levels\n"); + foundHacks = true; + if(autofix) + m_SndFile.m_nMixLevels = mixLevels_compatible; + } + if(autofix && foundHacks) SetModified(); Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2010-11-05 23:06:56 UTC (rev 756) @@ -428,6 +428,17 @@ if(newTypeIsS3M || newTypeIsMOD) m_SndFile.m_dwSongFlags &= ~SONG_EXFILTERRANGE; if(oldTypeIsXM && newTypeIsIT_MPT) m_SndFile.m_dwSongFlags |= SONG_ITCOMPATGXX; + // Adjust mix levels + if(newTypeIsMOD || newTypeIsS3M) + { + m_SndFile.m_nMixLevels = mixLevels_compatible; + m_SndFile.m_pConfig->SetMixLevels(mixLevels_compatible); + } + if(oldTypeIsMPT && m_SndFile.m_nMixLevels != mixLevels_compatible) + { + CHANGEMODTYPE_WARNING(wMixmode); + } + END_CRITICAL(); ChangeFileExtension(nNewType); @@ -463,6 +474,7 @@ CHANGEMODTYPE_CHECK(wTrimmedEnvelopes, "Instrument envelopes have been shortened.\n"); CHANGEMODTYPE_CHECK(wReleaseNode, "Instrument envelope release nodes are not supported by the new format.\n"); CHANGEMODTYPE_CHECK(wEditHistory, "Edit history will not be saved in the new format.\n"); + CHANGEMODTYPE_CHECK(wMixmode, "Consider setting the mix levels to \"Compatible\" in the song properties when working with legacy formats.\n"); SetModified(); GetPatternUndo()->ClearUndo(); Modified: trunk/OpenMPT/mptrack/ModConvert.h =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.h 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/mptrack/ModConvert.h 2010-11-05 23:06:56 UTC (rev 756) @@ -33,6 +33,7 @@ wTrimmedEnvelopes, wReleaseNode, wEditHistory, + wMixmode, wNumWarnings }; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-11-05 23:06:56 UTC (rev 756) @@ -670,7 +670,8 @@ m_SndFile.m_nMusicTempo = m_SndFile.m_nDefaultTempo = 125; m_SndFile.m_nMusicSpeed = m_SndFile.m_nDefaultSpeed = 6; - if(m_SndFile.m_nMixLevels == mixLevels_original) + // Set up levels + if(m_SndFile.m_nMixLevels == mixLevels_original || m_SndFile.m_nMixLevels == mixLevels_compatible) { m_SndFile.m_nGlobalVolume = m_SndFile.m_nDefaultGlobalVolume = MAX_GLOBAL_VOLUME; m_SndFile.m_nSamplePreAmp = m_SndFile.m_nVSTiVolume = 48; Modified: trunk/OpenMPT/mptrack/SoundFilePlayConfig.cpp =================================================================== --- trunk/OpenMPT/mptrack/SoundFilePlayConfig.cpp 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/mptrack/SoundFilePlayConfig.cpp 2010-11-05 23:06:56 UTC (rev 756) @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Sndfile.h" #include ".\soundfileplayconfig.h" CSoundFilePlayConfig::CSoundFilePlayConfig(void) { @@ -8,9 +9,11 @@ CSoundFilePlayConfig::~CSoundFilePlayConfig(void) { } -void CSoundFilePlayConfig::SetMixLevels(int mixLevelType) { +void CSoundFilePlayConfig::SetMixLevels(int mixLevelType) +{ switch (mixLevelType) { + // Olivier's version gives us floats in [-0.5; 0.5] and slightly saturates VSTis. case mixLevels_original: setVSTiAttenuation(NO_ATTENUATION); @@ -18,11 +21,12 @@ setFloatToInt(static_cast<float>(1<<28)); setGlobalVolumeAppliesToMaster(false); setUseGlobalPreAmp(true); - setForceSoftPanning(false); + setForcePanningMode(dontForcePanningMode); setDisplayDBValues(false); setNormalSamplePreAmp(128.0); setNormalVSTiVol(100.0); setNormalGlobalVol(128.0); + setExtraSampleAttenuation(MIXING_ATTENUATION); break; // Ericus' version gives us floats in [-0.06;0.06] and requires attenuation to @@ -33,11 +37,12 @@ setFloatToInt(static_cast<float>(0x07FFFFFFF)); setGlobalVolumeAppliesToMaster(false); setUseGlobalPreAmp(true); - setForceSoftPanning(false); + setForcePanningMode(dontForcePanningMode); setDisplayDBValues(false); setNormalSamplePreAmp(128.0); setNormalVSTiVol(100.0); setNormalGlobalVol(128.0); + setExtraSampleAttenuation(MIXING_ATTENUATION); break; // 117RC2 gives us floats in [-1.0; 1.0] and hopefully plays VSTis at @@ -49,11 +54,12 @@ setFloatToInt(static_cast<float>(MIXING_CLIPMAX)); setGlobalVolumeAppliesToMaster(true); setUseGlobalPreAmp(true); - setForceSoftPanning(false); + setForcePanningMode(dontForcePanningMode); setDisplayDBValues(false); setNormalSamplePreAmp(128.0); setNormalVSTiVol(100.0); setNormalGlobalVol(128.0); + setExtraSampleAttenuation(MIXING_ATTENUATION); break; // 117RC3 ignores the horrible global, system-specific pre-amp, @@ -66,13 +72,31 @@ setFloatToInt(static_cast<float>(MIXING_CLIPMAX)); setGlobalVolumeAppliesToMaster(true); setUseGlobalPreAmp(false); - setForceSoftPanning(true); + setForcePanningMode(forceSoftPanning); setDisplayDBValues(true); setNormalSamplePreAmp(128.0); setNormalVSTiVol(128.0); setNormalGlobalVol(256.0); + setExtraSampleAttenuation(0); break; + // A mixmode that is intended to be compatible to legacy trackers (IT/FT2/etc). + // This is basically derived from mixmode 1.17 RC3, with panning mode and volume levels changed. + // Sample attenuation is the same as in Schism Tracker (more attenuation than with RC3, thus VSTi attenuation is also higher). + case mixLevels_compatible: + setVSTiAttenuation(4.0f); + setIntToFloat(1.0f/static_cast<float>(MIXING_CLIPMAX)); + setFloatToInt(static_cast<float>(MIXING_CLIPMAX)); + setGlobalVolumeAppliesToMaster(true); + setUseGlobalPreAmp(false); + setForcePanningMode(forceNoSoftPanning); + setDisplayDBValues(true); + setNormalSamplePreAmp(48.0); + setNormalVSTiVol(48.0); + setNormalGlobalVol(256.0); + setExtraSampleAttenuation(1); + break; + // FOR TEST PURPOSES ONLY: /* case mixLevels_Test: @@ -86,6 +110,7 @@ setNormalSamplePreAmp(128.0); setNormalVSTiVol(128.0); setNormalGlobalVol(256.0); + setExtraAttenuation(0); break; */ @@ -153,11 +178,11 @@ } -bool CSoundFilePlayConfig::getForceSoftPanning() { +forcePanningMode CSoundFilePlayConfig::getForcePanningMode() { return m_forceSoftPanning; } -void CSoundFilePlayConfig::setForceSoftPanning(bool inForceSoftPanning) { +void CSoundFilePlayConfig::setForcePanningMode(forcePanningMode inForceSoftPanning) { m_forceSoftPanning=inForceSoftPanning; } @@ -193,5 +218,14 @@ return m_normalGlobalVol; } +void CSoundFilePlayConfig::setExtraSampleAttenuation(int attn) +{ + m_extraAttenuation = attn; +} +int CSoundFilePlayConfig::getExtraSampleAttenuation() +{ + return m_extraAttenuation; +} + Modified: trunk/OpenMPT/mptrack/SoundFilePlayConfig.h =================================================================== --- trunk/OpenMPT/mptrack/SoundFilePlayConfig.h 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/mptrack/SoundFilePlayConfig.h 2010-11-05 23:06:56 UTC (rev 756) @@ -13,13 +13,21 @@ }; enum { - mixLevels_original = 0, - mixLevels_117RC1 = 1, - mixLevels_117RC2 = 2, - mixLevels_117RC3 = 3, - mixLevels_Test = 4, + mixLevels_original = 0, + mixLevels_117RC1 = 1, + mixLevels_117RC2 = 2, + mixLevels_117RC3 = 3, + mixLevels_compatible = 4, + mixLevels_Test = 5, }; +enum forcePanningMode +{ + dontForcePanningMode, + forceSoftPanning, + forceNoSoftPanning, +}; + // Class used to store settings for a song file. class CSoundFilePlayConfig { @@ -49,12 +57,16 @@ void setUseGlobalPreAmp(bool); bool getUseGlobalPreAmp(); - void setForceSoftPanning(bool); - bool getForceSoftPanning(); + void setForcePanningMode(forcePanningMode); + forcePanningMode getForcePanningMode(); void setDisplayDBValues(bool); bool getDisplayDBValues(); + // Extra sample attenuation in bits + void setExtraSampleAttenuation(int); + int getExtraSampleAttenuation(); + //Values at which volumes are unchanged double getNormalSamplePreAmp(); double getNormalVSTiVol(); @@ -79,9 +91,11 @@ bool m_globalVolumeAppliesToMaster; bool m_ignorePreAmp; - bool m_forceSoftPanning; + forcePanningMode m_forceSoftPanning; bool m_displayDBValues; + int m_extraAttenuation; + DWORD m_LastSavedWithVersion; DWORD m_CreatedWithVersion; }; Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-11-05 23:06:56 UTC (rev 756) @@ -185,11 +185,11 @@ m_PlugMixBox.SetItemData(m_PlugMixBox.AddString("OpenMPT 1.17RC2"), mixLevels_117RC2); m_PlugMixBox.SetItemData(m_PlugMixBox.AddString("OpenMPT 1.17RC1"), mixLevels_117RC1); m_PlugMixBox.SetItemData(m_PlugMixBox.AddString("Original (MPT 1.16)"), mixLevels_original); - //m_PlugMixBox.SetItemData(m_PlugMixBox.AddString("Test"), mixLevels_Test); + m_PlugMixBox.SetItemData(m_PlugMixBox.AddString("Compatible"), mixLevels_compatible); //m_PlugMixBox.SetItemData(m_PlugMixBox.AddString("Test"), mixLevels_Test); switch(m_pSndFile->m_nMixLevels) { - //case mixLevels_Test: m_PlugMixBox.SetCurSel(4); break; - case mixLevels_original: m_PlugMixBox.SetCurSel(3); break; + //case mixLevels_Test: m_PlugMixBox.SetCurSel(5); break; + case mixLevels_compatible: m_PlugMixBox.SetCurSel(4); break; case mixLevels_original: m_PlugMixBox.SetCurSel(3); break; case mixLevels_117RC1: m_PlugMixBox.SetCurSel(2); break; case mixLevels_117RC2: m_PlugMixBox.SetCurSel(1); break; case mixLevels_117RC3: Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/mptrack/version.h 2010-11-05 23:06:56 UTC (rev 756) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 00 -#define VER_MINORMINOR 10 +#define VER_MINORMINOR 11 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-11-05 23:06:56 UTC (rev 756) @@ -998,6 +998,10 @@ // Load instrument and song extensions. if(mptStartPos >= dwMemPos) { + if(interpretModPlugMade) + { + m_nMixLevels = mixLevels_original; + } LPCBYTE ptr = LoadExtendedInstrumentProperties(lpStream + dwMemPos, lpStream + mptStartPos, &interpretModPlugMade); LoadExtendedSongProperties(GetType(), ptr, lpStream, mptStartPos, &interpretModPlugMade); } Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2010-11-05 23:06:56 UTC (rev 756) @@ -686,6 +686,7 @@ if(bMadeWithModPlug) { + m_nMixLevels = mixLevels_original; SetModFlag(MSF_COMPATIBLE_PLAY, false); if(!m_dwLastSavedWithVersion) { Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-11-05 23:06:56 UTC (rev 756) @@ -550,7 +550,7 @@ m_nMaxOrderPosition = 0; m_lpszPatternNames = NULL; m_lpszSongComments = nullptr; - m_nMixLevels = mixLevels_original; // Will be overridden if appropriate. + m_nMixLevels = mixLevels_compatible; // Will be overridden if appropriate. memset(Samples, 0, sizeof(Samples)); memset(ChnMix, 0, sizeof(ChnMix)); memset(Chn, 0, sizeof(Chn)); Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-11-05 23:06:56 UTC (rev 756) @@ -1831,7 +1831,8 @@ realvol = (pChn->nRealVolume * kChnMasterVol) >> 8; } - if (m_pConfig->getForceSoftPanning() || (gdwSoundSetup & SNDMIX_SOFTPANNING)) + const forcePanningMode panningMode = m_pConfig->getForcePanningMode(); + if (panningMode == forceSoftPanning || (panningMode == dontForcePanningMode && (gdwSoundSetup & SNDMIX_SOFTPANNING))) { if (pan < 128) { @@ -1905,11 +1906,15 @@ if (pChn->nInc >= 0xFE00) pChn->dwFlags |= CHN_NOIDO; #endif // FASTSOUNDLIB } - if (m_pConfig->getUseGlobalPreAmp()) + + /*if (m_pConfig->getUseGlobalPreAmp()) { pChn->nNewRightVol >>= MIXING_ATTENUATION; pChn->nNewLeftVol >>= MIXING_ATTENUATION; - } + }*/ + const int extraAttenuation = m_pConfig->getExtraSampleAttenuation(); + pChn->nNewRightVol >>= extraAttenuation; + pChn->nNewLeftVol >>= extraAttenuation; pChn->nRightRamp = pChn->nLeftRamp = 0; // Dolby Pro-Logic Surround Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2010-10-26 17:58:56 UTC (rev 755) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-11-05 23:06:56 UTC (rev 756) @@ -63,7 +63,7 @@ NOTE: If changing limits, see whether: -savefile format and GUI methods can handle new values(might not be a small task :). */ - "MPTm", // File extension + "mptm", // File extension 1, // Minimum note index NOTE_MAX, // Maximum note index true, // Has notecut. @@ -126,7 +126,7 @@ 0, // Max instrument filename length 31, // SamplesMax 0, // instrumentMax - mixLevels_original, // defaultMixLevels + mixLevels_compatible, // defaultMixLevels 0, // Max MIDI mapping directives 1, // Min Speed 32, // Max Speed @@ -166,7 +166,7 @@ 0, // Max instrument filename length 31, // SamplesMax 0, // instrumentMax - mixLevels_original, // defaultMixLevels + mixLevels_compatible, // defaultMixLevels 0, // Max MIDI mapping directives 1, // Min Speed 32, // Max Speed @@ -205,7 +205,7 @@ 0, // Max instrument filename length 128 * 16, // SamplesMax (actually 16 per instrument) 128, // instrumentMax - mixLevels_original, // defaultMixLevels + mixLevels_compatible, // defaultMixLevels 0, // Max MIDI mapping directives 1, // Min Speed 31, // Max Speed @@ -245,7 +245,7 @@ 0, // Max instrument filename length 4000, // SamplesMax (actually 16 per instrument(256*16=4096), but limited to MAX_SAMPLES=4000) 256, // instrumentMax - mixLevels_117RC3, // defaultMixLevels + mixLevels_compatible, // defaultMixLevels 200, // Max MIDI mapping directives 1, // Min Speed 31, // Max Speed @@ -284,7 +284,7 @@ 0, // Max instrument filename length 99, // SamplesMax 0, // instrumentMax - mixLevels_original, // defaultMixLevels + mixLevels_compatible, // defaultMixLevels 0, // Max MIDI mapping directives 1, // Min Speed 255, // Max Speed @@ -324,7 +324,7 @@ 0, // Max instrument filename length 99, // SamplesMax 0, // instrumentMax - mixLevels_original, // defaultMixLevels + mixLevels_compatible, // defaultMixLevels 0, // Max MIDI mapping directives 1, // Min Speed 255, // Max Speed @@ -363,7 +363,7 @@ 12, // Max instrument filename length 99, // SamplesMax 99, // instrumentMax - mixLevels_original, // defaultMixLevels + mixLevels_compatible, // defaultMixLevels 0, // Max MIDI mapping directives 1, // Min Speed 255, // Max Speed @@ -402,7 +402,7 @@ 12, // Max instrument filename length 4000, // SamplesMax 256, // instrumentMax - mixLevels_117RC3, // defaultMixLevels + mixLevels_compatible, // defaultMixLevels 200, // Max MIDI mapping directives 1, // Min Speed 255, // Max Speed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |