From: <sag...@us...> - 2009-07-29 14:08:48
|
Revision: 309 http://modplug.svn.sourceforge.net/modplug/?rev=309&view=rev Author: saga-games Date: 2009-07-29 12:20:51 +0000 (Wed, 29 Jul 2009) Log Message: ----------- [Imp] Sample editor: If sample length is 0, the "add silence / resize sample" dialog will switch into "resize" mode automatically (not a real difference, but looks cleaner) [Imp] Format conversion: \xx is converted to Zxx when converting to / saving S3M files or "compatible" IT files [Imp] S3M Loader: Recognize OpenMPT version in S3M header Modified Paths: -------------- trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/dlg_misc.h trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2009-07-28 13:34:18 UTC (rev 308) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-07-29 12:20:51 UTC (rev 309) @@ -380,6 +380,7 @@ { case CMD_PANNING8: m->param = (m->param + 1) >> 1; + break; case CMD_S3MCMDEX: if(m->param == 0x91) { @@ -387,6 +388,10 @@ m->command = CMD_PANNING8; m->param = 0xA4; } + break; + case CMD_SMOOTHMIDI: + m->command = CMD_MIDI; + break; default: break; } Modified: trunk/OpenMPT/mptrack/dlg_misc.h =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.h 2009-07-28 13:34:18 UTC (rev 308) +++ trunk/OpenMPT/mptrack/dlg_misc.h 2009-07-29 12:20:51 UTC (rev 309) @@ -354,12 +354,26 @@ DECLARE_MESSAGE_MAP() public: - UINT m_nSamples; - UINT m_nLength; - char m_nEditOption; // 1 = add at beginning, 2 = add at end, 3 = resize + UINT m_nSamples; // Add x samples (also containes the return value in all cases) + UINT m_nLength; // Set size to x samples (init value: current sample size) + char m_nEditOption; // 1 = add at beginning, 2 = add at end, 3 = resize public: - CAddSilenceDlg(CWnd *parent, UINT nSamples = 32, UINT nOrigLength = 1024):CDialog(IDD_ADDSILENCE, parent) { m_nSamples = nSamples; m_nLength = nOrigLength; m_nEditOption = 2; } + CAddSilenceDlg(CWnd *parent, UINT nSamples = 32, UINT nOrigLength = 64) : CDialog(IDD_ADDSILENCE, parent) + { + m_nSamples = nSamples; + if(nOrigLength > 0) + { + m_nLength = nOrigLength; + m_nEditOption = 2; + } + else + { + m_nLength = 64; + m_nEditOption = 3; + } + } + virtual BOOL OnInitDialog(); virtual void OnOK(); }; Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2009-07-28 13:34:18 UTC (rev 308) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2009-07-29 12:20:51 UTC (rev 309) @@ -1478,6 +1478,8 @@ LONG nDeltaLo = 0x10000 - (pChn->nPosLo & 0xffff); pChn->nPos = pChn->nLength - nDeltaHi - (nDeltaLo>>16); pChn->nPosLo = nDeltaLo & 0xffff; + // Impulse Tracker's software mixer would put a -2 (instead of -1) in the following line (doesn't happen on a GUS) + // TODO: How can we add IT compatibility here without slowing down the mixing routines? if ((pChn->nPos <= pChn->nLoopStart) || (pChn->nPos >= pChn->nLength)) pChn->nPos = pChn->nLength-1; } else { Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2009-07-28 13:34:18 UTC (rev 308) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2009-07-29 12:20:51 UTC (rev 309) @@ -2858,7 +2858,7 @@ if (vol != 0xFF) b |= 4; if (command) { - S3MSaveConvert(&command, ¶m, TRUE); + S3MSaveConvert(&command, ¶m, true, true); if (command) b |= 8; } // Packing information Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-07-28 13:34:18 UTC (rev 308) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-07-29 12:20:51 UTC (rev 309) @@ -12,9 +12,7 @@ #include "sndfile.h" #include "../mptrack/moddoc.h" #include "../mptrack/misc_util.h" -#ifndef MODPLUG_NO_FILESAVE #include "../mptrack/version.h" -#endif #pragma warning(disable:4244) //"conversion from 'type1' to 'type2', possible loss of data" @@ -154,8 +152,8 @@ } -void CSoundFile::S3MSaveConvert(UINT *pcmd, UINT *pprm, BOOL bIT) const -//--------------------------------------------------------------------- +void CSoundFile::S3MSaveConvert(UINT *pcmd, UINT *pprm, BOOL bIT, BOOL bCompatible) const +//--------------------------------------------------------------------------------------- { UINT command = *pcmd; UINT param = *pprm; @@ -186,20 +184,25 @@ case CMD_GLOBALVOLSLIDE: command = 'W'; break; case CMD_PANNING8: command = 'X'; - if ((bIT) && (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) && (m_nType != MOD_TYPE_XM)) + if (bIT && !(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM))) { if (param == 0xA4) { command = 'S'; param = 0x91; } else if (param <= 0x80) { param <<= 1; if (param > 255) param = 255; } else command = param = 0; } else - if ((!bIT) && ((m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) || (m_nType == MOD_TYPE_XM))) + if (!bIT && (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM))) { param >>= 1; } break; case CMD_PANBRELLO: command = 'Y'; break; case CMD_MIDI: command = 'Z'; break; - case CMD_SMOOTHMIDI: command = '\\'; break; //rewbs.smoothVST + case CMD_SMOOTHMIDI: //rewbs.smoothVST + if(bCompatible) + command = 'Z'; + else + command = '\\'; + break; case CMD_VELOCITY: command = ':'; break; //rewbs.velocity case CMD_XFINEPORTAUPDOWN: if (param & 0x0F) switch(param & 0xF0) @@ -262,6 +265,9 @@ psfh.scrm = LittleEndian(psfh.scrm); psfh.special = LittleEndianW(psfh.special); + if((psfh.cwtv & 0xF000) == 0x5000) // OpenMPT Version number (Major.Minor) + m_dwLastSavedWithVersion = (psfh.cwtv & 0x0FFF) << 16; + if ((!lpStream) || (dwMemLength <= sizeof(S3MFILEHEADER)+sizeof(S3MSAMPLESTRUCT)+64)) return FALSE; if (psfh.scrm != 0x4D524353) return FALSE; dwMemPos = 0x60; @@ -362,7 +368,6 @@ if (insfile[iSmp] > dwMemLength) insfile[iSmp] &= 0xFFFF; if ((Ins[iSmp].nLoopStart >= Ins[iSmp].nLoopEnd) || (Ins[iSmp].nLoopEnd - Ins[iSmp].nLoopStart < 1)) Ins[iSmp].nLoopStart = Ins[iSmp].nLoopEnd = 0; - UINT iLooplength = Ins[iSmp].nLoopEnd - Ins[iSmp].nLoopStart; Ins[iSmp].nPan = 0x80; //ASSERT(iLooplength == 0 || iLooplength > 4); } @@ -515,10 +520,10 @@ // Version info following: ST3.20 = 0x1320 // Most significant nibble: 1 = ST3, 2 = Orpheus, 3 = IT, 4 = Schism, 5 = MPT - // Following: One nibble = Major version, one byte = Minor version + // Following: One nibble = Major version, one byte = Minor version (hex) MptVersion::VersionNum vVersion = MptVersion::num; header[0x28] = (BYTE)((vVersion >> 16) & 0xFF); // the "17" in OpenMPT 1.17 - header[0x29] = 0x50 | (BYTE)((vVersion >> 24) & 0x0F); // the "1" in OpenMPT 1.17 + OpenMPT Identifier 5 (works only for versions up to 15.255 :)) + header[0x29] = 0x50 | (BYTE)((vVersion >> 24) & 0x0F); // the "1" in OpenMPT 1.17 + OpenMPT Identifier 5 (works only for versions up to 15.99 :)) header[0x2A] = 0x02; // Version = 1 => Signed samples header[0x2B] = 0x00; header[0x2C] = 'S'; @@ -606,7 +611,7 @@ if (volcmd == VOLCMD_PANNING) { vol |= 0x80; b |= 0x40; } if (command) { - S3MSaveConvert(&command, ¶m, FALSE); + S3MSaveConvert(&command, ¶m, false, true); if (command) b |= 0x80; } if (b & 0xE0) Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2009-07-28 13:34:18 UTC (rev 308) +++ trunk/OpenMPT/soundlib/Sndfile.h 2009-07-29 12:20:51 UTC (rev 309) @@ -1055,7 +1055,7 @@ UINT GetSaveFormats() const; void ConvertModCommand(MODCOMMAND *) const; void S3MConvert(MODCOMMAND *m, BOOL bIT) const; - void S3MSaveConvert(UINT *pcmd, UINT *pprm, BOOL bIT) const; + void S3MSaveConvert(UINT *pcmd, UINT *pprm, BOOL bIT, BOOL bCompatible = false) const; WORD ModSaveCommand(const MODCOMMAND *m, BOOL bXM) const; public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |