From: <sag...@us...> - 2010-09-30 22:44:40
|
Revision: 728 http://modplug.svn.sourceforge.net/modplug/?rev=728&view=rev Author: saga-games Date: 2010-09-30 22:44:28 +0000 (Thu, 30 Sep 2010) Log Message: ----------- [New] WAV Export: Sample-exact cue points are now written for each pattern transition (as requested by Skaven). TODO: Make this feature optional. [Ref] Moved WAV structs and IFF chunk ID stuff to a separate file [Mod] OpenMPT: Version is now 1.19.00.06 Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/mod2midi.cpp trunk/OpenMPT/mptrack/mptrack.vcproj trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/tagging.h trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/Load_mid.cpp trunk/OpenMPT/soundlib/Load_wav.cpp trunk/OpenMPT/soundlib/Sampleio.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Added Paths: ----------- trunk/OpenMPT/soundlib/Wav.h Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2010-09-30 22:44:28 UTC (rev 728) @@ -6,6 +6,7 @@ #include "mpdlgs.h" #include "vstplug.h" #include "mod2wave.h" +#include "Wav.h" extern UINT nMixingRates[NUMMIXRATE]; extern LPCSTR gszChnCfgNames[3]; @@ -696,6 +697,9 @@ ::SendMessage(progress, PBM_SETRANGE, 0, MAKELPARAM(0, (DWORD)(max >> 14))); } + // No pattern cue points yet + m_pSndFile->m_PatternCuePoints.clear(); + // Process the conversion UINT nBytesPerSample = (CSoundFile::gnBitsPerSample * CSoundFile::gnChannels) / 8; // For calculating the remaining time @@ -707,6 +711,20 @@ for (UINT n=0; ; n++) { UINT lRead = m_pSndFile->Read(buffer, sizeof(buffer)); + + // Process cue points (add base offset), if there are any to process. + vector<PatternCuePoint>::reverse_iterator iter = m_pSndFile->m_PatternCuePoints.rbegin(); + for(iter = m_pSndFile->m_PatternCuePoints.rbegin(); iter != m_pSndFile->m_PatternCuePoints.rend(); ++iter) + { + if(iter->processed) + { + // From this point, all cues have already been processed. + break; + } + iter->offset += ullSamples; + iter->processed = true; + } + /* if (m_bGivePlugsIdleTime) { LARGE_INTEGER startTime, endTime, duration,Freq; QueryPerformanceFrequency(&Freq); @@ -834,7 +852,37 @@ } } } - header.filesize = (sizeof(WAVEFILEHEADER)-8) + (8+fmthdr.length) + (8+datahdr.length); + + // Write cue points + DWORD cuePointLength = 0; + if(m_pSndFile->m_PatternCuePoints.size() > 0) + { + WAVCUEHEADER cuehdr; + cuehdr.cue_id = LittleEndian(IFFID_cue); + cuehdr.cue_num = m_pSndFile->m_PatternCuePoints.size(); + cuehdr.cue_len = 4 + cuehdr.cue_num * sizeof(WAVCUEPOINT); + cuePointLength = 8 + cuehdr.cue_len; + cuehdr.cue_num = LittleEndian(cuehdr.cue_num); + cuehdr.cue_len = LittleEndian(cuehdr.cue_len); + fwrite(&cuehdr, 1, sizeof(WAVCUEHEADER), f); + + // Write all cue points + vector<PatternCuePoint>::iterator iter; + DWORD num = 0; + for(iter = m_pSndFile->m_PatternCuePoints.begin(); iter != m_pSndFile->m_PatternCuePoints.end(); ++iter) + { + WAVCUEPOINT cuepoint; + cuepoint.cp_id = LittleEndian(num++); + cuepoint.cp_pos = LittleEndian((DWORD)iter->offset); + cuepoint.cp_chunkid = LittleEndian(IFFID_data); + cuepoint.cp_chunkstart = 0; // we use no Wave List Chunk (wavl) as we have only one data block, so this should be 0. + cuepoint.cp_blockstart = 0; + cuepoint.cp_offset = LittleEndian((DWORD)iter->offset); + fwrite(&cuepoint, 1, sizeof(WAVCUEPOINT), f); + } + } + + header.filesize = (sizeof(WAVEFILEHEADER) - 8) + (8 + fmthdr.length) + (8 + datahdr.length) + (cuePointLength); fseek(f, 0, SEEK_SET); fwrite(&header, sizeof(header), 1, f); fseek(f, dwDataOffset-sizeof(datahdr), SEEK_SET); Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2010-09-30 22:44:28 UTC (rev 728) @@ -11,6 +11,7 @@ #include "midi.h" #include "dlg_misc.h" #include "modsmp_ctrl.h" +#include "Wav.h" #define new DEBUG_NEW Modified: trunk/OpenMPT/mptrack/mod2midi.cpp =================================================================== --- trunk/OpenMPT/mptrack/mod2midi.cpp 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/mptrack/mod2midi.cpp 2010-09-30 22:44:28 UTC (rev 728) @@ -1,6 +1,7 @@ #include "stdafx.h" #include "mptrack.h" #include "mod2midi.h" +#include "Wav.h" #pragma pack(1) Modified: trunk/OpenMPT/mptrack/mptrack.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack.vcproj 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/mptrack/mptrack.vcproj 2010-09-30 22:44:28 UTC (rev 728) @@ -942,6 +942,9 @@ RelativePath=".\vstplug.h"> </File> <File + RelativePath="..\soundlib\Wav.h"> + </File> + <File RelativePath="..\soundlib\wavConverter.h"> </File> <File Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2010-09-30 22:44:28 UTC (rev 728) @@ -1251,6 +1251,10 @@ > </File> <File + RelativePath="..\soundlib\Wav.h" + > + </File> + <File RelativePath="..\soundlib\wavConverter.h" > </File> Modified: trunk/OpenMPT/mptrack/tagging.h =================================================================== --- trunk/OpenMPT/mptrack/tagging.h 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/mptrack/tagging.h 2010-09-30 22:44:28 UTC (rev 728) @@ -2,6 +2,7 @@ // ID3v2.4 / etc. tagging class (for mp3 / wav / etc. support) #include <string> +#include "Wav.h" using std::string; Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/mptrack/version.h 2010-09-30 22:44:28 UTC (rev 728) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 00 -#define VER_MINORMINOR 05 +#define VER_MINORMINOR 06 //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/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2010-09-30 22:44:28 UTC (rev 728) @@ -16,7 +16,9 @@ #include "sndfile.h" #include "../mptrack/mptrack.h" #include "dlsbank.h" +#include "Wav.h" + //#define DLSBANK_LOG //#define DLSINSTR_LOG Modified: trunk/OpenMPT/soundlib/Load_mid.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mid.cpp 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/soundlib/Load_mid.cpp 2010-09-30 22:44:28 UTC (rev 728) @@ -13,7 +13,9 @@ #include "stdafx.h" #include "Loaders.h" #include "dlsbank.h" +#include "Wav.h" + #pragma warning(disable:4244) //#define MIDI_LOG Modified: trunk/OpenMPT/soundlib/Load_wav.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_wav.cpp 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/soundlib/Load_wav.cpp 2010-09-30 22:44:28 UTC (rev 728) @@ -9,6 +9,7 @@ #include "stdafx.h" #include "Loaders.h" +#include "Wav.h" #ifndef WAVE_FORMAT_EXTENSIBLE #define WAVE_FORMAT_EXTENSIBLE 0xFFFE Modified: trunk/OpenMPT/soundlib/Sampleio.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sampleio.cpp 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/soundlib/Sampleio.cpp 2010-09-30 22:44:28 UTC (rev 728) @@ -11,6 +11,7 @@ #include "sndfile.h" #include "it_defs.h" #include "wavConverter.h" +#include "Wav.h" #pragma warning(disable:4244) Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-09-30 22:44:28 UTC (rev 728) @@ -462,6 +462,15 @@ }; +// For WAV export (writing pattern positions to file) +struct PatternCuePoint +{ + bool processed; // has this point been processed by the main WAV render function yet? + ULONGLONG offset; // offset in the file (in samples) + ORDERINDEX order; // which order is this? +}; + + class CSoundFile; @@ -599,8 +608,8 @@ UINT m_nMaxOrderPosition, m_nPatternNames; LPSTR m_lpszSongComments, m_lpszPatternNames; UINT ChnMix[MAX_CHANNELS]; // Channels to be mixed - MODCHANNEL Chn[MAX_CHANNELS]; // Channels - MODCHANNELSETTINGS ChnSettings[MAX_BASECHANNELS]; // Channels settings + MODCHANNEL Chn[MAX_CHANNELS]; // Mixing channels + MODCHANNELSETTINGS ChnSettings[MAX_BASECHANNELS]; // Initial channels settings CPatternContainer Patterns; // Patterns ModSequenceSet Order; // Modsequences. Order[x] returns an index of a pattern located at order x of the current sequence. MODSAMPLE Samples[MAX_SAMPLES]; // Sample Headers @@ -617,6 +626,8 @@ DWORD m_dwCreatedWithVersion; DWORD m_dwLastSavedWithVersion; + vector<PatternCuePoint> m_PatternCuePoints; // For WAV export (writing pattern positions to file) + // -> CODE#0023 // -> DESC="IT project files (.itp)" CHAR m_szInstrumentPath[MAX_INSTRUMENTS][_MAX_PATH]; @@ -1048,127 +1059,6 @@ } -////////////////////////////////////////////////////////// -// WAVE format information - -#pragma pack(1) - -// Standard IFF chunks IDs -#define IFFID_FORM 0x4d524f46 -#define IFFID_RIFF 0x46464952 -#define IFFID_WAVE 0x45564157 -#define IFFID_LIST 0x5453494C -#define IFFID_INFO 0x4F464E49 - -// IFF Info fields -#define IFFID_ICOP 0x504F4349 -#define IFFID_IART 0x54524149 -#define IFFID_IPRD 0x44525049 -#define IFFID_INAM 0x4D414E49 -#define IFFID_ICMT 0x544D4349 -#define IFFID_IENG 0x474E4549 -#define IFFID_ISFT 0x54465349 -#define IFFID_ISBJ 0x4A425349 -#define IFFID_IGNR 0x524E4749 -#define IFFID_ICRD 0x44524349 - -// Wave IFF chunks IDs -#define IFFID_wave 0x65766177 -#define IFFID_fmt 0x20746D66 -#define IFFID_wsmp 0x706D7377 -#define IFFID_pcm 0x206d6370 -#define IFFID_data 0x61746164 -#define IFFID_smpl 0x6C706D73 -#define IFFID_xtra 0x61727478 - -typedef struct WAVEFILEHEADER -{ - DWORD id_RIFF; // "RIFF" - DWORD filesize; // file length-8 - DWORD id_WAVE; -} WAVEFILEHEADER; - - -typedef struct WAVEFORMATHEADER -{ - DWORD id_fmt; // "fmt " - DWORD hdrlen; // 16 - WORD format; // 1 - WORD channels; // 1:mono, 2:stereo - DWORD freqHz; // sampling freq - DWORD bytessec; // bytes/sec=freqHz*samplesize - WORD samplesize; // sizeof(sample) - WORD bitspersample; // bits per sample (8/16) -} WAVEFORMATHEADER; - - -typedef struct WAVEDATAHEADER -{ - DWORD id_data; // "data" - DWORD length; // length of data -} WAVEDATAHEADER; - - -typedef struct WAVESMPLHEADER -{ - // SMPL - DWORD smpl_id; // "smpl" -> 0x6C706D73 - DWORD smpl_len; // length of smpl: 3Ch (54h with sustain loop) - DWORD dwManufacturer; - DWORD dwProduct; - DWORD dwSamplePeriod; // 1000000000/freqHz - DWORD dwBaseNote; // 3Ch = C-4 -> 60 + RelativeTone - DWORD dwPitchFraction; - DWORD dwSMPTEFormat; - DWORD dwSMPTEOffset; - DWORD dwSampleLoops; // number of loops - DWORD cbSamplerData; -} WAVESMPLHEADER; - - -typedef struct SAMPLELOOPSTRUCT -{ - DWORD dwIdentifier; - DWORD dwLoopType; // 0=normal, 1=bidi - DWORD dwLoopStart; - DWORD dwLoopEnd; // Byte offset ? - DWORD dwFraction; - DWORD dwPlayCount; // Loop Count, 0=infinite -} SAMPLELOOPSTRUCT; - - -typedef struct WAVESAMPLERINFO -{ - WAVESMPLHEADER wsiHdr; - SAMPLELOOPSTRUCT wsiLoops[2]; -} WAVESAMPLERINFO; - - -typedef struct WAVELISTHEADER -{ - DWORD list_id; // "LIST" -> 0x5453494C - DWORD list_len; - DWORD info; // "INFO" -} WAVELISTHEADER; - - -typedef struct WAVEEXTRAHEADER -{ - DWORD xtra_id; // "xtra" -> 0x61727478 - DWORD xtra_len; - DWORD dwFlags; - WORD wPan; - WORD wVolume; - WORD wGlobalVol; - WORD wReserved; - BYTE nVibType; - BYTE nVibSweep; - BYTE nVibDepth; - BYTE nVibRate; -} WAVEEXTRAHEADER; - -#pragma pack() - /////////////////////////////////////////////////////////// // Low-level Mixing functions Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-09-29 23:28:20 UTC (rev 727) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-09-30 22:44:28 UTC (rev 728) @@ -312,8 +312,19 @@ m_nBufferCount = lRead; } else #endif - if (!ReadNote()) + if (ReadNote()) { + // Save pattern cue points for WAV rendering here (if we reached a new pattern, that is.) + if(m_bIsRendering && (m_PatternCuePoints.empty() || m_nCurrentPattern != m_PatternCuePoints.back().order)) + { + PatternCuePoint cue; + cue.offset = lMax - lRead; + cue.order = m_nCurrentPattern; + cue.processed = false; + m_PatternCuePoints.push_back(cue); + } + } else + { #ifdef MODPLUG_TRACKER if ((m_nMaxOrderPosition) && (m_nCurrentPattern >= m_nMaxOrderPosition)) { Added: trunk/OpenMPT/soundlib/Wav.h =================================================================== --- trunk/OpenMPT/soundlib/Wav.h (rev 0) +++ trunk/OpenMPT/soundlib/Wav.h 2010-09-30 22:44:28 UTC (rev 728) @@ -0,0 +1,154 @@ +/* + * Wav.h + * ----- + * Purpose: Headers for WAV reading / writing (WAV structs, FOURCCs, etc...) + * Notes : Some FOURCCs are also used by the MIDI/DLS routines. + * Authors: OpenMPT Devs + * + */ + +#ifndef WAV_H +#define WAV_H +#pragma once + +#pragma pack(1) + +// Standard IFF chunks IDs +#define IFFID_FORM 0x4d524f46 +#define IFFID_RIFF 0x46464952 +#define IFFID_WAVE 0x45564157 +#define IFFID_LIST 0x5453494C +#define IFFID_INFO 0x4F464E49 + +// IFF Info fields +#define IFFID_ICOP 0x504F4349 +#define IFFID_IART 0x54524149 +#define IFFID_IPRD 0x44525049 +#define IFFID_INAM 0x4D414E49 +#define IFFID_ICMT 0x544D4349 +#define IFFID_IENG 0x474E4549 +#define IFFID_ISFT 0x54465349 +#define IFFID_ISBJ 0x4A425349 +#define IFFID_IGNR 0x524E4749 +#define IFFID_ICRD 0x44524349 + +// Wave IFF chunks IDs +#define IFFID_wave 0x65766177 +#define IFFID_fmt 0x20746D66 +#define IFFID_wsmp 0x706D7377 +#define IFFID_pcm 0x206d6370 +#define IFFID_data 0x61746164 +#define IFFID_smpl 0x6C706D73 +#define IFFID_xtra 0x61727478 +#define IFFID_cue 0x20657563 + + +typedef struct WAVEFILEHEADER +{ + DWORD id_RIFF; // "RIFF" + DWORD filesize; // file length-8 + DWORD id_WAVE; +} WAVEFILEHEADER; + + +typedef struct WAVEFORMATHEADER +{ + DWORD id_fmt; // "fmt " + DWORD hdrlen; // 16 + WORD format; // 1 + WORD channels; // 1:mono, 2:stereo + DWORD freqHz; // sampling freq + DWORD bytessec; // bytes/sec=freqHz*samplesize + WORD samplesize; // sizeof(sample) + WORD bitspersample; // bits per sample (8/16) +} WAVEFORMATHEADER; + + +typedef struct WAVEDATAHEADER +{ + DWORD id_data; // "data" + DWORD length; // length of data +} WAVEDATAHEADER; + + +typedef struct WAVESMPLHEADER +{ + // SMPL + DWORD smpl_id; // "smpl" -> 0x6C706D73 + DWORD smpl_len; // length of smpl: 3Ch (54h with sustain loop) + DWORD dwManufacturer; + DWORD dwProduct; + DWORD dwSamplePeriod; // 1000000000/freqHz + DWORD dwBaseNote; // 3Ch = C-4 -> 60 + RelativeTone + DWORD dwPitchFraction; + DWORD dwSMPTEFormat; + DWORD dwSMPTEOffset; + DWORD dwSampleLoops; // number of loops + DWORD cbSamplerData; +} WAVESMPLHEADER; + + +typedef struct SAMPLELOOPSTRUCT +{ + DWORD dwIdentifier; + DWORD dwLoopType; // 0=normal, 1=bidi + DWORD dwLoopStart; + DWORD dwLoopEnd; // Byte offset ? + DWORD dwFraction; + DWORD dwPlayCount; // Loop Count, 0=infinite +} SAMPLELOOPSTRUCT; + + +typedef struct WAVESAMPLERINFO +{ + WAVESMPLHEADER wsiHdr; + SAMPLELOOPSTRUCT wsiLoops[2]; +} WAVESAMPLERINFO; + + +typedef struct WAVELISTHEADER +{ + DWORD list_id; // "LIST" -> 0x5453494C + DWORD list_len; + DWORD info; // "INFO" +} WAVELISTHEADER; + + +typedef struct WAVEEXTRAHEADER +{ + DWORD xtra_id; // "xtra" -> 0x61727478 + DWORD xtra_len; + DWORD dwFlags; + WORD wPan; + WORD wVolume; + WORD wGlobalVol; + WORD wReserved; + BYTE nVibType; + BYTE nVibSweep; + BYTE nVibDepth; + BYTE nVibRate; +} WAVEEXTRAHEADER; + + +typedef struct WAVCUEHEADER +{ + DWORD cue_id; // "cue " -> 0x20657563 + DWORD cue_len; + DWORD cue_num; +} WAVCUEHEADER; + + +typedef struct WAVCUEPOINT +{ + DWORD cp_id; // Unique identification value + DWORD cp_pos; // Play order position + DWORD cp_chunkid; // RIFF ID of corresponding data chunk + DWORD cp_chunkstart; // Byte Offset of Data Chunk + DWORD cp_blockstart; // Byte Offset to sample of First Channel + DWORD cp_offset; // Byte Offset to sample byte of First Channel +} WAVCUEPOINT; + + +#pragma pack() + +#endif // WAV_H \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-10-03 16:11:14
|
Revision: 729 http://modplug.svn.sourceforge.net/modplug/?rev=729&view=rev Author: saga-games Date: 2010-10-03 16:11:07 +0000 (Sun, 03 Oct 2010) Log Message: ----------- [Mod] ITP Loader: Added version check (why was this not there in the first place?) [Mod] Mod Conversion: Added warning if the edit history will be lost [Ref] Some minor changes here and there Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/ModConvert.h trunk/OpenMPT/soundlib/Load_itp.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2010-09-30 22:44:28 UTC (rev 728) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2010-10-03 16:11:07 UTC (rev 729) @@ -708,12 +708,12 @@ DWORD dwSleepTime = dwStartTime; CMainFrame::GetMainFrame()->InitRenderer(m_pSndFile); //rewbs.VSTTimeInfo - for (UINT n=0; ; n++) + for (UINT n = 0; ; n++) { UINT lRead = m_pSndFile->Read(buffer, sizeof(buffer)); // Process cue points (add base offset), if there are any to process. - vector<PatternCuePoint>::reverse_iterator iter = m_pSndFile->m_PatternCuePoints.rbegin(); + vector<PatternCuePoint>::reverse_iterator iter; for(iter = m_pSndFile->m_PatternCuePoints.rbegin(); iter != m_pSndFile->m_PatternCuePoints.rend(); ++iter) { if(iter->processed) @@ -857,6 +857,7 @@ DWORD cuePointLength = 0; if(m_pSndFile->m_PatternCuePoints.size() > 0) { + // Cue point header WAVCUEHEADER cuehdr; cuehdr.cue_id = LittleEndian(IFFID_cue); cuehdr.cue_num = m_pSndFile->m_PatternCuePoints.size(); @@ -867,7 +868,7 @@ fwrite(&cuehdr, 1, sizeof(WAVCUEHEADER), f); // Write all cue points - vector<PatternCuePoint>::iterator iter; + vector<PatternCuePoint>::const_iterator iter; DWORD num = 0; for(iter = m_pSndFile->m_PatternCuePoints.begin(); iter != m_pSndFile->m_PatternCuePoints.end(); ++iter) { @@ -875,11 +876,12 @@ cuepoint.cp_id = LittleEndian(num++); cuepoint.cp_pos = LittleEndian((DWORD)iter->offset); cuepoint.cp_chunkid = LittleEndian(IFFID_data); - cuepoint.cp_chunkstart = 0; // we use no Wave List Chunk (wavl) as we have only one data block, so this should be 0. - cuepoint.cp_blockstart = 0; + cuepoint.cp_chunkstart = 0; // we use no Wave List Chunk (wavl) as we have only one data block, so this should be 0. + cuepoint.cp_blockstart = 0; // dito cuepoint.cp_offset = LittleEndian((DWORD)iter->offset); fwrite(&cuepoint, 1, sizeof(WAVCUEPOINT), f); } + m_pSndFile->m_PatternCuePoints.clear(); } header.filesize = (sizeof(WAVEFILEHEADER) - 8) + (8 + fmthdr.length) + (8 + datahdr.length) + (cuePointLength); Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2010-09-30 22:44:28 UTC (rev 728) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2010-10-03 16:11:07 UTC (rev 729) @@ -409,6 +409,12 @@ } } + // Check whether the new format supports embedding the edit history in the file. + if(oldTypeIsIT_MPT && !newTypeIsIT_MPT && GetFileHistory()->size() > 0) + { + CHANGEMODTYPE_WARNING(wEditHistory); + } + BEGIN_CRITICAL(); m_SndFile.ChangeModTypeTo(nNewType); if(!newTypeIsXM_IT_MPT && (m_SndFile.m_dwSongFlags & SONG_LINEARSLIDES)) @@ -456,6 +462,7 @@ CHANGEMODTYPE_CHECK(wLinearSlides, "Linear Frequency Slides not supported by the new format.\n"); 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"); SetModified(); GetPatternUndo()->ClearUndo(); Modified: trunk/OpenMPT/mptrack/ModConvert.h =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.h 2010-09-30 22:44:28 UTC (rev 728) +++ trunk/OpenMPT/mptrack/ModConvert.h 2010-10-03 16:11:07 UTC (rev 729) @@ -32,6 +32,7 @@ wLinearSlides, wTrimmedEnvelopes, wReleaseNode, + wEditHistory, wNumWarnings }; Modified: trunk/OpenMPT/soundlib/Load_itp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_itp.cpp 2010-09-30 22:44:28 UTC (rev 728) +++ trunk/OpenMPT/soundlib/Load_itp.cpp 2010-10-03 16:11:07 UTC (rev 729) @@ -43,6 +43,12 @@ version = id; dwMemPos += sizeof(DWORD); + // max supported version + if(version > ITP_VERSION) + { + return false; + } + m_nType = MOD_TYPE_IT; // Song name @@ -402,7 +408,8 @@ } // Embed instruments' header [v1.01] - if(version >= 0x00000101 && m_dwSongFlags & SONG_ITPEMBEDIH && fcode == 'EBIH'){ + if(version >= 0x00000101 && m_dwSongFlags & SONG_ITPEMBEDIH && fcode == 'EBIH') + { // jump embeded instrument header tag ptr += sizeof(__int32); @@ -698,13 +705,15 @@ // Embed instruments' header [v1.01] - if(m_dwSongFlags & SONG_ITPEMBEDIH){ + if(m_dwSongFlags & SONG_ITPEMBEDIH) + { // embeded instrument header tag __int32 code = 'EBIH'; fwrite(&code, 1, sizeof(__int32), f); // instruments' header - for(i=0; i<m_nInstruments; i++){ + for(i=0; i<m_nInstruments; i++) + { if(Instruments[i+1]) WriteInstrumentHeaderStruct(Instruments[i+1], f); // write separator tag code = 'SEP@'; Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2010-09-30 22:44:28 UTC (rev 728) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2010-10-03 16:11:07 UTC (rev 729) @@ -117,11 +117,11 @@ #define MOD_TYPE_UMX 0x80000000 // Fake type // For compatibility mode -#define TRK_IMPULSETRACKER MOD_TYPE_IT | MOD_TYPE_MPT -#define TRK_FASTTRACKER2 MOD_TYPE_XM -#define TRK_SCREAMTRACKER MOD_TYPE_S3M -#define TRK_PROTRACKER MOD_TYPE_MOD -#define TRK_ALLTRACKERS TRK_IMPULSETRACKER | TRK_FASTTRACKER2 | TRK_SCREAMTRACKER | TRK_PROTRACKER +#define TRK_IMPULSETRACKER (MOD_TYPE_IT | MOD_TYPE_MPT) +#define TRK_FASTTRACKER2 (MOD_TYPE_XM) +#define TRK_SCREAMTRACKER (MOD_TYPE_S3M) +#define TRK_PROTRACKER (MOD_TYPE_MOD) +#define TRK_ALLTRACKERS (TRK_IMPULSETRACKER | TRK_FASTTRACKER2 | TRK_SCREAMTRACKER | TRK_PROTRACKER) Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-09-30 22:44:28 UTC (rev 728) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-10-03 16:11:07 UTC (rev 729) @@ -320,7 +320,7 @@ PatternCuePoint cue; cue.offset = lMax - lRead; cue.order = m_nCurrentPattern; - cue.processed = false; + cue.processed = false; // We don't know the base offset in the file here. It has to be added in the main conversion loop. m_PatternCuePoints.push_back(cue); } } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-10-05 16:55:27
|
Revision: 734 http://modplug.svn.sourceforge.net/modplug/?rev=734&view=rev Author: saga-games Date: 2010-10-05 16:55:20 +0000 (Tue, 05 Oct 2010) Log Message: ----------- [Imp] When there's no mix rate specified in the INI file and the current audio device is an ASIO device, the default frequency is now obtained from the driver (previously, it was 44KHz in all cases, which some ASIO drivers doesn't support) [Imp] Some improvements to the Registry / INI reading (if there were no Registry settings because MPT 1.16 was previously not installed, the INI file is now read as it might contain some lines created by the installer) [Ref] Minor refactoring in the ASIO device class [Ref] Removed some unused #include lines Modified Paths: -------------- trunk/OpenMPT/mptrack/KeyConfigDlg.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/soundlib/SNDDEV.H trunk/OpenMPT/soundlib/SNDDEVX.H trunk/OpenMPT/soundlib/Snddev.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.h =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.h 2010-10-04 17:44:27 UTC (rev 733) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.h 2010-10-05 16:55:20 UTC (rev 734) @@ -1,15 +1,8 @@ #include "stdafx.h" #include "mptrack.h" #include "MainFrm.h" -#include "snddev.h" -#include "moddoc.h" -#include "childfrm.h" -#include "dlsbank.h" #include "mpdlgs.h" #include "moptions.h" -#include "vstplug.h" -#include "moptions.h" -//#include "KeyConfigDlg.h" // Might promote to class so we can add rules // (eg automatically do note off stuff, generate chord keybindings from notes based just on modifier. Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-10-04 17:44:27 UTC (rev 733) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-10-05 16:55:20 UTC (rev 734) @@ -137,7 +137,6 @@ BOOL CMainFrame::gbMdiMaximize = FALSE; bool CMainFrame::gbShowHackControls = false; //rewbs.varWindowSize -LONG CMainFrame::glCtrlWindowHeight = 188; //obsolete, for backwards compat only LONG CMainFrame::glGeneralWindowHeight = 178; LONG CMainFrame::glPatternWindowHeight = 152; LONG CMainFrame::glSampleWindowHeight = 188; @@ -319,15 +318,15 @@ { if (i == DIR_TUNING) // Hack: Tuning folder is set already so don't reset it. continue; - m_szDefaultDirectory[i][0] = 0; - m_szWorkingDirectory[i][0] = 0; + MemsetZero(m_szDefaultDirectory[i]); + MemsetZero(m_szWorkingDirectory[i]); } m_dTotalCPU=0; - memset(gpenVuMeter, 0, sizeof(gpenVuMeter)); + MemsetZero(gpenVuMeter); // Default chords - memset(Chords, 0, sizeof(Chords)); + MemsetZero(Chords); for (UINT ichord=0; ichord<3*12; ichord++) { Chords[ichord].key = (BYTE)ichord; @@ -359,12 +358,12 @@ m_csRegWindow.Format("%s%s", m_csRegKey, MAINFRAME_REGEXT_WINDOW); CString storedVersion = GetPrivateProfileCString("Version", "Version", "", theApp.GetConfigFileName()); - //If version number stored in INI is 1.17.02.40 or later, load setting from INI file. - //Else load settings from Registry - if (storedVersion >= "1.17.02.40") + // If version number stored in INI is 1.17.02.40 or later, always load setting from INI file. + // If it isn't, try loading from Registry first, then from the INI file. + if (storedVersion >= "1.17.02.40" || !LoadRegistrySettings()) + { LoadIniSettings(); - else - LoadRegistrySettings(); + } m_InputHandler = new CInputHandler(this); //rewbs.customKeys m_pPerfCounter= new CPerformanceCounter(); @@ -411,17 +410,40 @@ rgbCustomColors[ncol] = GetPrivateProfileDWord("Display", s, rgbCustomColors[ncol], iniFile); } - LONG defaultDevice = EnumerateSoundDevices(SNDDEV_ASIO, 0, nullptr, 0) ? SNDDEV_ASIO : SNDDEV_DSOUND; - m_nWaveDevice = GetPrivateProfileLong("Sound Settings", "WaveDevice", (defaultDevice << 8), iniFile); + DWORD defaultDevice = SNDDEV_DSOUND << 8; // first DirectSound device +#ifndef NO_ASIO + // If there's an ASIO device available, prefer it over DirectSound + if(EnumerateSoundDevices(SNDDEV_ASIO, 0, nullptr, 0)) + { + defaultDevice = SNDDEV_ASIO << 8; + } +#endif // NO_ASIO + m_nWaveDevice = GetPrivateProfileLong("Sound Settings", "WaveDevice", defaultDevice, iniFile); m_dwSoundSetup = GetPrivateProfileDWord("Sound Settings", "SoundSetup", SOUNDSETUP_SECONDARY, iniFile); m_dwQuality = GetPrivateProfileDWord("Sound Settings", "Quality", 0, iniFile); m_nSrcMode = GetPrivateProfileDWord("Sound Settings", "SrcMode", SRCMODE_POLYPHASE, iniFile); - m_dwRate = GetPrivateProfileDWord("Sound Settings", "Mixing_Rate", 44100, iniFile); + m_dwRate = GetPrivateProfileDWord("Sound Settings", "Mixing_Rate", 0, iniFile); m_nBitsPerSample = GetPrivateProfileDWord("Sound Settings", "BitsPerSample", 16, iniFile); m_nChannels = GetPrivateProfileDWord("Sound Settings", "ChannelMode", 2, iniFile); - m_nBufferLength = GetPrivateProfileDWord("Sound Settings", "BufferLength", 75, iniFile); + m_nBufferLength = GetPrivateProfileDWord("Sound Settings", "BufferLength", 50, iniFile); if(m_nBufferLength < SNDDEV_MINBUFFERLEN) m_nBufferLength = SNDDEV_MINBUFFERLEN; if(m_nBufferLength > SNDDEV_MAXBUFFERLEN) m_nBufferLength = SNDDEV_MAXBUFFERLEN; + if(m_dwRate == 0) + { + m_dwRate = 44100; +#ifndef NO_ASIO + // If no mixing rate is specified and we're using ASIO, get a mixing rate supported by the device. + if((m_nWaveDevice >> 8) == SNDDEV_ASIO) + { + ISoundDevice *dummy; + if(CreateSoundDevice(SNDDEV_ASIO, &dummy)) + { + m_dwRate = dummy->GetCurrentSampleRate(m_nWaveDevice & 0xFF); + delete dummy; + } + } +#endif // NO_ASIO + } m_nPreAmp = GetPrivateProfileDWord("Sound Settings", "PreAmp", 128, iniFile); CSoundFile::m_nStereoSeparation = GetPrivateProfileLong("Sound Settings", "StereoSeparation", 128, iniFile); @@ -498,7 +520,7 @@ m_pAutoSaver->SetFilenameTemplate(GetPrivateProfileCString("AutoSave", "FileNameTemplate", "", iniFile)); } -void CMainFrame::LoadRegistrySettings() +bool CMainFrame::LoadRegistrySettings() //------------------------------------- { @@ -523,7 +545,6 @@ if (d) theApp.m_nCmdShow = SW_SHOWMAXIMIZED; RegQueryValueEx(key, "MDIMaximize", NULL, &dwREG_DWORD, (LPBYTE)&gbMdiMaximize, &dwDWORDSize); RegQueryValueEx(key, "MDITreeWidth", NULL, &dwREG_DWORD, (LPBYTE)&glTreeWindowWidth, &dwDWORDSize); - RegQueryValueEx(key, "MDICtrlHeight", NULL, &dwREG_DWORD, (LPBYTE)&glCtrlWindowHeight, &dwDWORDSize); //obsolete, for backwards compat only RegQueryValueEx(key, "MDIGeneralHeight", NULL, &dwREG_DWORD, (LPBYTE)&glGeneralWindowHeight, &dwDWORDSize); RegQueryValueEx(key, "MDIPatternHeight", NULL, &dwREG_DWORD, (LPBYTE)&glPatternWindowHeight, &dwDWORDSize); RegQueryValueEx(key, "MDISampleHeight", NULL, &dwREG_DWORD, (LPBYTE)&glSampleWindowHeight, &dwDWORDSize); @@ -579,7 +600,7 @@ RegQueryValueEx(key, "MidiSetup", NULL, &dwREG_DWORD, (LPBYTE)&m_dwMidiSetup, &dwDWORDSize); RegQueryValueEx(key, "MidiDevice", NULL, &dwREG_DWORD, (LPBYTE)&m_nMidiDevice, &dwDWORDSize); RegQueryValueEx(key, "PatternSetup", NULL, &dwREG_DWORD, (LPBYTE)&m_dwPatternSetup, &dwDWORDSize); - m_dwPatternSetup |= PATTERN_NOTEFADE; // Set flag to maintain old behaviour(was changed in 1.17.02.50). + m_dwPatternSetup |= PATTERN_NOTEFADE; // Set flag to maintain old behaviour (was changed in 1.17.02.50). m_dwPatternSetup |= PATTERN_RESETCHANNELS; // Set flag to reset channels on loop was changed in 1.17.03.01). m_dwPatternSetup &= ~0x800; // quick paste autorepeat is now a keymap option RegQueryValueEx(key, "RowSpacing", NULL, &dwREG_DWORD, (LPBYTE)&m_nRowSpacing, &dwDWORDSize); @@ -643,6 +664,9 @@ //end rewbs.autoSave RegCloseKey(key); + } else + { + return false; } if (RegOpenKeyEx(HKEY_CURRENT_USER, m_csRegSettings, 0, KEY_READ, &key) == ERROR_SUCCESS) @@ -659,6 +683,8 @@ gnPatternSpacing = theApp.GetProfileInt("Pattern Editor", "Spacing", 0); gbPatternVUMeters = theApp.GetProfileInt("Pattern Editor", "VU-Meters", 0); gbPatternPluginNames = theApp.GetProfileInt("Pattern Editor", "Plugin-Names", 1); + + return true; } Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-10-04 17:44:27 UTC (rev 733) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-10-05 16:55:20 UTC (rev 734) @@ -412,7 +412,7 @@ static UINT m_nLastOptionsPage; static BOOL gbMdiMaximize; static bool gbShowHackControls; - static LONG glCtrlWindowHeight, glTreeWindowWidth, glTreeSplitRatio; + static LONG glTreeWindowWidth, glTreeSplitRatio; static LONG glGeneralWindowHeight, glPatternWindowHeight, glSampleWindowHeight, glInstrumentWindowHeight, glCommentsWindowHeight, glGraphWindowHeight; //rewbs.varWindowSize static HHOOK ghKbdHook; @@ -423,7 +423,8 @@ // Audio Setup static DWORD m_dwSoundSetup, m_dwRate, m_dwQuality, m_nSrcMode, m_nBitsPerSample, m_nPreAmp, gbLoopSong, m_nChannels; - static LONG m_nWaveDevice, m_nMidiDevice; + static LONG m_nWaveDevice; // lower 8 bits: device number (for this type). higher 8 bits: device type + static LONG m_nMidiDevice; static DWORD m_nBufferLength; static EQPRESET m_EqSettings; // Pattern Setup @@ -702,7 +703,7 @@ afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); private: - void LoadRegistrySettings(); + bool LoadRegistrySettings(); void LoadIniSettings(); void SaveIniSettings(); }; Modified: trunk/OpenMPT/soundlib/SNDDEV.H =================================================================== --- trunk/OpenMPT/soundlib/SNDDEV.H 2010-10-04 17:44:27 UTC (rev 733) +++ trunk/OpenMPT/soundlib/SNDDEV.H 2010-10-05 16:55:20 UTC (rev 734) @@ -73,6 +73,7 @@ virtual BOOL IsOpen() = 0; virtual UINT GetCurrentLatency() = 0; virtual void SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwUser=0) = 0; + virtual UINT GetCurrentSampleRate(UINT nDevice) { return 0; } }; Modified: trunk/OpenMPT/soundlib/SNDDEVX.H =================================================================== --- trunk/OpenMPT/soundlib/SNDDEVX.H 2010-10-04 17:44:27 UTC (rev 733) +++ trunk/OpenMPT/soundlib/SNDDEVX.H 2010-10-05 16:55:20 UTC (rev 734) @@ -1,6 +1,14 @@ #ifndef _SNDDEVX_H_ #define _SNDDEVX_H_ +#include <mmsystem.h> +#include <dsound.h> + +#ifndef NO_ASIO +#include <iasiodrv.h> +#define ASIO_LOG +#endif + //////////////////////////////////////////////////////////////////////////////////// // // MMSYSTEM WaveOut device @@ -123,11 +131,16 @@ UINT GetCurrentLatency() { return m_nAsioBufferLen; } void SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer); + UINT GetCurrentSampleRate(UINT nDevice); public: static BOOL EnumerateDevices(UINT nIndex, LPSTR pszDescription, UINT cbSize); protected: + void OpenDevice(UINT nDevice); + void CloseDevice(); + +protected: static CASIODevice *gpCurrentAsio; static LONG gnFillBuffers; static void BufferSwitch(long doubleBufferIndex, ASIOBool directProcess); Modified: trunk/OpenMPT/soundlib/Snddev.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snddev.cpp 2010-10-04 17:44:27 UTC (rev 733) +++ trunk/OpenMPT/soundlib/Snddev.cpp 2010-10-05 16:55:20 UTC (rev 734) @@ -1,12 +1,5 @@ #include "stdafx.h" -#include <mmsystem.h> -#include <dsound.h> -#ifndef NO_ASIO -#include <iasiodrv.h> -#define ASIO_LOG -#endif - #include "snddev.h" #include "snddevx.h" @@ -652,18 +645,13 @@ { gpCurrentAsio = NULL; } - if (m_pAsioDrv) - { - m_pAsioDrv->Release(); - m_pAsioDrv = NULL; - } + CloseDevice(); } BOOL CASIODevice::Open(UINT nDevice, LPWAVEFORMATEX pwfx) //------------------------------------------------------- { - CLSID clsid; BOOL bOk = FALSE; if (m_pAsioDrv) Close(); @@ -678,17 +666,8 @@ Log("CASIODevice::Open(%d:\"%s\"): %d-bit, %d channels, %dHz\n", nDevice, gAsioDrivers[nDevice].name, pwfx->wBitsPerSample, pwfx->nChannels, pwfx->nSamplesPerSec); #endif - clsid = gAsioDrivers[nDevice].clsid; - if (CoCreateInstance(clsid,0,CLSCTX_INPROC_SERVER, clsid, (VOID **)&m_pAsioDrv) == S_OK) - { - m_pAsioDrv->init((void *)m_hWnd); - } else - { - #ifdef ASIO_LOG - Log(" CoCreateInstance failed!\n"); - #endif - m_pAsioDrv = NULL; - } + OpenDevice(nDevice); + if (m_pAsioDrv) { long nInputChannels = 0, nOutputChannels = 0; @@ -812,11 +791,7 @@ #ifdef ASIO_LOG Log("Error opening ASIO device!\n"); #endif - if (m_pAsioDrv) - { - m_pAsioDrv->Release(); - m_pAsioDrv = NULL; - } + CloseDevice(); } return bOk; } @@ -856,12 +831,7 @@ } catch(...) { CASIODevice::ReportASIOException("ASIO crash in disposeBuffers()\n"); } - try { - m_pAsioDrv->Release(); - } catch(...) { - CASIODevice::ReportASIOException("ASIO crash in Release()\n"); - } - m_pAsioDrv = NULL; + CloseDevice(); } if (gpCurrentAsio == this) { @@ -885,7 +855,48 @@ } } + +void CASIODevice::OpenDevice(UINT nDevice) +//---------------------------------------- +{ + if (m_pAsioDrv) + { + return; + } + + CLSID clsid = gAsioDrivers[nDevice].clsid; + if (CoCreateInstance(clsid,0,CLSCTX_INPROC_SERVER, clsid, (VOID **)&m_pAsioDrv) == S_OK) + { + m_pAsioDrv->init((void *)m_hWnd); + } else + { +#ifdef ASIO_LOG + Log(" CoCreateInstance failed!\n"); +#endif + m_pAsioDrv = NULL; + } +} + + +void CASIODevice::CloseDevice() +//----------------------------- +{ + if (m_pAsioDrv) + { + try + { + m_pAsioDrv->Release(); + } catch(...) + { + CASIODevice::ReportASIOException("ASIO crash in Release()\n"); + } + m_pAsioDrv = NULL; + } +} + + void CASIODevice::SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer) +//-------------------------------------------------------------------------------------------- { for (UINT ich=0; ich<m_nChannels; ich++){ memset(m_BufferInfo[ich].buffers[dwBuffer], 0, m_nAsioBufferLen); @@ -1276,7 +1287,7 @@ } BOOL CASIODevice::ReportASIOException(LPCSTR format,...) -//------------------------------------------------------- +//------------------------------------------------------ { CHAR cBuf[1024]; va_list va; @@ -1289,6 +1300,36 @@ return TRUE; } + +// If the device is open, this returns the current sample rate. If it's not open, it returns some sample rate supported by the device. +UINT CASIODevice::GetCurrentSampleRate(UINT nDevice) +//-------------------------------------------------- +{ + const bool wasOpen = (m_pAsioDrv != NULL); + if(!wasOpen) + { + OpenDevice(nDevice); + if(m_pAsioDrv == NULL) + { + return 0; + } + } + + ASIOSampleRate samplerate; + if(m_pAsioDrv->getSampleRate(&samplerate) != ASE_OK) + { + samplerate = 0; + } + + if(!wasOpen) + { + CloseDevice(); + } + + return (UINT)samplerate; +} + + #endif // NO_ASIO /////////////////////////////////////////////////////////////////////////////////////// Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-10-04 17:44:27 UTC (rev 733) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-10-05 16:55:20 UTC (rev 734) @@ -40,7 +40,7 @@ BYTE nVibSweep; // Auto vibrato sweep (i.e. how long it takes until the vibrato effect reaches its full strength) BYTE nVibDepth; // Auto vibrato depth BYTE nVibRate; // Auto vibrato rate (speed) - //CHAR name[32]; // Maybe it would be nicer to have sample names here, but that would require some refactoring. Also, would this slow down the mixer (cache misses)? + //CHAR name[MAX_SAMPLENAME]; // Maybe it would be nicer to have sample names here, but that would require some refactoring. Also, would this slow down the mixer (cache misses)? CHAR filename[MAX_SAMPLEFILENAME]; // Return the size of one (elementary) sample in bytes. @@ -106,8 +106,8 @@ BYTE nDNA; // Duplicate note action BYTE nPanSwing; // Random panning factor BYTE nVolSwing; // Random volume factor - BYTE nIFC; // Default filter cutoff - BYTE nIFR; // Default filter resonance + BYTE nIFC; // Default filter cutoff (00...7F). Used if the high bit is set + BYTE nIFR; // Default filter resonance (00...7F). Used if the high bit is set WORD wMidiBank; // MIDI bank BYTE nMidiProgram; // MIDI program This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-10-12 20:13:17
|
Revision: 736 http://modplug.svn.sourceforge.net/modplug/?rev=736&view=rev Author: saga-games Date: 2010-10-12 20:13:10 +0000 (Tue, 12 Oct 2010) Log Message: ----------- [Ref] Sound device code refactoring Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/soundlib/SNDDEV.H Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-10-08 14:40:44 UTC (rev 735) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-10-12 20:13:10 UTC (rev 736) @@ -187,7 +187,7 @@ DWORD CMainFrame::m_nBitsPerSample = 16; DWORD CMainFrame::m_nPreAmp = 128; DWORD CMainFrame::gbLoopSong = TRUE; -LONG CMainFrame::m_nWaveDevice = (SNDDEV_DSOUND<<8); +LONG CMainFrame::m_nWaveDevice = (SNDDEV_DSOUND << SNDDEV_DEVICE_SHIFT); LONG CMainFrame::m_nMidiDevice = 0; DWORD CMainFrame::m_nBufferLength = 75; LONG CMainFrame::gnLVuMeter = 0; @@ -433,12 +433,12 @@ m_dwRate = 44100; #ifndef NO_ASIO // If no mixing rate is specified and we're using ASIO, get a mixing rate supported by the device. - if((m_nWaveDevice >> 8) == SNDDEV_ASIO) + if(SNDDEV_GET_TYPE(m_nWaveDevice) == SNDDEV_ASIO) { ISoundDevice *dummy; if(CreateSoundDevice(SNDDEV_ASIO, &dummy)) { - m_dwRate = dummy->GetCurrentSampleRate(m_nWaveDevice & 0xFF); + m_dwRate = dummy->GetCurrentSampleRate(SNDDEV_GET_NUMBER(m_nWaveDevice)); delete dummy; } } @@ -691,8 +691,6 @@ VOID CMainFrame::Initialize() //--------------------------- { - CHAR s[256]; - //Adding version number to the frame title CString title = GetTitle(); title += CString(" ") + MptVersion::str; @@ -711,12 +709,12 @@ // Load Chords theApp.LoadChords(Chords); // Check for valid sound device - if (!EnumerateSoundDevices(m_nWaveDevice>>8, m_nWaveDevice&0xff, s, sizeof(s))) + if (!EnumerateSoundDevices(SNDDEV_GET_TYPE(m_nWaveDevice), SNDDEV_GET_NUMBER(m_nWaveDevice), nullptr, 0)) { - m_nWaveDevice = (SNDDEV_DSOUND<<8); - if (!EnumerateSoundDevices(m_nWaveDevice>>8, m_nWaveDevice&0xff, s, sizeof(s))) + m_nWaveDevice = (SNDDEV_DSOUND << SNDDEV_DEVICE_SHIFT); + if (!EnumerateSoundDevices(SNDDEV_GET_TYPE(m_nWaveDevice), SNDDEV_GET_NUMBER(m_nWaveDevice), nullptr, 0)) { - m_nWaveDevice = (SNDDEV_WAVEOUT<<8); + m_nWaveDevice = (SNDDEV_WAVEOUT << SNDDEV_DEVICE_SHIFT); } } // Default directory location @@ -1480,8 +1478,8 @@ m_pSndFile->SetWaveConfig(samplespersec, bits, channels, (m_dwSoundSetup & SOUNDSETUP_ENABLEMMX) ? TRUE : FALSE); // Maybe we failed because someone is playing sound already. // Shut any sound off, and try once more before giving up. - UINT nDevType = m_nWaveDevice>>8; - UINT nDevNo = m_nWaveDevice&0xff; + UINT nDevType = SNDDEV_GET_TYPE(m_nWaveDevice); + UINT nDevNo = SNDDEV_GET_NUMBER(m_nWaveDevice); UINT fulOptions = (m_dwSoundSetup & SOUNDSETUP_SECONDARY) ? SNDDEV_OPTIONS_SECONDARY : 0; if ((gpSoundDevice) && (gpSoundDevice->GetDeviceType() != nDevType)) { Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-10-08 14:40:44 UTC (rev 735) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-10-12 20:13:10 UTC (rev 736) @@ -423,7 +423,7 @@ // Audio Setup static DWORD m_dwSoundSetup, m_dwRate, m_dwQuality, m_nSrcMode, m_nBitsPerSample, m_nPreAmp, gbLoopSong, m_nChannels; - static LONG m_nWaveDevice; // lower 8 bits: device number (for this type). higher 8 bits: device type + static LONG m_nWaveDevice; // use the SNDDEV_GET_NUMBER and SNDDEV_GET_TYPE macros to decode static LONG m_nMidiDevice; static DWORD m_nBufferLength; static EQPRESET m_EqSettings; Modified: trunk/OpenMPT/soundlib/SNDDEV.H =================================================================== --- trunk/OpenMPT/soundlib/SNDDEV.H 2010-10-08 14:40:44 UTC (rev 735) +++ trunk/OpenMPT/soundlib/SNDDEV.H 2010-10-12 20:13:10 UTC (rev 736) @@ -22,13 +22,19 @@ // // Sound Device Types -enum { - SNDDEV_WAVEOUT=0, +enum +{ + SNDDEV_WAVEOUT = 0, SNDDEV_DSOUND, SNDDEV_ASIO, SNDDEV_NUM_DEVTYPES }; +#define SNDDEV_DEVICE_MASK 0xFF // Mask for getting the device number +#define SNDDEV_DEVICE_SHIFT 8 // Shift amount for getting the device type +#define SNDDEV_GET_NUMBER(x) (x & SNDDEV_DEVICE_MASK) // Use this for getting the device number +#define SNDDEV_GET_TYPE(x) (x >> SNDDEV_DEVICE_SHIFT) // ...and this for getting the device type + #define SNDDEV_MINBUFFERS 2 #define SNDDEV_MAXBUFFERS 16 #define SNDDEV_MINBUFFERLEN 1 // 1ms This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-10-15 14:23:05
|
Revision: 738 http://modplug.svn.sourceforge.net/modplug/?rev=738&view=rev Author: saga-games Date: 2010-10-15 14:22:57 +0000 (Fri, 15 Oct 2010) Log Message: ----------- [Fix] The new "play whole row" thing should also work properly with auto stepping enabled. This also involves a change in CSoundFile::IsPaused() to also check for SONG_STEP, which fixes some problems with this new edit mode but I hope it doesn't break anything else (looks like it doesn't, but who knows...) Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-10-12 20:17:40 UTC (rev 737) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-10-15 14:22:57 UTC (rev 738) @@ -1878,17 +1878,14 @@ BOOL CMainFrame::PlayMod(CModDoc *pModDoc, HWND hPat, DWORD dwNotifyType) //----------------------------------------------------------------------- { - BOOL bPaused, bPatLoop, bResetAGC; if (!pModDoc) return FALSE; CSoundFile *pSndFile = pModDoc->GetSoundFile(); if ((!pSndFile) || (!pSndFile->GetType())) return FALSE; - bPaused = (pSndFile->m_dwSongFlags & SONG_PAUSED) ? TRUE : FALSE; - bPatLoop = (pSndFile->m_dwSongFlags & SONG_PATTERNLOOP) ? TRUE : FALSE; + const bool bPaused = pSndFile->IsPaused(); + const bool bPatLoop = (pSndFile->m_dwSongFlags & SONG_PATTERNLOOP) ? true : false; pSndFile->ResetChannels(); - bResetAGC = FALSE; - if (((m_pSndFile) && (pSndFile != m_pSndFile)) || (!m_dwElapsedTime)) bResetAGC = TRUE; if ((m_pSndFile) || (m_dwStatus & MODSTATUS_PLAYING)) PauseMod(); - if (bResetAGC) CSoundFile::ResetAGC(); + if (((m_pSndFile) && (pSndFile != m_pSndFile)) || (!m_dwElapsedTime)) CSoundFile::ResetAGC(); m_pSndFile = pSndFile; m_pModPlaying = pModDoc; m_hFollowSong = hPat; Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-10-12 20:17:40 UTC (rev 737) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-10-15 14:22:57 UTC (rev 738) @@ -162,9 +162,11 @@ #define NUM_VUMETER_PENS 32 // Pattern Setup (contains also non-pattern related settings) +// Feel free to replace the deprecated flags by new flags, but be sure to +// update CMainFrame::LoadIniSettings() as well. #define PATTERN_PLAYNEWNOTE 0x01 // play new notes while recording #define PATTERN_LARGECOMMENTS 0x02 // use large font in comments -#define PATTERN_STDHIGHLIGHT 0x04 // enable primary highlight +#define PATTERN_STDHIGHLIGHT 0x04 // enable primary highlight (measures) #define PATTERN_SMALLFONT 0x08 // use small font in pattern editor #define PATTERN_CENTERROW 0x10 // always center active row #define PATTERN_WRAP 0x20 // wrap around cursor in editor @@ -176,7 +178,7 @@ #define PATTERN_PLAYEDITROW 0x800 // play all notes on the current row while entering notes #define PATTERN_NOEXTRALOUD 0x1000 // no loud samples in sample editor #define PATTERN_DRAGNDROPEDIT 0x2000 // enable drag and drop editing -#define PATTERN_2NDHIGHLIGHT 0x4000 // activate secondary highlight +#define PATTERN_2NDHIGHLIGHT 0x4000 // activate secondary highlight (beats) #define PATTERN_MUTECHNMODE 0x8000 // ignore muted channels #define PATTERN_SHOWPREVIOUS 0x10000 // show prev/next patterns #define PATTERN_CONTSCROLL 0x20000 // continous pattern scrolling Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-10-12 20:17:40 UTC (rev 737) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-10-15 14:22:57 UTC (rev 738) @@ -2007,7 +2007,7 @@ void CViewPattern::PatternStep(bool autoStep) -//--------------------------------------------- +//------------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); @@ -2015,17 +2015,17 @@ if ((pMainFrm) && (pModDoc)) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - if ((!pSndFile->Patterns[m_nPattern].GetNumRows()) || (!pSndFile->Patterns[m_nPattern])) return; - // Cut instrument/sample + if ((!pSndFile->Patterns.IsValidPat(m_nPattern)) || (!pSndFile->Patterns[m_nPattern].GetNumRows())) return; BEGIN_CRITICAL(); - for (UINT i=pSndFile->m_nChannels; i<MAX_CHANNELS; i++) + // Cut instrument\xB4s/samples in virtual channels + for (CHANNELINDEX i = pSndFile->m_nChannels; i < MAX_CHANNELS; i++) { pSndFile->Chn[i].dwFlags |= CHN_NOTEFADE | CHN_KEYOFF; - pSndFile->m_dwSongFlags &= ~SONG_PAUSED; - pSndFile->LoopPattern(m_nPattern); - pSndFile->m_nNextRow = GetCurrentRow(); - pSndFile->m_dwSongFlags |= SONG_STEP; } + pSndFile->LoopPattern(m_nPattern); + pSndFile->m_nNextRow = GetCurrentRow(); + pSndFile->m_dwSongFlags &= ~SONG_PAUSED; + pSndFile->m_dwSongFlags |= SONG_STEP; END_CRITICAL(); if (pMainFrm->GetModPlaying() != pModDoc) { @@ -3770,6 +3770,8 @@ } \ } + +// Enter volume effect / number in the pattern. void CViewPattern::TempEnterVol(int v) //------------------------------------ { @@ -3864,6 +3866,7 @@ } +// Enter an effect letter in the pattenr void CViewPattern::TempEnterFX(int c) //----------------------------------- { @@ -3918,6 +3921,7 @@ } +// Enter an effect param in the pattenr void CViewPattern::TempEnterFXparam(int v) //---------------------------------------- { @@ -3964,6 +3968,7 @@ } +// Stop a note that has been entered void CViewPattern::TempStopNote(int note, bool fromMidi, const bool bChordMode) //----------------------------------------------------------------------------- { @@ -4097,6 +4102,7 @@ } +// Enter an octave number in the pattern void CViewPattern::TempEnterOctave(int val) //----------------------------------------- { @@ -4118,6 +4124,8 @@ } + +// Enter an instrument number in the pattern void CViewPattern::TempEnterIns(int val) //-------------------------------------- { @@ -4178,6 +4186,7 @@ } +// Enter a note in the pattern void CViewPattern::TempEnterNote(int note, bool oldStyle, int vol) //---------------------------------------------------------------- { @@ -4230,11 +4239,15 @@ // -- Chord autodetection: step back if we just entered a note - if ((bRecordEnabled) && (recordGroup) && !bIsLiveRecord) { - if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) { + if ((bRecordEnabled) && (recordGroup) && !bIsLiveRecord) + { + if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) + { if ((timeGetTime() - m_dwLastNoteEntryTime < CMainFrame::gnAutoChordWaitTime) - && (nRow>=m_nSpacing) && (!m_bLastNoteEntryBlocked)) + && (nRow >= m_nSpacing) && (!m_bLastNoteEntryBlocked)) + { nRow -= m_nSpacing; + } } } m_dwLastNoteEntryTime = timeGetTime(); @@ -4257,7 +4270,7 @@ // -- write note and instrument data. const bool isSplit = HandleSplit(p, note); - // Nice idea actually: Use lower section of the keyboard to play chords + // Nice idea actually: Use lower section of the keyboard to play chords (but it won't work 100% correctly this way...) /*if(isSplit) { TempEnterChord(note); @@ -4306,6 +4319,57 @@ if (oldStyle && ((p->note == NOTE_NOTECUT) || (p->note == NOTE_KEYOFF) || (p->note == NOTE_FADE))) p->instr=0; + //-- if not recording, restore old command. + if (bRecordEnabled == false) + { + *p = oldcmd; + } + + // -- play note + if ((CMainFrame::m_dwPatternSetup & (PATTERN_PLAYNEWNOTE|PATTERN_PLAYEDITROW)) || (!bRecordEnabled)) + { + if ((CMainFrame::m_dwPatternSetup & PATTERN_PLAYEDITROW) && !bIsLiveRecord) + { + // play the whole row in "step mode" + PatternStep(false); + } else + { + // just play the newly inserted note... + if (p->instr) + { + // ...using the already specified instrument + nPlayIns = p->instr; + } else if ((!p->instr) && (p->note <= NOTE_MAX)) + { + // ...or one that can be found on a previous row of this pattern. + MODCOMMAND *search = p; + UINT srow = nRow; + while (srow-- > 0) + { + search -= pSndFile->m_nChannels; + if (search->instr) + { + nPlayIns = search->instr; + m_nFoundInstrument = nPlayIns; //used to figure out which instrument to stop on key release. + break; + } + } + } + BOOL bNotPlaying = ((pMainFrm->GetModPlaying() == pModDoc) && (pMainFrm->IsPlaying())) ? FALSE : TRUE; + //pModDoc->PlayNote(p->note, nPlayIns, 0, bNotPlaying, -1, 0, 0, nChn); //rewbs.vstiLive - added extra args + pModDoc->PlayNote(p->note, nPlayIns, 0, bNotPlaying, 4*vol, 0, 0, nChn); //rewbs.vstiLive - added extra args +/* for (UINT kplchrd=0; kplchrd<nPlayChord; kplchrd++) + { + if (chordplaylist[kplchrd]) + { + pModDoc->PlayNote(chordplaylist[kplchrd], nPlayIns, 0, FALSE, -1, 0, 0, nChn); //rewbs.vstiLive - - added extra args + m_dwStatus |= PATSTATUS_CHORDPLAYING; + } + } +*/ + } + } + // -- if recording, handle post note entry behaviour (move cursor etc..) if(bRecordEnabled) { @@ -4326,20 +4390,19 @@ } } - //Move cursor down only if not recording live. - if(bIsLiveRecord == false) + // Set new cursor position (row spacing) + if (!bIsLiveRecord) { if((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) { - if(nRow + m_nSpacing < pSndFile->Patterns[nPat].GetNumRows() || (CMainFrame::m_dwPatternSetup & PATTERN_CONTSCROLL)) { SetCurrentRow(nRow + m_nSpacing, (CMainFrame::m_dwPatternSetup & PATTERN_CONTSCROLL) ? true: false); - m_bLastNoteEntryBlocked=false; + m_bLastNoteEntryBlocked = false; } else { - m_bLastNoteEntryBlocked=true; // if the cursor is block by the end of the pattern here, - } // we must remember to not step back should the next note form a chord. + m_bLastNoteEntryBlocked = true; // if the cursor is block by the end of the pattern here, + } // we must remember to not step back should the next note form a chord. } DWORD sel = m_dwCursor | (m_nRow << 16); @@ -4378,61 +4441,12 @@ } } } - - // -- play note - if ((CMainFrame::m_dwPatternSetup & (PATTERN_PLAYNEWNOTE|PATTERN_PLAYEDITROW)) || (bRecordEnabled == false)) - { - if ((CMainFrame::m_dwPatternSetup & PATTERN_PLAYEDITROW) && !bIsLiveRecord) - { - // play the whole row - PatternStep(false); - } else - { - // just play the newly inserted note... - if (p->instr) - { - // ...using the already specified instrument - nPlayIns = p->instr; - } else if ((!p->instr) && (p->note <= NOTE_MAX)) - { - // ...or one that can be found on a previous row of this pattern. - MODCOMMAND *search = p; - UINT srow = nRow; - while (srow-- > 0) - { - search -= pSndFile->m_nChannels; - if (search->instr) - { - nPlayIns = search->instr; - m_nFoundInstrument = nPlayIns; //used to figure out which instrument to stop on key release. - break; - } - } - } - BOOL bNotPlaying = ((pMainFrm->GetModPlaying() == pModDoc) && (pMainFrm->IsPlaying())) ? FALSE : TRUE; - //pModDoc->PlayNote(p->note, nPlayIns, 0, bNotPlaying, -1, 0, 0, nChn); //rewbs.vstiLive - added extra args - pModDoc->PlayNote(p->note, nPlayIns, 0, bNotPlaying, 4*vol, 0, 0, nChn); //rewbs.vstiLive - added extra args -/* for (UINT kplchrd=0; kplchrd<nPlayChord; kplchrd++) - { - if (chordplaylist[kplchrd]) - { - pModDoc->PlayNote(chordplaylist[kplchrd], nPlayIns, 0, FALSE, -1, 0, 0, nChn); //rewbs.vstiLive - - added extra args - m_dwStatus |= PATSTATUS_CHORDPLAYING; - } - } -*/ - } - } - - //-- if not recording, restore old command. - if (bRecordEnabled == false) - { - *p = oldcmd; - } } } + +// Enter a chord in the pattern void CViewPattern::TempEnterChord(int note) //----------------------------------------- { @@ -4453,7 +4467,9 @@ MODCOMMAND* p = &prowbase[nChn]; const MODCOMMAND oldcmd = *p; // This is the command we are about to overwrite + const bool bIsLiveRecord = IsLiveRecord(*pMainFrm, *pModDoc, *pSndFile); + const bool bRecordEnabled = IsEditingEnabled(); // -- establish note data //const bool isSplit = HandleSplit(p, note); @@ -4490,7 +4506,7 @@ recordGroup = currentRecordGroup; //record group found UINT n = ((nchordnote-1)/12) * 12 + pChords[nchord].notes[nchno]; - if(IsEditingEnabled()) + if(bRecordEnabled) { if ((nchordch != nChn) && recordGroup && (currentRecordGroup == recordGroup) && (n <= NOTE_MAX)) { @@ -4512,7 +4528,7 @@ } // -- write notedata - if(IsEditingEnabled()) + if(bRecordEnabled) { DWORD sel = (m_nRow << 16) | m_dwCursor; SetCurSel(sel, sel); @@ -4523,14 +4539,6 @@ InvalidateRow(); UpdateIndicator(); } - if ( IsLiveRecord(*pMainFrm, *pModDoc, *pSndFile) == false ) - { - if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) - SetCurrentRow(m_nRow+m_nSpacing); - DWORD sel = m_dwCursor | (m_nRow << 16); - SetCurSel(sel, sel); - - } } else { // recording disabled @@ -4538,11 +4546,11 @@ } // -- play note - if ((CMainFrame::m_dwPatternSetup & (PATTERN_PLAYNEWNOTE|PATTERN_PLAYEDITROW)) || (!(IsEditingEnabled()))) + if ((CMainFrame::m_dwPatternSetup & (PATTERN_PLAYNEWNOTE|PATTERN_PLAYEDITROW)) || (!bRecordEnabled)) { if ((CMainFrame::m_dwPatternSetup & PATTERN_PLAYEDITROW) && !bIsLiveRecord) { - // play the whole row + // play the whole row in "step mode" PatternStep(false); } else { @@ -4556,9 +4564,8 @@ // ...or one that can be found on a previous row of this pattern. MODCOMMAND *search = p; UINT srow = m_nRow; - while (srow > 0) + while (srow-- > 0) { - srow--; search -= pSndFile->m_nChannels; if (search->instr) { @@ -4580,6 +4587,16 @@ } } } // end play note + + // Set new cursor position (row spacing) - only when not recording live + if (bRecordEnabled && !bIsLiveRecord) + { + if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) + SetCurrentRow(m_nRow + m_nSpacing); + DWORD sel = m_dwCursor | (m_nRow << 16); + SetCurSel(sel, sel); + } + } // end mainframe and moddoc exist } Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2010-10-12 20:17:40 UTC (rev 737) +++ trunk/OpenMPT/mptrack/View_pat.h 2010-10-15 14:22:57 UTC (rev 738) @@ -31,7 +31,7 @@ #define PATSTATUS_PATTERNLOOP 0x4000 // Row Spacing -#define MAX_SPACING 64 +#define MAX_SPACING 64 // MAX_PATTERN_ROWS enum PatternColumns { Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-10-12 20:17:40 UTC (rev 737) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-10-15 14:22:57 UTC (rev 738) @@ -688,7 +688,7 @@ void SetRepeatCount(int n) { m_nRepeatCount = n; } int GetRepeatCount() const { return m_nRepeatCount; } - bool IsPaused() const { return (m_dwSongFlags & SONG_PAUSED) ? true : false; } + bool IsPaused() const { return (m_dwSongFlags & (SONG_PAUSED|SONG_STEP)) ? true : false; } // Added SONG_STEP as it seems to be desirable in most cases to check for this as well. void LoopPattern(PATTERNINDEX nPat, ROWINDEX nRow = 0); void CheckCPUUsage(UINT nCPU); BOOL SetPatternName(PATTERNINDEX nPat, LPCSTR lpszName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-10-15 14:52:33
|
Revision: 739 http://modplug.svn.sourceforge.net/modplug/?rev=739&view=rev Author: saga-games Date: 2010-10-15 14:52:26 +0000 (Fri, 15 Oct 2010) Log Message: ----------- [Fix] XM Compatibility: Fixed some more upside-down logic when it comes to instrument number + portamento [Mod] OpenMPT: Version is now 1.19.00.07 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2010-10-15 14:22:57 UTC (rev 738) +++ trunk/OpenMPT/mptrack/version.h 2010-10-15 14:52:26 UTC (rev 739) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 00 -#define VER_MINORMINOR 07 +#define VER_MINORMINOR 08 //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/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-10-15 14:22:57 UTC (rev 738) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-10-15 14:52:26 UTC (rev 739) @@ -83,7 +83,7 @@ } double CSoundFile::GetLength(bool& targetReached, BOOL bAdjust, BOOL bTotal, ORDERINDEX endOrder, ROWINDEX endRow) -//---------------------------------------------------- +//---------------------------------------------------------------------------------------------------------------- { // -> CODE#0022 // -> DESC="alternative BPM/Speed interpretation method" @@ -503,7 +503,7 @@ } else { // Original behaviour - if (pIns->NoteMap[note-1] >= NOTE_MIN_SPECIAL) return; + if(pIns->NoteMap[note-1] > NOTE_MAX) return; UINT n = pIns->Keyboard[note-1]; pSmp = ((n) && (n < MAX_SAMPLES)) ? &Samples[n] : nullptr; } @@ -539,10 +539,12 @@ } } - // XM compatibility: new instrument + portamento = forget it! + // XM compatibility: new instrument + portamento = ignore new instrument number, but reload old instrument settings (the world of XM is upside down...) if(bInstrumentChanged && bPorta && IsCompatibleMode(TRK_FASTTRACKER2)) { - return; + pIns = pChn->pModInstrument; + pSmp = pChn->pModSample; + bInstrumentChanged = false; } else { pChn->pModInstrument = pIns; @@ -4180,7 +4182,7 @@ //--------------------------------------------------------------------------------------------- { const ORDERINDEX nMaxOrd = Order.GetLengthTailTrimmed(); - if(nOrd >= nMaxOrd) + if(nOrd >= nMaxOrd || nRow > Patterns[Order[nOrd]].GetNumRows()) return; // The module might have been edited in the meantime - so we have to extend this a bit. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-10-16 21:06:16
|
Revision: 743 http://modplug.svn.sourceforge.net/modplug/?rev=743&view=rev Author: saga-games Date: 2010-10-16 21:06:10 +0000 (Sat, 16 Oct 2010) Log Message: ----------- [Fix] IT Loader: IT files with no samples made OpenMPT crash since rev.730 [Mod] Edit History: Dialog also shows total edit count now. Modified Paths: -------------- trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-10-16 00:26:47 UTC (rev 742) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-10-16 21:06:10 UTC (rev 743) @@ -3139,12 +3139,17 @@ SetDlgItemText(IDC_EDIT_HISTORY, s); // Total edit time - totalTime = (uint64)((double)(totalTime) / HISTORY_TIMER_PRECISION); - s.Format(_T("Total edit time: %lluh %02llum %02llus"), totalTime / 3600, (totalTime / 60) % 60, totalTime % 60); - SetDlgItemText(IDC_TOTAL_EDIT_TIME, s); - // Window title - s.Format(_T("Edit history for %s"), m_pModDoc->GetTitle()); - SetWindowText(s); + s = ""; + if(totalTime) + { + totalTime = (uint64)((double)(totalTime) / HISTORY_TIMER_PRECISION); + + s.Format(_T("Total edit time: %lluh %02llum %02llus (%u session%s)"), totalTime / 3600, (totalTime / 60) % 60, totalTime % 60, num, (num != 1) ? _T("s") : _T("")); + SetDlgItemText(IDC_TOTAL_EDIT_TIME, s); + // Window title + s.Format(_T("Edit history for %s"), m_pModDoc->GetTitle()); + SetWindowText(s); + } // Enable or disable Clear button GetDlgItem(IDC_BTN_CLEAR)->EnableWindow((m_pModDoc->GetFileHistory()->empty()) ? FALSE : TRUE); Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-10-16 00:26:47 UTC (rev 742) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-10-16 21:06:10 UTC (rev 743) @@ -904,7 +904,11 @@ // In order to properly compute the position, in file, of eventual extended settings // such as "attack" we need to keep the "real" size of the last sample as those extra // setting will follow this sample in the file - UINT lastSampleOffset = smppos[min(0, pifh->smpnum - 1)] + sizeof(ITSAMPLESTRUCT); + UINT lastSampleOffset = 0; + if(pifh->smpnum > 0) + { + lastSampleOffset = smppos[pifh->smpnum - 1] + sizeof(ITSAMPLESTRUCT); + } // -! NEW_FEATURE#0027 // Reading Samples This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-10-22 14:24:25
|
Revision: 744 http://modplug.svn.sourceforge.net/modplug/?rev=744&view=rev Author: saga-games Date: 2010-10-22 14:24:19 +0000 (Fri, 22 Oct 2010) Log Message: ----------- [Fix] S3M Compatibility: Speed and tempo values to what ST3 actually expects and adjusted the loader code to how ST3 would react to out-of-range speed and tempo values. [Fix] S3M Specs: Removed the X param (#) effect from the supported effect list. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/mod_specifications.h Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2010-10-16 21:06:10 UTC (rev 743) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2010-10-22 14:24:19 UTC (rev 744) @@ -92,8 +92,16 @@ // -> CODE#0016 // -> DESC="default tempo update" // m_SpinTempo.SetRange(32, 255); // 255 bpm max - m_SpinTempo.SetRange((short)specs.tempoMin, (short)specs.tempoMax); - m_SpinSpeed.SetRange((short)specs.speedMin, (short)specs.speedMax); + // S3M HACK + if(m_pSndFile->GetType() & MOD_TYPE_S3M) + { + m_SpinTempo.SetRange(33, 255); + m_SpinSpeed.SetRange(1, 25); + } else + { + m_SpinTempo.SetRange((short)specs.tempoMin, (short)specs.tempoMax); + m_SpinSpeed.SetRange((short)specs.speedMin, (short)specs.speedMax); + } // -! BEHAVIOUR_CHANGE#0016 m_SpinGlobalVol.SetRange(0, 128); m_SpinSamplePA.SetRange(0, 2000); Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2010-10-16 21:06:10 UTC (rev 743) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2010-10-22 14:24:19 UTC (rev 744) @@ -270,10 +270,11 @@ SpaceToNullStringFixed(m_szNames[0], 28); // Speed m_nDefaultSpeed = psfh.speed; - if (!m_nDefaultSpeed) m_nDefaultSpeed = 6; + if (!m_nDefaultSpeed || m_nDefaultSpeed == 255) m_nDefaultSpeed = 6; // Tempo m_nDefaultTempo = psfh.tempo; - m_nDefaultTempo = CLAMP(m_nDefaultTempo, 32, 255); + //m_nDefaultTempo = CLAMP(m_nDefaultTempo, 32, 255); + if(m_nDefaultTempo < 33) m_nDefaultTempo = 125; // Global Volume m_nDefaultGlobalVolume = psfh.globalvol << 2; if(!m_nDefaultGlobalVolume && psfh.cwtv < 0x1320) m_nDefaultGlobalVolume = MAX_GLOBAL_VOLUME; // not very reliable, but it fixes a few tunes Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2010-10-16 21:06:10 UTC (rev 743) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2010-10-22 14:24:19 UTC (rev 744) @@ -331,7 +331,7 @@ false, // No song comments 0, // No instrument envelopes false, // No envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\?#", // Supported Effects + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\??", // Supported Effects " vp?????????????", // Supported Volume Column commands true, // Has "+++" pattern false, // Doesn't have restart position (order) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-10-22 16:00:45
|
Revision: 748 http://modplug.svn.sourceforge.net/modplug/?rev=748&view=rev Author: saga-games Date: 2010-10-22 16:00:37 +0000 (Fri, 22 Oct 2010) Log Message: ----------- [Reg] The "Position aware timer" option is gone. It is now always used. It was optional in the first place because of some buggy code, which is now fixed: [Imp] Cleaned up the mess associated to GetLength and made the parameters more intuitive. As a result, GetLength is now only called once when changing to a different order or when exporting to WAV, instead of three calls. [Fix] Order list: When jumping to an order which is normally not played, the song variables are now reset (previously, if the main song had f.e. a global volume fade out at the end, this was retained when switching to an unplayed order, effectively muting all sub songs). [Mod] OpenMPT: Version is now 1.19.00.10 Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-10-22 16:00:37 UTC (rev 748) @@ -316,12 +316,15 @@ pSndFile->m_nCurrentPattern = m_nScrollPos; pSndFile->SetCurrentOrder(m_nScrollPos); pSndFile->m_dwSongFlags |= dwPaused; - if (!(dwPaused & SONG_PATTERNLOOP)) pSndFile->GetLength(TRUE); // update channel parameters + //if (!(dwPaused & SONG_PATTERNLOOP)) // why? + { + // update channel parameters and play time + m_pModDoc->SetElapsedTime(m_nScrollPos, 0); + } if (bIsPlaying) pMainFrm->ResetNotificationBuffer(); END_CRITICAL(); } m_pParent->SetCurrentPattern(n); - m_pModDoc->SetElapsedTime(m_nScrollPos, 0); } } UpdateInfoText(); @@ -672,8 +675,8 @@ p += str.size(); *p++ = ' '; } - *p++ = 0x0D; - *p++ = 0x0A; + *p++ = '\r'; + *p++ = '\n'; *p = 0; } GlobalUnlock(hCpy); Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-10-22 16:00:37 UTC (rev 748) @@ -465,7 +465,7 @@ if(vIniVersion < MAKE_VERSION_NUMERIC(1,19,00,07)) m_dwPatternSetup &= ~0x800; // this was previously deprecated and is now used for something else if(vIniVersion < MPT_VERSION_NUMERIC) - m_dwPatternSetup &= ~(0x200000|0x400000); // various deprecated old options + m_dwPatternSetup &= ~(0x200000|0x400000|0x10000000); // various deprecated old options m_nRowSpacing = GetPrivateProfileDWord("Pattern Editor", "RowSpacing", 16, iniFile); m_nRowSpacing2 = GetPrivateProfileDWord("Pattern Editor", "RowSpacing2", 4, iniFile); Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-10-22 16:00:37 UTC (rev 748) @@ -192,7 +192,7 @@ #define PATTERN_AUTODELAY 0x2000000 // automatically insert delay commands in pattern when entering notes #define PATTERN_NOTEFADE 0x4000000 // alt. note fade behaviour when entering notes #define PATTERN_OVERFLOWPASTE 0x8000000 // continue paste in the next pattern instead of cutting off -#define PATTERN_POSITIONAWARETIMER 0x10000000 // try to set the timer in the statusbar when jumping around in modules +//#define PATTERN_POSITIONAWARETIMER 0x10000000 // try to set the timer in the statusbar when jumping around in modules (deprecated, it generated too much load in the code due to some bugs, hence it was made optional. those bugs are now resolved, so there's no point in keeping this flag.) #define PATTERN_RESETCHANNELS 0x20000000 // reset channels when looping #define PATTERN_LIVEUPDATETREE 0x40000000 // update active sample / instr icons in treeview Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-10-22 16:00:37 UTC (rev 748) @@ -1587,8 +1587,8 @@ if (wsdlg.m_bSelectPlay) { m_SndFile.SetCurrentOrder(wsdlg.m_nMinOrder); + m_SndFile.GetLength(true, wsdlg.m_nMinOrder, 0); m_SndFile.m_nCurrentPattern = wsdlg.m_nMinOrder; - m_SndFile.GetLength(TRUE, FALSE); m_SndFile.m_nMaxOrderPosition = wsdlg.m_nMaxOrder + 1; } if(dwcdlg.DoModal() != IDOK) break; @@ -1597,8 +1597,10 @@ // Restore channels' flags if(wsdlg.m_bChannelMode) { - for(int i = 0 ; i < nRenderPasses ; i++) + for(CHANNELINDEX i = 0; i < m_SndFile.GetNumChannels(); i++) + { m_SndFile.ChnSettings[i].dwFlags = channelFlags[i]; + } } // Restore instruments' / samples' flags if(wsdlg.m_bInstrumentMode) @@ -1619,7 +1621,6 @@ } m_SndFile.SetCurrentPos(pos); - m_SndFile.GetLength(TRUE); CMainFrame::UpdateAudioParameters(TRUE); } @@ -1677,7 +1678,6 @@ dwcdlg.m_dwSongLimit = wsdlg.m_dwSongLimit; dwcdlg.DoModal(); m_SndFile.SetCurrentPos(pos); - m_SndFile.GetLength(TRUE); CMainFrame::UpdateAudioParameters(TRUE); } @@ -3318,7 +3318,7 @@ END_CRITICAL(); // set playback timer in the status bar - SetElapsedTime(nOrd, nRow, true); + SetElapsedTime(nOrd, nRow); if (pModPlaying != this) { @@ -3373,7 +3373,7 @@ END_CRITICAL(); // set playback timer in the status bar - SetElapsedTime(nOrd, nRow, true); + SetElapsedTime(nOrd, nRow); if (pModPlaying != this) { pMainFrm->PlayMod(this, followSonghWnd, m_dwNotifyType|MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); //rewbs.fix2977 @@ -3431,7 +3431,7 @@ END_CRITICAL(); // set playback timer in the status bar - SetElapsedTime(nOrd, nRow, true); + SetElapsedTime(nOrd, nRow); if (pModPlaying != this) { @@ -3660,22 +3660,17 @@ } -// Sets playback timer to playback time at given position. If 'bReset' is true, -// timer is reset if playback position timer is not enabled. -void CModDoc::SetElapsedTime(ORDERINDEX nOrd, ROWINDEX nRow, bool bReset) -//----------------------------------------------------------------------- +// Sets playback timer to playback time at given position. +// At the same time, the playback parameters (global volume, channel volume and stuff like that) are calculated for this position. +void CModDoc::SetElapsedTime(ORDERINDEX nOrd, ROWINDEX nRow) +//---------------------------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); if(pMainFrm == NULL) return; - if(CMainFrame::m_dwPatternSetup & PATTERN_POSITIONAWARETIMER) - { - double dPatternPlaytime = max(0, m_SndFile.GetPlaybackTimeAt(nOrd, nRow)); - pMainFrm->SetElapsedTime((DWORD) (dPatternPlaytime * 1000)); - } - else if(bReset) - pMainFrm->ResetElapsedTime(); + const double dPatternPlaytime = m_SndFile.GetPlaybackTimeAt(nOrd, nRow, false); + pMainFrm->SetElapsedTime((DWORD) (max(0, dPatternPlaytime) * 1000)); } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/mptrack/Moddoc.h 2010-10-22 16:00:37 UTC (rev 748) @@ -306,7 +306,7 @@ void TogglePluginEditor(UINT m_nCurrentPlugin); //rewbs.patPlugNames void RecordParamChange(int slot, long param); void LearnMacro(int macro, long param); - void SetElapsedTime(ORDERINDEX nOrd, ROWINDEX nRow, bool bReset = false); + void SetElapsedTime(ORDERINDEX nOrd, ROWINDEX nRow); bool RemoveChannels(bool bChnMask[MAX_BASECHANNELS]); Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2010-10-22 16:00:37 UTC (rev 748) @@ -554,7 +554,8 @@ LPCSTR pszListName, pszDescription; } OPTGENDESC; -enum { +enum +{ OPTGEN_PLAYNEWNOTES=0, OPTGEN_PLAYEDITROW, OPTGEN_CENTERROW, @@ -606,10 +607,9 @@ {PATTERN_OLDCTXMENUSTYLE, "Old style pattern context menu", "Check this option to hide unavailable items in the pattern editor context menu. Uncheck to grey-out unavailable items instead."}, {PATTERN_SYNCMUTE, "Maintain sample sync on mute", "Samples continue to be processed when channels are muted (like in IT2 and FT2)"}, {PATTERN_AUTODELAY, "Automatic delay commands", "Automatically insert appropriate note-delay commands when recording notes during live playback."}, - {PATTERN_NOTEFADE, "Note fade on key up", "Enable to fade/stop notes on key up in pattern tab." }, + {PATTERN_NOTEFADE, "Note fade on key up", "Enable to fade / stop notes on key up in pattern tab." }, {PATTERN_OVERFLOWPASTE, "Overflow paste mode", "Wrap pasted pattern data into next pattern. This is useful for creating echo channels."}, - {PATTERN_POSITIONAWARETIMER, "Position aware timer", "If enabled, timer will show the playback position time if possible instead of running timer."}, - {PATTERN_RESETCHANNELS, "Reset channels on loop", "If enabled, channels will be reset to their initial state when song looping is enabled.\nNote: This does not affect manual song loops (i.e. triggered by pattern commands)"}, + {PATTERN_RESETCHANNELS, "Reset channels on loop", "If enabled, channels will be reset to their initial state when song looping is enabled.\nNote: This does not affect manual song loops (i.e. triggered by pattern commands) and is recommended to be enabled."}, {PATTERN_LIVEUPDATETREE,"Update sample status in tree", "If enabled, active samples and instruments will be indicated by a different icon in the treeview."} }; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-10-22 16:00:37 UTC (rev 748) @@ -5410,7 +5410,7 @@ ORDERINDEX currentOrder = SendCtrlMessage(CTRLMSG_GETCURRENTORDER); if(pSndFile->Order[currentOrder] == m_nPattern) { - const double t = pSndFile->GetPlaybackTimeAt(currentOrder, m_nRow); + const double t = pSndFile->GetPlaybackTimeAt(currentOrder, m_nRow, true); if(t < 0) msg.Format("Unable to determine the time. Possible cause: No order %d, row %d found from play sequence", currentOrder, m_nRow); else Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/mptrack/version.h 2010-10-22 16:00:37 UTC (rev 748) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 00 -#define VER_MINORMINOR 09 +#define VER_MINORMINOR 10 //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/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-10-22 16:00:37 UTC (rev 748) @@ -73,17 +73,26 @@ } */ -double CSoundFile::GetLength(BOOL bAdjust, BOOL bTotal) -//------------------------------------------- +double CSoundFile::GetLength(bool bAdjust, ORDERINDEX endOrder, ROWINDEX endRow) +//------------------------------------------------------------------------------ { bool dummy = false; - double result = GetLength(dummy, bAdjust, bTotal); - InitializeVisitedRows(true); // forget that we went over the whole module. + double result = GetLength(dummy, bAdjust, endOrder, endRow); + if(!bAdjust) + { + InitializeVisitedRows(true); // forget that we went over the whole module. + } return result; } -double CSoundFile::GetLength(bool& targetReached, BOOL bAdjust, BOOL bTotal, ORDERINDEX endOrder, ROWINDEX endRow) -//---------------------------------------------------------------------------------------------------------------- + +// Get mod length in various cases. Parameters: +// &targetReached: Will be set to true if the specified order/row combination has been reached while going through the module. +// bAdjust: If enabled, the mod parameters (such as global volume, speed, tempo, etc...) will be memorized (if the target has been reached) when leaving the function (i.e. they won't be reset to the previous values) +// endOrder: Order which should be reached (ORDERINDEX_INVALID means whole song) +// endRow: Row in that order that should be reached +double CSoundFile::GetLength(bool& targetReached, bool bAdjust, ORDERINDEX endOrder, ROWINDEX endRow) +//--------------------------------------------------------------------------------------------------- { // -> CODE#0022 // -> DESC="alternative BPM/Speed interpretation method" @@ -96,7 +105,6 @@ double dElapsedTime=0.0; // -! NEW_FEATURE#0022 UINT nMusicSpeed = m_nDefaultSpeed, nMusicTempo = m_nDefaultTempo, nNextRow = 0; - UINT nMaxRow = 0, nMaxPattern = 0; LONG nGlbVol = m_nDefaultGlobalVolume, nOldGlbVolSlide = 0; vector<BYTE> instr; vector<UINT> notes; @@ -114,8 +122,6 @@ patloop.resize(m_nChannels, 0); patloopstart.resize(m_nChannels, 0); for(CHANNELINDEX icv = 0; icv < m_nChannels; icv++) chnvols[icv] = ChnSettings[icv].nVolume; - nMaxRow = m_nNextRow; - nMaxPattern = m_nNextPattern; nCurrentPattern = nNextPattern = 0; nPattern = Order[0]; nRow = nNextRow = 0; @@ -192,18 +198,6 @@ for(UINT ipck = 0; ipck < m_nChannels; ipck++) patloop[ipck] = dElapsedTime; } - if (!bTotal) - { - if ((nCurrentPattern > nMaxPattern) || ((nCurrentPattern == nMaxPattern) && (nRow >= nMaxRow))) - { - if (bAdjust) - { - m_nMusicSpeed = nMusicSpeed; - m_nMusicTempo = nMusicTempo; - } - break; - } - } MODCHANNEL *pChn = Chn; MODCOMMAND *p = Patterns[nPattern] + nRow * m_nChannels; @@ -222,7 +216,7 @@ { // Position Jump case CMD_POSITIONJUMP: - positionJumpOnThisRow=true; + positionJumpOnThisRow = true; nNextPattern = (ORDERINDEX)param; nNextPatStartRow = 0; // FT2 E60 bug // see http://lpchip.com/modplug/viewtopic.php?t=2769 - FastTracker resets Dxx if Bxx is called _after_ Dxx @@ -430,17 +424,20 @@ case tempo_mode_alternative: dElapsedTime += 60000.0 / (1.65625 * (double)(nMusicSpeed * nMusicTempo)); break; case tempo_mode_modern: - dElapsedTime += 60000.0/(double)nMusicTempo / (double)m_nCurrentRowsPerBeat; break; + dElapsedTime += 60000.0 / (double)nMusicTempo / (double)m_nCurrentRowsPerBeat; break; case tempo_mode_classic: default: dElapsedTime += (2500.0 * (double)nSpeedCount) / (double)nMusicTempo; } } - if ((bAdjust) && (!bTotal)) + // Store final variables + if (bAdjust && (targetReached || endOrder == ORDERINDEX_INVALID || endRow == ROWINDEX_INVALID)) { m_nGlobalVolume = nGlbVol; m_nOldGlbVolSlide = nOldGlbVolSlide; - for (UINT n=0; n<m_nChannels; n++) + m_nMusicSpeed = nMusicSpeed; + m_nMusicTempo = nMusicTempo; + for (CHANNELINDEX n = 0; n < m_nChannels; n++) { Chn[n].nGlobalVol = chnvols[n]; if (notes[n]) Chn[n].nNewNote = notes[n]; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-10-22 16:00:37 UTC (rev 748) @@ -3052,11 +3052,12 @@ return false; } -double CSoundFile::GetPlaybackTimeAt(ORDERINDEX ord, ROWINDEX row) -//---------------------------------------------------------------- + +double CSoundFile::GetPlaybackTimeAt(ORDERINDEX ord, ROWINDEX row, bool resetVars) +//-------------------------------------------------------------------------------- { bool targetReached = false; - const double t = GetLength(targetReached, FALSE, TRUE, ord, row); + const double t = GetLength(targetReached, !resetVars, ord, row); if(targetReached) return t; else return -1; //Given position not found from play sequence. } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-10-22 14:26:03 UTC (rev 747) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-10-22 16:00:37 UTC (rev 748) @@ -494,8 +494,9 @@ public: //Misc void ChangeModTypeTo(const MODTYPE& newType); - //Returns value in seconds. If given position won't be played at all, returns -1. - double GetPlaybackTimeAt(ORDERINDEX, ROWINDEX); + // Returns value in seconds. If given position won't be played at all, returns -1. + // If resetVars is true, the state of various playback variables will be retained. + double GetPlaybackTimeAt(ORDERINDEX ord, ROWINDEX row, bool resetVars); uint16 GetModFlags() const {return m_ModFlags;} void SetModFlags(const uint16 v) {m_ModFlags = v;} @@ -676,15 +677,15 @@ UINT GetMusicSpeed() const { return m_nMusicSpeed; } UINT GetMusicTempo() const { return m_nMusicTempo; } - double GetLength(BOOL bAdjust, BOOL bTotal=FALSE); + double GetLength(bool bAdjust, ORDERINDEX ord = ORDERINDEX_MAX, ROWINDEX row = ROWINDEX_MAX); private: //Get modlength in various cases: total length, length to //specific order&row etc. Return value is in seconds. - double GetLength(bool& targetReached, BOOL bAdjust, BOOL bTotal=FALSE, ORDERINDEX ord = ORDERINDEX_MAX, ROWINDEX row = ROWINDEX_MAX); + double GetLength(bool& targetReached, bool bAdjust, ORDERINDEX ord, ROWINDEX row); public: //Returns song length in seconds. - DWORD GetSongTime() { return static_cast<DWORD>((m_nTempoMode == tempo_mode_alternative) ? GetLength(FALSE, TRUE)+1.0 : GetLength(FALSE, TRUE)+0.5); } + DWORD GetSongTime() { return static_cast<DWORD>((m_nTempoMode == tempo_mode_alternative) ? GetLength(false) + 1.0 : GetLength(false) + 0.5); } void SetRepeatCount(int n) { m_nRepeatCount = n; } int GetRepeatCount() const { return m_nRepeatCount; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rel...@us...> - 2010-10-25 20:27:13
|
Revision: 754 http://modplug.svn.sourceforge.net/modplug/?rev=754&view=rev Author: relabsoluness Date: 2010-10-25 20:27:05 +0000 (Mon, 25 Oct 2010) Log Message: ----------- [Imp] Sample editor: Can now zoom with ctrl + mouse wheel. [Imp] Instrument editor: Can now zoom with ctrl + mouse wheel. [Ref] Tiny fixes, changes and documentation including VC10 build fixes, some added utilities and project config changes. Modified Paths: -------------- trunk/OpenMPT/mptrack/Stdafx.h trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/misc_util.h trunk/OpenMPT/mptrack/serialization_utils.cpp trunk/OpenMPT/mptrack/serialization_utils.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_mo3.cpp trunk/OpenMPT/soundlib/Snddev.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundtouch/soundtouch_08.vcproj trunk/OpenMPT/ungzip/ungzip_08.vcproj trunk/OpenMPT/unlha/unlha_08.vcproj trunk/OpenMPT/unrar/unrar_08.vcproj trunk/OpenMPT/unzip/unzip_08.vcproj trunk/OpenMPT/xsoundlib/xsoundlib_08.vcproj trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj Modified: trunk/OpenMPT/mptrack/Stdafx.h =================================================================== --- trunk/OpenMPT/mptrack/Stdafx.h 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/Stdafx.h 2010-10-25 20:27:05 UTC (rev 754) @@ -13,7 +13,7 @@ #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #if _MSC_VER >= 1500 - #define _WIN32_WINNT 0x0500 + #define _WIN32_WINNT 0x0500 // 0x0500 = Windows 2000 #else #define WINVER 0x0401 #endif Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/Undo.cpp 2010-10-25 20:27:05 UTC (rev 754) @@ -14,6 +14,7 @@ #include "modsmp_ctrl.h" #include "Undo.h" +#define new DEBUG_NEW ///////////////////////////////////////////////////////////////////////////////////////// // Pattern Undo Functions Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2010-10-25 20:27:05 UTC (rev 754) @@ -98,6 +98,7 @@ ON_COMMAND(ID_ENVELOPE_TOGGLERELEASENODE, OnEnvToggleReleasNode) //}}AFX_MSG_MAP ON_COMMAND(ID_ENVELOPE_SCALEPOINTS, OnEnvelopeScalepoints) + ON_WM_MOUSEWHEEL() END_MESSAGE_MAP() @@ -2486,3 +2487,18 @@ return envelope; } + + +BOOL CViewInstrument::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +//---------------------------------------------------------------------- +{ + // Ctrl + mouse wheel: envelope zoom. + if (nFlags == MK_CONTROL) + { + // Speed up zoom scrolling by some factor (might need some tuning). + const float speedUpFactor = Util::Max(1.0f, m_fZoom * 7.0f / ENV_MAX_ZOOM); + EnvSetZoom(m_fZoom + speedUpFactor * (zDelta / WHEEL_DELTA)); + } + + return CModScrollView::OnMouseWheel(nFlags, zDelta, pt); +} Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/View_ins.h 2010-10-25 20:27:05 UTC (rev 754) @@ -195,6 +195,7 @@ afx_msg void OnDropFiles(HDROP hDropInfo); afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM); //rewbs.customKeys afx_msg LRESULT OnMidiMsg(WPARAM, LPARAM); + afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); virtual BOOL PreTranslateMessage(MSG *pMsg); //rewbs.customKeys //}}AFX_MSG DECLARE_MESSAGE_MAP() Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-10-25 20:27:05 UTC (rev 754) @@ -128,6 +128,7 @@ ON_WM_RBUTTONUP() END_MESSAGE_MAP() +static_assert(MODCOMMAND::maxColumnValue <= 999, "Command range for ID_CHANGE_PCNOTE_PARAM is designed for 999"); CViewPattern::CViewPattern() //-------------------------- Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2010-10-25 20:27:05 UTC (rev 754) @@ -66,6 +66,7 @@ ON_WM_KEYDOWN() ON_WM_KEYUP() ON_WM_DROPFILES() + ON_WM_MOUSEWHEEL() ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) ON_COMMAND(ID_EDIT_SELECT_ALL, OnEditSelectAll) ON_COMMAND(ID_EDIT_CUT, OnEditCut) @@ -2636,3 +2637,69 @@ return NULL; } + + +// Returns auto-zoom level compared to other zoom levels. +// If auto-zoom gives bigger zoom than zoom level N but smaller than zoom level N-1, +// return value is N. If zoom is bigger than the biggest zoom, returns MIN_ZOOM + 1 and +// if smaller than the smallest zoom, returns value >= MAX_ZOOM + 1. +UINT CViewSample::GetAutoZoomLevel(const MODSAMPLE& smp) +//----------------------------------------------------- +{ + m_rcClient.NormalizeRect(); + if (m_rcClient.Width() == 0 || smp.nLength <= 0) + return MAX_ZOOM + 1; + + // When m_nZoom > 0, 2^(m_nZoom - 1) = samplesPerPixel [1] + // With auto-zoom setting the whole sample is fitted to screen: + // ViewScreenWidthInPixels * samplesPerPixel = sampleLength (approximately) [2]. + // Solve samplesPerPixel from [2], then "m_nZoom" from [1]. + float zoom = static_cast<float>(smp.nLength) / static_cast<float>(m_rcClient.Width()); + zoom = 1 + (log10(zoom) / log10(2.0f)); + return static_cast<UINT>(Util::Max(zoom + 1, MIN_ZOOM + 1.0f)); +} + + +BOOL CViewSample::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +//------------------------------------------------------------------ +{ + // Ctrl + mouse wheel: zoom control. + // One scroll direction zooms in and the other zooms out. + // This behaviour is different from what would happen if simply scrolling + // the zoom levels in the zoom combobox. + if (nFlags == MK_CONTROL) + { + CSoundFile* const pSndFile = (GetDocument()) ? GetDocument()->GetSoundFile() : nullptr; + if (pSndFile != nullptr) + { + // zoomOrder: Biggest to smallest zoom order. + UINT zoomOrder[MAX_ZOOM + 1]; + for(size_t i = 1; i < CountOf(zoomOrder); ++i) + zoomOrder[i-1] = i; // [0]=1, [1]=2, ... + zoomOrder[CountOf(zoomOrder) - 1] = 0; + UINT* const pZoomOrderEnd = zoomOrder + CountOf(zoomOrder); + const UINT nAutoZoomLevel = GetAutoZoomLevel(pSndFile->Samples[m_nSample]); + + // If auto-zoom is not the smallest zoom, move auto-zoom index(=zero) + // to the right position in the zoom order. + if (nAutoZoomLevel < MAX_ZOOM + 1) + { + UINT* p = std::find(zoomOrder, pZoomOrderEnd, nAutoZoomLevel); + if (p != pZoomOrderEnd) + { + memmove(p + 1, p, sizeof(zoomOrder[0]) * (pZoomOrderEnd - (p+1))); + *p = 0; + } + else + ASSERT(false); + } + const ptrdiff_t nPos = std::find(zoomOrder, pZoomOrderEnd, m_nZoom) - zoomOrder; + if (zDelta > 0 && nPos > 0) + SendCtrlMessage(CTRLMSG_SMP_SETZOOM, zoomOrder[nPos - 1]); + else if (zDelta < 0 && nPos + 1 < CountOf(zoomOrder)) + SendCtrlMessage(CTRLMSG_SMP_SETZOOM, zoomOrder[nPos + 1]); + } + } + + return CModScrollView::OnMouseWheel(nFlags, zDelta, pt); +} Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/View_smp.h 2010-10-25 20:27:05 UTC (rev 754) @@ -58,6 +58,12 @@ template<class T, class uT> T GetSampleValueFromPoint(const CPoint& point); + // Returns auto-zoom level compared to other zoom levels. + // If auto-zoom gives bigger zoom than zoom level N but smaller than zoom level N-1, + // return value is N. If zoom is bigger than the biggest zoom, returns MIN_ZOOM + 1 and + // if smaller than the smallest zoom, returns value >= MAX_ZOOM + 1. + UINT GetAutoZoomLevel(const MODSAMPLE& smp); + public: //{{AFX_VIRTUAL(CViewSample) virtual void OnDraw(CDC *); @@ -119,6 +125,7 @@ afx_msg void OnAddSilence(); afx_msg LRESULT OnMidiMsg(WPARAM, LPARAM); afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM); //rewbs.customKeys + afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-10-25 20:27:05 UTC (rev 754) @@ -20,6 +20,8 @@ #include "../zlib/zlib.h" //For CRC32 calculation (to detect plugins with same UID) #endif +#define new DEBUG_NEW + #ifndef NO_VST char CVstPluginManager::s_szHostProductString[64] = "OpenMPT"; Modified: trunk/OpenMPT/mptrack/misc_util.h =================================================================== --- trunk/OpenMPT/mptrack/misc_util.h 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/misc_util.h 2010-10-25 20:27:05 UTC (rev 754) @@ -4,6 +4,9 @@ #include <sstream> #include <string> #include <limits> +#if _HAS_TR1 + #include <type_traits> +#endif //Convert object(typically number) to string template<class T> @@ -20,6 +23,9 @@ inline T ConvertStrTo(LPCSTR psz) //------------------------------- { + #if _HAS_TR1 + static_assert(std::tr1::is_const<T>::value == false && std::tr1::is_volatile<T>::value == false, "Const and volatile types are not handled correctly."); + #endif if(std::numeric_limits<T>::is_integer) return static_cast<T>(atoi(psz)); else @@ -43,7 +49,13 @@ // Memset given object to zero. template <class T> -inline void MemsetZero(T& a) {memset(&a, 0, sizeof(T));} +inline void MemsetZero(T& a) +{ + #if _HAS_TR1 + static_assert(std::tr1::is_pointer<T>::value == false, "Won't memset pointers."); + #endif + memset(&a, 0, sizeof(T)); +} // Limits 'val' to given range. If 'val' is less than 'lowerLimit', 'val' is set to value 'lowerLimit'. @@ -205,4 +217,13 @@ } } +namespace Util +{ + // Like std::max, but avoids conflict with max-macro. + template <class T> inline const T& Max(const T& a, const T& b) {return (std::max)(a, b);} + + // Returns maximum value of given integer type. + template <class T> inline T MaxValueOfType(const T&) {static_assert(std::numeric_limits<T>::is_integer == true, "Only interger types are allowed."); return (std::numeric_limits<T>::max)();} +}; + #endif Modified: trunk/OpenMPT/mptrack/serialization_utils.cpp =================================================================== --- trunk/OpenMPT/mptrack/serialization_utils.cpp 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/serialization_utils.cpp 2010-10-25 20:27:05 UTC (rev 754) @@ -1,6 +1,7 @@ #include "stdafx.h" #include "serialization_utils.h" #include <algorithm> +#include <iterator> // for back_inserter namespace srlztn { @@ -752,7 +753,7 @@ if(nIdsize == IdSizeVariable) //Variablesize ID ReadAdaptive12(iStrm, nIdsize); const size_t nOldEnd = m_Idarray.size(); - if(nIdsize > 0) + if (nIdsize > 0 && (Util::MaxValueOfType(nOldEnd) - nOldEnd >= nIdsize)) { m_Idarray.resize(nOldEnd + nIdsize); iStrm.read(&m_Idarray[nOldEnd], nIdsize); Modified: trunk/OpenMPT/mptrack/serialization_utils.h =================================================================== --- trunk/OpenMPT/mptrack/serialization_utils.h 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/mptrack/serialization_utils.h 2010-10-25 20:27:05 UTC (rev 754) @@ -318,7 +318,7 @@ static int32 s_DefaultWriteLogMask; static fpLogFunc_t s_DefaultLogFunc; static const char s_EntryID[3]; - static const uint32 s_DefaultFlags = (1 << RwfWMapStartPosEntry) + + static const int32 s_DefaultFlags = (1 << RwfWMapStartPosEntry) + (1 << RwfWMapSizeEntry) + (1 << RwfWVersionNum) + (1 << RwfRPartialIdMatch); }; Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-10-25 20:27:05 UTC (rev 754) @@ -32,7 +32,8 @@ /* MPTM version history for cwtv-field in "IT" header (only for MPTM files!): 0x890(1.18.02.00) -> 0x891(1.19.00.00): Pattern-specific time signatures -0x88F(1.18.01.00) -> 0x890(1.18.02.00): Removed volume command velocity :xy, added delay-cut command :xy. + Fixed behaviour of Pattern Loop command for rows > 255 (r617) +0x88F(1.18.01.00) -> 0x890(1.18.02.00): Removed volume command velocity :xy, added delay-cut command :xy. 0x88E(1.17.02.50) -> 0x88F(1.18.01.00): Numerous changes 0x88D(1.17.02.49) -> 0x88E(1.17.02.50): Changed ID to that of IT and undone the orderlist change done in 0x88A->0x88B. Now extended orderlist is saved as extension. Modified: trunk/OpenMPT/soundlib/Load_mo3.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mo3.cpp 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/soundlib/Load_mo3.cpp 2010-10-25 20:27:05 UTC (rev 754) @@ -62,8 +62,8 @@ } else //case: dll loaded succesfully. { - UNMO3_DECODE UNMO3_Decode = (UNMO3_DECODE)GetProcAddress(unmo3, _TEXT("UNMO3_Decode")); - UNMO3_FREE UNMO3_Free = (UNMO3_FREE)GetProcAddress(unmo3, _TEXT("UNMO3_Free")); + UNMO3_DECODE UNMO3_Decode = (UNMO3_DECODE)GetProcAddress(unmo3, "UNMO3_Decode"); + UNMO3_FREE UNMO3_Free = (UNMO3_FREE)GetProcAddress(unmo3, "UNMO3_Free"); if(UNMO3_Decode != NULL && UNMO3_Free != NULL) { Modified: trunk/OpenMPT/soundlib/Snddev.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snddev.cpp 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/soundlib/Snddev.cpp 2010-10-25 20:27:05 UTC (rev 754) @@ -1373,6 +1373,7 @@ { if (ghDSoundDLL) return TRUE; if ((ghDSoundDLL = LoadLibrary("dsound.dll")) == NULL) return FALSE; + static_assert(sizeof(TCHAR) == 1, "Check DirectSoundEnumerateA below"); if ((gpDSoundEnumerate = (LPDSOUNDENUMERATE)GetProcAddress(ghDSoundDLL, "DirectSoundEnumerateA")) == NULL) return FALSE; if ((gpDSoundCreate = (LPDSOUNDCREATE)GetProcAddress(ghDSoundDLL, "DirectSoundCreate")) == NULL) return FALSE; RtlZeroMemory(glpDSoundGUID, sizeof(glpDSoundGUID)); Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-10-25 20:27:05 UTC (rev 754) @@ -652,6 +652,8 @@ void SetMasterVolume(UINT vol, bool adjustAGC = false); UINT GetMasterVolume() const { return m_nMasterVolume; } + + // Returns 1 + index of last valid pattern, zero if no such pattern exists. PATTERNINDEX GetNumPatterns() const; INSTRUMENTINDEX GetNumInstruments() const { return m_nInstruments; } SAMPLEINDEX GetNumSamples() const { return m_nSamples; } Modified: trunk/OpenMPT/soundtouch/soundtouch_08.vcproj =================================================================== --- trunk/OpenMPT/soundtouch/soundtouch_08.vcproj 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/soundtouch/soundtouch_08.vcproj 2010-10-25 20:27:05 UTC (rev 754) @@ -45,7 +45,7 @@ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DLL_EXPORTS;INTEGER_SAMPLES=1" MinimalRebuild="true" BasicRuntimeChecks="3" - RuntimeLibrary="1" + RuntimeLibrary="3" ForceConformanceInForLoopScope="true" UsePrecompiledHeader="0" WarningLevel="3" Modified: trunk/OpenMPT/ungzip/ungzip_08.vcproj =================================================================== --- trunk/OpenMPT/ungzip/ungzip_08.vcproj 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/ungzip/ungzip_08.vcproj 2010-10-25 20:27:05 UTC (rev 754) @@ -17,7 +17,7 @@ <Configurations> <Configuration Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" + OutputDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="4" CharacterSet="2" @@ -78,7 +78,7 @@ </Configuration> <Configuration Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" + OutputDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="4" CharacterSet="2" @@ -104,7 +104,7 @@ Optimization="2" EnableIntrinsicFunctions="true" PreprocessorDefinitions="WIN32;ZLIB_WINAPI" - RuntimeLibrary="2" + RuntimeLibrary="0" EnableFunctionLevelLinking="true" WarningLevel="3" SuppressStartupBanner="false" Modified: trunk/OpenMPT/unlha/unlha_08.vcproj =================================================================== --- trunk/OpenMPT/unlha/unlha_08.vcproj 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/unlha/unlha_08.vcproj 2010-10-25 20:27:05 UTC (rev 754) @@ -45,7 +45,7 @@ PreprocessorDefinitions="WIN32;_DEBUG;_LIB" StringPooling="true" BasicRuntimeChecks="3" - RuntimeLibrary="1" + RuntimeLibrary="3" BufferSecurityCheck="true" EnableFunctionLevelLinking="true" PrecompiledHeaderFile=".\Debug/unlha.pch" Modified: trunk/OpenMPT/unrar/unrar_08.vcproj =================================================================== --- trunk/OpenMPT/unrar/unrar_08.vcproj 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/unrar/unrar_08.vcproj 2010-10-25 20:27:05 UTC (rev 754) @@ -43,7 +43,7 @@ Optimization="0" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" StringPooling="true" - RuntimeLibrary="1" + RuntimeLibrary="3" BufferSecurityCheck="true" EnableFunctionLevelLinking="true" PrecompiledHeaderFile=".\Debug/UNRAR.pch" Modified: trunk/OpenMPT/unzip/unzip_08.vcproj =================================================================== --- trunk/OpenMPT/unzip/unzip_08.vcproj 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/unzip/unzip_08.vcproj 2010-10-25 20:27:05 UTC (rev 754) @@ -43,7 +43,7 @@ Optimization="0" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" StringPooling="true" - RuntimeLibrary="1" + RuntimeLibrary="3" BufferSecurityCheck="true" EnableFunctionLevelLinking="true" PrecompiledHeaderFile=".\Debug/unzip.pch" Modified: trunk/OpenMPT/xsoundlib/xsoundlib_08.vcproj =================================================================== --- trunk/OpenMPT/xsoundlib/xsoundlib_08.vcproj 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/xsoundlib/xsoundlib_08.vcproj 2010-10-25 20:27:05 UTC (rev 754) @@ -44,7 +44,7 @@ PreprocessorDefinitions="WIN32;_DEBUG;_LIB" MinimalRebuild="true" BasicRuntimeChecks="3" - RuntimeLibrary="1" + RuntimeLibrary="3" BufferSecurityCheck="true" UsePrecompiledHeader="2" WarningLevel="3" Modified: trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj =================================================================== --- trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj 2010-10-25 19:49:49 UTC (rev 753) +++ trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj 2010-10-25 20:27:05 UTC (rev 754) @@ -50,7 +50,7 @@ AdditionalIncludeDirectories="..\..\..;..\..\masmx86" PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" ExceptionHandling="0" - RuntimeLibrary="1" + RuntimeLibrary="3" BufferSecurityCheck="false" PrecompiledHeaderFile="$(IntDir)/zlibstat.pch" AssemblerListingLocation="$(IntDir)\" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-10-26 17:59:03
|
Revision: 755 http://modplug.svn.sourceforge.net/modplug/?rev=755&view=rev Author: saga-games Date: 2010-10-26 17:58:56 +0000 (Tue, 26 Oct 2010) Log Message: ----------- [Fix] Loading IT files from the tree view was broken since the introduction of the edit history. [Fix] Mod Conversion: Got rid of the unnecessary "channel panning is not supported" message when converting from MOD to XM. [Fix] Playing samples from modules with a very short order list through the tree view should now also work again. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-10-25 20:27:05 UTC (rev 754) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-10-26 17:58:56 UTC (rev 755) @@ -2142,6 +2142,7 @@ m_WaveFile.m_nInstruments = 0; m_WaveFile.m_nSamples = 1; } + m_WaveFile.Order.resize(3); m_WaveFile.Order[0] = 0; m_WaveFile.Order[1] = 1; m_WaveFile.Order[2] = m_WaveFile.Order.GetInvalidPatIndex(); @@ -2156,10 +2157,10 @@ m[1].note = (BYTE)nNote; m[1].instr = 1; m = m_WaveFile.Patterns[1]; - m[32*4].note = 0xFF; - m[32*4+1].note = 0xFF; - m[63*4].note = 0xFE; - m[63*4+1].note = 0xFE; + m[32*4].note = NOTE_FADE; + m[32*4+1].note = NOTE_FADE; + m[63*4].note = NOTE_KEYOFF; + m[63*4+1].note = NOTE_KEYOFF; } if ((nInstrument) && (nInstrument <= pSong->m_nInstruments)) { Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2010-10-25 20:27:05 UTC (rev 754) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2010-10-26 17:58:56 UTC (rev 755) @@ -386,7 +386,7 @@ CHANGEMODTYPE_WARNING(wChannelVolSurround); } } - if(newTypeIsXM) + if(newTypeIsXM && !oldTypeIsMOD_XM) { if(m_SndFile.ChnSettings[nChn].nPan != 128) { Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-10-25 20:27:05 UTC (rev 754) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-10-26 17:58:56 UTC (rev 755) @@ -723,36 +723,42 @@ if (nflt * 8 <= dwMemLength - dwMemPos && dwMemPos + nflt * 8 <= minptr) { - GetpModDoc()->GetFileHistory()->clear(); - for(size_t n = 0; n < nflt; n++) +#ifdef MODPLUG_TRACKER + if(GetpModDoc() != nullptr) { -#ifdef MODPLUG_TRACKER - ITHISTORYSTRUCT itHistory = *((ITHISTORYSTRUCT *)(lpStream + dwMemPos)); - itHistory.fatdate = LittleEndianW(itHistory.fatdate); - itHistory.fattime = LittleEndianW(itHistory.fattime); - itHistory.runtime = LittleEndian(itHistory.runtime); + GetpModDoc()->GetFileHistory()->clear(); + for(size_t n = 0; n < nflt; n++) + { + ITHISTORYSTRUCT itHistory = *((ITHISTORYSTRUCT *)(lpStream + dwMemPos)); + itHistory.fatdate = LittleEndianW(itHistory.fatdate); + itHistory.fattime = LittleEndianW(itHistory.fattime); + itHistory.runtime = LittleEndian(itHistory.runtime); - FileHistory mptHistory; - MemsetZero(mptHistory); - // Decode FAT date and time - mptHistory.loadDate.tm_year = ((itHistory.fatdate >> 9) & 0x7F) + 80; - mptHistory.loadDate.tm_mon = CLAMP((itHistory.fatdate >> 5) & 0x0F, 1, 12) - 1; - mptHistory.loadDate.tm_mday = CLAMP(itHistory.fatdate & 0x1F, 1, 31); - mptHistory.loadDate.tm_hour = CLAMP((itHistory.fattime >> 11) & 0x1F, 0, 23); - mptHistory.loadDate.tm_min = CLAMP((itHistory.fattime >> 5) & 0x3F, 0, 59); - mptHistory.loadDate.tm_sec = CLAMP((itHistory.fattime & 0x1F) * 2, 0, 59); - mptHistory.openTime = itHistory.runtime * (HISTORY_TIMER_PRECISION / 18.2f); - GetpModDoc()->GetFileHistory()->push_back(mptHistory); + FileHistory mptHistory; + MemsetZero(mptHistory); + // Decode FAT date and time + mptHistory.loadDate.tm_year = ((itHistory.fatdate >> 9) & 0x7F) + 80; + mptHistory.loadDate.tm_mon = CLAMP((itHistory.fatdate >> 5) & 0x0F, 1, 12) - 1; + mptHistory.loadDate.tm_mday = CLAMP(itHistory.fatdate & 0x1F, 1, 31); + mptHistory.loadDate.tm_hour = CLAMP((itHistory.fattime >> 11) & 0x1F, 0, 23); + mptHistory.loadDate.tm_min = CLAMP((itHistory.fattime >> 5) & 0x3F, 0, 59); + mptHistory.loadDate.tm_sec = CLAMP((itHistory.fattime & 0x1F) * 2, 0, 59); + mptHistory.openTime = itHistory.runtime * (HISTORY_TIMER_PRECISION / 18.2f); + GetpModDoc()->GetFileHistory()->push_back(mptHistory); #ifdef DEBUG - const uint32 seconds = (uint32)(((double)itHistory.runtime) / 18.2f); - CHAR stime[128]; - wsprintf(stime, "IT Edit History: Loaded %04u-%02u-%02u %02u:%02u:%02u, open for %u:%02u:%02u (%u ticks)\n", ((itHistory.fatdate >> 9) & 0x7F) + 1980, (itHistory.fatdate >> 5) & 0x0F, itHistory.fatdate & 0x1F, (itHistory.fattime >> 11) & 0x1F, (itHistory.fattime >> 5) & 0x3F, (itHistory.fattime & 0x1F) * 2, seconds / 3600, (seconds / 60) % 60, seconds % 60, itHistory.runtime); - Log(stime); + const uint32 seconds = (uint32)(((double)itHistory.runtime) / 18.2f); + CHAR stime[128]; + wsprintf(stime, "IT Edit History: Loaded %04u-%02u-%02u %02u:%02u:%02u, open for %u:%02u:%02u (%u ticks)\n", ((itHistory.fatdate >> 9) & 0x7F) + 1980, (itHistory.fatdate >> 5) & 0x0F, itHistory.fatdate & 0x1F, (itHistory.fattime >> 11) & 0x1F, (itHistory.fattime >> 5) & 0x3F, (itHistory.fattime & 0x1F) * 2, seconds / 3600, (seconds / 60) % 60, seconds % 60, itHistory.runtime); + Log(stime); #endif // DEBUG + dwMemPos += 8; + } + } else #endif // MODPLUG_TRACKER - dwMemPos += 8; + { + dwMemPos += nflt * 8; } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <sag...@us...> - 2010-11-13 22:03:11
|
Revision: 761 http://modplug.svn.sourceforge.net/modplug/?rev=761&view=rev Author: saga-games Date: 2010-11-13 22:03:04 +0000 (Sat, 13 Nov 2010) Log Message: ----------- [Fix] IT Compatibility: Sample autovibrato is now hopefully a bit closer to Impulse Tracker... [Mod] OpenMPT: Version is now 1.19.00.13 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2010-11-13 13:49:04 UTC (rev 760) +++ trunk/OpenMPT/mptrack/version.h 2010-11-13 22:03:04 UTC (rev 761) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 00 -#define VER_MINORMINOR 12 +#define VER_MINORMINOR 13 //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/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-11-13 13:49:04 UTC (rev 760) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-11-13 22:03:04 UTC (rev 761) @@ -1112,6 +1112,7 @@ MODINSTRUMENT *pIns = pChn->pModInstrument; // Volume Envelope // IT Compatibility: S77 does not disable the volume envelope, it just pauses the counter + // Problem: This pauses on the wrong tick at the moment... if (((pChn->dwFlags & CHN_VOLENV) || ((pIns->VolEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pIns->VolEnv.nNodes)) { int envvol = getVolEnvValueFromPosition(pChn->VolEnv.nEnvPosition, pIns); @@ -1139,6 +1140,7 @@ } // Panning Envelope // IT Compatibility: S79 does not disable the panning envelope, it just pauses the counter + // Problem: This pauses on the wrong tick at the moment... if (((pChn->dwFlags & CHN_PANENV) || ((pIns->PanEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pIns->PanEnv.nNodes)) { int envpos = pChn->PanEnv.nEnvPosition; @@ -1232,7 +1234,7 @@ pChn->nRealVolume = 0; } else if (m_pConfig->getGlobalVolumeAppliesToMaster()) { - pChn->nRealVolume = _muldiv(vol*MAX_GLOBAL_VOLUME, pChn->nGlobalVol * pChn->nInsVol, 1 << 20); + pChn->nRealVolume = _muldiv(vol * MAX_GLOBAL_VOLUME, pChn->nGlobalVol * pChn->nInsVol, 1 << 20); } else { pChn->nRealVolume = _muldiv(vol * m_nGlobalVolume, pChn->nGlobalVol * pChn->nInsVol, 1 << 20); @@ -1320,6 +1322,7 @@ // Pitch/Filter Envelope // IT Compatibility: S7B does not disable the pitch envelope, it just pauses the counter + // Problem: This pauses on the wrong tick at the moment... if ((pIns) && ((pChn->dwFlags & CHN_PITCHENV) || ((pIns->PitchEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pChn->pModInstrument->PitchEnv.nNodes)) { int envpos = pChn->PitchEnv.nEnvPosition; @@ -1520,94 +1523,160 @@ if ((pChn->pModSample) && (pChn->pModSample->nVibDepth)) { MODSAMPLE *pSmp = pChn->pModSample; + const bool alternativeTuning = pChn->pModInstrument && pChn->pModInstrument->pTuning; - // IT compatibility: No vibrato sweep = No vibrato at all! - if (pSmp->nVibSweep == 0 && !IsCompatibleMode(TRK_IMPULSETRACKER)) + // IT compatibility: Autovibrato is so much different in IT that I just put this in a separate code block, to get rid of a dozen IsCompatibilityMode() calls. + if(IsCompatibleMode(TRK_IMPULSETRACKER) && !alternativeTuning) { - pChn->nAutoVibDepth = pSmp->nVibDepth << 8; + // Schism's autovibrato code + + /* + X86 Assembler from ITTECH.TXT: + 1) Mov AX, [SomeVariableNameRelatingToVibrato] + 2) Add AL, Rate + 3) AdC AH, 0 + 4) AH contains the depth of the vibrato as a fine-linear slide. + 5) Mov [SomeVariableNameRelatingToVibrato], AX ; For the next cycle. + */ + const int vibpos = pChn->nAutoVibPos & 0xFF; + int adepth = pChn->nAutoVibDepth; // (1) + adepth += pSmp->nVibSweep & 0xFF; // (2 & 3) + adepth = min(adepth, (int)(pSmp->nVibDepth << 8)); + pChn->nAutoVibDepth = adepth; // (5) + adepth >>= 8; // (4) + + pChn->nAutoVibPos += pSmp->nVibRate; + + int vdelta; + switch(pSmp->nVibType) + { + case VIB_RANDOM: + vdelta = (rand() & 0x7F) - 0x40; + break; + case VIB_RAMP_DOWN: + vdelta = ITRampDownTable[vibpos]; + break; + case VIB_RAMP_UP: + vdelta = -ITRampDownTable[vibpos]; + break; + case VIB_SQUARE: + vdelta = ITSquareTable[vibpos]; + break; + case VIB_SINE: + default: + vdelta = ITSinusTable[vibpos]; + break; + } + + vdelta = (vdelta * adepth) >> 6; + int l = abs(vdelta); + if(vdelta < 0) + { + vdelta = _muldiv(period, LinearSlideDownTable[l >> 2], 0x10000) - period; + if (l & 0x03) + { + vdelta += _muldiv(period, FineLinearSlideDownTable[l & 0x03], 0x10000) - period; + } + } else + { + vdelta = _muldiv(period, LinearSlideUpTable[l >> 2], 0x10000) - period; + if (l & 0x03) + { + vdelta += _muldiv(period, FineLinearSlideUpTable[l & 0x03], 0x10000) - period; + } + } + period -= vdelta; + } else { - if (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) + // MPT's autovibrato code + if (pSmp->nVibSweep == 0) { - if(IsCompatibleMode(TRK_IMPULSETRACKER)) + pChn->nAutoVibDepth = pSmp->nVibDepth << 8; + } else + { + // Calculate current autovibrato depth using vibsweep + if (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) { - // TODO - pChn->nAutoVibDepth += pSmp->nVibSweep << 3; + // Note: changed bitshift from 3 to 1 as the variable is not divided by 4 in the IT loader anymore + // - so we divide sweep by 4 here. + pChn->nAutoVibDepth += pSmp->nVibSweep << 1; } else { - /* Note: changed bitshift from 3 to 1 as the variable is not divided by 4 in the IT loader anymore - - so we divide sweep by 4 here. */ - pChn->nAutoVibDepth += pSmp->nVibSweep << 1; + if (!(pChn->dwFlags & CHN_KEYOFF)) + { + pChn->nAutoVibDepth += (pSmp->nVibDepth << 8) / pSmp->nVibSweep; + } } - } else - if (!(pChn->dwFlags & CHN_KEYOFF)) + if ((pChn->nAutoVibDepth >> 8) > pSmp->nVibDepth) + pChn->nAutoVibDepth = pSmp->nVibDepth << 8; + } + const int vibpos = pChn->nAutoVibPos & 0xFF; + pChn->nAutoVibPos += pSmp->nVibRate; + int vdelta; + switch(pSmp->nVibType) { - pChn->nAutoVibDepth += (pSmp->nVibDepth << 8) / pSmp->nVibSweep; + case VIB_RANDOM: + vdelta = ModRandomTable[pChn->nAutoVibPos & 0x3F]; + pChn->nAutoVibPos++; + break; + case VIB_RAMP_DOWN: + vdelta = ((0x40 - (pChn->nAutoVibPos >> 1)) & 0x7F) - 0x40; + break; + case VIB_RAMP_UP: + vdelta = ((0x40 + (pChn->nAutoVibPos >> 1)) & 0x7f) - 0x40; + break; + case VIB_SQUARE: + vdelta = (pChn->nAutoVibPos & 128) ? +64 : -64; + break; + case VIB_SINE: + default: + vdelta = ft2VibratoTable[pChn->nAutoVibPos & 0xFF]; } - if ((pChn->nAutoVibDepth >> 8) > pSmp->nVibDepth) - pChn->nAutoVibDepth = pSmp->nVibDepth << 8; - } - pChn->nAutoVibPos += pSmp->nVibRate; - int val; - switch(pSmp->nVibType) - { - case 4: // Random - val = ModRandomTable[pChn->nAutoVibPos & 0x3F]; - pChn->nAutoVibPos++; - break; - case 3: // Ramp Down - val = ((0x40 - (pChn->nAutoVibPos >> 1)) & 0x7F) - 0x40; - break; - case 2: // Ramp Up - val = ((0x40 + (pChn->nAutoVibPos >> 1)) & 0x7f) - 0x40; - break; - case 1: // Square - val = (pChn->nAutoVibPos & 128) ? +64 : -64; - break; - default: // Sine - val = ft2VibratoTable[pChn->nAutoVibPos & 255]; - } - int n = ((val * pChn->nAutoVibDepth) >> 8); + int n; + n = ((vdelta * pChn->nAutoVibDepth) >> 8); - if(pChn->pModInstrument && pChn->pModInstrument->pTuning) - { - //Vib sweep is not taken into account here. - vibratoFactor += 0.05F * pSmp->nVibDepth * val / 4096.0F; //4096 == 64^2 - //See vibrato for explanation. - pChn->m_CalculateFreq = true; - /* - Finestep vibrato: - const float autoVibDepth = pSmp->nVibDepth * val / 4096.0F; //4096 == 64^2 - vibratoFineSteps += static_cast<CTuning::FINESTEPTYPE>(pChn->pModInstrument->pTuning->GetFineStepCount() * autoVibDepth); - pChn->m_CalculateFreq = true; - */ - } - else //Original behavior - { - if (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) + if(alternativeTuning) { - int df1, df2; - if (n < 0) + //Vib sweep is not taken into account here. + vibratoFactor += 0.05F * pSmp->nVibDepth * vdelta / 4096.0F; //4096 == 64^2 + //See vibrato for explanation. + pChn->m_CalculateFreq = true; + /* + Finestep vibrato: + const float autoVibDepth = pSmp->nVibDepth * val / 4096.0F; //4096 == 64^2 + vibratoFineSteps += static_cast<CTuning::FINESTEPTYPE>(pChn->pModInstrument->pTuning->GetFineStepCount() * autoVibDepth); + pChn->m_CalculateFreq = true; + */ + } + else //Original behavior + { + if (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) { - n = -n; - UINT n1 = n >> 8; - df1 = LinearSlideUpTable[n1]; - df2 = LinearSlideUpTable[n1+1]; + int df1, df2; + if (n < 0) + { + n = -n; + UINT n1 = n >> 8; + df1 = LinearSlideUpTable[n1]; + df2 = LinearSlideUpTable[n1+1]; + } else + { + UINT n1 = n >> 8; + df1 = LinearSlideDownTable[n1]; + df2 = LinearSlideDownTable[n1+1]; + } + n >>= 2; + period = _muldiv(period, df1 + ((df2 - df1) * (n & 0x3F) >> 6), 256); + nPeriodFrac = period & 0xFF; + period >>= 8; } else { - UINT n1 = n >> 8; - df1 = LinearSlideDownTable[n1]; - df2 = LinearSlideDownTable[n1+1]; + period += (n >> 6); } - n >>= 2; - period = _muldiv(period, df1 + ((df2 - df1) * (n & 0x3F) >> 6), 256); - nPeriodFrac = period & 0xFF; - period >>= 8; - } else - { - period += (n >> 6); - } - } //Original MPT behavior + } //Original MPT behavior + } + } //End: AutoVibrato // Final Period if (period <= m_nMinPeriod) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-11-17 21:08:02
|
Revision: 763 http://modplug.svn.sourceforge.net/modplug/?rev=763&view=rev Author: saga-games Date: 2010-11-17 21:07:55 +0000 (Wed, 17 Nov 2010) Log Message: ----------- [Mod] Updated History.txt, updated URLs. Modified Paths: -------------- trunk/OpenMPT/packageTemplate/History.txt trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/packageTemplate/History.txt =================================================================== --- trunk/OpenMPT/packageTemplate/History.txt 2010-11-16 21:39:23 UTC (rev 762) +++ trunk/OpenMPT/packageTemplate/History.txt 2010-11-17 21:07:55 UTC (rev 763) @@ -10,10 +10,11 @@ (tx XYZ): thanks to XYZ for telling us about the bug -v1.19.xx.xx (October 2010, revision 748) not release yet --------------------------------------------------------- +v1.19.01.00 (October 2010, revision 757) +---------------------------------------- Pattern tab [New] <Jojo> Experimental feature: Play the whole pattern row when entering notes and chords into the pattern editor. This can be enabled from the setup screen. + [Mod] <Jojo> Using the Goto Dialog should now update channel parameters and set the elapsed time. (http://bugs.openmpt.org/view.php?id=28) [Fix] <Jojo> Cursor paste was possible even when editing was disabled. [Fix] <Jojo> When entering chords into the pattern editor, the module was only marked as modified if the base note of the chord was changed. [Fix] <Jojo> When jumping to an order which is normally not played, the song variables are now reset (previously, if the main song had f.e. a global volume fade out at the end, this was retained when switching to an unplayed order, effectively muting all sub songs). @@ -23,9 +24,11 @@ [Fix] <Jojo> The meaning of Q0x was displayed wrong for S3M / IT. Sample tab + [Imp] <re> Ctrl + Mouse Wheel can now be used for zooming into the sample data. [Fix] <Jojo> When cutting samples with a loop, the loop end point was not always moved correctly if the cut start was in the loop. Instrument tab + [Imp] <re> Ctrl + Mouse Wheel can now be used for zooming into the envelopes. [Mod] <Jojo> Copying and pasting envelopes with no points isn't possible anymore. (Who wants to do that anyway?) [Fix] <Jojo> Changing the filter mode didn't mark the file as modified. @@ -37,12 +40,17 @@ [Fix] <Jojo> Q0y means "no volume change" in S3M / IT, but R0y means "continue volume change" in FT2, and converting from IT / S3M to XM didn't consider this. Q0y is now converted to R8y, and E9y is now converted to Q0y (instead of Q8y). Playback + [New] <Jojo> 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. Please use compatible mixing levels when working with legacy formats from now on. [Imp] <Jojo> Improved the algorithm for finding a free channel for note playback in the editor (does not affect normal module playback). + [Fix] <Jojo> Pattern jumps to the same row + pattern as the jump command are not ignored anymore. (http://forum.openmpt.org/index.php?topic=1810.0) + IT [New] <Jojo> Edit history information can now be read from IT files and saved to IT / MPTM files. This is based on an undocumented feature in Impulse Tracker. Use View -> Edit History for viewing or deleting this information. [Imp] <Jojo> ITs made with Modplug Tracker 1.00a5 are now also detected as such. - [Mod] <Jojo> Sane values are used again for the "cwtv" and "cmwt" header fields when saving IT files; in fact the same values as in compatibility export are used. To be able to distinguish between raped and compatiblity-exported IT files, "OMPT" is written in the "reserved" header field. As a consequence, IT files made with OpenMPT can now be loaded in Impulse Tracker again. + [Mod] <Jojo> Sane values are used again for the "cwtv" and "cmwt" header fields when saving IT files; in fact the same values as in compatibility export are used. To be able to distinguish between raped and compatibility-exported IT files, "OMPT" is written in the "reserved" header field. As a consequence, IT files made with OpenMPT can now be loaded in Impulse Tracker again. + [Mod] <Jojo> IT Loader: MIDI macros are now cleared when loading IT files made with old Impulse Tracker versions (< 2.14), so that Zxx commands won't break the songs anymore (fixes denonde.it, fix from Schism Tracker). + [Fix] <Jojo> Sample autovibrato is now hopefully a bit closer to Impulse Tracker in compatible mode... [Fix] <Jojo> The envelope handling was altered slightly to work more like in Schism Tracker. This fixes a combination of Envelope Carry + Portamento as it can be found in "electric bunny" by Alpha C. [Fix] <Jojo> Various fixes to playback of multi-sample instruments. "Ultima Ratio" by Nebularia and "Shuttle Departure" by Sphenx sound better now. [Fix] <Jojo> The extended sample map is not saved anymore in the instrument headers when using compatibility export. @@ -52,8 +60,9 @@ [New] <Jojo> Edit history information (read the "IT" section above for an explanation) XM - [Fix] <Jojo> XM Compatiblity: Various mind-boggling combinations of EDx, notes and instrument numbers should work correctly now. - [Fix] <Jojo> XM Compatiblity: When there's a instrument number next to a 3xx effect which differs from the previous instrument number, it resets the instrument properties of the previous instrument now. + [Fix] <Jojo> XM Compatibility: Various mind-boggling combinations of EDx, notes and instrument numbers should work correctly now. + [Fix] <Jojo> XM Compatibility: When there's a instrument number next to a 3xx effect which differs from the previous instrument number, it resets the instrument properties of the previous instrument now. + [Fix] <Jojo> XM Compatibility: Portamento combined with an Offset command results in the offset command being ignored. [Fix] <Jojo> XM Loader: Fixed handling of instruments with no samples, so that instruments assigned to VST plugins work correctly. MOD @@ -64,6 +73,7 @@ [New] <Jojo> Added a heuristic detection for VBlank MODs. Most MODs use the CIA timer instead of VBlank timing, but some don't. [New] <Jojo> Added a heuristic detection for PT 1.x playback mode: If there is pattern data that looks like it needs on-the-fly sample swapping, PT 1.x mode is enabled. [New] <Jojo> Added a heuristic detection for MODs with 7-bit panning, which is then automatically converted to 8-bit panning. + [Fix] <Jojo> Tentative fix for MODs with short loops at the sample start that were most likely not intended. S3M [Mod] <Jojo> Changed some code in the S3M loader that should only affect really broken S3M files which every player handles different anyway (at least my broken version of aa-polym.s3m sounds better now) @@ -87,6 +97,7 @@ [New] <Jojo> WAV Export: Sample-exact cue points are now written at each pattern transition. [Imp] <Jojo> New keyboard shortcuts: Panic, View Edit History, Set Invalid / Ignore (--- / +++) Pattern (in the orderlist) [Imp] <Jojo> Some improvements were made to the Registry / INI reading: If there were no Registry settings because MPT 1.16 was previously not installed, the INI file is now also read as it might contain some lines created by the installer. + [Mod] <Jojo> Changes to keymap file handling: The active keymap is now always saved to Keybindings.mkb (in either %APPDATA%\OpenMPT or the executable's directory). Any other keymaps are now only overwritten when using the "Save keys as" function. [Mod] <Jojo> On first run, the default ASIO driver is now chosen instead of DirectSound (if there is one). [Mod] <Jojo> The "Original" mix mode now also has a version number (1.16) to reflect what the "original" thing is. [Mod] <Jojo> Updated genre list in the MP3 export dialog. @@ -623,7 +634,7 @@ [Mod] <Jojo> Entering note with row spacing enabled can now move cursor to next pattern if continuous scroll is enabled. [Fix] <Jojo> Inserting a new pattern won't resize it to 32 rows anymore if the current pattern has less than 32 rows. [Fix] <Jojo> Show "offset" and "velocity" volume commands in default color instead of "pitch" color. - [Fix] <Jojo> Fixed weird combination of context menu shortcut and "always center active row" being disabled (http://lpchip.com/modplug/viewtopic.php?t=3203). + [Fix] <Jojo> Fixed weird combination of context menu shortcut and "always center active row" being disabled (http://forum.openmpt.org/index.php?topic=3203.0). [Fix] <Jojo> Keyboard split note was off by one. [Fix] <Jojo> Set max. row spacing / skipping value to 64, visibly clamp values > 64 to 64 in the edit box. @@ -880,7 +891,7 @@ [Fix] <jojo> Song Cleanup: Sample cleanup should no longer remove data after sustain loop end point. (rev. 248) [Fix] <jojo> Misc: When adding channels from song properties, new channels are now initialized properly (bug 1814). (rev. 236) [Fix] <jojo> BPM approximation showed wrong rows per beat in some cases (bug 2532) (rev. 231) - [Fix] <jojo> Disabled special handling of '&'-character when drawing texts to various components where the special handling should not take place. (http://lpchip.com/modplug/viewtopic.php?t=1962) (rev. 229) + [Fix] <jojo> Disabled special handling of '&'-character when drawing texts to various components where the special handling should not take place. (http://forum.openmpt.org/index.php?topic=1962.0) (rev. 229) [Fix] <re> File opening: Added a couple of return value checks to reduce the change of crash when opening lots of files (bug 2546) (rev. 239) [Mod] <jojo> Menu: Goto dialog can now be opened from Edit-menu. (rev. 246) @@ -903,7 +914,7 @@ [Fix] <re> Undo fixes (didn't properly handle playback positions/multichannel record, set redundant undo points)(rev 243) [Fix] <re> Param record in plugs GUI wrote commands even when pattern record was off. (rev 243) [Fix] <re> Fixed chord detection when row spacing was enabled. (rev 243) - [Fix] <re> Fix to displaying wrong pattern name when using more than 255 patterns (http://lpchip.com/modplug/viewtopic.php?t=2344) (rev. 212) + [Fix] <re> Fix to displaying wrong pattern name when using more than 255 patterns (http://forum.openmpt.org/index.php?topic=2344.0) (rev. 212) [Fix] <re> Accidental moving when selecting order in margins shouldn't happen anymore. (rev 225) [Fix] <re> Fix to possible crash when using undo after pattern resize (bug introduced in rev. 168) @@ -976,7 +987,7 @@ v1.17.02.52 (14 Apr 2008, revision 210) --------------------------------------- [Fix] <re> Shouldn't need winhttp anymore (at least now that updatecheck is disabled). Dependency caused problems in Win98. - [Fix] <re> Fix to faulty plug file existence check (introduced in 1.17.02.51)(http://lpchip.com/modplug/viewtopic.php?t=2255) + [Fix] <re> Fix to faulty plug file existence check (introduced in 1.17.02.51)(http://forum.openmpt.org/index.php?topic=2255.0) [Fix] <re> Sound card-options buffer length value validation. [Fix] <re> In .51, muted channels were ignored completely in MIDI export. Now pattern effects are processed in muted channels. [Fix] <re> IT style-playback fix @@ -987,30 +998,30 @@ [Fix] <re> Fix to crash when loading VST with long(>32) param name. [Fix] <ma & re> Fix to possible memory corruption problem on handling VST with more than 30 outputs. - VST with more than 32 outputs might still be handled poorly. - [Fix] <re> Fix to possible crash when browsing modules in treeview(http://lpchip.com/modplug/viewtopic.php?t=2222). + [Fix] <re> Fix to possible crash when browsing modules in treeview(http://forum.openmpt.org/index.php?topic=2222.0). [Fix] <re> Fix to severe memory leak in the same section as above. [Fix] <re> Fix to mptm not showing in tree view file browser. - [Fix] <re> Fix to MIDI drum export (http://lpchip.com/modplug/viewtopic.php?t=2024) + [Fix] <re> Fix to MIDI drum export (http://forum.openmpt.org/index.php?topic=2024.0) [Fix] <re> Fix to possible crash on MIDI export if exporting module with more than 64 channels. - [Mod] <re> MIDI export won't anymore export muted channels(http://lpchip.com/modplug/viewtopic.php?t=2017) - [Fix] <re> When converting MOD->S3M/IT/MPTM, finetune setting was ignored (http://lpchip.com/modplug/viewtopic.php?t=1706) - [Fix] <re> IT compatibility: Fix to not resetting envelopes on new instrument (http://lpchip.com/modplug/viewtopic.php?t=1869) - [Fix] <re> IT compatibility: Fix to bidi loop resetting (http://lpchip.com/modplug/viewtopic.php?t=788) - [Fix] <re> IT compatibility: Fix to note trigger after note cut(http://lpchip.com/modplug/viewtopic.php?t=2080) - [Fix] <re> Mixmode tool tip in general tab was in some cases shown on unrelated controls (http://lpchip.com/modplug/viewtopic.php?t=2176) - [Fix] <re> Pitch/tempo lock was lost on first instrument when opening instrument tab for the first time. (http://lpchip.com/modplug/viewtopic.php?t=1823) - [Fix] <re> Verifying buffer length-setting read from INI-file to prevent the impression that it can be set < 10 (http://lpchip.com/modplug/viewtopic.php?t=992) - [Fix] <re> Pattern effectdata paste was broken for MOD (probably since .46) (http://lpchip.com/modplug/viewtopic.php?t=1938) - [Mod] <re> When loading plug information at startup, checking whether the plug files exist. (http://lpchip.com/modplug/viewtopic.php?t=1367) - [Fix] <re> Continuous pattern navigation fixes(http://lpchip.com/modplug/viewtopic.php?t=1960, http://lpchip.com/modplug/viewtopic.php?t=1959) - [Fix] <re> Keyboard split related fix (http://lpchip.com/modplug/viewtopic.php?t=1887) - [Fix] <re> Releasenode information should now be included when copying instrument envelopes (http://lpchip.com/modplug/viewtopic.php?t=1780) + [Mod] <re> MIDI export won't anymore export muted channels(http://forum.openmpt.org/index.php?topic=2017.0) + [Fix] <re> When converting MOD->S3M/IT/MPTM, finetune setting was ignored (http://forum.openmpt.org/index.php?topic=1706.0) + [Fix] <re> IT compatibility: Fix to not resetting envelopes on new instrument (http://forum.openmpt.org/index.php?topic=1869.0) + [Fix] <re> IT compatibility: Fix to bidi loop resetting (http://forum.openmpt.org/index.php?topic=788.0) + [Fix] <re> IT compatibility: Fix to note trigger after note cut(http://forum.openmpt.org/index.php?topic=2080.0) + [Fix] <re> Mixmode tool tip in general tab was in some cases shown on unrelated controls (http://forum.openmpt.org/index.php?topic=2176.0) + [Fix] <re> Pitch/tempo lock was lost on first instrument when opening instrument tab for the first time. (http://forum.openmpt.org/index.php?topic=1823.0) + [Fix] <re> Verifying buffer length-setting read from INI-file to prevent the impression that it can be set < 10 (http://forum.openmpt.org/index.php?topic=992.0) + [Fix] <re> Pattern effectdata paste was broken for MOD (probably since .46) (http://forum.openmpt.org/index.php?topic=1938.0) + [Mod] <re> When loading plug information at startup, checking whether the plug files exist. (http://forum.openmpt.org/index.php?topic=1367.0) + [Fix] <re> Continuous pattern navigation fixes(http://forum.openmpt.org/index.php?topic=1960.0, http://forum.openmpt.org/index.php?topic=1959.0) + [Fix] <re> Keyboard split related fix (http://forum.openmpt.org/index.php?topic=1887.0) + [Fix] <re> Releasenode information should now be included when copying instrument envelopes (http://forum.openmpt.org/index.php?topic=1780.0) [Fix] <ma> Potential memory corruption bug when loading VSTs - [Reg] <re> Removed buggy rearrange samples (http://lpchip.com/modplug/viewtopic.php?t=2148) + [Reg] <re> Removed buggy rearrange samples (http://forum.openmpt.org/index.php?topic=2148.0) [Fix] <re> Fixed MIDI mapping not checking MIDI event, which could cause events like pitch bend to trigger some mapping item. - [Fix] <re> Extended song/instrument properties were not always loaded correctly for IT (bug introduced in 1.17.02.50)(http://lpchip.com/modplug/viewtopic.php?p=16335) - [Fix] <re> Fix for faulty tabs when switching between modtypes with and without instrumenttab. (http://lpchip.com/modplug/viewtopic.php?t=1614) + [Fix] <re> Extended song/instrument properties were not always loaded correctly for IT (bug introduced in 1.17.02.50)(http://forum.openmpt.org/index.php?topic=2154.0) + [Fix] <re> Fix for faulty tabs when switching between modtypes with and without instrumenttab. (http://forum.openmpt.org/index.php?topic=1614.0) [Fix] <re> Fix for possible crash on save/load when using more than 64 channels with MPTM. [Mod] <re> Modified flag is not set when sliding tempo/global volume slider for MOD file. [Mod] <re> When setting instrument pan, checking whether instrument samples have set pan enabled and optionally disabling them. @@ -1036,16 +1047,16 @@ [Fix] <re> Default VST editor preset field name validation in the menubar. [New] <re> Added ability to edit various flags in song properties. - [Fix] <re> Fix for pattern duplicate for small patterns (http://lpchip.com/modplug/viewtopic.php?t=1747) + [Fix] <re> Fix for pattern duplicate for small patterns (http://forum.openmpt.org/index.php?topic=1747.0) [Fix] <re> Fixed song properties-menu entry in mainframe(was greyed and didn't show keyshortcut) - [Fix] <re> Fixed crash with certain toolbar related ini-settings (http://lpchip.com/modplug/viewtopic.php?t=2033) + [Fix] <re> Fixed crash with certain toolbar related ini-settings (http://forum.openmpt.org/index.php?topic=2033.0) [Fix] <re> Further fixes to prevent unnotified overwriting of file. [Mod] <re> .bak-files won't now be shown with "All modules" filter when loading modules. - [Fix] <re> Show row playtime didn't on certain cases work on first pattern row (http://lpchip.com/modplug/viewtopic.php?t=2044) - [Fix] <re> Fix to faulty play with certain instruments without notes in IT compatible playmode (http://lpchip.com/modplug/viewtopic.php?t=2080) - [Fix] <re> Pattern number box didn't open pattern properties when using MPTm. (http://lpchip.com/modplug/viewtopic.php?t=2073) + [Fix] <re> Show row playtime didn't on certain cases work on first pattern row (http://forum.openmpt.org/index.php?topic=2044.0) + [Fix] <re> Fix to faulty play with certain instruments without notes in IT compatible playmode (http://forum.openmpt.org/index.php?topic=2080.0) + [Fix] <re> Pattern number box didn't open pattern properties when using MPTm. (http://forum.openmpt.org/index.php?topic=2073.0) [Fix] <re> Fixed wrong MIDI CC names in macro editor. - [Fix/Mod] <re> Setting volume to 0(v00) in pattern didn't necessarily set volume to 0 when using volume random variation for instrument. All other random variation behaviors are changed as well; now the 'swing' is applied directly to channel values instead of using swing addition, and by default the swing effect is reset on new note. (http://lpchip.com/modplug/viewtopic.php?t=2074) + [Fix/Mod] <re> Setting volume to 0(v00) in pattern didn't necessarily set volume to 0 when using volume random variation for instrument. All other random variation behaviors are changed as well; now the 'swing' is applied directly to channel values instead of using swing addition, and by default the swing effect is reset on new note. (http://forum.openmpt.org/index.php?topic=2074.0) [Mod] <re> MPTm made with this version will be recognized as IT in earlier versions. [Mod] <re> Various validity checks for read data in ITP loading. @@ -1056,19 +1067,19 @@ [New] <re> Improved VST preset navigation in VST window. Known problem: doesn't update if preset is changed from VSTs own preset navigation. [New] <re> Improvements in IT compatibility playmode. When loading ITs, if file doesn't seem modplug made, then automatically setting IT compatibility playmode. The playmode setting can be toggled in song properties dialog, and the autodetection with an ini setting. [New] <re> 'key binding not understood'-messages can be disabled with an ini setting. - [Fix] <re> Fixed wrong file version in IT compatibility save. (http://lpchip.com/modplug/viewtopic.php?t=1723) - [Fix] <re> Fixed possible unnotified overwriting of file occurring for example when dealing with a new file. (http://lpchip.com/modplug/viewtopic.php?t=1813) - [Fix] <re> Fixed broken note preview for certain type of instruments in instrument tab. (http://lpchip.com/modplug/viewtopic.php?t=1996) - [Fix] <re> Fixed possible crash on channel mode wav export when a channel has a long name. (http://lpchip.com/modplug/viewtopic.php?t=2005) - [Fix] <re> Fixed pattern position indicator jump when clicking VST-box in channel header. (http://lpchip.com/modplug/viewtopic.php?t=2014) + [Fix] <re> Fixed wrong file version in IT compatibility save. (http://forum.openmpt.org/index.php?topic=1723.0) + [Fix] <re> Fixed possible unnotified overwriting of file occurring for example when dealing with a new file. (http://forum.openmpt.org/index.php?topic=1813.0) + [Fix] <re> Fixed broken note preview for certain type of instruments in instrument tab. (http://forum.openmpt.org/index.php?topic=1996.0) + [Fix] <re> Fixed possible crash on channel mode wav export when a channel has a long name. (http://forum.openmpt.org/index.php?topic=2005.0) + [Fix] <re> Fixed pattern position indicator jump when clicking VST-box in channel header. (http://forum.openmpt.org/index.php?topic=2014.0) [Mod] <re> Custom tuning related - file format changes - changed interpretation of finesteps: now zero finesteps means that finesteps are equal to notesteps, previously zero finesteps disabled portamentos etc) - Pitch slide between notes with portamentos is now specialised also for other tuning types than just geometric(changes behavior). Previously behavior was 'geometric' for all types. - [Fix] <rewbs> Fix pattern search, which could search for the wrong param. Also enable typing of desired param value rather than only selecting from listbox. (http://lpchip.com/modplug/viewtopic.php?t=1799) - [Fix] <rewbs> Delay-load winhttp.dll and don't die if it can't be found, e.g. on win98. (http://lpchip.com/modplug/viewtopic.php?t=1778) - [Fix] <rewbs> Fix a couple of pixels on D# in the pattern editor small font bitmap. (http://lpchip.com/modplug/viewtopic.php?t=1781) + [Fix] <rewbs> Fix pattern search, which could search for the wrong param. Also enable typing of desired param value rather than only selecting from listbox. (http://forum.openmpt.org/index.php?topic=1799.0) + [Fix] <rewbs> Delay-load winhttp.dll and don't die if it can't be found, e.g. on win98. (http://forum.openmpt.org/index.php?topic=1778.0) + [Fix] <rewbs> Fix a couple of pixels on D# in the pattern editor small font bitmap. (http://forum.openmpt.org/index.php?topic=1781.0) [New] <rewbs> Add name filter to plugin selection dialog. Useful when you have hundreds of plugins. [New] <Pelya> Allow Window key as a modifier in the keyboard configuration. Disables start menu pop-up when pressing the Win key if and only if it used in the active keyboard configuration. [New] <Pelya> Disables NumLock/CapsLock/ScrollLock lamps on keyboard if and only if they are used in the active keyboard configuration. The lamps will blink anyway - can't help it until we start using DirectInput. @@ -1076,15 +1087,15 @@ v1.17.02.48 ----------- - [Fix] <re> Fix song cleanup issue (http://lpchip.com/modplug/viewtopic.php?t=1711) - [Fix] <re> Pitch/Tempo lock fix (broken in .46 and .47) (http://lpchip.com/modplug/viewtopic.php?t=1646) - [Mod] <re> Pattern manager channel reordering behviour changes / fixes. (http://lpchip.com/modplug/viewtopic.php?t=1148) - [Fix] <pelya> Fix bad horizontal scrolling in pattern editor when positioning the cursor with the mouse. (http://lpchip.com/modplug/viewtopic.php?t=1650) - [Fix] <rewbs> Fix odd "play row" behaviour when using 1 tick-per-row (http://lpchip.com/modplug/viewtopic.php?t=1038). - [Fix] <rewbs> Fix pop due to ramping when song starts with a pattern command that sets a low global volume. (http://lpchip.com/modplug/viewtopic.php?t=523) - [Fix] <rewbs> Fix occasional colour issues with orderlist (http://lpchip.com/modplug/viewtopic.php?t=867) + [Fix] <re> Fix song cleanup issue (http://forum.openmpt.org/index.php?topic=1711.0) + [Fix] <re> Pitch/Tempo lock fix (broken in .46 and .47) (http://forum.openmpt.org/index.php?topic=1646.0) + [Mod] <re> Pattern manager channel reordering behviour changes / fixes. (http://forum.openmpt.org/index.php?topic=1148.0) + [Fix] <pelya> Fix bad horizontal scrolling in pattern editor when positioning the cursor with the mouse. (http://forum.openmpt.org/index.php?topic=1650.0) + [Fix] <rewbs> Fix odd "play row" behaviour when using 1 tick-per-row (http://forum.openmpt.org/index.php?topic=1038.0). + [Fix] <rewbs> Fix pop due to ramping when song starts with a pattern command that sets a low global volume. (http://forum.openmpt.org/index.php?topic=523.0) + [Fix] <rewbs> Fix occasional colour issues with orderlist (http://forum.openmpt.org/index.php?topic=867.0) [Fix] <rewbs> Fix impossible horizontal scrolling in pattern editor when playing with follow song on - [Fix] <rewbs> Grey out "Trim" option in sample editor context menu if there's no selection. (http://lpchip.com/modplug/viewtopic.php?t=908) + [Fix] <rewbs> Grey out "Trim" option in sample editor context menu if there's no selection. (http://forum.openmpt.org/index.php?topic=908.0) v1.17.02.47 @@ -1172,11 +1183,11 @@ v1.17.02.42 ----------- [New] <rewbs> "Compatibility export" in file menu: save as 'plain' IT, without all of OpenMPT's crap. IT only for now (not XM). - [Fix] <rewbs> Set instrument in pattern editor should work when no note is specified (tx Torvus - http://lpchip.com/modplug/viewtopic.php?t=470) - [Fix] <rewbs> Restart position saved in IT (tx LPChip - http://lpchip.com/modplug/viewtopic.php?t=473) - [Fix] <rewbs> Loop song now works even if restart pos falls on +++ (tx LPChip - http://lpchip.com/modplug/viewtopic.php?t=463) - [Fix] <rewbs> Last used tempo is applied even when playback is triggered from instrument panel. (tx LPChip - http://lpchip.com/modplug/viewtopic.php?t=480) - [Mod] <rewbs> User now gets a warning when loading MDA Degrade (tx fisk0 - http://lpchip.com/modplug/viewtopic.php?t=467) + [Fix] <rewbs> Set instrument in pattern editor should work when no note is specified (tx Torvus - http://forum.openmpt.org/index.php?topic=470.0) + [Fix] <rewbs> Restart position saved in IT (tx LPChip - http://forum.openmpt.org/index.php?topic=473.0) + [Fix] <rewbs> Loop song now works even if restart pos falls on +++ (tx LPChip - http://forum.openmpt.org/index.php?topic=463.0) + [Fix] <rewbs> Last used tempo is applied even when playback is triggered from instrument panel. (tx LPChip - http://forum.openmpt.org/index.php?topic=480.0) + [Mod] <rewbs> User now gets a warning when loading MDA Degrade (tx fisk0 - http://forum.openmpt.org/index.php?topic=467.0) v1.17.02.41 Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-11-16 21:39:23 UTC (rev 762) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-11-17 21:07:55 UTC (rev 763) @@ -219,7 +219,7 @@ positionJumpOnThisRow = true; nNextPattern = (ORDERINDEX)param; nNextPatStartRow = 0; // FT2 E60 bug - // see http://lpchip.com/modplug/viewtopic.php?t=2769 - FastTracker resets Dxx if Bxx is called _after_ Dxx + // see http://forum.openmpt.org/index.php?topic=2769.0 - FastTracker resets Dxx if Bxx is called _after_ Dxx if(!patternBreakOnThisRow || (GetType() == MOD_TYPE_XM)) nNextRow = 0; @@ -2003,7 +2003,7 @@ //instant jumps - modifying behavior so that now position jumps //occurs also when pattern loop is enabled. } - // see http://lpchip.com/modplug/viewtopic.php?t=2769 - FastTracker resets Dxx if Bxx is called _after_ Dxx + // see http://forum.openmpt.org/index.php?topic=2769.0 - FastTracker resets Dxx if Bxx is called _after_ Dxx if(GetType() == MOD_TYPE_XM) nBreakRow = 0; break; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-11-16 21:39:23 UTC (rev 762) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-11-17 21:07:55 UTC (rev 763) @@ -424,7 +424,7 @@ lRead -= lCount; m_nBufferCount -= lCount; m_lTotalSampleCount += lCount; // increase sample count for VSTTimeInfo. - // Turn on ramping after first read (fix http://lpchip.com/modplug/viewtopic.php?t=523 ) + // Turn on ramping after first read (fix http://forum.openmpt.org/index.php?topic=523.0 ) gnVolumeRampSamples = CMainFrame::glVolumeRampSamples; } MixDone: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-11-20 21:11:39
|
Revision: 765 http://modplug.svn.sourceforge.net/modplug/?rev=765&view=rev Author: saga-games Date: 2010-11-20 21:11:32 +0000 (Sat, 20 Nov 2010) Log Message: ----------- [Fix] Format string for keymap errors was broken since rev.762 [Mod] Made the keyboard config dialog look a bit nicer. [Mod] Updated URLs. [Ref] Small changes here and there. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/packageTemplate/History.txt trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html trunk/OpenMPT/soundlib/Loaders.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2010-11-20 20:55:32 UTC (rev 764) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2010-11-20 21:11:32 UTC (rev 765) @@ -1504,7 +1504,7 @@ if(fileVersion > KEYMAP_VERSION) { CString err; - err.Format("Key binding file has version %d. Your version of OpenMPT only supports loading files up to version %d.", szFilename, fileVersion, KEYMAP_VERSION); + err.Format("File version is %d, but your version of OpenMPT only supports loading files up to version %d.", fileVersion, KEYMAP_VERSION); errText += err + "\n"; Log(err); } @@ -1543,15 +1543,17 @@ if(!ignoreLine) { //Error checking (TODO): - if (cmd<0 || cmd>=kcNumCommands || spos==-1) + if (cmd < 0 || cmd >= kcNumCommands || spos == -1) { errorCount++; CString err; - if (errorCount<10) { - err.Format("Line %d was not understood.", l, szFilename); + if (errorCount < 10) + { + err.Format("Line %d was not understood.", l); errText += err + "\n"; Log(err); - } else if (errorCount==10) { + } else if (errorCount == 10) + { err = "Too many errors detected, not reporting any more."; errText += err + "\n"; Log(err); @@ -1571,8 +1573,8 @@ { CString err; err.Format("The following problems have been encountered while trying to load the key binding file %s:\n", szFilename); - errText = err + errText; - ::MessageBox(NULL, errText, "", MB_ICONEXCLAMATION|MB_OK); + err += errText; + ::MessageBox(NULL, err, "", MB_ICONEXCLAMATION|MB_OK); } if(fileVersion < KEYMAP_VERSION) UpgradeKeymap(pTempCS, fileVersion); Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2010-11-20 20:55:32 UTC (rev 764) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2010-11-20 21:11:32 UTC (rev 765) @@ -156,7 +156,7 @@ m_eCustHotKey.SetParent(m_hWnd, IDC_CUSTHOTKEY, this); m_eReport.FmtLines(TRUE); - m_eReport.SetWindowText("Log:\r\n"); + m_eReport.SetWindowText(""); CString s; s.Format("%d", CMainFrame::gnAutoChordWaitTime); Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2010-11-20 20:55:32 UTC (rev 764) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2010-11-20 21:11:32 UTC (rev 765) @@ -1787,7 +1787,7 @@ m_heContact.SetWindowText( "Contact / Discussion:\r\n" - "http://openmpt.com/forum/\r\n" + "http://forum.openmpt.org/\r\n" "\r\nUpdates:\r\n" "http://sourceforge.net/projects/modplug/"); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2010-11-20 20:55:32 UTC (rev 764) +++ trunk/OpenMPT/mptrack/mptrack.rc 2010-11-20 21:11:32 UTC (rev 765) @@ -345,40 +345,40 @@ CTEXT "Writing file...",IDC_TEXT1,4,4,178,9 END -IDD_OPTIONS_KEYBOARD DIALOGEX 0, 0, 272, 279 +IDD_OPTIONS_KEYBOARD DIALOGEX 0, 0, 274, 281 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Keyboard" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - COMBOBOX IDC_KEYCATEGORY,5,16,130,204,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LISTBOX IDC_COMMAND_LIST,5,32,130,238,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_CHOICECOMBO,147,16,79,51,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_CUSTHOTKEY,163,31,98,13,ES_AUTOHSCROLL - CONTROL "On Key Down",IDC_CHECKKEYDOWN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,44,66,14 - CONTROL "On Key Hold",IDC_CHECKKEYHOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,57,66,10 - CONTROL "On Key Up",IDC_CHECKKEYUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,68,66,8 - PUSHBUTTON "Restore",IDC_RESTORE,217,46,43,13 - PUSHBUTTON "Delete",IDC_DELETE,217,64,43,13 - EDITTEXT IDC_KEYREPORT,138,94,128,98,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL - PUSHBUTTON "Y",IDC_NOTESREPEAT,234,207,12,9 - PUSHBUTTON "N",IDC_NONOTESREPEAT,250,207,12,9 - EDITTEXT IDC_CHORDDETECTWAITTIME,234,220,24,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT + COMBOBOX IDC_KEYCATEGORY,5,16,133,204,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LISTBOX IDC_COMMAND_LIST,5,32,133,244,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_CHOICECOMBO,150,18,114,51,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_CUSTHOTKEY,168,36,95,13,ES_AUTOHSCROLL + CONTROL "On Key Down",IDC_CHECKKEYDOWN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,54,66,8 + CONTROL "On Key Hold",IDC_CHECKKEYHOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,66,66,8 + CONTROL "On Key Up",IDC_CHECKKEYUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,78,66,8 + PUSHBUTTON "Restore",IDC_RESTORE,222,54,43,13 + PUSHBUTTON "Delete",IDC_DELETE,222,71,43,13 + EDITTEXT IDC_KEYREPORT,144,192,126,84,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL + PUSHBUTTON "Yes",IDC_NOTESREPEAT,228,108,18,9 + PUSHBUTTON "No",IDC_NONOTESREPEAT,246,108,18,9 + EDITTEXT IDC_CHORDDETECTWAITTIME,240,120,24,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT PUSHBUTTON "it",IDC_EFFECTLETTERSIT,103,184,12,9,NOT WS_VISIBLE PUSHBUTTON "xm",IDC_EFFECTLETTERSXM,119,184,12,9,NOT WS_VISIBLE - PUSHBUTTON "Load Keys...",IDC_LOAD,144,252,54,13 - PUSHBUTTON "Save Keys As...",IDC_SAVE,204,252,54,13 + PUSHBUTTON "Import Keys...",IDC_LOAD,150,156,54,13 + PUSHBUTTON "Export Keys...",IDC_SAVE,210,156,54,13 CONTROL "Debug Save",IDC_DEBUGSAVE,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,59,199,56,10 - LTEXT "Select category:",IDC_STATIC,7,5,74,11 - PUSHBUTTON "Set",IDC_SET,225,45,43,13,NOT WS_VISIBLE - GROUPBOX "Key setup for this command ",IDC_STATIC,139,5,127,75 - LTEXT "Key:",IDC_STATIC,147,33,16,8 - GROUPBOX "Misc",IDC_STATIC,138,198,126,37 - GROUPBOX "Multi Config Handling",IDC_STATIC,138,240,126,31 - LTEXT "Repeat notes on hold?",IDC_STATIC,142,207,74,11 + LTEXT "Select category:",IDC_STATIC,7,5,131,11 + PUSHBUTTON "Set",IDC_SET,228,52,43,13,NOT WS_VISIBLE + GROUPBOX "Key setup for this command ",IDC_STATIC,144,6,126,84 + LTEXT "Key:",IDC_STATIC,150,38,16,8 + GROUPBOX "Misc",IDC_STATIC,144,96,126,40 + GROUPBOX "Multi Config Handling",IDC_STATIC,144,144,126,31 + LTEXT "Repeat notes on hold?",IDC_STATIC,150,108,74,8 LTEXT "Effect letters like:",IDC_STATIC,11,185,73,11,NOT WS_VISIBLE - LTEXT "Chord detect interval (ms):",IDC_STATIC,142,222,88,11 - LTEXT "Log:",IDC_STATIC,141,84,19,10 - PUSHBUTTON "Clear Log",IDC_CLEARLOG,227,85,37,9 + LTEXT "Chord detect interval (ms):",IDC_STATIC,150,122,88,8 + LTEXT "Error Log:",IDC_STATIC,144,180,88,8 + PUSHBUTTON "Clear Log",IDC_CLEARLOG,228,179,42,12 END IDD_OPTIONS_COLORS DIALOGEX 0, 0, 272, 281 @@ -1564,9 +1564,9 @@ IDD_OPTIONS_KEYBOARD, DIALOG BEGIN - RIGHTMARGIN, 266 + RIGHTMARGIN, 268 TOPMARGIN, 5 - BOTTOMMARGIN, 275 + BOTTOMMARGIN, 277 END IDD_OPTIONS_COLORS, DIALOG @@ -2377,7 +2377,7 @@ "Can't open keybindings file %1 for reading. Default keybindings will be used." IDS_UNABLE_TO_LOAD_KEYBINDINGS "Loading keybindings failed. The keyboard won't work properly." - IDS_CANT_OPEN_FILE_FOR_WRITING "Can't open file for writing." + IDS_CANT_OPEN_FILE_FOR_WRITING "Can't open keybindings file for writing." IDS_CONFIRM_SEQUENCE_DELETE "Delete sequence %1?" IDS_PATTERN_CLEANUP_UNAVAILABLE "Removing unused patterns is not available when using multiple sequences." Modified: trunk/OpenMPT/packageTemplate/History.txt =================================================================== --- trunk/OpenMPT/packageTemplate/History.txt 2010-11-20 20:55:32 UTC (rev 764) +++ trunk/OpenMPT/packageTemplate/History.txt 2010-11-20 21:11:32 UTC (rev 765) @@ -221,7 +221,7 @@ [New] <Jojo> Key shortcut + context menu entry for toggling the plugin editor of the PC note that's under the cursor. [Imp] <Jojo> Overflow paste now only uses one undo step. [Imp] <Jojo> Instead of simply ignoring note off/cut/fade when working with .MOD files, it is converted to C00. - [Fix] <rewbs> Effect visualizer is now aware of PC notes (bug 3836). + [Fix] <rewbs> Effect visualizer is now aware of PC notes (http://forum.openmpt.org/index.php?topic=3836.0). [Fix] <Jojo> When using MIDI record or split keyboard settings, volume data was written into the volume column in MOD format. [Fix] <Jojo> When converting PC Notes to MIDI Macros, the instrument index is now also cleaned as well. Noticeable for example when pasting PC notes into an IT module. [Fix] <Jojo> Now, plugin slot 100 can also be automated using PC Notes. @@ -886,31 +886,31 @@ v1.17.02.53 (May 2009, revision 259) ------------------------------------ General - [New] <jojo> Can now import MO3 files using external library. (rev. 248) + [New] <Jojo> Can now import MO3 files using external library. (rev. 248) - [Fix] <jojo> Song Cleanup: Sample cleanup should no longer remove data after sustain loop end point. (rev. 248) - [Fix] <jojo> Misc: When adding channels from song properties, new channels are now initialized properly (bug 1814). (rev. 236) - [Fix] <jojo> BPM approximation showed wrong rows per beat in some cases (bug 2532) (rev. 231) - [Fix] <jojo> Disabled special handling of '&'-character when drawing texts to various components where the special handling should not take place. (http://forum.openmpt.org/index.php?topic=1962.0) (rev. 229) - [Fix] <re> File opening: Added a couple of return value checks to reduce the change of crash when opening lots of files (bug 2546) (rev. 239) + [Fix] <Jojo> Song Cleanup: Sample cleanup should no longer remove data after sustain loop end point. (rev. 248) + [Fix] <Jojo> Misc: When adding channels from song properties, new channels are now initialized properly (http://forum.openmpt.org/index.php?topic=1814.0). (rev. 236) + [Fix] <Jojo> BPM approximation showed wrong rows per beat in some cases (http://forum.openmpt.org/index.php?topic=2532.0) (rev. 231) + [Fix] <Jojo> Disabled special handling of '&'-character when drawing texts to various components where the special handling should not take place. (http://forum.openmpt.org/index.php?topic=1962.0) (rev. 229) + [Fix] <re> File opening: Added a couple of return value checks to reduce the change of crash when opening lots of files (http://forum.openmpt.org/index.php?topic=2546.0) (rev. 239) - [Mod] <jojo> Menu: Goto dialog can now be opened from Edit-menu. (rev. 246) + [Mod] <Jojo> Menu: Goto dialog can now be opened from Edit-menu. (rev. 246) [Mod] <re> Pattern cleanup: Clearing sequence after first '---' item is now optional. (rev. 239) [Mod] <re> When passing MIDI to plug, documents will now be set modified since MIDI data may change parameters. (rev. 243) General tab - [Mod] <jojo> General tab: VST volume slider is now disabled for S3M. (rev. 246) - [Mod] <jojo> General tab: Initial channel volume controls are now enabled only for IT and MPTM. (rev. 246) + [Mod] <Jojo> General tab: VST volume slider is now disabled for S3M. (rev. 246) + [Mod] <Jojo> General tab: Initial channel volume controls are now enabled only for IT and MPTM. (rev. 246) Pattern tab - [New] <jojo> Added descriptions of SBx, S3x, S4x and S5x command parameters to note properties dialog. (rev. 251) - [New] <jojo> Descriptions to retrigger note command parameters in note properties dialog. (rev. 248) - [New] <jojo> Ability to start playback with incoming MIDI note (see setup->MIDI) (rev. 246) - [New] <jojo> Duplicate channel (see channel header context menu). (246) + [New] <Jojo> Added descriptions of SBx, S3x, S4x and S5x command parameters to note properties dialog. (rev. 251) + [New] <Jojo> Descriptions to retrigger note command parameters in note properties dialog. (rev. 248) + [New] <Jojo> Ability to start playback with incoming MIDI note (see setup->MIDI) (rev. 246) + [New] <Jojo> Duplicate channel (see channel header context menu). (246) [New] <re> MIDI controllers can now be used to input smooth MIDI macro commands to pattern (setup->MIDI). (rev. 240) [Fix] <re> Undo should now work with chords. (rev. 244) - [Fix] <re> When playing with MIDI keyboard, plugins got a constant note velocity, not the actual velocity (bug 2754) (rev. 239) + [Fix] <re> When playing with MIDI keyboard, plugins got a constant note velocity, not the actual velocity (http://forum.openmpt.org/index.php?topic=2754.0) (rev. 239) [Fix] <re> Undo fixes (didn't properly handle playback positions/multichannel record, set redundant undo points)(rev 243) [Fix] <re> Param record in plugs GUI wrote commands even when pattern record was off. (rev 243) [Fix] <re> Fixed chord detection when row spacing was enabled. (rev 243) @@ -918,35 +918,35 @@ [Fix] <re> Accidental moving when selecting order in margins shouldn't happen anymore. (rev 225) [Fix] <re> Fix to possible crash when using undo after pattern resize (bug introduced in rev. 168) - [Mod] <jojo> When applying "change instrument", an instrument number won't be added to note off/cut anymore if the note doesn't already have an instrument. (rev. 248) + [Mod] <Jojo> When applying "change instrument", an instrument number won't be added to note off/cut anymore if the note doesn't already have an instrument. (rev. 248) [Mod] <re> Default orderlist margin value can now be controlled with "DefaultSequenceMargins" ini-settings under "Pattern Editor" context. (rev 225) - [Mod] <jojo & re> Sequence view: Sequence scrolling won't no longer be cut on first '---' item on IT/MPTM/XM. (rev. 237) - [Fix] <re> Pattern: The keyboard split 'feature' when entering chords is removed (bug 2790). (rev. 244) + [Mod] <Jojo & re> Sequence view: Sequence scrolling won't no longer be cut on first '---' item on IT/MPTM/XM. (rev. 237) + [Fix] <re> Pattern: The keyboard split 'feature' when entering chords is removed (http://forum.openmpt.org/index.php?topic=2790.0). (rev. 244) Sample tab - [New] <jojo> Can now normalize sample selections. (rev. 254) - [New] <jojo> Can now optionally normalize all samples instead of just one (click normalize with shift down) (rev. 249) - [New] <jojo & re> Status bar now displays offset value at given sample point. (rev. 232) - [New] <jojo & re> Sample amplify now accepts negative values(inverts sample phase) (request 2219) (rev. 234) - [New] <jojo & re> Signed/unsigned sample conversion. (rev. 235) + [New] <Jojo> Can now normalize sample selections. (rev. 254) + [New] <Jojo> Can now optionally normalize all samples instead of just one (click normalize with shift down) (rev. 249) + [New] <Jojo & re> Status bar now displays offset value at given sample point. (rev. 232) + [New] <Jojo & re> Sample amplify now accepts negative values(inverts sample phase) (request 2219) (rev. 234) + [New] <Jojo & re> Signed/unsigned sample conversion. (rev. 235) [New] <re> Added button for phase invert to toolbar. (rev. 235) - [New] <jojo> Ability to save sample as raw. (rev. 236) + [New] <Jojo> Ability to save sample as raw. (rev. 236) [Fix] <re> Fix to zoom-related crash when loading samples in sample tab. Occurs usually with lengthy samples. (rev. 211) - [Fix] <jojo> Playing sample selection didn't work properly in all cases (bug 1700). (rev. 231) - [Fix] <jojo> Setting loop points could affect playing of sample even if loop was disabled (bug 1874) (rev. 231) + [Fix] <Jojo> Playing sample selection didn't work properly in all cases (http://forum.openmpt.org/index.php?topic=1700.0). (rev. 231) + [Fix] <Jojo> Setting loop points could affect playing of sample even if loop was disabled (http://forum.openmpt.org/index.php?topic=1874.0) (rev. 231) - [Mod] <jojo> Notes from MIDI should now be played like notes from keyboard. (rev. 246) - [Mod] <jojo> Play sample button now stops previous note even if mod is playing (bug 1366) (rev. 231) - [Mod] <jojo> Sustain loop will now be enabled when setting it to sample selection. (rev. 231) - [Mod] <jojo> Sample editing: If possible, use loop points as trim limits if there's no selection chosen. (rev. 230) + [Mod] <Jojo> Notes from MIDI should now be played like notes from keyboard. (rev. 246) + [Mod] <Jojo> Play sample button now stops previous note even if mod is playing (http://forum.openmpt.org/index.php?topic=1366.0) (rev. 231) + [Mod] <Jojo> Sustain loop will now be enabled when setting it to sample selection. (rev. 231) + [Mod] <Jojo> Sample editing: If possible, use loop points as trim limits if there's no selection chosen. (rev. 230) [Mod] <re> Time stretching is now implemented with SoundTouch library. (rev. 228) [Mod] <re> Disabled pitchshifting/time stretching of 8-bit samples(didn't seem to work). (rev. 228) Instrument tab - [Fix] <jojo> Envelope view: Middle line will now be drawn in panning and pitch/filter envelopes even if row guidelines are enabled. (rev. 254) + [Fix] <Jojo> Envelope view: Middle line will now be drawn in panning and pitch/filter envelopes even if row guidelines are enabled. (rev. 254) - [Mod] <jojo> Instrument tab: Sample map can now map "No sample". (rev. 236) + [Mod] <Jojo> Instrument tab: Sample map can now map "No sample". (rev. 236) [Mod] <re> Changed default instrument plug volume command handling from Dry/Wet to none. Also added ini-setting with which one can set the default value used for new instruments. Ini setting is "DefaultPlugVolumeHandling" in [Misc], possible values are 0,1,2. (rev. 238) MPTM @@ -960,23 +960,23 @@ [Mod] <re> Notes should now be drawn more clearly when using custom tunings. (rev. 217) IT - [Fix] <jojo & re> Macro config should now be loaded correctly also when loading IT files not made with MPT. (rev. 257) - [Fix] <jojo & re> Playback fix to vibrato with ramp down waveform in IT compatibility play. (rev. 257) + [Fix] <Jojo & re> Macro config should now be loaded correctly also when loading IT files not made with MPT. (rev. 257) + [Fix] <Jojo & re> Playback fix to vibrato with ramp down waveform in IT compatibility play. (rev. 257) [Fix] <re> When file was saved with compatibility export, the last order was not shown in Impulse Tracker. (rev. 257) XM - [Fix] <jojo> Fix to handling a special case of Bxx and Dxx (bug 2769) (rev 241) + [Fix] <Jojo> Dxx effects that are to the left of a Bxx effect are now ignored. (http://forum.openmpt.org/index.php?topic=2769.0) (rev 241) S3M [Fix] <re> S3M saving: Sequence of length 241-255 should now be cut to length 240 instead of 16. (rev. 239) - [Mod] <re> When loading S3M files which contain Zxx effects, user is now asked how to process them. (bug 2166) (rev. 233) [Mod] <re> S3M saving: Saved sequence is no longer cut on first '---' item. (rev. 239) + [Mod] <re> When loading S3M files which contain Zxx effects, user is now asked how to process them. (http://forum.openmpt.org/index.php?topic=2166.0) (rev. 233) MOD - [Fix] <jojo & re> Fixes to MOD saving: it should now be possible to create ProTracker compatible MOD files with compatibility export. (rev. 256) + [Fix] <Jojo & re> Fixes to MOD saving: it should now be possible to create ProTracker compatible MOD files with compatibility export. (rev. 256) Package template - [Mod] <jojo> PackageTemplate: Update to DE_jojo-keymap + [Mod] <Jojo> PackageTemplate: Update to DE_jojo.mkb keymap Misc [Fix] <from libmodplug> Fix to faulty portamento handling on loading AMF. @@ -987,15 +987,15 @@ v1.17.02.52 (14 Apr 2008, revision 210) --------------------------------------- [Fix] <re> Shouldn't need winhttp anymore (at least now that updatecheck is disabled). Dependency caused problems in Win98. - [Fix] <re> Fix to faulty plug file existence check (introduced in 1.17.02.51)(http://forum.openmpt.org/index.php?topic=2255.0) + [Fix] <re> Fix to faulty plug file existence check (introduced in 1.17.02.51) (http://forum.openmpt.org/index.php?topic=2255.0) [Fix] <re> Sound card-options buffer length value validation. - [Fix] <re> In .51, muted channels were ignored completely in MIDI export. Now pattern effects are processed in muted channels. + [Fix] <re> In 1.17.02.51, muted channels were ignored completely in MIDI export. Now pattern effects are processed in muted channels. [Fix] <re> IT style-playback fix v1.17.02.51 (29 Mar 2008, revision 208) internal test build ----------------------------------------------------------- - [Fix] <re> Fix to crash when loading VST with long(>32) param name. + [Fix] <re> Fix to crash when loading VST with long(> 32 characters) param name. [Fix] <ma & re> Fix to possible memory corruption problem on handling VST with more than 30 outputs. - VST with more than 32 outputs might still be handled poorly. [Fix] <re> Fix to possible crash when browsing modules in treeview(http://forum.openmpt.org/index.php?topic=2222.0). Modified: trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html =================================================================== --- trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html 2010-11-20 20:55:32 UTC (rev 764) +++ trunk/OpenMPT/packageTemplate/OMPT_1.18_ReleaseNotes.html 2010-11-20 21:11:32 UTC (rev 765) @@ -120,7 +120,7 @@ <ul> <li>It is very simple to <strong>switch to another module</strong> now: Simply click the module name!</li> <li><strong>Closing a module</strong> is almost as simple: Right-click the module name and select the appropriate context menu entry.</li> - <li>Sample and instrument <strong>playback indicators</strong>.</li> + <li>Sample and instrument <strong>playback indication icons</strong>. Has to be enabled from the settings.</li> <li><strong>Improved icons</strong>: Mute status is now displayed.</li> <li><strong>Sequence control</strong> including copying a sequence to another module.</li> </ul> @@ -207,8 +207,9 @@ <h2>Contact</h2> <p> - Helpful bug reports, new ideas and brave volunteers to test early development builds or contribute to the code are more than welcome! - You can meet us at the ModPlug Central forums: <a href="http://forum.openmpt.org/">http://forum.openmpt.org/</a>. + Helpful bug reports, new ideas and brave volunteers to test early development builds or contribute to the code are more than welcome!<br /> + Our issue tracker is located at <a href="http://bugs.openmpt.org/">http://bugs.openmpt.org/</a> and can be used to report bugs and feature requests.<br /> + You can also meet us at the ModPlug Central forums: <a href="http://forum.openmpt.org/">http://forum.openmpt.org/</a>. </p> </body> Modified: trunk/OpenMPT/soundlib/Loaders.h =================================================================== --- trunk/OpenMPT/soundlib/Loaders.h 2010-11-20 20:55:32 UTC (rev 764) +++ trunk/OpenMPT/soundlib/Loaders.h 2010-11-20 21:11:32 UTC (rev 765) @@ -9,7 +9,7 @@ #include "Sndfile.h" -// Execute "action" if "request" bytes cannot be read from stream +// Execute "action" if "request_bytes" bytes cannot be read from stream at position "position" #define ASSERT_CAN_READ_PROTOTYPE(position, length, request_bytes, action) \ if( position > length || request_bytes > length - position) action; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-12-03 22:05:15
|
Revision: 768 http://modplug.svn.sourceforge.net/modplug/?rev=768&view=rev Author: saga-games Date: 2010-12-03 22:05:09 +0000 (Fri, 03 Dec 2010) Log Message: ----------- [Imp] Mod Conversion: Changed volume command priority when converting from XM to IT/S3M - Cxx overrides vxx in XM, so this is now taken into account. [Fix] Pattern Editor: When applying the Amplify command on a pattern selection that was just covering the note/instrument column of the first channel, the program crashed. [Ref] Rewrote some of the pattern amplification code to look less dumb and be more efficient. Modified Paths: -------------- trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/soundlib/modcommand.cpp Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-12-02 22:52:54 UTC (rev 767) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-12-03 22:05:09 UTC (rev 768) @@ -2785,31 +2785,57 @@ static UINT snOldAmp = 100; CAmpDlg dlg(this, snOldAmp, 0); CModDoc *pModDoc = GetDocument(); - BYTE chvol[MAX_BASECHANNELS]; if ((pModDoc) && (dlg.DoModal() == IDOK)) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); + const bool useVolCol = (pSndFile->GetType() != MOD_TYPE_MOD); + BeginWaitCursor(); PrepareUndo(m_dwBeginSel, m_dwEndSel); snOldAmp = static_cast<UINT>(dlg.m_nFactor); - memset(chvol, 64, sizeof(chvol)); + if (pSndFile->Patterns[m_nPattern]) { MODCOMMAND *p = pSndFile->Patterns[m_nPattern]; - CHANNELINDEX firstChannel = (m_dwBeginSel & 0xFFFF) >> 3, lastChannel = (m_dwEndSel & 0xFFFF) >> 3; - ROWINDEX firstRow = (m_dwBeginSel >> 16), lastRow = (m_dwEndSel >> 16); + CHANNELINDEX firstChannel = GetSelectionStartChan(), lastChannel = GetSelectionEndChan(); + ROWINDEX firstRow = GetSelectionStartRow(), lastRow = GetSelectionEndRow(); firstChannel = CLAMP(firstChannel, 0, pSndFile->m_nChannels - 1); - lastChannel = CLAMP(lastChannel, 0, pSndFile->m_nChannels - 1); + lastChannel = CLAMP(lastChannel, firstChannel, pSndFile->m_nChannels - 1); firstRow = CLAMP(firstRow, 0, pSndFile->Patterns[m_nPattern].GetNumRows() - 1); - lastRow = CLAMP(lastRow, 0, pSndFile->Patterns[m_nPattern].GetNumRows() - 1); + lastRow = CLAMP(lastRow, firstRow, pSndFile->Patterns[m_nPattern].GetNumRows() - 1); - for (CHANNELINDEX nChn = firstChannel; nChn <= lastChannel; nChn++) + // adjust min/max channel if they're only partly selected (i.e. volume column or effect column (when using .MOD) is not covered) + if(((firstChannel << 3) | (useVolCol ? 2 : 3)) < (m_dwBeginSel & 0xFFFF)) { - for (ROWINDEX nRow = firstRow; nRow <= lastRow; nRow++) + if(firstChannel >= lastChannel) { - MODCOMMAND *m = p + nRow * pSndFile->m_nChannels + nChn; + // Selection too small! + EndWaitCursor(); + return; + } + firstChannel++; + } + if(((lastChannel << 3) | (useVolCol ? 2 : 3)) > (m_dwEndSel & 0xFFFF)) + { + if(lastChannel == 0) + { + // Selection too small! + EndWaitCursor(); + return; + } + lastChannel--; + } + + // Volume memory for each channel. + vector<BYTE> chvol(lastChannel + 1, 64); + + for (ROWINDEX nRow = firstRow; nRow <= lastRow; nRow++) + { + MODCOMMAND *m = p + nRow * pSndFile->m_nChannels + firstChannel; + for (CHANNELINDEX nChn = firstChannel; nChn <= lastChannel; nChn++, m++) + { if ((m->command == CMD_VOLUME) && (m->param <= 64)) { chvol[nChn] = m->param; @@ -2841,14 +2867,14 @@ } else { //nonexistant sample and no volume present in patten? assume volume=64. - if(pSndFile->GetType() == MOD_TYPE_MOD) + if(useVolCol) { + m->volcmd = VOLCMD_VOLUME; + m->vol = 64; + } else + { m->command = CMD_VOLUME; m->param = 64; - } else - { - m->volcmd = VOLCMD_VOLUME; - m->vol = 64; } chvol[nChn] = 64; break; @@ -2857,26 +2883,22 @@ } } - // adjust min/max channel if they're only partly selected (i.e. volume column is not covered) - if(((firstChannel << 3) | 2) < (m_dwBeginSel & 0xFFFF)) firstChannel++; - if(((lastChannel << 3) | 2) > (m_dwEndSel & 0xFFFF)) lastChannel--; - for (ROWINDEX nRow = firstRow; nRow <= lastRow; nRow++) { - p = pSndFile->Patterns[m_nPattern] + nRow * pSndFile->m_nChannels; - int cy = lastRow - firstRow + 1; // total rows (for fading) - for (CHANNELINDEX nChn = firstChannel; nChn <= lastChannel; nChn++) + MODCOMMAND *m = p + nRow * pSndFile->m_nChannels + firstChannel; + const int cy = lastRow - firstRow + 1; // total rows (for fading) + for (CHANNELINDEX nChn = firstChannel; nChn <= lastChannel; nChn++, m++) { - if ((!p[nChn].volcmd) && (p[nChn].command != CMD_VOLUME) - && (p[nChn].note) && (p[nChn].note <= NOTE_MAX) && (p[nChn].instr)) + if ((!m->volcmd) && (m->command != CMD_VOLUME) + && (m->note) && (m->note <= NOTE_MAX) && (m->instr)) { - UINT nSmp = p[nChn].instr; + UINT nSmp = m->instr; bool overrideSampleVol = false; if (pSndFile->m_nInstruments) { if ((nSmp <= pSndFile->m_nInstruments) && (pSndFile->Instruments[nSmp])) { - nSmp = pSndFile->Instruments[nSmp]->Keyboard[p[nChn].note]; + nSmp = pSndFile->Instruments[nSmp]->Keyboard[m->note]; // hack for instruments without samples if(!nSmp) { @@ -2890,49 +2912,49 @@ } if ((nSmp) && (nSmp <= pSndFile->m_nSamples)) { - if(pSndFile->GetType() == MOD_TYPE_MOD) + if(useVolCol) { - p[nChn].command = CMD_VOLUME; - p[nChn].param = (overrideSampleVol) ? 64 : pSndFile->Samples[nSmp].nVolume >> 2; + m->volcmd = VOLCMD_VOLUME; + m->vol = (overrideSampleVol) ? 64 : pSndFile->Samples[nSmp].nVolume >> 2; } else { - p[nChn].volcmd = VOLCMD_VOLUME; - p[nChn].vol = (overrideSampleVol) ? 64 : pSndFile->Samples[nSmp].nVolume >> 2; + m->command = CMD_VOLUME; + m->param = (overrideSampleVol) ? 64 : pSndFile->Samples[nSmp].nVolume >> 2; } } } - if (p[nChn].volcmd == VOLCMD_VOLUME) chvol[nChn] = (BYTE)p[nChn].vol; - if (((dlg.m_bFadeIn) || (dlg.m_bFadeOut)) && (p[nChn].command != CMD_VOLUME) && (!p[nChn].volcmd)) + if (m->volcmd == VOLCMD_VOLUME) chvol[nChn] = (BYTE)m->vol; + if (((dlg.m_bFadeIn) || (dlg.m_bFadeOut)) && (m->command != CMD_VOLUME) && (!m->volcmd)) { - if(pSndFile->GetType() == MOD_TYPE_MOD) + if(useVolCol) { - p[nChn].command = CMD_VOLUME; - p[nChn].param = chvol[nChn]; + m->volcmd = VOLCMD_VOLUME; + m->vol = chvol[nChn]; } else { - p[nChn].volcmd = VOLCMD_VOLUME; - p[nChn].vol = chvol[nChn]; + m->command = CMD_VOLUME; + m->param = chvol[nChn]; } } - if (p[nChn].volcmd == VOLCMD_VOLUME) + if (m->volcmd == VOLCMD_VOLUME) { - int vol = p[nChn].vol * dlg.m_nFactor; + int vol = m->vol * dlg.m_nFactor; if (dlg.m_bFadeIn) vol = (vol * (nRow+1-firstRow)) / cy; if (dlg.m_bFadeOut) vol = (vol * (cy+firstRow-nRow)) / cy; - vol = (vol+50) / 100; + vol = (vol + 50) / 100; if (vol > 64) vol = 64; - p[nChn].vol = (BYTE)vol; + m->vol = (BYTE)vol; } if ((((nChn << 3) | 3) >= (m_dwBeginSel & 0xFFFF)) && (((nChn << 3) | 3) <= (m_dwEndSel & 0xFFFF))) { - if ((p[nChn].command == CMD_VOLUME) && (p[nChn].param <= 64)) + if ((m->command == CMD_VOLUME) && (m->param <= 64)) { - int vol = p[nChn].param * dlg.m_nFactor; + int vol = m->param * dlg.m_nFactor; if (dlg.m_bFadeIn) vol = (vol * (nRow + 1 - firstRow)) / cy; if (dlg.m_bFadeOut) vol = (vol * (cy + firstRow - nRow)) / cy; vol = (vol + 50) / 100; if (vol > 64) vol = 64; - p[nChn].param = (BYTE)vol; + m->param = (BYTE)vol; } } } Modified: trunk/OpenMPT/soundlib/modcommand.cpp =================================================================== --- trunk/OpenMPT/soundlib/modcommand.cpp 2010-12-02 22:52:54 UTC (rev 767) +++ trunk/OpenMPT/soundlib/modcommand.cpp 2010-12-03 22:05:09 UTC (rev 768) @@ -136,7 +136,8 @@ MODExx2S3MSxx(m); break; case CMD_VOLUME: - if (!m->volcmd) + // Effect column volume command overrides the volume column in XM. + if (m->volcmd == VOLCMD_NONE || m->volcmd == VOLCMD_VOLUME) { m->volcmd = VOLCMD_VOLUME; m->vol = m->param; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-12-13 15:23:45
|
Revision: 772 http://modplug.svn.sourceforge.net/modplug/?rev=772&view=rev Author: saga-games Date: 2010-12-13 15:23:38 +0000 (Mon, 13 Dec 2010) Log Message: ----------- [Imp] Pattern Editor: The new "select whole row" feature now also autoscrolls the pattern. [Ref] Some refactoring (IT Saver: Using IsPatternEmpty, const modifiers in modcommand.h, refactored visited rows code for future expansion) [Mod] OpenMPT: Version is now 1.19.00.15 Modified Paths: -------------- trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/modcommand.h Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-12-06 23:54:31 UTC (rev 771) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-12-13 15:23:38 UTC (rev 772) @@ -512,6 +512,11 @@ } +// Drag a selection to position dwPos. +// If bScroll is true, the point dwPos is scrolled into the view if needed. +// If bNoMode if specified, the original selection points are not altered. +// Note that scrolling will only be executed if dwPos contains legal coordinates. +// This can be useful when selecting a whole row and specifying 0xFFFF as the end channel. BOOL CViewPattern::DragToSel(DWORD dwPos, BOOL bScroll, BOOL bNoMove) //------------------------------------------------------------------- { @@ -1322,7 +1327,7 @@ // Mark row number => mark whole row (continue) InvalidateSelection(); m_dwEndSel = GetPositionFromPoint(point) | 0xFFFF; - SetCurSel(m_dwStartSel, m_dwEndSel); + DragToSel(m_dwEndSel, TRUE, FALSE); } else if (m_dwStatus & PATSTATUS_MOUSEDRAGSEL) { CModDoc *pModDoc = GetDocument(); Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2010-12-06 23:54:31 UTC (rev 771) +++ trunk/OpenMPT/mptrack/version.h 2010-12-13 15:23:38 UTC (rev 772) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 00 -#define VER_MINORMINOR 14 +#define VER_MINORMINOR 15 //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-12-06 23:54:31 UTC (rev 771) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-12-13 15:23:38 UTC (rev 772) @@ -1637,22 +1637,12 @@ bNeedsMptPatSave = true; // Check for empty pattern - if (Patterns[npat].GetNumRows() == 64) + if (Patterns[npat].GetNumRows() == 64 && Patterns.IsPatternEmpty(npat)) { - MODCOMMAND *pzc = Patterns[npat]; - UINT nz = Patterns[npat].GetNumRows() * m_nChannels; - UINT iz = 0; - for (iz=0; iz<nz; iz++) - { - if ((pzc[iz].note) || (pzc[iz].instr) - || (pzc[iz].volcmd) || (pzc[iz].command)) break; - } - if (iz == nz) - { - patpos[npat] = 0; - continue; - } + patpos[npat] = 0; + continue; } + fwrite(patinfo, 8, 1, f); dwPos += 8; memset(chnmask, 0xFF, sizeof(chnmask)); @@ -2237,23 +2227,14 @@ patinfo[1] = Patterns[npat].GetNumRows(); patinfo[2] = 0; patinfo[3] = 0; + // Check for empty pattern - if (Patterns[npat].GetNumRows() == 64) + if (Patterns[npat].GetNumRows() == 64 && Patterns.IsPatternEmpty(npat)) { - MODCOMMAND *pzc = Patterns[npat]; - UINT nz = Patterns[npat].GetNumRows() * nChannels; - UINT iz = 0; - for (iz=0; iz<nz; iz++) - { - if ((pzc[iz].note) || (pzc[iz].instr) - || (pzc[iz].volcmd) || (pzc[iz].command)) break; - } - if (iz == nz) - { - patpos[npat] = 0; - continue; - } + patpos[npat] = 0; + continue; } + fwrite(patinfo, 8, 1, f); dwPos += 8; memset(chnmask, 0xFF, sizeof(chnmask)); Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-12-06 23:54:31 UTC (rev 771) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-12-13 15:23:38 UTC (rev 772) @@ -78,10 +78,6 @@ { bool dummy = false; double result = GetLength(dummy, bAdjust, endOrder, endRow); - if(!bAdjust) - { - InitializeVisitedRows(true); // forget that we went over the whole module. - } return result; } @@ -106,28 +102,22 @@ // -! NEW_FEATURE#0022 UINT nMusicSpeed = m_nDefaultSpeed, nMusicTempo = m_nDefaultTempo, nNextRow = 0; LONG nGlbVol = m_nDefaultGlobalVolume, nOldGlbVolSlide = 0; - vector<BYTE> instr; - vector<UINT> notes; - vector<BYTE> vols; - vector<BYTE> oldparam; - vector<UINT> chnvols; - vector<double> patloop; - vector<ROWINDEX> patloopstart; - - notes.resize(m_nChannels, 0); - instr.resize(m_nChannels, 0); - vols.resize(m_nChannels, 0xFF); - oldparam.resize(m_nChannels, 0); - chnvols.resize(m_nChannels, 64); - patloop.resize(m_nChannels, 0); - patloopstart.resize(m_nChannels, 0); + vector<BYTE> instr(m_nChannels, 0); + vector<UINT> notes(m_nChannels, 0); + vector<BYTE> vols(m_nChannels, 0xFF); + vector<BYTE> oldparam(m_nChannels, 0); + vector<UINT> chnvols(m_nChannels, 64); + vector<double> patloop(m_nChannels, 0); + vector<ROWINDEX> patloopstart(m_nChannels, 0); + VisitedRowsType visitedRows; // temporary visited rows vector (so that GetLength() won't interfere with the player code if the module is playing at the same time) + + InitializeVisitedRows(true, &visitedRows); + for(CHANNELINDEX icv = 0; icv < m_nChannels; icv++) chnvols[icv] = ChnSettings[icv].nVolume; nCurrentPattern = nNextPattern = 0; nPattern = Order[0]; nRow = nNextRow = 0; - InitializeVisitedRows(true); - for (;;) { UINT nSpeedCount = 0; @@ -157,7 +147,7 @@ } nPattern = (nCurrentPattern < Order.size()) ? Order[nCurrentPattern] : Order.GetInvalidPatIndex(); nNextPattern = nCurrentPattern; - if((!Patterns.IsValidPat(nPattern)) && IsRowVisited(nCurrentPattern, 0, true)) + if((!Patterns.IsValidPat(nPattern)) && IsRowVisited(nCurrentPattern, 0, true, &visitedRows)) break; } // Skip non-existing patterns @@ -180,7 +170,7 @@ break; } - if(IsRowVisited(nCurrentPattern, nRow, true)) + if(IsRowVisited(nCurrentPattern, nRow, true, &visitedRows)) break; // Update next position @@ -458,6 +448,8 @@ m_nMusicTempo = m_nDefaultTempo; m_nGlobalVolume = m_nDefaultGlobalVolume; } + // When adjusting the playback status, we will also want to update the visited rows vector according to the current position. + m_bVisitedRows = visitedRows; } return dElapsedTime / 1000.0; @@ -4220,8 +4212,8 @@ Specific implementations: Length detection code: - As the ModPlug engine already deals with pattern loops sufficiently, there's no problem with (infinite) pattern loops - in this code. + As the ModPlug engine already deals with pattern loops sufficiently (though not always correctly), + there's no problem with (infinite) pattern loops in this code. Normal player code: Bare in mind that rows inside pattern loops should only be evaluated once, or else the algorithm will cancel too early! @@ -4229,65 +4221,97 @@ */ -void CSoundFile::InitializeVisitedRows(const bool bReset) -//------------------------------------------------------- +// Resize / Clear the row vector. +// If bReset is true, the vector is not only resized to the required dimensions, but also completely cleared (i.e. all visited rows are unset). +// If pRowVector is specified, an alternative row vector instead of the module's global one will be used (f.e. when using GetLength()). +void CSoundFile::InitializeVisitedRows(const bool bReset, VisitedRowsType *pRowVector) +//------------------------------------------------------------------------------------ { - m_bVisitedRows.resize(Order.GetLengthTailTrimmed()); + if(pRowVector == nullptr) + { + pRowVector = &m_bVisitedRows; + } + pRowVector->resize(Order.GetLengthTailTrimmed()); for(ORDERINDEX nOrd = 0; nOrd < Order.GetLengthTailTrimmed(); nOrd++) { - // If we want to reset the vectors completely, we overwrite exisiting items with 0. + VisitedRowsBaseType *pRow = &(pRowVector->at(nOrd)); + // If we want to reset the vectors completely, we overwrite existing items with false. if(bReset) { - for(size_t i = 0; i < m_bVisitedRows[nOrd].size(); i++) - { - m_bVisitedRows[nOrd][i] = false; - } + pRow->assign(pRow->size(), false); } - m_bVisitedRows[nOrd].resize(GetVisitedRowsVectorSize(Order[nOrd]), false); + pRow->resize(GetVisitedRowsVectorSize(Order[nOrd]), false); } } // (Un)sets a given row as visited. -void CSoundFile::SetRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bVisited) -//--------------------------------------------------------------------------------------------- +// nOrd, nRow - which row should be (un)set +// If bVisited is true, the row will be set as visited. +// If pRowVector is specified, an alternative row vector instead of the module's global one will be used (f.e. when using GetLength()). +void CSoundFile::SetRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bVisited, VisitedRowsType *pRowVector) +//-------------------------------------------------------------------------------------------------------------------------- { const ORDERINDEX nMaxOrd = Order.GetLengthTailTrimmed(); if(nOrd >= nMaxOrd || nRow > Patterns[Order[nOrd]].GetNumRows()) + { return; + } + if(pRowVector == nullptr) + { + pRowVector = &m_bVisitedRows; + } + // The module might have been edited in the meantime - so we have to extend this a bit. - if(nOrd >= m_bVisitedRows.size() || nRow >= m_bVisitedRows[nOrd].size()) - InitializeVisitedRows(false); + if(nOrd >= pRowVector->size() || nRow >= pRowVector->at(nOrd).size()) + { + InitializeVisitedRows(false, pRowVector); + } - m_bVisitedRows[nOrd][nRow] = bVisited; + pRowVector->at(nOrd)[nRow] = bVisited; } // Returns if a given row has been visited yet. // If bAutoSet is true, the queried row will automatically be marked as visited. -// Use this parameter instead of consecutive IsRowVisited/SetRowVisited calls, as it's faster. -bool CSoundFile::IsRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bAutoSet) -//-------------------------------------------------------------------------------------------- +// Use this parameter instead of consecutive IsRowVisited/SetRowVisited calls. +// If pRowVector is specified, an alternative row vector instead of the module's global one will be used (f.e. when using GetLength()). +bool CSoundFile::IsRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bAutoSet, VisitedRowsType *pRowVector) +//------------------------------------------------------------------------------------------------------------------------- { const ORDERINDEX nMaxOrd = Order.GetLengthTailTrimmed(); if(nOrd >= nMaxOrd) + { return false; + } + if(pRowVector == nullptr) + { + pRowVector = &m_bVisitedRows; + } + // The row slot for this row has not been assigned yet - Just return false, as this means that the program has not played the row yet. - if(nOrd >= m_bVisitedRows.size() || nRow >= m_bVisitedRows[nOrd].size()) + if(nOrd >= pRowVector->size() || nRow >= pRowVector->at(nOrd).size()) { if(bAutoSet) - SetRowVisited(nOrd, nRow, true); + { + SetRowVisited(nOrd, nRow, true, pRowVector); + } return false; } - if(m_bVisitedRows[nOrd][nRow]) - return true; // we visited this row already - this module must be looping. + if(pRowVector->at(nOrd)[nRow]) + { + // we visited this row already - this module must be looping. + return true; + } if(bAutoSet) - m_bVisitedRows[nOrd][nRow] = true; + { + pRowVector->at(nOrd)[nRow] = true; + } return false; } @@ -4298,7 +4322,12 @@ //------------------------------------------------------------------ { if(Patterns.IsValidPat(nPat)) + { return (size_t)(Patterns[nPat].GetNumRows()); + } else - return 1; // invalid patterns consist of a "fake" row. + { + // invalid patterns consist of a "fake" row. + return 1; + } } \ No newline at end of file Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-12-06 23:54:31 UTC (rev 771) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-12-13 15:23:38 UTC (rev 772) @@ -470,10 +470,11 @@ ORDERINDEX order; // which order is this? }; +// Data type for the visited rows routines. +typedef vector<bool> VisitedRowsBaseType; +typedef vector<VisitedRowsBaseType> VisitedRowsType; -class CSoundFile; - //Note: These are bit indeces. MSF <-> Mod(Specific)Flag. //If changing these, ChangeModTypeTo() might need modification. const BYTE MSF_COMPATIBLE_PLAY = 0; //IT/MPT/XM @@ -553,7 +554,7 @@ const CModSpecifications* m_pModSpecs; // For handling backwards jumps and stuff to prevent infinite loops when counting the mod length or rendering to wav. - vector<vector<bool> > m_bVisitedRows; + VisitedRowsType m_bVisitedRows; @@ -689,6 +690,7 @@ //Returns song length in seconds. DWORD GetSongTime() { return static_cast<DWORD>((m_nTempoMode == tempo_mode_alternative) ? GetLength(false) + 1.0 : GetLength(false) + 0.5); } + // A repeat count value of -1 means infinite loop void SetRepeatCount(int n) { m_nRepeatCount = n; } int GetRepeatCount() const { return m_nRepeatCount; } bool IsPaused() const { return (m_dwSongFlags & (SONG_PAUSED|SONG_STEP)) ? true : false; } // Added SONG_STEP as it seems to be desirable in most cases to check for this as well. @@ -1023,10 +1025,10 @@ // A couple of functions for handling backwards jumps and stuff to prevent infinite loops when counting the mod length or rendering to wav. public: - void InitializeVisitedRows(const bool bReset = true); + void InitializeVisitedRows(const bool bReset = true, VisitedRowsType *pRowVector = nullptr); private: - void SetRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bVisited = true); - bool IsRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bAutoSet = true); + void SetRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bVisited = true, VisitedRowsType *pRowVector = nullptr); + bool IsRowVisited(const ORDERINDEX nOrd, const ROWINDEX nRow, const bool bAutoSet = true, VisitedRowsType *pRowVector = nullptr); size_t GetVisitedRowsVectorSize(const PATTERNINDEX nPat); public: Modified: trunk/OpenMPT/soundlib/modcommand.h =================================================================== --- trunk/OpenMPT/soundlib/modcommand.h 2010-12-06 23:54:31 UTC (rev 771) +++ trunk/OpenMPT/soundlib/modcommand.h 2010-12-13 15:23:38 UTC (rev 772) @@ -53,7 +53,7 @@ // Returns true if modcommand is empty, false otherwise. // If ignoreEffectValues is true (default), effect values are ignored are ignored if there is no effect command present. - bool IsEmpty(bool ignoreEffectValues = true) const + bool IsEmpty(const bool ignoreEffectValues = true) const { if(ignoreEffectValues) return (this->note == 0 && this->instr == 0 && this->volcmd == 0 && this->command == 0); @@ -66,7 +66,7 @@ // Returns true if and only if note is NOTE_PC or NOTE_PCS. bool IsPcNote() const { return note == NOTE_PC || note == NOTE_PCS; } - static bool IsPcNote(NOTE note_id) { return note_id == NOTE_PC || note_id == NOTE_PCS; } + static bool IsPcNote(const NOTE note_id) { return note_id == NOTE_PC || note_id == NOTE_PCS; } // Swap volume and effect column (doesn't do any conversion as it's mainly for importing formats with multiple effect columns, so beware!) void SwapEffects() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-12-18 19:06:08
|
Revision: 773 http://modplug.svn.sourceforge.net/modplug/?rev=773&view=rev Author: saga-games Date: 2010-12-18 19:06:01 +0000 (Sat, 18 Dec 2010) Log Message: ----------- [Fix] Pattern Editor: Pressing Shift doesn't interfere with full row selection anymore (http://bugs.openmpt.org/view.php?id=45#c24) [Mod] Config Dialog: The MMX acceleration label is now updated according to the multimedia extensions that are supported by the CPU (3DNow! / SSE) [Ref] Added some comments to the HW-accelerated mixing code Modified Paths: -------------- trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/soundlib/Mmx_mix.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2010-12-13 15:23:38 UTC (rev 772) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2010-12-18 19:06:01 UTC (rev 773) @@ -113,7 +113,16 @@ if (m_dwSoundSetup & SOUNDSETUP_SOFTPANNING) CheckDlgButton(IDC_CHECK2, MF_CHECKED); if (m_dwSoundSetup & SOUNDSETUP_ENABLEMMX) CheckDlgButton(IDC_CHECK3, MF_CHECKED); if (m_dwSoundSetup & SOUNDSETUP_SECONDARY) CheckDlgButton(IDC_CHECK4, MF_CHECKED); + // Multimedia extensions ::EnableWindow(::GetDlgItem(m_hWnd, IDC_CHECK3), (CSoundFile::GetSysInfo() & SYSMIX_ENABLEMMX) ? TRUE : FALSE); + if(CSoundFile::GetSysInfo() & SYSMIX_SSE) + { + SetDlgItemText(IDC_CHECK3, _T("Enable SSE acceleration")); + } else if (CSoundFile::GetSysInfo() & SYSMIX_3DNOW) + { + SetDlgItemText(IDC_CHECK3, _T("Enable 3DNow! acceleration")); + } + // Sampling Rate { UINT n = 1; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2010-12-13 15:23:38 UTC (rev 772) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2010-12-18 19:06:01 UTC (rev 773) @@ -903,7 +903,7 @@ if (rm.note) { if(m->IsPcNote()) - { // Clear whole row if clearing PC note + { // Clear whole cell if clearing PC note m->Clear(); invalidateAllCols = true; } @@ -3707,14 +3707,14 @@ return wParam; } case kcSelectWithCopySelect: case kcSelectWithNav: - case kcSelect: if (!(m_dwStatus & PATSTATUS_DRAGNDROPEDIT)) m_dwStartSel = (m_nRow << 16) | m_dwCursor; + case kcSelect: if (!(m_dwStatus & (PATSTATUS_DRAGNDROPEDIT|PATSTATUS_SELECTROW))) m_dwStartSel = (m_nRow << 16) | m_dwCursor; m_dwStatus |= PATSTATUS_KEYDRAGSEL; return wParam; case kcSelectOffWithCopySelect: case kcSelectOffWithNav: case kcSelectOff: m_dwStatus &= ~PATSTATUS_KEYDRAGSEL; return wParam; case kcCopySelectWithSelect: case kcCopySelectWithNav: - case kcCopySelect: if (!(m_dwStatus & PATSTATUS_DRAGNDROPEDIT)) m_dwStartSel = (m_nRow << 16) | m_dwCursor; + case kcCopySelect: if (!(m_dwStatus & (PATSTATUS_DRAGNDROPEDIT|PATSTATUS_SELECTROW))) m_dwStartSel = (m_nRow << 16) | m_dwCursor; m_dwStatus |= PATSTATUS_CTRLDRAGSEL; return wParam; case kcCopySelectOffWithSelect: case kcCopySelectOffWithNav: @@ -4930,8 +4930,8 @@ AppendMenu(hMenu, (pSndFile->ChnSettings[nChn].dwFlags & CHN_MUTE) ? (MF_STRING|MF_CHECKED) : MF_STRING, ID_PATTERN_MUTE, "Mute Channel\t" + ih->GetKeyTextFromCommand(kcChannelMute)); - BOOL bSolo = false, bUnmuteAll = false; - BOOL bSoloPending = false, bUnmuteAllPending = false; // doesn't work perfectly yet + bool bSolo = false, bUnmuteAll = false; + bool bSoloPending = false, bUnmuteAllPending = false; // doesn't work perfectly yet for (CHANNELINDEX i = 0; i < pSndFile->m_nChannels; i++) { if (i != nChn) Modified: trunk/OpenMPT/soundlib/Mmx_mix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Mmx_mix.cpp 2010-12-13 15:23:38 UTC (rev 772) +++ trunk/OpenMPT/soundlib/Mmx_mix.cpp 2010-12-18 19:06:01 UTC (rev 773) @@ -37,7 +37,7 @@ #define PROCSUPPORT_3DNOW 0x08 #define PROCSUPPORT_SSE 0x10 - +// Byte offsets into the MODCHANNEL structure #define CHNOFS_PCURRENTSAMPLE 0 #define CHNOFS_NPOS 4 #define CHNOFS_NPOSLO 8 Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2010-12-13 15:23:38 UTC (rev 772) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2010-12-18 19:06:01 UTC (rev 773) @@ -282,12 +282,12 @@ #define DNA_NOTEFADE 2 // Mixer Hardware-Dependent features -#define SYSMIX_ENABLEMMX 0x01 -#define SYSMIX_SLOWCPU 0x02 -#define SYSMIX_FASTCPU 0x04 -#define SYSMIX_MMXEX 0x08 -#define SYSMIX_3DNOW 0x10 -#define SYSMIX_SSE 0x20 +#define SYSMIX_ENABLEMMX 0x01 // Hardware acceleration features (MMX/3DNow!/SSE) are supported by this processor +#define SYSMIX_SLOWCPU 0x02 // *Really* old processor (in this context, it doesn't know CPUID instructions => Must be older than Pentium) +#define SYSMIX_FASTCPU 0x04 // "Fast" processor (in this context, anything that is at least a Pentium MMX) +#define SYSMIX_MMXEX 0x08 // Processor supports AMD MMX extensions +#define SYSMIX_3DNOW 0x10 // Processor supports AMD 3DNow! instructions +#define SYSMIX_SSE 0x20 // Processor supports SSE instructions // Module flags #define SONG_EMBEDMIDICFG 0x0001 // Embed macros in file Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-12-13 15:23:38 UTC (rev 772) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-12-18 19:06:01 UTC (rev 773) @@ -175,6 +175,7 @@ typedef struct __declspec(align(32)) _MODCHANNEL { // First 32-bytes: Most used mixing information: don't change it + // These fields are accessed directly by the MMX mixing code (look out for CHNOFS_PCURRENTSAMPLE), so the order is crucial LPSTR pCurrentSample; DWORD nPos; DWORD nPosLo; // actually 16-bit This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2010-12-23 23:24:51
|
Revision: 778 http://modplug.svn.sourceforge.net/modplug/?rev=778&view=rev Author: saga-games Date: 2010-12-23 23:24:44 +0000 (Thu, 23 Dec 2010) Log Message: ----------- [Mod] The code has been updated to use the VST 2.4 SDK. Please follow the instructions in include/readme.txt and upgrade your header files! The changes have not been tested very much, but they should not be very big anyway - a few things have been updated, but that doesn't mean that VST 2.4 plugins will work better now. But that's what comes next... ;) [Mod] OpenMPT: Version is now 1.19.00.17 Modified Paths: -------------- trunk/OpenMPT/mptrack/VSTEditor.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Sndfile.h Added Paths: ----------- trunk/OpenMPT/include/readme.txt Added: trunk/OpenMPT/include/readme.txt =================================================================== --- trunk/OpenMPT/include/readme.txt (rev 0) +++ trunk/OpenMPT/include/readme.txt 2010-12-23 23:24:44 UTC (rev 778) @@ -0,0 +1,22 @@ +What files do I need to compile OpenMPT? + +VST 2.4 SDK +=========== +If you don't use #define NO_VST, you will need to place the following files +from Steinberg's VST 2.4 SDK in this folder: +aeffect.h +aeffectx.h +vstfxstore.h +You can find them in the "vstsdk2.4/pluginterfaces/vst2.x" folder. + +ASIO SDK +======== +If you don't use #define NO_ASIO, you will need to place the following files +from Steinberg's ASIO SDK in this folder: +asio.h +asiosys.h +iasiodrv.h +You can find them in the "ASIOSDK2/common" directory. + +Please visit http://www.steinberg.net/en/company/developer.html to download +these SDKs. \ No newline at end of file Modified: trunk/OpenMPT/mptrack/VSTEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/VSTEditor.cpp 2010-12-23 23:06:16 UTC (rev 777) +++ trunk/OpenMPT/mptrack/VSTEditor.cpp 2010-12-23 23:24:44 UTC (rev 778) @@ -11,31 +11,21 @@ #ifndef NO_VST COwnerVstEditor::COwnerVstEditor(CVstPlugin *pPlugin) : CAbstractVstEditor(pPlugin) -//----------------------------------------- +//--------------------------------------------------------------------------------- { } COwnerVstEditor::~COwnerVstEditor() -//----------------------- +//--------------------------------- { } -#pragma pack(push, 1) -typedef struct _ERect -{ - short top; - short left; - short bottom; - short right; -} ERect, *PERect; -#pragma pack(pop) - BOOL COwnerVstEditor::OpenEditor(CWnd *parent) -//--------------------------------------- +//-------------------------------------------- { Create(IDD_PLUGINEDITOR, parent); SetupMenu(); @@ -81,21 +71,21 @@ VOID COwnerVstEditor::OnClose() -//------------------------ +//----------------------------- { DoClose(); } VOID COwnerVstEditor::OnOK() -//--------------------- +//-------------------------- { OnClose(); } VOID COwnerVstEditor::OnCancel() -//------------------------- +//------------------------------ { OnClose(); } @@ -103,7 +93,7 @@ VOID COwnerVstEditor::DoClose() -//------------------------ +//----------------------------- { #ifdef VST_LOG Log("CVstEditor::DoClose()\n"); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-12-23 23:06:16 UTC (rev 777) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-12-23 23:24:44 UTC (rev 778) @@ -26,7 +26,7 @@ char CVstPluginManager::s_szHostProductString[64] = "OpenMPT"; char CVstPluginManager::s_szHostVendorString[64] = "OpenMPT project"; -long CVstPluginManager::s_nHostVendorVersion = MptVersion::num; +VstIntPtr CVstPluginManager::s_nHostVendorVersion = MptVersion::num; //#define VST_LOG //#define ENABLE_BUZZ @@ -54,8 +54,8 @@ } #endif -long VSTCALLBACK CVstPluginManager::MasterCallBack(AEffect *effect, long opcode, long index, long value, void *ptr, float opt) -//---------------------------------------------------------------------------------------------------------------------------- +VstIntPtr VSTCALLBACK CVstPluginManager::MasterCallBack(AEffect *effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void *ptr, float opt) +//---------------------------------------------------------------------------------------------------------------------------------------------- { CVstPluginManager *that = theApp.GetPluginManager(); if (that) @@ -640,8 +640,8 @@ } //rewbs.VSTCompliance: Added support for lots of opcodes -long CVstPluginManager::VstCallback(AEffect *effect, long opcode, long index, long value, void *ptr, float /*opt*/) -//------------------------------------------------------------------------------------------------------------- +VstIntPtr CVstPluginManager::VstCallback(AEffect *effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void *ptr, float /*opt*/) +//----------------------------------------------------------------------------------------------------------------------------------- { #ifdef VST_LOG Log("VST plugin to host: Eff: 0x%.8X, Opcode = %d, Index = %d, Value = %d, PTR = %.8X, OPT = %.3f\n",(int)effect, opcode,index,value,(int)ptr,opt); @@ -706,7 +706,7 @@ } return 0; // Called when plugin asks for VST version supported by host - case audioMasterVersion: return 2300; + case audioMasterVersion: return kVstVersion; // Returns the unique id of a plug that's currently loading // (not sure what this is actually for - we return *effect's UID, cos Herman Seib does something similar :) // Let's see what happens...) @@ -789,7 +789,7 @@ timeInfo.timeSigDenominator = 4; //gcd(pSndFile->m_nCurrentRowsPerMeasure, pSndFile->m_nCurrentRowsPerBeat); } } - return (long)&timeInfo; + return (VstIntPtr)&timeInfo; } // VstEvents* in <ptr> // We don't support plugs that send VSTEvents to the host @@ -861,7 +861,7 @@ break; case audioMasterGetOutputLatency: { - long latency = CMainFrame::GetMainFrame()->m_nBufferLength*(CMainFrame::GetMainFrame()->GetSampleRate()/1000L); + VstIntPtr latency = CMainFrame::GetMainFrame()->m_nBufferLength * (CMainFrame::GetMainFrame()->GetSampleRate()/1000L); return latency; } // input pin in <value> (-1: first to come), returns cEffect* @@ -946,12 +946,15 @@ //"asyncProcessing", //"offline", //"supportShell" + //"editFile" + //"startStopProcess" if ((strcmp((char*)ptr,"sendVstEvents") == 0 || strcmp((char*)ptr,"sendVstMidiEvent") == 0 || strcmp((char*)ptr,"sendVstTimeInfo") == 0 || strcmp((char*)ptr,"supplyIdle") == 0 || strcmp((char*)ptr,"sizeWindow") == 0 || - strcmp((char*)ptr,"openFileSelector") == 0 + strcmp((char*)ptr,"openFileSelector") == 0 || + strcmp((char*)ptr,"closeFileSelector") == 0 )) return HostCanDo; else @@ -990,6 +993,7 @@ return 0; //---from here VST 2.1 extension opcodes------------------------------------------------------ + // begin of automation session (when mouse down), parameter index in <index> case audioMasterBeginEdit: Log("VST plugin to host: Begin Edit\n"); @@ -1001,26 +1005,36 @@ // open a fileselector window with VstFileSelect* in <ptr> case audioMasterOpenFileSelector: //---from here VST 2.2 extension opcodes------------------------------------------------------ + // close a fileselector operation with VstFileSelect* in <ptr>: Must be always called after an open ! case audioMasterCloseFileSelector: return VstFileSelector(opcode == audioMasterCloseFileSelector, (VstFileSelect *)ptr, effect); - // open an editor for audio (defined by XML text in ptr) + // open an editor for audio (defined by XML text in ptr) - DEPRECATED case audioMasterEditFile: Log("VST plugin to host: Edit File\n"); break; // get the native path of currently loading bank or project - // (called from writeChunk) void* in <ptr> (char[2048], or sizeof(FSSpec)) + // (called from writeChunk) void* in <ptr> (char[2048], or sizeof(FSSpec)) - DEPRECATED case audioMasterGetChunkFile: Log("VST plugin to host: Get Chunk File\n"); break; //---from here VST 2.3 extension opcodes------------------------------------------------------ - // result a VstSpeakerArrangement in ret + + // result a VstSpeakerArrangement in ret - DEPRECATED case audioMasterGetInputSpeakerArrangement: Log("VST plugin to host: Get Input Speaker Arrangement\n"); break; + + //---from here VST 2.4 extension opcodes------------------------------------------------------ + + // Floating point processing precision + case effSetProcessPrecision: + return kVstProcessPrecision32; + } + // Unknown codes: return 0; @@ -1029,8 +1043,8 @@ // Helper function for file selection dialog stuff. -long CVstPluginManager::VstFileSelector(const bool destructor, VstFileSelect *pFileSel, const AEffect *effect) -//------------------------------------------------------------------------------------------------------------ +VstIntPtr CVstPluginManager::VstFileSelector(const bool destructor, VstFileSelect *pFileSel, const AEffect *effect) +//----------------------------------------------------------------------------------------------------------------- { if(pFileSel == nullptr) { @@ -1304,8 +1318,8 @@ #define NUM_PROBLEMPLUGS 3 static _PROBLEMATIC_PLUG gProblemPlugs[NUM_PROBLEMPLUGS] = { - {'VstP', 'Ni4S', 1, "Native Instruments B4", "* v1.1.1 hangs on playback. Do not proceed unless you have v1.1.5. *"}, - {'VstP', 'mdaC', 1, "MDA Degrade", "* This plugin can cause OpenMPT to behave erratically.\r\nYou should try SoundHack's Decimate, ConcreteFX's Lowbit or Subtek's LoFi Plus instead. *"}, + {kEffectMagic, CCONST('N', 'i', '4', 'S'), 1, "Native Instruments B4", "* v1.1.1 hangs on playback. Do not proceed unless you have v1.1.5. *"}, + {kEffectMagic, CCONST('m', 'd', 'a', 'C'), 1, "MDA Degrade", "* This plugin can cause OpenMPT to behave erratically.\r\nYou should try SoundHack's Decimate, ConcreteFX's Lowbit or Subtek's LoFi Plus instead. *"}, }; bool CSelectPluginDlg::VerifyPlug(PVSTPLUGINLIB plug) @@ -1368,7 +1382,7 @@ switch(m_pPlugin->Info.dwPluginId2) { // Enable drymix by default for these known plugins - case 'Scop': + case CCONST('S', 'c', 'o', 'p'): m_pPlugin->Info.dwInputRouting |= MIXPLUG_INPUTF_WETMIX; break; } @@ -1748,7 +1762,7 @@ //rewbs.VSTcompliance //Store a pointer so we can get the CVstPlugin object from the basic VST effect object. //Assuming 32bit address space... - m_pEffect->resvd1=(long)this; + m_pEffect->resvd1=(VstIntPtr)this; //rewbs.plugDocAware m_pSndFile = pSndFile; m_pModDoc = pSndFile->GetpModDoc(); @@ -1767,20 +1781,20 @@ sa.type = kSpeakerArrStereo; for(int i = 0; i < ARRAYELEMCOUNT(sa.speakers); i++) { - sa.speakers[i].azimuth = 0; - sa.speakers[i].elevation = 0; - sa.speakers[i].radius = 0; + sa.speakers[i].azimuth = 0.0f; + sa.speakers[i].elevation = 0.0f; + sa.speakers[i].radius = 0.0f; sa.speakers[i].reserved = 0.0f; // For now, only left and right speaker are used. switch(i) { case 0: sa.speakers[i].type = kSpeakerL; - strcpy(sa.speakers[i].name, "Left"); + vst_strncpy(sa.speakers[i].name, "Left", kVstMaxNameLen - 1); break; case 1: sa.speakers[i].type = kSpeakerR; - strcpy(sa.speakers[i].name, "Right"); + vst_strncpy(sa.speakers[i].name, "Right", kVstMaxNameLen - 1); break; default: sa.speakers[i].type = kSpeakerUndefined; @@ -1788,7 +1802,7 @@ } } // For now, input setup = output setup. - Dispatch(effSetSpeakerArrangement, 0, (LONG_PTR)(&sa), &sa, 0.0f); + Dispatch(effSetSpeakerArrangement, 0, (VstIntPtr)(&sa), &sa, 0.0f); // Dummy pin properties collection. // We don't use them but some plugs might do inits in here. @@ -1989,16 +2003,16 @@ } //rewbs.VSTpresets -long CVstPlugin::GetUID() -//----------------------- +VstInt32 CVstPlugin::GetUID() +//--------------------------- { if (!(m_pEffect)) return 0; return m_pEffect->uniqueID; } -long CVstPlugin::GetVersion() -//----------------------- +VstInt32 CVstPlugin::GetVersion() +//------------------------------- { if (!(m_pEffect)) return 0; @@ -2006,8 +2020,8 @@ return m_pEffect->version; } -bool CVstPlugin::GetParams(float *param, long min, long max) -//---------------------------------------------------------- +bool CVstPlugin::GetParams(float *param, VstInt32 min, VstInt32 max) +//------------------------------------------------------------------ { if (!(m_pEffect)) return false; @@ -2015,15 +2029,15 @@ if (max>m_pEffect->numParams) max = m_pEffect->numParams; - for (long p=min; p<max; p++) + for (VstInt32 p = min; p < max; p++) param[p-min]=GetParameter(p); return true; } -bool CVstPlugin::RandomizeParams(long minParam, long maxParam) -//------------------------------------------------------------ +bool CVstPlugin::RandomizeParams(VstInt32 minParam, VstInt32 maxParam) +//-------------------------------------------------------------------- { if (!(m_pEffect)) return false; @@ -2039,7 +2053,7 @@ maxParam=m_pEffect->numParams; } - for (long p=minParam; p<maxParam; p++) + for (VstInt32 p = minParam; p < maxParam; p++) SetParameter(p, (rand() / float(RAND_MAX))); return true; @@ -2095,14 +2109,14 @@ if (m_pEffect->uniqueID != fxp.fxID) return false; - if (fxp.fxMagic == 'FxCk') //Load preset based fxp + if (fxp.fxMagic == fMagic) //Load preset based fxp { if (m_pEffect->numParams != fxp.numParams) return false; for (int p=0; p<fxp.numParams; p++) SetParameter(p, fxp.params[p]); } - else if (fxp.fxMagic == 'FPCh') + else if (fxp.fxMagic == chunkPresetMagic) { Dispatch(effSetChunk, 1, fxp.chunkSize, (BYTE*)fxp.chunk, 0); } @@ -2111,8 +2125,8 @@ } //end rewbs.VSTpresets -long CVstPlugin::Dispatch(long opCode, long index, long value, void *ptr, float opt) -//---------------------------------------------------------------------------------- +VstIntPtr CVstPlugin::Dispatch(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt) +//---------------------------------------------------------------------------------------------------- { long lresult = 0; @@ -3009,7 +3023,7 @@ if ((m_pEffect->flags & effFlagsProgramChunks) && (Dispatch(effIdentify, 0,0, NULL, 0) == 'NvEf') - && (m_pEffect->uniqueID != 'Sytr')) //special case: imageline sytrus pretends to support chunks but gives us garbage. + && (m_pEffect->uniqueID != CCONST('S', 'y', 't', 'r'))) //special case: imageline sytrus pretends to support chunks but gives us garbage. { PVOID p = NULL; LONG nByteSize = 0; @@ -3417,16 +3431,16 @@ CBuzz2Vst(CMachineInterface *, const CMachineInfo *); ~CBuzz2Vst(); AEffect *GetEffect() { return &m_Effect; } - long Dispatcher(long opCode, long index, long value, void *ptr, float opt); - void SetParameter(long index, float parameter); - float GetParameter(long index); + VstIntPtr Dispatcher(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt); + void SetParameter(VstInt32 index, float parameter); + float GetParameter(VstInt32 index); void Process(float **inputs, float **outputs, long sampleframes); public: - static long VSTCALLBACK BuzzDispatcher(AEffect *effect, long opCode, long index, long value, void *ptr, float opt); - static void VSTCALLBACK BuzzSetParameter(AEffect *effect, long index, float parameter); - static float VSTCALLBACK BuzzGetParameter(AEffect *effect, long index); - static void VSTCALLBACK BuzzProcess(AEffect *effect, float **inputs, float **outputs, long sampleframes); + static VstIntPtr VSTCALLBACK BuzzDispatcher(AEffect *effect, VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt); + static void VSTCALLBACK BuzzSetParameter(AEffect *effect, VstInt32 index, float parameter); + static float VSTCALLBACK BuzzGetParameter(AEffect *effect, VstInt32 index); + static void VSTCALLBACK BuzzProcess(AEffect *effect, float **inputs, float **outputs, VstInt32 sampleframes); // CMICallbacks interface public: @@ -3569,8 +3583,8 @@ } -long CBuzz2Vst::BuzzDispatcher(AEffect *effect, long opCode, long index, long value, void *ptr, float opt) -//-------------------------------------------------------------------------------------------------------- +VstIntPtr CBuzz2Vst::BuzzDispatcher(AEffect *effect, VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt) +//-------------------------------------------------------------------------------------------------------------------------- { CBuzz2Vst *pBuzz2Vst = (CBuzz2Vst *)effect->object; if (pBuzz2Vst) return pBuzz2Vst->Dispatcher(opCode, index, value, ptr, opt); @@ -3578,16 +3592,16 @@ } -void CBuzz2Vst::BuzzSetParameter(AEffect *effect, long index, float parameter) -//---------------------------------------------------------------------------- +void CBuzz2Vst::BuzzSetParameter(AEffect *effect, VstInt32 index, float parameter) +//-------------------------------------------------------------------------------- { CBuzz2Vst *pBuzz2Vst = (CBuzz2Vst *)effect->object; if (pBuzz2Vst) pBuzz2Vst->SetParameter(index, parameter); } -float CBuzz2Vst::BuzzGetParameter(AEffect *effect, long index) -//------------------------------------------------------------ +float CBuzz2Vst::BuzzGetParameter(AEffect *effect, VstInt32 index) +//---------------------------------------------------------------- { CBuzz2Vst *pBuzz2Vst = (CBuzz2Vst *)effect->object; if (pBuzz2Vst) return pBuzz2Vst->GetParameter(index); @@ -3595,16 +3609,16 @@ } -void CBuzz2Vst::BuzzProcess(AEffect *effect, float **inputs, float **outputs, long sampleframes) -//---------------------------------------------------------------------------------------------- +void CBuzz2Vst::BuzzProcess(AEffect *effect, float **inputs, float **outputs, VstInt32 sampleframes) +//-------------------------------------------------------------------------------------------------- { CBuzz2Vst *pBuzz2Vst = (CBuzz2Vst *)effect->object; if (pBuzz2Vst) pBuzz2Vst->Process(inputs, outputs, sampleframes); } -long CBuzz2Vst::Dispatcher(long opCode, long index, long value, void *ptr, float opt) -//----------------------------------------------------------------------------------- +VstIntPtr CBuzz2Vst::Dispatcher(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt) +//----------------------------------------------------------------------------------------------------- { if (!m_pMachineInterface) return 0; switch(opCode) @@ -3702,15 +3716,15 @@ } -void CBuzz2Vst::SetParameter(long index, float parameter) -//------------------------------------------------------- +void CBuzz2Vst::SetParameter(VstInt32 index, float parameter) +//----------------------------------------------------------- { } -float CBuzz2Vst::GetParameter(long index) -//--------------------------------------- +float CBuzz2Vst::GetParameter(VstInt32 index) +//------------------------------------------- { if (index < m_pMachineInfo->numGlobalParameters) { @@ -3805,16 +3819,16 @@ CDmo2Vst(IMediaObject *pMO, IMediaObjectInPlace *pMOIP, DWORD uid); ~CDmo2Vst(); AEffect *GetEffect() { return &m_Effect; } - long Dispatcher(long opCode, long index, long value, void *ptr, float opt); - void SetParameter(long index, float parameter); - float GetParameter(long index); + VstIntPtr Dispatcher(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt); + void SetParameter(VstInt32 index, float parameter); + float GetParameter(VstInt32 index); void Process(float **inputs, float **outputs, long sampleframes); public: - static long VSTCALLBACK DmoDispatcher(AEffect *effect, long opCode, long index, long value, void *ptr, float opt); - static void VSTCALLBACK DmoSetParameter(AEffect *effect, long index, float parameter); - static float VSTCALLBACK DmoGetParameter(AEffect *effect, long index); - static void VSTCALLBACK DmoProcess(AEffect *effect, float **inputs, float **outputs, long sampleframes); + static VstIntPtr VSTCALLBACK DmoDispatcher(AEffect *effect, VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt); + static void VSTCALLBACK DmoSetParameter(AEffect *effect, VstInt32 index, float parameter); + static float VSTCALLBACK DmoGetParameter(AEffect *effect, VstInt32 index); + static void VSTCALLBACK DmoProcess(AEffect *effect, float **inputs, float **outputs, VstInt32 sampleframes); }; @@ -3882,8 +3896,8 @@ } -long CDmo2Vst::DmoDispatcher(AEffect *effect, long opCode, long index, long value, void *ptr, float opt) -//------------------------------------------------------------------------------------------------------ +VstIntPtr CDmo2Vst::DmoDispatcher(AEffect *effect, VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt) +//------------------------------------------------------------------------------------------------------------------------ { if (effect) { @@ -3894,8 +3908,8 @@ } -void CDmo2Vst::DmoSetParameter(AEffect *effect, long index, float parameter) -//-------------------------------------------------------------------------- +void CDmo2Vst::DmoSetParameter(AEffect *effect, VstInt32 index, float parameter) +//------------------------------------------------------------------------------ { if (effect) { @@ -3905,7 +3919,7 @@ } -float CDmo2Vst::DmoGetParameter(AEffect *effect, long index) +float CDmo2Vst::DmoGetParameter(AEffect *effect, VstInt32 index) //---------------------------------------------------------- { if (effect) @@ -3917,8 +3931,8 @@ } -void CDmo2Vst::DmoProcess(AEffect *effect, float **inputs, float **outputs, long sampleframes) -//-------------------------------------------------------------------------------------------- +void CDmo2Vst::DmoProcess(AEffect *effect, float **inputs, float **outputs, VstInt32 sampleframes) +//------------------------------------------------------------------------------------------------ { if (effect) { @@ -3928,8 +3942,8 @@ } -long CDmo2Vst::Dispatcher(long opCode, long index, long value, void *ptr, float opt) -//---------------------------------------------------------------------------------- +VstIntPtr CDmo2Vst::Dispatcher(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt) +//---------------------------------------------------------------------------------------------------- { switch(opCode) { @@ -4035,8 +4049,8 @@ } -void CDmo2Vst::SetParameter(long index, float fValue) -//--------------------------------------------------- +void CDmo2Vst::SetParameter(VstInt32 index, float fValue) +//------------------------------------------------------- { MP_PARAMINFO mpi; @@ -4065,8 +4079,8 @@ } -float CDmo2Vst::GetParameter(long index) -//-------------------------------------- +float CDmo2Vst::GetParameter(VstInt32 index) +//------------------------------------------ { if ((index < m_Effect.numParams) && (m_pParamInfo) && (m_pMediaParams)) { Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2010-12-23 23:06:16 UTC (rev 777) +++ trunk/OpenMPT/mptrack/Vstplug.h 2010-12-23 23:24:44 UTC (rev 778) @@ -2,7 +2,9 @@ #define _VST_PLUGIN_MANAGER_H_ #ifndef NO_VST + #define VST_FORCE_DEPRECATED 0 #include <aeffectx.h> // VST + #include <vstfxstore.h> #endif #define kBuzzMagic 'Buzz' @@ -66,7 +68,7 @@ PVSTPLUGINLIB m_pFactory; PSNDMIXPLUGIN m_pMixStruct; AEffect *m_pEffect; - void (*m_pProcessFP)(AEffect*, float**, float**, long); //Function pointer to AEffect processReplacing if supported, else process. + void (*m_pProcessFP)(AEffect*, float**, float**, VstInt32); //Function pointer to AEffect processReplacing if supported, else process. CAbstractVstEditor *m_pEditor; //rewbs.defaultPlugGUI UINT m_nSampleRate; BOOL m_bIsVst2; @@ -110,10 +112,10 @@ long GetProgramNameIndexed(long index, long category, char *text); //rewbs.VSTpresets bool LoadProgram(CString fileName); bool SaveProgram(CString fileName); - long GetUID(); //rewbs.VSTpresets - long GetVersion(); //rewbs.VSTpresets - bool GetParams(float* param, long min, long max); //rewbs.VSTpresets - bool RandomizeParams(long minParam=0, long maxParam=0); //rewbs.VSTpresets + VstInt32 GetUID(); //rewbs.VSTpresets + VstInt32 GetVersion(); //rewbs.VSTpresets + bool GetParams(float* param, VstInt32 min, VstInt32 max); //rewbs.VSTpresets + bool RandomizeParams(VstInt32 minParam = 0, VstInt32 maxParam = 0); //rewbs.VSTpresets bool isModified() {return m_bModified;} inline CModDoc* GetModDoc() {return m_pModDoc;} inline CSoundFile* GetSoundFile() {return m_pSndFile;} @@ -135,7 +137,7 @@ VOID GetParamName(UINT nIndex, LPSTR pszName, UINT cbSize); VOID GetParamLabel(UINT nIndex, LPSTR pszLabel); VOID GetParamDisplay(UINT nIndex, LPSTR pszDisplay); - long Dispatch(long opCode, long index, long value, void *ptr, float opt); + VstIntPtr Dispatch(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt); VOID ToggleEditor(); VOID GetPluginType(LPSTR pszType); BOOL GetDefaultEffectName(LPSTR pszName); @@ -245,16 +247,16 @@ VOID EnumerateDirectXDMOs(); protected: - long VstCallback(AEffect *effect, long opcode, long index, long value, void *ptr, float opt); - long VstFileSelector(const bool destructor, VstFileSelect *pFileSel, const AEffect *effect); - static long VSTCALLBACK MasterCallBack(AEffect *effect, long opcode, long index, long value, void *ptr, float opt); + VstIntPtr VstCallback(AEffect *effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void *ptr, float opt); + VstIntPtr VstFileSelector(const bool destructor, VstFileSelect *pFileSel, const AEffect *effect); + static VstIntPtr VSTCALLBACK MasterCallBack(AEffect *effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void *ptr, float opt); static BOOL __cdecl CreateMixPluginProc(PSNDMIXPLUGIN, CSoundFile*); VstTimeInfo timeInfo; //rewbs.VSTcompliance public: static char s_szHostProductString[64]; static char s_szHostVendorString[64]; - static long s_nHostVendorVersion; + static VstIntPtr s_nHostVendorVersion; #else // NO_VST public: Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2010-12-23 23:06:16 UTC (rev 777) +++ trunk/OpenMPT/mptrack/version.h 2010-12-23 23:24:44 UTC (rev 778) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 00 -#define VER_MINORMINOR 16 +#define VER_MINORMINOR 17 //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/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-12-23 23:06:16 UTC (rev 777) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-12-23 23:24:44 UTC (rev 778) @@ -19,6 +19,15 @@ #include "Snd_defs.h" #include "Endianness.h" +// For VstInt32 and stuff - a stupid workaround for IMixPlugin. +#ifndef NO_VST +#define VST_FORCE_DEPRECATED 0 +#include <aeffect.h> // VST +#else +typedef int32 VstInt32; +typedef int32 VstIntPtr; +#endif + class CTuningBase; typedef CTuningBase CTuning; @@ -288,7 +297,7 @@ // Mix Plugins #define MIXPLUG_MIXREADY 0x01 // Set when cleared -typedef long PlugParamIndex; +typedef VstInt32 PlugParamIndex; typedef float PlugParamValue; class IMixPlugin @@ -313,7 +322,7 @@ virtual PlugParamValue GetParameter(PlugParamIndex nIndex) = 0; virtual UINT GetZxxParameter(UINT nParam) = 0; //rewbs.smoothVST virtual void ModifyParameter(PlugParamIndex nIndex, PlugParamValue diff); - virtual long Dispatch(long opCode, long index, long value, void *ptr, float opt) =0; //rewbs.VSTCompliance + virtual VstIntPtr Dispatch(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt) =0; //rewbs.VSTCompliance virtual void NotifySongPlaying(bool)=0; //rewbs.VSTCompliance virtual bool IsSongPlaying()=0; virtual bool IsResumed()=0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rel...@us...> - 2011-01-02 16:10:56
|
Revision: 780 http://modplug.svn.sourceforge.net/modplug/?rev=780&view=rev Author: relabsoluness Date: 2011-01-02 16:10:49 +0000 (Sun, 02 Jan 2011) Log Message: ----------- [Fix] Sample Editor: Changing zoom level should now preserve better the view position. [Fix] Build: VC03 build was broken. [Ref] Some cleanup(mostly regarding compiler warnings). Modified Paths: -------------- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h trunk/OpenMPT/mptrack/misc_util.cpp trunk/OpenMPT/mptrack/misc_util.h trunk/OpenMPT/soundlib/Load_ams.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/SNDDEV.H trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/unlha/UNLHA32.H Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-01-02 16:10:49 UTC (rev 780) @@ -36,7 +36,7 @@ } -void CCustEdit::SetKey(UINT inMod, CString c) +void CCustEdit::SetKey(UINT /*inMod*/, CString /*c*/) { /* mod = inMod; @@ -354,7 +354,7 @@ void COptionsKeyboard::OnCategorySelChanged() //------------------------------------------- { - CommandID nCmd = (CommandID)m_lbnCommandKeys.GetItemData( m_lbnCommandKeys.GetCurSel() ); + //CommandID nCmd = (CommandID)m_lbnCommandKeys.GetItemData( m_lbnCommandKeys.GetCurSel() ); int nCat = m_cmbCategory.GetItemData( m_cmbCategory.GetCurSel() ); //Fill Command list @@ -372,7 +372,7 @@ m_lbnCommandKeys.SetItemData(m_lbnCommandKeys.AddString(plocalCmdSet->GetCommandText(com)), com); if (commandCategories[nCat].separatorAt(com)) - m_lbnCommandKeys.SetItemData(m_lbnCommandKeys.AddString("------------------------------------------------------"), -1); + m_lbnCommandKeys.SetItemData(m_lbnCommandKeys.AddString("------------------------------------------------------"), DWORD_PTR(-1)); } } m_lbnCommandKeys.SetCurSel(0); @@ -657,7 +657,7 @@ if(files.abort) return; m_sFullPathName = files.first_file.c_str(); - plocalCmdSet->SaveFile(m_sFullPathName, m_bDebugSave.GetCheck()); + plocalCmdSet->SaveFile(m_sFullPathName, m_bDebugSave.GetCheck() != BST_UNCHECKED); //TentativeSetToDefaultFile(m_sFullPathName); } Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.h =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.h 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.h 2011-01-02 16:10:49 UTC (rev 780) @@ -33,7 +33,7 @@ commands.Copy(copy.commands); separators.Copy(copy.separators); } - bool separatorAt(UINT c) + bool separatorAt(int c) { for (int p=0; p<separators.GetSize(); p++) { Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-02 16:10:49 UTC (rev 780) @@ -760,7 +760,20 @@ SendMessageToActiveViews(WM_MOD_ACTIVATEVIEW, IDD_CONTROL_INSTRUMENTS, nIns); } +void CModDoc::AddLogEvent(LogEventType eventType, LPCTSTR pszFuncName, LPCTSTR pszFormat, ...) +{ + CString strMsg; + va_list args; + va_start(args, pszFormat); + strMsg.FormatV(pszFormat, args); + va_end(args); + m_logEvents << Util::GetDateTimeStr() + << _T("Event type: ") << eventType << std::endl + << _T("Function: ") << pszFuncName << std::endl + << _T("Message: ") << strMsg << std::endl << std::endl; +} + BOOL CModDoc::AddToLog(LPCSTR lpszLog) //------------------------------------ { Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/mptrack/Moddoc.h 2011-01-02 16:10:49 UTC (rev 780) @@ -147,13 +147,19 @@ bool octaveLink; // apply octaveModifier }; +enum LogEventType +{ + LogEventUnexpectedError +}; + //============================= class CModDoc: public CDocument //============================= { protected: LPSTR m_lpszLog; + std::basic_ostringstream<TCHAR> m_logEvents; // Log for general progress and error events. CSoundFile m_SndFile; BOOL m_bPaused; @@ -197,6 +203,10 @@ LPCSTR GetLog() const { return m_lpszLog; } BOOL ClearLog(); UINT ShowLog(LPCSTR lpszTitle=NULL, CWnd *parent=NULL); + + // Logging for general progress and error events. + void AddLogEvent(LogEventType eventType, LPCTSTR pszFuncName, LPCTSTR pszFormat, ...); + void ViewPattern(UINT nPat, UINT nOrd); void ViewSample(UINT nSmp); void ViewInstrument(UINT nIns); Modified: trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp 2011-01-02 16:10:49 UTC (rev 780) @@ -39,7 +39,7 @@ void CMoveFXSlotDialog::OnOK() //---------------------------- { - m_nToSlot = m_CbnEmptySlots.GetItemData(m_CbnEmptySlots.GetCurSel()); + m_nToSlot = static_cast<PLUGINDEX>(m_CbnEmptySlots.GetItemData(m_CbnEmptySlots.GetCurSel())); CDialog::OnOK(); } Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2011-01-02 16:10:49 UTC (rev 780) @@ -135,7 +135,7 @@ } -void CViewSample::UpdateScrollSize() +void CViewSample::UpdateScrollSize(const UINT nZoomOld) //---------------------------------- { CModDoc *pModDoc = GetDocument(); @@ -182,7 +182,19 @@ sizePage.cx = sizeLine.cx * 4; sizePage.cy = sizeLine.cy; SetScrollSizes(MM_TEXT, m_sizeTotal, sizePage, sizeLine); - m_nScrollPos = GetScrollPos(SB_HORZ) << m_nScrollFactor; + + if (nZoomOld != m_nZoom) // After zoom change, keep the view position. + { + const UINT nOldPos = ScrollPosToSamplePos(nZoomOld); + const float fPosFraction = (dwLen > 0) ? static_cast<float>(nOldPos) / dwLen : 0; + m_nScrollPos = 0; + m_nScrollPos = SampleToScreen(nOldPos); + SetScrollPos(SB_HORZ, static_cast<int>(fPosFraction * GetScrollLimit(SB_HORZ))); + } + else + { + m_nScrollPos = GetScrollPos(SB_HORZ) << m_nScrollFactor; + } } } @@ -220,8 +232,9 @@ if (nZoom > MAX_ZOOM) return FALSE; + const UINT nZoomOld = m_nZoom; m_nZoom = nZoom; - UpdateScrollSize(); + UpdateScrollSize(nZoomOld); InvalidateRect(NULL, FALSE); return TRUE; } @@ -749,8 +762,9 @@ CSoundFile *pSndFile; HGDIOBJ oldpen; HDC hdc; - UINT nSmpScrollPos = (m_nZoom) ? (m_nScrollPos << (m_nZoom - 1)) : 0; + UINT nSmpScrollPos = ScrollPosToSamplePos(); + if ((!pModDoc) || (!pDC)) return; hdc = pDC->m_hDC; oldpen = ::SelectObject(hdc, CMainFrame::penBlack); Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/mptrack/View_smp.h 2011-01-02 16:10:49 UTC (rev 780) @@ -31,7 +31,8 @@ DECLARE_SERIAL(CViewSample) public: - void UpdateScrollSize(); + void UpdateScrollSize() {UpdateScrollSize(m_nZoom);} + void UpdateScrollSize(const UINT nZoomOld); BOOL SetCurrentSample(SAMPLEINDEX nSmp); BOOL SetZoom(UINT nZoom); LONG SampleToScreen(LONG n) const; @@ -65,6 +66,9 @@ // if smaller than the smallest zoom, returns value >= MAX_ZOOM + 1. UINT GetAutoZoomLevel(const MODSAMPLE& smp); + UINT ScrollPosToSamplePos() const {return ScrollPosToSamplePos(m_nZoom);} + UINT ScrollPosToSamplePos(UINT nZoom) const {return (nZoom > 0) ? (m_nScrollPos << (nZoom - 1)) : 0;} + public: //{{AFX_VIRTUAL(CViewSample) virtual void OnDraw(CDC *); Modified: trunk/OpenMPT/mptrack/misc_util.cpp =================================================================== --- trunk/OpenMPT/mptrack/misc_util.cpp 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/mptrack/misc_util.cpp 2011-01-02 16:10:49 UTC (rev 780) @@ -1,5 +1,6 @@ #include "stdafx.h" #include "misc_util.h" +#include <ctime> /* * Loads resource. @@ -51,3 +52,11 @@ return sMsg; } + +std::basic_string<TCHAR> Util::GetDateTimeStr() +{ + time_t t; + std::time(&t); + return _tctime(&t); +} + Modified: trunk/OpenMPT/mptrack/misc_util.h =================================================================== --- trunk/OpenMPT/mptrack/misc_util.h 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/mptrack/misc_util.h 2011-01-02 16:10:49 UTC (rev 780) @@ -53,6 +53,7 @@ { #if _HAS_TR1 static_assert(std::tr1::is_pointer<T>::value == false, "Won't memset pointers."); + static_assert(std::tr1::is_pod<T>::value == true, "Won't memset non-pods."); #endif memset(&a, 0, sizeof(T)); } @@ -224,6 +225,9 @@ // Returns maximum value of given integer type. template <class T> inline T MaxValueOfType(const T&) {static_assert(std::numeric_limits<T>::is_integer == true, "Only interger types are allowed."); return (std::numeric_limits<T>::max)();} + + // Returns string containing date and time ended with newline. + std::basic_string<TCHAR> GetDateTimeStr(); }; #endif Modified: trunk/OpenMPT/soundlib/Load_ams.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ams.cpp 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/soundlib/Load_ams.cpp 2011-01-02 16:10:49 UTC (rev 780) @@ -349,10 +349,11 @@ #pragma pack() -bool CSoundFile::ReadAMS2(LPCBYTE lpStream, DWORD dwMemLength) +bool CSoundFile::ReadAMS2(LPCBYTE /*lpStream*/, DWORD /*dwMemLength*/) //------------------------------------------------------------ { return false; +#if 0 const AMS2FILEHEADER *pfh = (AMS2FILEHEADER *)lpStream; AMS2SONGHEADER *psh; DWORD dwMemPos; @@ -590,6 +591,7 @@ dwMemPos += ReadSample(&Samples[iSmp], flags, (LPSTR)(lpStream+dwMemPos), dwMemLength-dwMemPos); } return true; +#endif } Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-02 16:10:49 UTC (rev 780) @@ -1269,6 +1269,7 @@ for(size_t n = start; n < num; n++) { tm loadDate; + MemsetZero(loadDate); uint32 openTime; if(n < num - 1) @@ -1281,7 +1282,14 @@ { // Current ("new") timestamp const time_t creationTime = pModDoc->GetCreationTime(); - localtime_s(&loadDate, &creationTime); + //localtime_s(&loadDate, &creationTime); + const tm* const p = localtime(&creationTime); + if (p != nullptr) + loadDate = *p; + else if (pSndFile->GetModDocPtr() != nullptr) + pSndFile->GetModDocPtr()->AddLogEvent(LogEventUnexpectedError, + __FUNCTION__, + _T("localtime() returned nullptr.")); openTime = (uint32)((double)difftime(time(nullptr), creationTime) * 18.2f); } Modified: trunk/OpenMPT/soundlib/SNDDEV.H =================================================================== --- trunk/OpenMPT/soundlib/SNDDEV.H 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/soundlib/SNDDEV.H 2011-01-02 16:10:49 UTC (rev 780) @@ -79,7 +79,7 @@ virtual BOOL IsOpen() = 0; virtual UINT GetCurrentLatency() = 0; virtual void SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwUser=0) = 0; - virtual UINT GetCurrentSampleRate(UINT nDevice) { return 0; } + virtual UINT GetCurrentSampleRate(UINT nDevice) { UNREFERENCED_PARAMETER(nDevice); return 0; } }; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-01-02 16:10:49 UTC (rev 780) @@ -439,13 +439,14 @@ CTuningCollection* CSoundFile::s_pTuningsSharedLocal(0); uint8 CSoundFile::s_DefaultPlugVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE; - +#pragma warning(disable : 4355) // "'this' : used in base member initializer list" CSoundFile::CSoundFile() : Patterns(*this), Order(*this), m_PlaybackEventer(*this), m_pModSpecs(&ModSpecs::itEx), m_MIDIMapper(*this) +#pragma warning(default : 4355) // "'this' : used in base member initializer list" //---------------------- { m_nType = MOD_TYPE_NONE; @@ -1532,7 +1533,7 @@ //added to position i. If index of some current channel is missing from the //newOrder-vector, then the channel gets removed. - CHANNELINDEX nRemainingChannels = newOrder.size(); + const CHANNELINDEX nRemainingChannels = static_cast<CHANNELINDEX>(newOrder.size()); if(nRemainingChannels > GetModSpecifications().channelsMax || nRemainingChannels < GetModSpecifications().channelsMin) { @@ -2587,10 +2588,9 @@ transp++; ftune -= 128; } - if (transp > 127) transp = 127; - if (transp < -127) transp = -127; - psmp->RelativeTone = transp; - psmp->nFineTune = ftune; + Limit(transp, -127, 127); + psmp->RelativeTone = static_cast<int8>(transp); + psmp->nFineTune = static_cast<int8>(ftune); } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/soundlib/Sndfile.h 2011-01-02 16:10:49 UTC (rev 780) @@ -25,7 +25,7 @@ #include <aeffect.h> // VST #else typedef int32 VstInt32; -typedef int32 VstIntPtr; +typedef intptr_t VstIntPtr; #endif class CTuningBase; @@ -660,6 +660,7 @@ inline bool TypeIsXM_MOD() const { return (m_nType & (MOD_TYPE_XM | MOD_TYPE_MOD)) != 0; } inline bool TypeIsMOD_S3M() const { return (m_nType & (MOD_TYPE_MOD | MOD_TYPE_S3M)) != 0; } CModDoc* GetpModDoc() const { return m_pModDoc; } + CModDoc* GetModDocPtr() const { return m_pModDoc; } void SetMasterVolume(UINT vol, bool adjustAGC = false); UINT GetMasterVolume() const { return m_nMasterVolume; } Modified: trunk/OpenMPT/unlha/UNLHA32.H =================================================================== --- trunk/OpenMPT/unlha/UNLHA32.H 2010-12-31 20:58:02 UTC (rev 779) +++ trunk/OpenMPT/unlha/UNLHA32.H 2011-01-02 16:10:49 UTC (rev 780) @@ -81,7 +81,7 @@ protected: void setup_get(char *p) { get_ptr = p; } int get_byte() { return (*get_ptr++ & 0xff); } - unsigned short get_word() { int b0, b1; b0 = get_byte(); b1 = get_byte(); return (b1 << 8) + b0; } + unsigned short get_word() { int b0, b1; b0 = get_byte(); b1 = get_byte(); return static_cast<unsigned short>((b1 << 8) + b0); } long get_longword() { long b0, b1, b2, b3; b0 = get_byte(); b1 = get_byte(); b2 = get_byte(); b3 = get_byte(); return (b3 << 24) + (b2 << 16) + (b1 << 8) + b0; } BOOL get_header(DWORD &fp, LzHeader *hdr); VOID make_crctable(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-01-03 14:49:29
|
Revision: 781 http://modplug.svn.sourceforge.net/modplug/?rev=781&view=rev Author: saga-games Date: 2011-01-03 14:49:21 +0000 (Mon, 03 Jan 2011) Log Message: ----------- [Fix] High notes were broken in XM files since rev.764 (http://bugs.openmpt.org/view.php?id=55) [Mod] When using the ACM MP3 codec, 320kbit/s bitrate should now theoretically be available. [Mod] Updated copyright year [Mod] Updated history.txt [Mod] OpenMPT: Version is now 1.19.00.18 [Ref] Minor refactoring in ctrl_smp.cpp, vstplug.cpp Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/packageTemplate/History.txt trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-01-02 16:10:49 UTC (rev 780) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-01-03 14:49:21 UTC (rev 781) @@ -45,8 +45,9 @@ // Deduce exponent from equation : v = 2^exponent int PowerOf2Exponent(const unsigned int v) { - float v2f = (float)v; - return ( (*(int *)&v2f >> 23) & 0xff ) - 127; + return (int)_logb((double)v); + //float v2f = (float)v; + //return ( (*(int *)&v2f >> 23) & 0xff ) - 127; } // -! TEST#0029 @@ -1075,7 +1076,7 @@ { if ((m_pModDoc) && (m_pSndFile)) { - // Fix (bug report 1366). + // Commented out line to fix http://forum.openmpt.org/index.php?topic=1366.0 // if ((m_pSndFile->IsPaused()) && (m_pModDoc->IsNotePlaying(0, m_nSample, 0))) if (m_pModDoc->IsNotePlaying(0, m_nSample, 0)) { @@ -1378,9 +1379,8 @@ dwEnd = pSmp->nLength; } - smplsize = (pSmp->uFlags & CHN_16BIT) ? 2 : 1; - if (pSmp->uFlags & CHN_STEREO) smplsize *= 2; - newsmplsize = (pSmp->uFlags & CHN_STEREO) ? 4 : 2; + smplsize = pSmp->GetBytesPerSample(); + newsmplsize = pSmp->GetNumChannels() * 2; // new sample is always 16-Bit pOriginal = pSmp->pSample; dwNewLen = pSmp->nLength + (dwEnd-dwStart); pNewSample = NULL; @@ -1389,7 +1389,7 @@ { m_pModDoc->GetSampleUndo()->PrepareUndo(m_nSample, sundo_replace); - UINT nCh = (pSmp->uFlags & CHN_STEREO) ? 2 : 1; + const UINT nCh = pSmp->GetNumChannels(); for (UINT iCh=0; iCh<nCh; iCh++) { int len = dwEnd-dwStart; @@ -1526,8 +1526,7 @@ dwStart = 0; dwEnd = pSmp->nLength; } - smplsize = (pSmp->uFlags & CHN_16BIT) ? 2 : 1; - if (pSmp->uFlags & CHN_STEREO) smplsize *= 2; + smplsize = pSmp->GetSampleSizeInBytes(); pOriginal = pSmp->pSample; dwRemove = (dwEnd-dwStart+1)>>1; dwNewLen = pSmp->nLength - dwRemove; @@ -1539,7 +1538,7 @@ m_pModDoc->GetSampleUndo()->PrepareUndo(m_nSample, sundo_replace); - UINT nCh = (pSmp->uFlags & CHN_STEREO) ? 2 : 1; + const UINT nCh = pSmp->GetNumChannels(); for (UINT iCh=0; iCh<nCh; iCh++) { int len = dwRemove; @@ -2599,7 +2598,7 @@ if(pSmp->uFlags & CHN_LOOP) { /* only update sample buffer if the loop is actually enabled - (resets sound without any reason otherwise) - bug report 1874 */ + (resets sound without any reason otherwise) - http://forum.openmpt.org/index.php?topic=1874.0 */ m_pModDoc->AdjustEndOfSample(m_nSample); } m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); @@ -2620,7 +2619,7 @@ if(pSmp->uFlags & CHN_LOOP) { /* only update sample buffer if the loop is actually enabled - (resets sound without any reason otherwise) - bug report 1874 */ + (resets sound without any reason otherwise) - http://forum.openmpt.org/index.php?topic=1874.0 */ m_pModDoc->AdjustEndOfSample(m_nSample); } m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-01-02 16:10:49 UTC (rev 780) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-01-03 14:49:21 UTC (rev 781) @@ -802,13 +802,6 @@ // Initialize OLE MFC support AfxOleInit(); // Standard initialization -/* -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif -*/ // Change the registry key under which our settings are stored. //SetRegistryKey(_T("Olivier Lapicque")); @@ -1793,12 +1786,12 @@ const char* const pArrCredit = { "OpenMPT / ModPlug Tracker|" - "Copyright \xA9 2004-2010 Contributors|" + "Copyright \xA9 2004-2011 Contributors|" "Copyright \xA9 1997-2003 Olivier Lapicque (ol...@mo...)|" "|" "Contributors:|" - "Ahti Lepp\xE4nen (2005-2010)|" - "Johannes Schultz (2008-2010)|" + "Ahti Lepp\xE4nen (2005-2011)|" + "Johannes Schultz (2008-2011)|" "Robin Fernandes (2004-2007)|" "Sergiy Pylypenko (2007)|" "Eric Chavanon (2004-2005)|" @@ -2708,6 +2701,7 @@ } switch(iFmt & 7) { + case 5: wfx.wfx.nAvgBytesPerSec = 320/8; break; case 4: wfx.wfx.nAvgBytesPerSec = 64/8; break; case 3: wfx.wfx.nAvgBytesPerSec = 96/8; break; case 2: wfx.wfx.nAvgBytesPerSec = 128/8; break; Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-01-02 16:10:49 UTC (rev 780) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-01-03 14:49:21 UTC (rev 781) @@ -671,7 +671,8 @@ if(pModDoc->GetSoundFile() && pModDoc->GetSoundFile()->GetModSpecifications().supportsPlugins) CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc); } - //Could be used to update general tab in real time, but causes flickers in treeview + // Could be used to update general tab in real time, but causes flickers in treeview + // Better idea: add an update hint just for plugin params? //pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL); } @@ -789,7 +790,7 @@ timeInfo.timeSigDenominator = 4; //gcd(pSndFile->m_nCurrentRowsPerMeasure, pSndFile->m_nCurrentRowsPerBeat); } } - return (VstIntPtr)&timeInfo; + return ToVstPtr(&timeInfo); } // VstEvents* in <ptr> // We don't support plugs that send VSTEvents to the host @@ -891,7 +892,7 @@ // Not entirely sure what this means. We can write automation TO the plug. // Is that "read" in this context? //Log("VST plugin to host: Get Automation State\n"); - return 2; + return kVstAutomationRead; case audioMasterOfflineStart: Log("VST plugin to host: Offlinestart\n"); @@ -972,8 +973,8 @@ break; // get plug directory, FSSpec on MAC, else char* case audioMasterGetDirectory: - Log("VST plugin to host: Get Directory\n"); - break; + //Log("VST plugin to host: Get Directory\n"); + return ToVstPtr(CMainFrame::GetDefaultDirectory(DIR_PLUGINS)); // something has changed, update 'multi-fx' display case audioMasterUpdateDisplay: if (effect && effect->resvd1) @@ -1064,13 +1065,13 @@ VstFileType *pType = &(pFileSel->fileTypes[i]); extensions += pType->name; extensions += "|"; -#if (defined(WIN32) || defined(WINDOWS)) +#if (defined(WIN32) || (defined(WINDOWS) && WINDOWS == 1)) extensions += "*."; extensions += pType->dosType; -#elif defined(MAC) +#elif defined(MAC) && MAC == 1 extensions += "*"; extensions += pType->macType; -#elif defined(UNIX) +#elif defined(UNIX) && UNIX == 1 extensions += "*."; extensions += pType->unixType; #else @@ -1315,7 +1316,7 @@ } _PROBLEMATIC_PLUG, *PPROBLEMATIC_PLUG; //TODO: Check whether the list is still valid. -#define NUM_PROBLEMPLUGS 3 +#define NUM_PROBLEMPLUGS 2 static _PROBLEMATIC_PLUG gProblemPlugs[NUM_PROBLEMPLUGS] = { {kEffectMagic, CCONST('N', 'i', '4', 'S'), 1, "Native Instruments B4", "* v1.1.1 hangs on playback. Do not proceed unless you have v1.1.5. *"}, @@ -1762,7 +1763,7 @@ //rewbs.VSTcompliance //Store a pointer so we can get the CVstPlugin object from the basic VST effect object. //Assuming 32bit address space... - m_pEffect->resvd1=(VstIntPtr)this; + m_pEffect->resvd1=ToVstPtr(this); //rewbs.plugDocAware m_pSndFile = pSndFile; m_pModDoc = pSndFile->GetpModDoc(); @@ -1770,7 +1771,8 @@ //end rewbs.plugDocAware Dispatch(effOpen, 0, 0, NULL, 0); - m_bIsVst2 = (CVstPlugin::Dispatch(effGetVstVersion, 0,0, NULL, 0) >= 2) ? TRUE : FALSE; + // VST 2.0 plugins return 2 here, VST 2.4 plugins return 2400... Great! + m_bIsVst2 = (CVstPlugin::Dispatch(effGetVstVersion, 0,0, NULL, 0) >= 2) ? true : false; if (m_bIsVst2) { // Set VST speaker in/out setup to Stereo. Required for some plugins (possibly all VST 2.4+ plugins?) @@ -1802,7 +1804,7 @@ } } // For now, input setup = output setup. - Dispatch(effSetSpeakerArrangement, 0, (VstIntPtr)(&sa), &sa, 0.0f); + Dispatch(effSetSpeakerArrangement, 0, ToVstPtr(&sa), &sa, 0.0f); // Dummy pin properties collection. // We don't use them but some plugs might do inits in here. @@ -2302,18 +2304,20 @@ } void CVstPlugin::Suspend() +//------------------------ { try { Dispatch(effStopProcess, 0, 0, NULL, 0.0f); Dispatch(effMainsChanged, 0, 0, NULL, 0.0f); // calls plugin's suspend m_bPlugResumed=false; } catch (...) { - CVstPluginManager::ReportPlugException("Exception in Resume() (Plugin=%s)\n", m_pFactory->szLibraryName); + CVstPluginManager::ReportPlugException("Exception in Suspend() (Plugin=%s)\n", m_pFactory->szLibraryName); } } void CVstPlugin::ProcessVSTEvents() +//--------------------------------- { // Process VST events if ((m_pEffect) && (m_pEffect->dispatcher) && (m_pEvList) && (m_pEvList->numEvents > 0)) @@ -2351,8 +2355,9 @@ } -void CVstPlugin::SetDryRatio(UINT param) { -//---------------------------------------- +void CVstPlugin::SetDryRatio(UINT param) +//-------------------------------------- +{ param = min(param, 127); m_pMixStruct->fDryRatio = 1.0-(static_cast<float>(param)/127.0f); } Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2011-01-02 16:10:49 UTC (rev 780) +++ trunk/OpenMPT/mptrack/Vstplug.h 2011-01-03 14:49:21 UTC (rev 781) @@ -71,7 +71,7 @@ void (*m_pProcessFP)(AEffect*, float**, float**, VstInt32); //Function pointer to AEffect processReplacing if supported, else process. CAbstractVstEditor *m_pEditor; //rewbs.defaultPlugGUI UINT m_nSampleRate; - BOOL m_bIsVst2; + bool m_bIsVst2; SNDMIXPLUGINSTATE m_MixState; UINT m_nInputs, m_nOutputs; VstEvents *m_pEvList; Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-01-02 16:10:49 UTC (rev 780) +++ trunk/OpenMPT/mptrack/version.h 2011-01-03 14:49:21 UTC (rev 781) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 00 -#define VER_MINORMINOR 17 +#define VER_MINORMINOR 18 //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/packageTemplate/History.txt =================================================================== --- trunk/OpenMPT/packageTemplate/History.txt 2011-01-02 16:10:49 UTC (rev 780) +++ trunk/OpenMPT/packageTemplate/History.txt 2011-01-03 14:49:21 UTC (rev 781) @@ -10,22 +10,35 @@ (tx XYZ): thanks to XYZ for telling us about the bug -v1.19.01.00 (October 2010, revision 757) +v1.19.01.00 (January 2011, revision 781) ---------------------------------------- Pattern tab + [New] <Jojo> Clicking and dragging the row numbers selects the whole row now (Excel / Calc style) - see http://bugs.openmpt.org/view.php?id=45 [New] <Jojo> Experimental feature: Play the whole pattern row when entering notes and chords into the pattern editor. This can be enabled from the setup screen. [Mod] <Jojo> Using the Goto Dialog should now update channel parameters and set the elapsed time. (http://bugs.openmpt.org/view.php?id=28) + [Mod] <Jojo> Undo steps have been increased from 100 to 1000. [Fix] <Jojo> Cursor paste was possible even when editing was disabled. + [Fix] <Jojo> Using Right-Click -> Change Plugin on PC notes did not work for plugin numbers that were higher than the highest instrument number. [Fix] <Jojo> When entering chords into the pattern editor, the module was only marked as modified if the base note of the chord was changed. [Fix] <Jojo> When jumping to an order which is normally not played, the song variables are now reset (previously, if the main song had f.e. a global volume fade out at the end, this was retained when switching to an unplayed order, effectively muting all sub songs). + [Fix] <Jojo> OpenMPT should not crash anymore when applying the Amplify command on a pattern selection that just covers the note / instrument column of the first channel. [Reg] <Jojo> The "Position aware timer" option is gone. The position aware timer is now automatically used. It was optional in the first place because of some buggy code, which is now fixed. Pattern tab::Note properties [Fix] <Jojo> The meaning of Q0x was displayed wrong for S3M / IT. + [Fix] <Jojo> Changing a value didn't create an undo point. (http://bugs.openmpt.org/view.php?id=56) +Pattern tab::Find/replace + [New] <Jojo> Added Find / Replace mode: Find in current pattern selection. + [Imp] <Jojo> When changing the content of a combobox, the corresponding checkbox is now automatically checked. Likewise, the "Replace By" checkbox is checked if a checkbox or combobox on the "Replace" tab is enabled. + [Mod] <Jojo> "Replace All" just creates one undo point now. + Sample tab + [New] <Jojo> The new "sample grid" feature can create equally-sized sample selections, so it is f.e. easy to split a sample into four equally-sized samples. [Imp] <re> Ctrl + Mouse Wheel can now be used for zooming into the sample data. + [Mod] <Jojo> Undo steps have been increased from 100 to 1000. [Fix] <Jojo> When cutting samples with a loop, the loop end point was not always moved correctly if the cut start was in the loop. + [Fix] <re> Changing zoom level should now preserve the view position better. Instrument tab [Imp] <re> Ctrl + Mouse Wheel can now be used for zooming into the envelopes. @@ -37,14 +50,14 @@ [Imp] <Jojo> Sample sustain loops are now converted to normal loops if needed and possible. [Imp] <Jojo> Bidi loops are disabled when converting to MOD / S3M now. [Imp] <Jojo> More warnings are shown, old warning messages were improved. + [Imp] <Jojo> Volume command priority when converting from XM to IT / S3M has been changed - Cxx overrides vxx in XM, so this is now taken into account. [Fix] <Jojo> Q0y means "no volume change" in S3M / IT, but R0y means "continue volume change" in FT2, and converting from IT / S3M to XM didn't consider this. Q0y is now converted to R8y, and E9y is now converted to Q0y (instead of Q8y). Playback - [New] <Jojo> 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. Please use compatible mixing levels when working with legacy formats from now on. + [New] <Jojo> 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, and it forces soft panning to be *disabled*. Please use compatible mixing levels when working with legacy formats from now on. [Imp] <Jojo> Improved the algorithm for finding a free channel for note playback in the editor (does not affect normal module playback). [Fix] <Jojo> Pattern jumps to the same row + pattern as the jump command are not ignored anymore. (http://forum.openmpt.org/index.php?topic=1810.0) - IT [New] <Jojo> Edit history information can now be read from IT files and saved to IT / MPTM files. This is based on an undocumented feature in Impulse Tracker. Use View -> Edit History for viewing or deleting this information. [Imp] <Jojo> ITs made with Modplug Tracker 1.00a5 are now also detected as such. @@ -79,11 +92,14 @@ [Mod] <Jojo> Changed some code in the S3M loader that should only affect really broken S3M files which every player handles different anyway (at least my broken version of aa-polym.s3m sounds better now) [Fix] <Jojo> Octave 8 was allowed in S3M files while it shouldn't (it wasn't even saved in the file) [Fix] <Jojo> Removed the X param (#) effect from the supported effect list. - [Fix] <Jojo> Speed and tempo values are now adjusted to what Screamtracker actually expects (speed 1 - 254, tempo 32 - 255) - anything out of this range is ignored by Screamtracker, so it is now also ignored by OpenMPT. + [Fix] <Jojo> Speed and tempo values are now adjusted to what Scream Tracker actually expects (speed 1 - 254, tempo 32 - 255) - anything out of this range is ignored by Scream Tracker, so it is now also ignored by OpenMPT. VST + [New] <Jojo> Plugins can now request common file dialogs (file and directory selection). [Mod] <Jojo> When automatically inserting a new instrument from the VST editor, the bank and patch values are now not filled in anymore, so it is easier to change to another patch while editing. - [Fix] <Jojo> VST: The time signature sent to VST plugins should be correct now. + [Mod] <Jojo> Various small improvements to support VST 2.4 plugins better. + [Fix] <Jojo> Speaker arrangement is now sent to the plugins upon initialization. This fixes Voxengo SPAN 2 (a VST 2.4 plugin). Does this break other multichannel plugins? + [Fix] <Jojo> The time signature sent to VST plugins should be correct now. Other modules [Imp] <Jojo> Garbage characters in sample / instrument / song names should be gone now.. This should f.e. avoid sample names like " ntitled" turning up in modules after deleting sample names. @@ -101,7 +117,10 @@ [Mod] <Jojo> On first run, the default ASIO driver is now chosen instead of DirectSound (if there is one). [Mod] <Jojo> The "Original" mix mode now also has a version number (1.16) to reflect what the "original" thing is. [Mod] <Jojo> Updated genre list in the MP3 export dialog. + [Mod] <Jojo> When using the ACM MP3 codec, 320kbit/s bitrate should now theoretically be available. + [Mod] <Jojo> The MMX acceleration label in the Soundcard setup dialog is now updated according to the multimedia extensions that are supported by the CPU (3DNow! / SSE) [Fix] <Jojo> Mod Cleanup: Rearrange patterns was broken when using more than one sequence in the MPTM format. (tx Skaven) + [Fix] <Jojo> Mod Cleanup: Various sample / instrument rearranging functions broke PC Notes. [Fix] <Jojo> The text length was calculated wrong in the message reader, leading to a possible buffer overflow when reading song messages with mixed line endings where CR or LF line endings where expected. [Fix] <Jojo> When there was no INI file, the size of the upper pattern view was defaulting to a wrong value. [Fix] <Jojo> The ID3v2 "comments" field was not formatted properly when exporting to MP3. @@ -122,7 +141,7 @@ Pattern tab::pattern editing [Imp] <Jojo> Just like in MPT 1.16, it is now possible again to interpolate between an effect and "nothing". In that case, the same value as the already existing one is repeated between the two rows. - [Fix] <Jojo> When the first column of a pattern selection (larger than one selection field) was the parameter column, PCNote values in this column were not reset properly. + [Fix] <Jojo> When the first column of a pattern selection (larger than one selection field) was the parameter column, PC Note values in this column were not reset properly. [Fix] <Jojo> Pattern Editor: Transposing notes up/down doesn't allow notes which are actually supported by the current module format (f.e. notes below C-1 in XMs) anymore. [Fix] <Jojo> Keyboard shortcut for toggling record state didn't save the change, so it was reset with every new module. @@ -218,12 +237,12 @@ Pattern tab::pattern editing [New] <Jojo> Extended context menu for PC Notes - [New] <Jojo> Key shortcut + context menu entry for toggling the plugin editor of the PC note that's under the cursor. + [New] <Jojo> Key shortcut + context menu entry for toggling the plugin editor of the PC Note that's under the cursor. [Imp] <Jojo> Overflow paste now only uses one undo step. [Imp] <Jojo> Instead of simply ignoring note off/cut/fade when working with .MOD files, it is converted to C00. - [Fix] <rewbs> Effect visualizer is now aware of PC notes (http://forum.openmpt.org/index.php?topic=3836.0). + [Fix] <rewbs> Effect visualizer is now aware of PC Notes (http://forum.openmpt.org/index.php?topic=3836.0). [Fix] <Jojo> When using MIDI record or split keyboard settings, volume data was written into the volume column in MOD format. - [Fix] <Jojo> When converting PC Notes to MIDI Macros, the instrument index is now also cleaned as well. Noticeable for example when pasting PC notes into an IT module. + [Fix] <Jojo> When converting PC Notes to MIDI Macros, the instrument index is now also cleaned as well. Noticeable for example when pasting PC Notes into an IT module. [Fix] <Jojo> Now, plugin slot 100 can also be automated using PC Notes. [Fix] <Jojo> When pasting pattern data that exactly reached the pattern end with overflow paste enabled, a redundant undo point was created. [Fix] <Jojo> Entered (volume) effects are now properly validated (makes a difference f.e. in MOD format where it was previously possible to enter effects like Hxx) @@ -233,7 +252,7 @@ Pattern tab::GUI [New] <Jojo> When the PT1x mode or the S3M "Amiga" flag are enabled, dodgy notes (i.e lower than C-4 or higher than B-6) are marked red. - [Imp] <Jojo> The status bar shows plugin and parameter names for PC notes now as well. + [Imp] <Jojo> The status bar shows plugin and parameter names for PC Notes now as well. [Imp] <Jojo> Effect vis: Make use of song's own row highlighting variables instead of fixed global ones. [Fix] <Jojo> The status bar ("Position x of y") only the showed order length for the first sub tune if sub tunes were separated by an "---" order item. [Fix] <Jojo> Changing a channel plugin in MOD/S3M files doesn't mark them as modified anymore. @@ -421,14 +440,14 @@ [Fix] <Jojo> Pattern c&p: invalid commands are not pasted anymore. [Imp] <Jojo> If "record note off" is enabled and Note Off commands are not supported by the current format, try Note Cut and volume commands. [Mod] <Jojo> It is impossible to enter something into the volume column in MOD format now. - [Mod] <Jojo> When interpolating PC notes, the plugin number and note type won't get overridden if the note type is already PC or PCs. + [Mod] <Jojo> When interpolating PC Notes, the plugin number and note type won't get overridden if the note type is already PC or PCs. [Fix] <re> Pattern c&p: Mix paste should behave better with parameter control notes. [Fix] <Jojo> Amplify acted VERY weird when it was applied on an instrument that's not assigned to any sample. Should be a bit better now. [Fix] <Jojo> Amplify doesn't use volume column in MOD format anymore. [Fix] <Jojo> When recording live from the keyboard, SDx shouldn't exceed the song speed anymore. [Fix] <Jojo> Got rid of possible redundant undo points. - [Fix] <Jojo> PC notes are now deleted properly (last column). - [Fix] <Jojo> Copying only the param column of PC notes overwrote the value column when pasting them. + [Fix] <Jojo> PC Notes are now deleted properly (last column). + [Fix] <Jojo> Copying only the param column of PC Notes overwrote the value column when pasting them. [Fix] <Jojo> Entering Note Fade notes didn't work the "old style" way. Pattern tab::GUI @@ -721,7 +740,7 @@ [Fix] <Jojo> Don't ignore value of pattern break commands on last pattern anymore. MPTM - [New] <re> New experimental parameter controls (PC notes) for controlling plug params. + [New] <re> New experimental parameter controls (PC Notes) for controlling plug params. [New] <re> Can now have multiple sequences in a module (access from orderlist context menu). [New] <Jojo> Allow up to 240 envelope points. [New] <Jojo> IT "Note Fade" command: This existed in IT's player routines already, but there was no way to actually use it in the editor. Triggering an invalid note would cause a note fade, so this is a new note type. Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-01-02 16:10:49 UTC (rev 780) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-01-03 14:49:21 UTC (rev 781) @@ -777,8 +777,14 @@ return; } - if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MED)) note += pChn->nTranspose; - note = CLAMP(note, NOTE_MIN, NOTE_MAX); + if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MED)) + { + note += pChn->nTranspose; + note = CLAMP(note, NOTE_MIN, 131); // why 131? 120+11, how does this make sense? + } else + { + note = CLAMP(note, NOTE_MIN, NOTE_MAX); + } pChn->nNote = note; pChn->m_CalculateFreq = true; @@ -3000,6 +3006,7 @@ // TRASH IT!!! (Yes, the sample!) pModSample->pSample[pModSample->nLoopStart + pChn->nEFxOffset] = ~pModSample->pSample[pModSample->nLoopStart + pChn->nEFxOffset]; + //AdjustSampleLoop(pModSample); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-01-03 15:11:29
|
Revision: 782 http://modplug.svn.sourceforge.net/modplug/?rev=782&view=rev Author: saga-games Date: 2011-01-03 15:11:22 +0000 (Mon, 03 Jan 2011) Log Message: ----------- [Ref] Added a version of SpaceToNullStringFixed with static length checks (using another template parameter) which should be preferred over the dynamic check version if the string length is known. Modified Paths: -------------- trunk/OpenMPT/mptrack/misc_util.h trunk/OpenMPT/soundlib/LOAD_AMF.CPP trunk/OpenMPT/soundlib/LOAD_DBM.CPP trunk/OpenMPT/soundlib/LOAD_DMF.CPP trunk/OpenMPT/soundlib/LOAD_DSM.CPP trunk/OpenMPT/soundlib/Load_669.cpp trunk/OpenMPT/soundlib/Load_ams.cpp trunk/OpenMPT/soundlib/Load_far.cpp trunk/OpenMPT/soundlib/Load_gdm.cpp trunk/OpenMPT/soundlib/Load_imf.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_mdl.cpp trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Load_mt2.cpp trunk/OpenMPT/soundlib/Load_mtm.cpp trunk/OpenMPT/soundlib/Load_okt.cpp trunk/OpenMPT/soundlib/Load_psm.cpp trunk/OpenMPT/soundlib/Load_ptm.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/Load_stm.cpp trunk/OpenMPT/soundlib/Load_ult.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/load_j2b.cpp Modified: trunk/OpenMPT/mptrack/misc_util.h =================================================================== --- trunk/OpenMPT/mptrack/misc_util.h 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/mptrack/misc_util.h 2011-01-03 15:11:22 UTC (rev 782) @@ -189,23 +189,45 @@ //-------------------------------------- { STATIC_ASSERT(size > 0); - bool overwrite = false; - for(size_t pos = 0; pos < size; pos++) + size_t pos = 0; + // Find the first null char. + while(buffer[pos] != '\0' && pos < size) { - if(overwrite) - buffer[pos] = 0; - else if(buffer[pos] == 0) - overwrite = true; + pos++; } + // Remove everything after the null char. + while(pos < size) + { + buffer[pos++] = '\0'; + } } -// Convert a space-padded string to a 0-terminated string. -// Additional parameter to specifify the max length of the final string, +// Convert a space-padded string to a 0-terminated string. STATIC VERSION! (use this if the maximum string length is known) +// Additional template parameter to specifify the max length of the final string, // not including null char (useful for e.g. mod loaders) +template <size_t length, size_t size> +void SpaceToNullStringFixed(char (&buffer)[size]) +//------------------------------------------------ +{ + STATIC_ASSERT(size > 0); + STATIC_ASSERT(length < size); + // Remove Nulls in string + SpaceToNullString(buffer); + // Overwrite trailing chars + for(size_t pos = length; pos < size; pos++) + { + buffer[pos] = 0; + } +} + + +// Convert a space-padded string to a 0-terminated string. DYNAMIC VERSION! +// Additional function parameter to specifify the max length of the final string, +// not including null char (useful for e.g. mod loaders) template <size_t size> -void SpaceToNullStringFixed(char (&buffer)[size], const size_t length) -//-------------------------------------------------------------------- +void SpaceToNullStringFixed(char (&buffer)[size], size_t length) +//-------------------------------------------------------------- { STATIC_ASSERT(size > 0); ASSERT(length < size); Modified: trunk/OpenMPT/soundlib/LOAD_AMF.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2011-01-03 15:11:22 UTC (rev 782) @@ -201,7 +201,7 @@ { MODSAMPLE *psmp = &Samples[iSmp+1]; memcpy(m_szNames[iSmp + 1], lpStream+dwMemPos, 22); - SpaceToNullStringFixed(m_szNames[iSmp + 1], 22); + SpaceToNullStringFixed<22>(m_szNames[iSmp + 1]); psmp->nFineTune = MOD2XMFineTune(lpStream[dwMemPos+22]); psmp->nVolume = lpStream[dwMemPos+23]; psmp->nGlobalVol = 64; @@ -273,7 +273,7 @@ || (pfh->numchannels < 1) || (pfh->numchannels > 32)) return false; memcpy(m_szNames[0], pfh->title, 31); - SpaceToNullStringFixed(m_szNames[0], 31); + SpaceToNullStringFixed<31>(m_szNames[0]); dwMemPos = sizeof(AMFFILEHEADER); m_nType = MOD_TYPE_AMF; m_nChannels = pfh->numchannels; @@ -334,8 +334,8 @@ dwMemPos += sizeof(AMFSAMPLE); memcpy(m_szNames[iIns+1], psh->samplename, 31); memcpy(pSmp->filename, psh->filename, 13); - SpaceToNullStringFixed(m_szNames[iIns + 1], 31); - SpaceToNullStringFixed(pSmp->filename, 13); + SpaceToNullStringFixed<31>(m_szNames[iIns + 1]); + SpaceToNullStringFixed<13>(pSmp->filename); pSmp->nLength = LittleEndian(psh->length); pSmp->nC5Speed = LittleEndianW(psh->c2spd); pSmp->nGlobalVol = 64; Modified: trunk/OpenMPT/soundlib/LOAD_DBM.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DBM.CPP 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/LOAD_DBM.CPP 2011-01-03 15:11:22 UTC (rev 782) @@ -196,7 +196,7 @@ m_nType = MOD_TYPE_DBM; m_nChannels = CLAMP(BigEndianW(pfh->channels), 1, MAX_BASECHANNELS); // note: MAX_BASECHANNELS is currently 127, but DBM supports up to 128 channels. memcpy(m_szNames[0], (pfh->songname[0]) ? pfh->songname : pfh->songname2, 32); - SpaceToNullStringFixed(m_szNames[0], 31); + SpaceToNullStringFixed<31>(m_szNames[0]); Order.resize(nOrders, Order.GetInvalidPatIndex()); for (UINT iOrd=0; iOrd < nOrders; iOrd++) { @@ -235,11 +235,11 @@ nsmp = BigEndianW(pih->sampleno); psmp = ((nsmp) && (nsmp < MAX_SAMPLES)) ? &Samples[nsmp] : nullptr; memcpy(pIns->name, pih->name, 30); - SpaceToNullStringFixed(pIns->name, 30); + SpaceToNullStringFixed<30>(pIns->name); if (psmp) { memcpy(m_szNames[nsmp], pih->name, 30); - SpaceToNullStringFixed(m_szNames[nsmp], 30); + SpaceToNullStringFixed<30>(m_szNames[nsmp]); } pIns->nFadeOut = 1024; // ??? Modified: trunk/OpenMPT/soundlib/LOAD_DMF.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2011-01-03 15:11:22 UTC (rev 782) @@ -100,7 +100,7 @@ if ((pfh->id != 0x464d4444) || (!pfh->version) || (pfh->version & 0xF0)) return false; dwMemPos = 66; memcpy(m_szNames[0], pfh->songname, 30); - SpaceToNullStringFixed(m_szNames[0], 30); + SpaceToNullStringFixed<30>(m_szNames[0]); m_nType = MOD_TYPE_DMF; m_nChannels = 0; #ifdef DMFLOG Modified: trunk/OpenMPT/soundlib/LOAD_DSM.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2011-01-03 15:11:22 UTC (rev 782) @@ -121,7 +121,7 @@ } } memcpy(m_szNames[0], psong->songname, 28); - SpaceToNullStringFixed(m_szNames[0], 28); + SpaceToNullStringFixed<28>(m_szNames[0]); nPat = 0; nSmp = 1; while (dwMemPos < dwMemLength - 8) @@ -215,10 +215,10 @@ DWORD dwPos = dwMemPos + sizeof(DSMSAMPLE); dwMemPos += 8 + pSmp->inst_len; memcpy(m_szNames[nSmp], pSmp->samplename, 28); - SpaceToNullStringFixed(m_szNames[nSmp], 28); + SpaceToNullStringFixed<28>(m_szNames[nSmp]); MODSAMPLE *psmp = &Samples[nSmp]; memcpy(psmp->filename, pSmp->filename, 13); - SpaceToNullStringFixed(psmp->filename, 13); + SpaceToNullStringFixed<13>(psmp->filename); psmp->nGlobalVol = 64; psmp->nC5Speed = pSmp->c2spd; psmp->uFlags = (WORD)((pSmp->flags & 1) ? CHN_LOOP : 0); Modified: trunk/OpenMPT/soundlib/Load_669.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_669.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_669.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -70,7 +70,7 @@ m_nChannels = 8; memcpy(m_szNames[0], pfh->songmessage, 16); - SpaceToNullStringFixed(m_szNames[0], 16); + SpaceToNullStringFixed<16>(m_szNames[0]); m_nSamples = pfh->samples; for (SAMPLEINDEX nSmp = 1; nSmp <= m_nSamples; nSmp++, psmp++) @@ -87,7 +87,7 @@ Samples[nSmp].nLoopEnd = loopend; if (loopend) Samples[nSmp].uFlags |= CHN_LOOP; memcpy(m_szNames[nSmp], psmp->filename, 13); - SpaceToNullStringFixed(m_szNames[nSmp], 13); + SpaceToNullStringFixed<13>(m_szNames[nSmp]); Samples[nSmp].nVolume = 256; Samples[nSmp].nGlobalVol = 64; Samples[nSmp].nPan = 128; Modified: trunk/OpenMPT/soundlib/Load_ams.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ams.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_ams.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -599,6 +599,7 @@ // AMS Sample unpacking void AMSUnpack(const char *psrc, UINT inputlen, char *pdest, UINT dmax, char packcharacter) +//----------------------------------------------------------------------------------------- { UINT tmplen = dmax; signed char *amstmp = new signed char[tmplen]; Modified: trunk/OpenMPT/soundlib/Load_far.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_far.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_far.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -88,7 +88,7 @@ m_nDefaultGlobalVolume = MAX_GLOBAL_VOLUME; memcpy(m_szNames[0], pmh1->songname, 31); - SpaceToNullStringFixed(m_szNames[0], 31); + SpaceToNullStringFixed<31>(m_szNames[0]); // Channel Setting for (UINT nchpan=0; nchpan<16; nchpan++) @@ -246,7 +246,7 @@ dwMemPos += sizeof(FARSAMPLE); m_nSamples = ismp + 1; memcpy(m_szNames[ismp+1], pfs->samplename, 31); - SpaceToNullStringFixed(m_szNames[ismp + 1], 31); + SpaceToNullStringFixed<31>(m_szNames[ismp + 1]); const DWORD length = LittleEndian( pfs->length ); pSmp->nLength = length; pSmp->nLoopStart = LittleEndian(pfs->reppos) ; Modified: trunk/OpenMPT/soundlib/Load_gdm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_gdm.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_gdm.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -102,7 +102,7 @@ // song name memset(m_szNames, 0, sizeof(m_szNames)); memcpy(m_szNames[0], pHeader->SongTitle, 32); - SpaceToNullStringFixed(m_szNames[0], 31); + SpaceToNullStringFixed<31>(m_szNames[0]); // read channel pan map... 0...15 = channel panning, 16 = surround channel, 255 = channel does not exist m_nChannels = 32; @@ -163,9 +163,9 @@ // sample header memcpy(m_szNames[iSmp], pSample->SamName, 32); - SpaceToNullStringFixed(m_szNames[iSmp], 31); + SpaceToNullStringFixed<31>(m_szNames[iSmp]); memcpy(Samples[iSmp].filename, pSample->FileName, 12); - SpaceToNullStringFixed(Samples[iSmp].filename, 12); + SpaceToNullStringFixed<12>(Samples[iSmp].filename); Samples[iSmp].nC5Speed = LittleEndianW(pSample->C4Hertz); Samples[iSmp].nGlobalVol = 256; // not supported in this format Modified: trunk/OpenMPT/soundlib/Load_imf.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_imf.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_imf.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -291,7 +291,7 @@ // song name memset(m_szNames, 0, sizeof(m_szNames)); memcpy(m_szNames[0], hdr.title, 31); - SpaceToNullStringFixed(m_szNames[0], 31); + SpaceToNullStringFixed<31>(m_szNames[0]); if (hdr.flags & 1) m_dwSongFlags |= SONG_LINEARSLIDES; @@ -310,7 +310,7 @@ ChnSettings[nChn].nPan *= 4; memcpy(ChnSettings[nChn].szName, hdr.channels[nChn].name, 12); - SpaceToNullStringFixed(ChnSettings[nChn].szName, 12); + SpaceToNullStringFixed<12>(ChnSettings[nChn].szName); // TODO: reverb/chorus? switch(hdr.channels[nChn].status) @@ -503,7 +503,7 @@ SetDefaultInstrumentValues(pIns); memcpy(pIns->name, imfins.name, 31); - SpaceToNullStringFixed(pIns->name, 31); + SpaceToNullStringFixed<31>(pIns->name); if(imfins.smpnum) { @@ -542,7 +542,7 @@ return false; memcpy(pSample->filename, imfsmp.filename, 12); - SpaceToNullStringFixed(pSample->filename, 12); + SpaceToNullStringFixed<12>(pSample->filename); strcpy(m_szNames[m_nSamples], pSample->filename); blen = pSample->nLength = LittleEndian(imfsmp.length); Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -298,8 +298,8 @@ const ITOLDINSTRUMENT *pis = (const ITOLDINSTRUMENT *)p; memcpy(pIns->name, pis->name, 26); memcpy(pIns->filename, pis->filename, 12); - SpaceToNullStringFixed(pIns->name, 26); - SpaceToNullStringFixed(pIns->filename, 12); + SpaceToNullStringFixed<26>(pIns->name); + SpaceToNullStringFixed<12>(pIns->filename); pIns->nFadeOut = pis->fadeout << 6; pIns->nGlobalVol = 64; for (UINT j=0; j<NOTE_MAX; j++) @@ -340,8 +340,8 @@ const ITINSTRUMENT *pis = (const ITINSTRUMENT *)p; memcpy(pIns->name, pis->name, 26); memcpy(pIns->filename, pis->filename, 12); - SpaceToNullStringFixed(pIns->name, 26); - SpaceToNullStringFixed(pIns->filename, 12); + SpaceToNullStringFixed<26>(pIns->name); + SpaceToNullStringFixed<12>(pIns->filename); if (pis->mpr<=128) pIns->nMidiProgram = pis->mpr; pIns->nMidiChannel = pis->mch; @@ -579,7 +579,7 @@ if (pifh->flags & 0x1000) m_dwSongFlags |= SONG_EXFILTERRANGE; memcpy(m_szNames[0], pifh->songname, 26); - SpaceToNullStringFixed(m_szNames[0], 26); + SpaceToNullStringFixed<26>(m_szNames[0]); // Global Volume m_nDefaultGlobalVolume = pifh->globalvol << 1; @@ -934,7 +934,7 @@ { MODSAMPLE *pSmp = &Samples[nsmp+1]; memcpy(pSmp->filename, pis->filename, 12); - SpaceToNullStringFixed(pSmp->filename, 12); + SpaceToNullStringFixed<12>(pSmp->filename); pSmp->uFlags = 0; pSmp->nLength = 0; pSmp->nLoopStart = pis->loopbegin; @@ -989,7 +989,7 @@ } } memcpy(m_szNames[nsmp + 1], pis->name, 26); - SpaceToNullStringFixed(m_szNames[nsmp + 1], 26); + SpaceToNullStringFixed<26>(m_szNames[nsmp + 1]); } m_nSamples = max(1, m_nSamples); Modified: trunk/OpenMPT/soundlib/Load_mdl.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mdl.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_mdl.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -275,7 +275,7 @@ #endif pmib = (MDLINFOBLOCK *)(lpStream+dwMemPos); memcpy(m_szNames[0], pmib->songname, 31); - SpaceToNullStringFixed(m_szNames[0], 31); + SpaceToNullStringFixed<31>(m_szNames[0]); norders = pmib->norders; if (norders > MAX_ORDERS) norders = MAX_ORDERS; @@ -370,7 +370,7 @@ MODINSTRUMENT *pIns = Instruments[nins]; memset(pIns, 0, sizeof(MODINSTRUMENT)); memcpy(pIns->name, lpStream+dwPos+2, 32); - SpaceToNullStringFixed(pIns->name, 31); + SpaceToNullStringFixed<31>(pIns->name); pIns->nGlobalVol = 64; pIns->nPPC = 5*12; @@ -461,8 +461,8 @@ MODSAMPLE *pSmp = &Samples[nins]; memcpy(m_szNames[nins], lpStream+dwPos+1, 31); memcpy(pSmp->filename, lpStream+dwPos+33, 8); - SpaceToNullStringFixed(m_szNames[nins], 31); - SpaceToNullStringFixed(pSmp->filename, 8); + SpaceToNullStringFixed<31>(m_szNames[nins]); + SpaceToNullStringFixed<8>(pSmp->filename); const BYTE *p = lpStream+dwPos+41; if (pmsh->version > 0) { Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -300,7 +300,7 @@ UINT loopstart, looplen; memcpy(m_szNames[i], pms->name, 22); - SpaceToNullStringFixed(m_szNames[i], 22); + SpaceToNullStringFixed<22>(m_szNames[i]); psmp->uFlags = 0; psmp->nLength = BigEndianW(pms->length)*2; dwTotalSampleLen += psmp->nLength; @@ -417,7 +417,7 @@ m_nMinPeriod = 14 << 2; m_nMaxPeriod = 3424 << 2; memcpy(m_szNames[0], lpStream, 20); - SpaceToNullStringFixed(m_szNames[0], 20); + SpaceToNullStringFixed<20>(m_szNames[0]); // Setup channel pan positions and volume SetupMODPanning(); Modified: trunk/OpenMPT/soundlib/Load_mt2.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mt2.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_mt2.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -214,7 +214,7 @@ Order[iOrd] = (PATTERNINDEX)pfh->Orders[iOrd]; } memcpy(m_szNames[0], pfh->szSongName, 32); - SpaceToNullStringFixed(m_szNames[0], 31); + SpaceToNullStringFixed<31>(m_szNames[0]); dwMemPos = sizeof(MT2FILEHEADER); nDrumDataLen = *(WORD *)(lpStream + dwMemPos); @@ -407,7 +407,7 @@ { memcpy(Instruments[iIns], &m_defaultInstrument, sizeof(MODINSTRUMENT)); memcpy(pIns->name, pmi->szName, 32); - SpaceToNullStringFixed(pIns->name, 31); + SpaceToNullStringFixed<31>(pIns->name); pIns->nGlobalVol = 64; pIns->nPan = 128; for (BYTE i = 0; i < NOTE_MAX; i++) @@ -520,7 +520,7 @@ if (iSmp < MAX_SAMPLES) { memcpy(m_szNames[iSmp], pms->szName, 31); - SpaceToNullStringFixed(m_szNames[iSmp], 31); + SpaceToNullStringFixed<31>(m_szNames[iSmp]); } if (pms->dwDataLen > 0) { Modified: trunk/OpenMPT/soundlib/Load_mtm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mtm.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_mtm.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -61,7 +61,7 @@ || (!pmh->numtracks) || (!pmh->numchannels) || (!pmh->lastpattern) || (pmh->lastpattern > MAX_PATTERNS)) return false; memcpy(m_szNames[0], pmh->songname, 20); - SpaceToNullStringFixed(m_szNames[0], 20); + SpaceToNullStringFixed<20>(m_szNames[0]); if (dwMemPos + 37 * pmh->numsamples + 128 + 192 * pmh->numtracks + 64 * (pmh->lastpattern+1) + pmh->commentsize >= dwMemLength) return false; @@ -73,7 +73,7 @@ { MTMSAMPLE *pms = (MTMSAMPLE *)(lpStream + dwMemPos); memcpy(m_szNames[i], pms->samplename, 22); - SpaceToNullStringFixed(m_szNames[i], 22); + SpaceToNullStringFixed<22>(m_szNames[i]); Samples[i].nVolume = pms->volume << 2; Samples[i].nGlobalVol = 64; UINT len = pms->length; Modified: trunk/OpenMPT/soundlib/Load_okt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_okt.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_okt.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -74,7 +74,7 @@ MemsetZero(*pSmp); strncpy(pSndFile->m_szNames[nSmp], oktsmp.name, 20); - SpaceToNullStringFixed(pSndFile->m_szNames[nSmp], 20); + SpaceToNullStringFixed<20>(pSndFile->m_szNames[nSmp]); pSmp->nC5Speed = 8287; pSmp->nGlobalVol = 64; Modified: trunk/OpenMPT/soundlib/Load_psm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_psm.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_psm.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -186,7 +186,7 @@ { case PSMCHUNKID_TITL: // "TITL" - Song Title memcpy(m_szNames[0], lpStream + dwMemPos, (chunkSize < 31) ? chunkSize : 31); - SpaceToNullStringFixed(m_szNames[0], 31); + SpaceToNullStringFixed<31>(m_szNames[0]); break; case PSMCHUNKID_SDFT: // "SDFT" - Format info (song data starts here) @@ -220,7 +220,7 @@ PSMSUBSONG subsong; subsong.restartPos = (ORDERINDEX)Order.size(); // restart order "offset": current orderlist length memcpy(subsong.songName, &pSong->songType, 9); // subsong name - SpaceToNullStringFixed(subsong.songName, 9); + SpaceToNullStringFixed<9>(subsong.songName); DWORD dwChunkPos = dwMemPos + sizeof(PSMSONGHEADER); @@ -445,9 +445,9 @@ SAMPLEINDEX smp = (SAMPLEINDEX)(LittleEndianW(pSample->sampleNumber) + 1); m_nSamples = max(m_nSamples, smp); memcpy(m_szNames[smp], pSample->sampleName, 31); - SpaceToNullStringFixed(m_szNames[smp], 31); + SpaceToNullStringFixed<31>(m_szNames[smp]); memcpy(Samples[smp].filename, pSample->fileName, 8); - SpaceToNullStringFixed(Samples[smp].filename, 8); + SpaceToNullStringFixed<8>(Samples[smp].filename); Samples[smp].nGlobalVol = 0x40; Samples[smp].nC5Speed = LittleEndianW(pSample->C5Freq); @@ -469,9 +469,9 @@ SAMPLEINDEX smp = (SAMPLEINDEX)(LittleEndianW(pSample->sampleNumber) + 1); m_nSamples = max(m_nSamples, smp); memcpy(m_szNames[smp], pSample->sampleName, 31); - SpaceToNullStringFixed(m_szNames[smp], 31); + SpaceToNullStringFixed<31>(m_szNames[smp]); memcpy(Samples[smp].filename, pSample->fileName, 8); - SpaceToNullStringFixed(Samples[smp].filename, 8); + SpaceToNullStringFixed<8>(Samples[smp].filename); Samples[smp].nGlobalVol = 0x40; Samples[smp].nC5Speed = LittleEndianW(pSample->C5Freq); @@ -895,7 +895,7 @@ memset(m_szNames, 0, sizeof(m_szNames)); memcpy(m_szNames[0], shdr->songName, 31); - SpaceToNullStringFixed(m_szNames[0], 31); + SpaceToNullStringFixed<31>(m_szNames[0]); // Read orders dwMemPos = LittleEndian(shdr->orderOffset); @@ -935,9 +935,9 @@ m_nSamples = max(m_nSamples, iSmp); memcpy(m_szNames[iSmp], smphdr->name, 24); - SpaceToNullStringFixed(m_szNames[iSmp], 24); + SpaceToNullStringFixed<24>(m_szNames[iSmp]); memcpy(Samples[iSmp].filename, smphdr->filename, 13); - SpaceToNullStringFixed(Samples[iSmp].filename, 13); + SpaceToNullStringFixed<13>(Samples[iSmp].filename); Samples[iSmp].nLength = LittleEndian(smphdr->length); Samples[iSmp].nLoopStart = LittleEndian(smphdr->loopStart); Modified: trunk/OpenMPT/soundlib/Load_ptm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ptm.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_ptm.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -91,7 +91,7 @@ || (!pfh.npatterns) || (pfh.npatterns > 128) || (SIZEOF_PTMFILEHEADER+pfh.nsamples*SIZEOF_PTMSAMPLE >= (int)dwMemLength)) return false; memcpy(m_szNames[0], pfh.songname, 28); - SpaceToNullStringFixed(m_szNames[0], 28); + SpaceToNullStringFixed<28>(m_szNames[0]); m_nType = MOD_TYPE_PTM; m_nChannels = pfh.nchannels; @@ -112,8 +112,8 @@ lstrcpyn(m_szNames[ismp+1], psmp->samplename, 28); memcpy(pSmp->filename, psmp->filename, 12); - SpaceToNullStringFixed(m_szNames[ismp + 1], 28); - SpaceToNullStringFixed(pSmp->filename, 12); + SpaceToNullStringFixed<28>(m_szNames[ismp + 1]); + SpaceToNullStringFixed<12>(pSmp->filename); pSmp->nGlobalVol = 64; pSmp->nPan = 128; Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -267,7 +267,7 @@ m_nType = MOD_TYPE_S3M; memset(m_szNames, 0, sizeof(m_szNames)); memcpy(m_szNames[0], psfh.name, 28); - SpaceToNullStringFixed(m_szNames[0], 28); + SpaceToNullStringFixed<28>(m_szNames[0]); // Speed m_nDefaultSpeed = psfh.speed; if (!m_nDefaultSpeed || m_nDefaultSpeed == 255) m_nDefaultSpeed = 6; @@ -355,13 +355,13 @@ memcpy(s, lpStream+nInd, 0x50); memcpy(Samples[iSmp].filename, s+1, 12); - SpaceToNullStringFixed(Samples[iSmp].filename, 12); + SpaceToNullStringFixed<12>(Samples[iSmp].filename); insflags[iSmp-1] = s[0x1F]; inspack[iSmp-1] = s[0x1E]; s[0x4C] = 0; lstrcpy(m_szNames[iSmp], (LPCSTR)&s[0x30]); - SpaceToNullStringFixed(m_szNames[iSmp], 28); + SpaceToNullStringFixed<28>(m_szNames[iSmp]); if ((s[0] == S3I_TYPE_PCM) && (s[0x4E] == 'R') && (s[0x4F] == 'S')) { Modified: trunk/OpenMPT/soundlib/Load_stm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_stm.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_stm.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -70,7 +70,7 @@ || ((_strnicmp(phdr->trackername, "!SCREAM!", 8)) && (_strnicmp(phdr->trackername, "BMOD2STM", 8)))) return false; memcpy(m_szNames[0], phdr->songname, 20); - SpaceToNullStringFixed(m_szNames[0], 20); + SpaceToNullStringFixed<20>(m_szNames[0]); // Read STM header m_nType = MOD_TYPE_STM; m_nSamples = 31; @@ -98,8 +98,8 @@ STMSAMPLE *pStm = &phdr->sample[nIns]; // STM sample data memcpy(pIns->filename, pStm->filename, 13); memcpy(m_szNames[nIns+1], pStm->filename, 12); - SpaceToNullStringFixed(pIns->filename, 12); - SpaceToNullStringFixed(m_szNames[nIns + 1], 12); + SpaceToNullStringFixed<12>(pIns->filename); + SpaceToNullStringFixed<12>(m_szNames[nIns + 1]); pIns->nC5Speed = LittleEndianW(pStm->c2spd); pIns->nGlobalVol = 64; pIns->nVolume = pStm->volume << 2; Modified: trunk/OpenMPT/soundlib/Load_ult.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ult.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_ult.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -371,7 +371,7 @@ memcpy(m_szNames[nSmp + 1], ultSmp.name, 32); SetNullTerminator(m_szNames[nSmp + 1]); memcpy(pSmp->filename, ultSmp.filename, 12); - SpaceToNullStringFixed(pSmp->filename, 12); + SpaceToNullStringFixed<12>(pSmp->filename); if(ultSmp.size_end <= ultSmp.size_start) continue; Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -254,7 +254,7 @@ // look for null-terminated song name - that's most likely a tune made with modplug for(int i = 0; i < 20; i++) if(lpStream[17 + i] == 0) bProbablyMadeWithModPlug = true; - SpaceToNullStringFixed(m_szNames[0], 20); + SpaceToNullStringFixed<20>(m_szNames[0]); // load and convert header memcpy(&xmheader, lpStream + 58, sizeof(XMFILEHEADER)); @@ -325,7 +325,7 @@ Instruments[iIns]->nPluginVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE; memcpy(Instruments[iIns]->name, pih.name, 22); - SpaceToNullStringFixed(Instruments[iIns]->name, 22); + SpaceToNullStringFixed<22>(Instruments[iIns]->name); memset(&xmsh, 0, sizeof(XMSAMPLEHEADER)); @@ -528,7 +528,7 @@ if (!xmss.looplen) xmss.type &= ~3; UINT imapsmp = samplemap[ins]; memcpy(m_szNames[imapsmp], xmss.name, 22); - SpaceToNullStringFixed(m_szNames[imapsmp], 22); + SpaceToNullStringFixed<22>(m_szNames[imapsmp]); MODSAMPLE *pSmp = &Samples[imapsmp]; pSmp->nLength = (xmss.samplen > MAX_SAMPLE_LENGTH) ? MAX_SAMPLE_LENGTH : xmss.samplen; pSmp->nLoopStart = xmss.loopstart; @@ -557,7 +557,7 @@ pSmp->nVibDepth = xmsh.vibdepth; pSmp->nVibRate = xmsh.vibrate; memcpy(pSmp->filename, xmss.name, 22); - SpaceToNullStringFixed(pSmp->filename, 21); + SpaceToNullStringFixed<21>(pSmp->filename); if ((xmss.type & 3) == 3) // MPT 1.09 and maybe newer / older versions set both flags for bidi loops bProbablyMPT109 = true; Modified: trunk/OpenMPT/soundlib/load_j2b.cpp =================================================================== --- trunk/OpenMPT/soundlib/load_j2b.cpp 2011-01-03 14:49:21 UTC (rev 781) +++ trunk/OpenMPT/soundlib/load_j2b.cpp 2011-01-03 15:11:22 UTC (rev 782) @@ -487,7 +487,7 @@ ASSERT_CAN_READ_CHUNK(mainchunk->channels); memcpy(m_szNames[0], mainchunk->songname, 32); - SpaceToNullStringFixed(m_szNames[0], 31); + SpaceToNullStringFixed<31>(m_szNames[0]); m_dwSongFlags = SONG_ITOLDEFFECTS | SONG_ITCOMPATGXX; if(!(mainchunk->flags & 0x01)) m_dwSongFlags |= SONG_LINEARSLIDES; if(mainchunk->channels < 1) return false; @@ -558,7 +558,7 @@ m_nInstruments = max(m_nInstruments, nIns); memcpy(pIns->name, instheader->name, 28); - SpaceToNullStringFixed(pIns->name, 28); + SpaceToNullStringFixed<28>(pIns->name); for(BYTE i = 0; i < 128; i++) { @@ -599,7 +599,7 @@ if(smpchunk->signature != AMCHUNKID_SAMP) break; // SAMP memcpy(m_szNames[nSmp], smpchunk->name, 28); - SpaceToNullStringFixed(m_szNames[nSmp], 28); + SpaceToNullStringFixed<28>(m_szNames[nSmp]); Samples[nSmp].nPan = smpchunk->pan << 2; Samples[nSmp].nVolume = smpchunk->volume << 2; @@ -669,7 +669,7 @@ m_nInstruments = max(m_nInstruments, nIns); memcpy(pIns->name, instheader->name, 32); - SpaceToNullStringFixed(pIns->name, 31); + SpaceToNullStringFixed<31>(pIns->name); for(BYTE i = 0; i < 128; i++) { @@ -717,7 +717,7 @@ MemsetZero(Samples[nSmp]); memcpy(m_szNames[nSmp], smpchunk->name, 32); - SpaceToNullStringFixed(m_szNames[nSmp], 31); + SpaceToNullStringFixed<31>(m_szNames[nSmp]); if(LittleEndianW(smpchunk->pan) > 0x7FFF || LittleEndianW(smpchunk->volume) > 0x7FFF) break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-01-03 19:08:40
|
Revision: 783 http://modplug.svn.sourceforge.net/modplug/?rev=783&view=rev Author: saga-games Date: 2011-01-03 19:08:33 +0000 (Mon, 03 Jan 2011) Log Message: ----------- [Fix] When restarting a pattern, the timer was not reset properly (CModDoc:::OnPatternRestart) [Ref] Moved bool instrumentModified[MAX_INSTRUMENTS] to CModDoc and turned it into a bitset. ctrl_ins code has been unified with regards to this bitset, so the treeview should now also be updated properly in all cases and the document / instruments should be marked as modified as well. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Sampleio.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-01-03 15:11:22 UTC (rev 782) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-01-03 19:08:33 UTC (rev 783) @@ -983,6 +983,22 @@ } +// Set instrument (and moddoc) as modified. +void CCtrlInstruments::SetInstrumentModified(const bool modified) +//--------------------------------------------------------------- +{ + if(m_pModDoc == nullptr) return; +// -> CODE#0023 +// -> DESC="IT project files (.itp)" + m_pModDoc->m_bsInstrumentModified.set(m_nInstrument - 1, modified); + m_pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this); +// -! NEW_FEATURE#0023 + if(modified) + { + m_pModDoc->SetModified(); + } +} + BOOL CCtrlInstruments::SetCurrentInstrument(UINT nIns, BOOL bUpdNum) //------------------------------------------------------------------ { @@ -1399,7 +1415,7 @@ if(n >= _MAX_PATH) n = _MAX_PATH-1; strncpy(m_pSndFile->m_szInstrumentPath[m_nInstrument-1],lpszFileName,n); m_pSndFile->m_szInstrumentPath[m_nInstrument-1][n] = '\0'; - m_pSndFile->instrumentModified[m_nInstrument-1] = FALSE; + SetInstrumentModified(false); // -! NEW_FEATURE#0023 bOk = TRUE; } @@ -1723,7 +1739,7 @@ int n = strlen(files.first_file.c_str()); if(n > _MAX_PATH) n = _MAX_PATH; strncpy(m_pSndFile->m_szInstrumentPath[m_nInstrument-1], files.first_file.c_str(),n); - m_pSndFile->instrumentModified[m_nInstrument-1] = FALSE; + SetInstrumentModified(false); // -! NEW_FEATURE#0023 EndWaitCursor(); @@ -1773,13 +1789,8 @@ MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument]; if ((pIns) && (strncmp(s, pIns->name, 32))) { -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; -// -! NEW_FEATURE#0023 memcpy(pIns->name, s, 32); - m_pModDoc->SetModified(); - m_pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this); + SetInstrumentModified(true); } } } @@ -1798,12 +1809,7 @@ if ((pIns) && (strncmp(s, pIns->filename, 12))) { memcpy(pIns->filename, s, 12); - m_pModDoc->SetModified(); -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 + SetInstrumentModified(true); } } } @@ -1821,12 +1827,7 @@ if(nVol != (int)pIns->nFadeOut) { pIns->nFadeOut = nVol; - m_pModDoc->SetModified(); -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 + SetInstrumentModified(true); } } } @@ -1844,12 +1845,7 @@ if (nVol != (int)pIns->nGlobalVol) { pIns->nGlobalVol = nVol; - if (m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) m_pModDoc->SetModified(); -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 + SetInstrumentModified(true); } } } @@ -1893,18 +1889,11 @@ if(smp <= m_pSndFile->GetNumSamples()) m_pSndFile->Samples[smp].uFlags &= ~CHN_PANNING; } - m_pModDoc->SetModified(); m_pModDoc->UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_MODTYPE); } } } - -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 - m_pModDoc->SetModified(); + SetInstrumentModified(true); } } @@ -1923,12 +1912,7 @@ if (nPan != (int)pIns->nPan) { pIns->nPan = nPan; - if (m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) m_pModDoc->SetModified(); -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument - 1] = true; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 + SetInstrumentModified(true); } } } @@ -1940,17 +1924,11 @@ MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument]; if ((!IsLocked()) && (pIns)) { - if (pIns->nNNA != m_ComboNNA.GetCurSel()) { - m_pModDoc->SetModified(); + if (pIns->nNNA != m_ComboNNA.GetCurSel()) + { pIns->nNNA = m_ComboNNA.GetCurSel(); - } - -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument - 1] = true; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 - + SetInstrumentModified(true); + } } } @@ -1961,16 +1939,11 @@ MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument]; if ((!IsLocked()) && (pIns)) { - if (pIns->nDCT != m_ComboDCT.GetCurSel()) { + if (pIns->nDCT != m_ComboDCT.GetCurSel()) + { pIns->nDCT = m_ComboDCT.GetCurSel(); - m_pModDoc->SetModified(); + SetInstrumentModified(true); } -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 - } } @@ -1981,15 +1954,11 @@ MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument]; if ((!IsLocked()) && (pIns)) { - if (pIns->nDNA != m_ComboDCA.GetCurSel()) { + if (pIns->nDNA != m_ComboDCA.GetCurSel()) + { pIns->nDNA = m_ComboDCA.GetCurSel(); - m_pModDoc->SetModified(); + SetInstrumentModified(true); } -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 } } @@ -2001,10 +1970,12 @@ if ((!IsLocked()) && (pIns)) { int n = GetDlgItemInt(IDC_EDIT10); - if ((n >= 0) && (n <= 255)) { - if (pIns->nMidiProgram != n) { + if ((n >= 0) && (n <= 255)) + { + if (pIns->nMidiProgram != n) + { pIns->nMidiProgram = n; - m_pModDoc->SetModified(); + SetInstrumentModified(true); } } //rewbs.MidiBank: we will not set the midi bank/program if it is 0 @@ -2015,12 +1986,6 @@ UnlockControls(); } //end rewbs.MidiBank - -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 } } @@ -2032,10 +1997,12 @@ if ((!IsLocked()) && (pIns)) { WORD w = GetDlgItemInt(IDC_EDIT11); - if ((w >= 0) && (w <= 255)) { - if (pIns->wMidiBank != w) { - m_pModDoc->SetModified(); + if ((w >= 0) && (w <= 255)) + { + if (pIns->wMidiBank != w) + { pIns->wMidiBank = w; + SetInstrumentModified(true); } } //rewbs.MidiBank: we will not set the midi bank/program if it is 0 @@ -2046,9 +2013,6 @@ UnlockControls(); } //end rewbs.MidiBank - - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); } } //end rewbs.MidiBank @@ -2060,11 +2024,10 @@ if ((!IsLocked()) && (pIns)) { int n = m_CbnMidiCh.GetItemData(m_CbnMidiCh.GetCurSel()); - if (pIns->nMidiChannel != (BYTE)(n & 0xff)) { + if (pIns->nMidiChannel != (BYTE)(n & 0xff)) + { pIns->nMidiChannel = (BYTE)(n & 0xff); - m_pModDoc->SetModified(); - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); + SetInstrumentModified(true); } } } @@ -2076,10 +2039,10 @@ if ((!IsLocked()) && (pIns)) { int n = m_CbnResampling.GetItemData(m_CbnResampling.GetCurSel()); - if (pIns->nResampling != (BYTE)(n & 0xff)) { + if (pIns->nResampling != (BYTE)(n & 0xff)) + { pIns->nResampling = (BYTE)(n & 0xff); - m_pModDoc->SetModified(); - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; + SetInstrumentModified(true); m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); } } @@ -2108,11 +2071,11 @@ if (nPlug>=0 && nPlug <= MAX_MIXPLUGINS) { - if ((!IsLocked()) && pIns->nMixPlug != nPlug) { - m_pModDoc->SetModified(); + if ((!IsLocked()) && pIns->nMixPlug != nPlug) + { pIns->nMixPlug = nPlug; + SetInstrumentModified(true); m_pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, this); - m_pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this); } m_CbnPluginVelocityHandling.SetCurSel(pIns->nPluginVelocityHandling); m_CbnPluginVolumeHandling.SetCurSel(pIns->nPluginVolumeHandling); @@ -2126,9 +2089,9 @@ // if this plug can recieve MIDI events and we have no MIDI channel // selected for this instrument, automatically select MIDI channel 1. - if (pPlug->pMixPlugin->isInstrument() && pIns->nMidiChannel==0) { - pIns->nMidiChannel=1; - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; + if (pPlug->pMixPlugin->isInstrument() && pIns->nMidiChannel == 0) + { + pIns->nMidiChannel = 1; UpdateView((m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT, NULL); } return; @@ -2152,17 +2115,12 @@ { int n = GetDlgItemInt(IDC_EDIT15); if ((n >= -32) && (n <= 32)) { - if (pIns->nPPS != (signed char)n) { + if (pIns->nPPS != (signed char)n) + { pIns->nPPS = (signed char)n; - m_pModDoc->SetModified(); + SetInstrumentModified(true); } } -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 - } } @@ -2177,21 +2135,17 @@ if(n > MAX_ATTACK_VALUE) n = MAX_ATTACK_VALUE; int newRamp = n; //? MAX_ATTACK_LENGTH - n : 0; -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - if(pIns->nVolRamp != newRamp){ - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); + if(pIns->nVolRamp != newRamp) + { + pIns->nVolRamp = newRamp; + SetInstrumentModified(true); } -// -! NEW_FEATURE#0023 - pIns->nVolRamp = newRamp; m_SliderAttack.SetPos(n); if( CSpinButtonCtrl *spin = (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN1) ) spin->SetPos(n); LockControls(); if (n == 0) SetDlgItemText(IDC_EDIT2,"default"); UnlockControls(); - m_pModDoc->SetModified(); } } // -! NEW_FEATURE#0027 @@ -2204,17 +2158,14 @@ if ((!IsLocked()) && (pIns)) { int n = m_ComboPPC.GetCurSel(); - if ((n >= 0) && (n <= NOTE_MAX - 1)) { - if (pIns->nPPC != n) { - m_pModDoc->SetModified(); + if ((n >= 0) && (n <= NOTE_MAX - 1)) + { + if (pIns->nPPC != n) + { pIns->nPPC = n; + SetInstrumentModified(true); } } -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 } } @@ -2251,12 +2202,7 @@ } } } -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 - m_pModDoc->SetModified(); + SetInstrumentModified(true); SwitchToView(); } } @@ -2294,12 +2240,7 @@ } } } -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 - m_pModDoc->SetModified(); + SetInstrumentModified(true); SwitchToView(); } } @@ -2380,16 +2321,12 @@ if (pSlider==&m_SliderAttack) { n = m_SliderAttack.GetPos(); int newRamp = n; //? MAX_ATTACK_LENGTH - n : 0; -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - if(pIns->nVolRamp != newRamp){ - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); + if(pIns->nVolRamp != newRamp) + { pIns->nVolRamp = newRamp; SetDlgItemInt(IDC_EDIT2,n); - m_pModDoc->SetModified(); + SetInstrumentModified(true); } -// -! NEW_FEATURE#0023 // -! NEW_FEATURE#0027 } // Volume Swing @@ -2398,12 +2335,8 @@ n = m_SliderVolSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nVolSwing)) { -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; -// -! NEW_FEATURE#0023 pIns->nVolSwing = (BYTE)n; - m_pModDoc->SetModified(); + SetInstrumentModified(true); } } // Pan Swing @@ -2412,12 +2345,8 @@ n = m_SliderPanSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nPanSwing)) { -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; -// -! NEW_FEATURE#0023 pIns->nPanSwing = (BYTE)n; - m_pModDoc->SetModified(); + SetInstrumentModified(true); } } //Cutoff swing @@ -2426,9 +2355,8 @@ n = m_SliderCutSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nCutSwing)) { - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; pIns->nCutSwing = (BYTE)n; - m_pModDoc->SetModified(); + SetInstrumentModified(true); } } //Resonance swing @@ -2437,9 +2365,8 @@ n = m_SliderResSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nResSwing)) { - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; pIns->nResSwing = (BYTE)n; - m_pModDoc->SetModified(); + SetInstrumentModified(true); } } // Filter CutOff @@ -2448,13 +2375,9 @@ n = m_SliderCutOff.GetPos(); if ((n >= 0) && (n < 0x80) && (n != (int)(pIns->nIFC & 0x7F))) { - // -> CODE#0023 - // -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - // -! NEW_FEATURE#0023 pIns->nIFC &= 0x80; pIns->nIFC |= (BYTE)n; - m_pModDoc->SetModified(); + SetInstrumentModified(true); UpdateFilterText(); filterChanger = true; } @@ -2465,13 +2388,9 @@ n = m_SliderResonance.GetPos(); if ((n >= 0) && (n < 0x80) && (n != (int)(pIns->nIFR & 0x7F))) { - // -> CODE#0023 - // -> DESC="IT project files (.itp)" - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - // -! NEW_FEATURE#0023 pIns->nIFR &= 0x80; pIns->nIFR |= (BYTE)n; - m_pModDoc->SetModified(); + SetInstrumentModified(true); filterChanger = true; } } @@ -2738,9 +2657,7 @@ if(n != pIns->nPluginVelocityHandling) { pIns->nPluginVelocityHandling = n; - m_pModDoc->SetModified(); - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); + SetInstrumentModified(true); } } } @@ -2756,9 +2673,7 @@ if(n != pIns->nPluginVolumeHandling) { pIns->nPluginVolumeHandling = n; - m_pModDoc->SetModified(); - m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE; - m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this); + SetInstrumentModified(true); } } } Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2011-01-03 15:11:22 UTC (rev 782) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2011-01-03 19:08:33 UTC (rev 783) @@ -120,7 +120,8 @@ VOID UpdateFilterText(); LONG* GetSplitPosRef() {return &CMainFrame::glInstrumentWindowHeight;} //rewbs.varWindowSize - +protected: + void CCtrlInstruments::SetInstrumentModified(const bool modified); public: //{{AFX_VIRTUAL(CCtrlInstruments) Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-03 15:11:22 UTC (rev 782) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-03 19:08:33 UTC (rev 783) @@ -113,6 +113,8 @@ time(&m_creationTime); m_FileHistory.clear(); + m_bsInstrumentModified.reset(); + #ifdef _DEBUG MODCHANNEL *p = m_SndFile.Chn; if (((DWORD)p) & 7) Log("MODCHANNEL is not aligned (0x%08X)\n", p); @@ -463,8 +465,13 @@ bool unsavedInstrument = false; - for(UINT i = 0 ; i < m_SndFile.m_nInstruments ; i++){ - if(m_SndFile.instrumentModified[i]) { unsavedInstrument = true; break; } + for(INSTRUMENTINDEX i = 0 ; i < m_SndFile.GetNumInstruments() ; i++) + { + if(m_bsInstrumentModified[i]) + { + unsavedInstrument = true; + break; + } } if(unsavedInstrument && ::MessageBox(NULL,"Do you want to save modified instruments?",NULL,MB_ICONQUESTION | MB_YESNO | MB_APPLMODAL) == IDYES){ @@ -905,7 +912,7 @@ if (nVol >= 0) pChn->nVolume = nVol; // handle sample looping. - // Fix: Bug report 1700. + // Changed line to fix http://forum.openmpt.org/index.php?topic=1700.0 //if ((loopstart + 16 < loopend) && (loopstart >= 0) && (loopend <= (LONG)pChn->nLength)) { if ((loopstart + 16 < loopend) && (loopstart >= 0) && (pChn->pModSample != nullptr)) { @@ -3332,7 +3339,7 @@ END_CRITICAL(); // set playback timer in the status bar - SetElapsedTime(nOrd, nRow); + SetElapsedTime(nOrd, 0); if (pModPlaying != this) { Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2011-01-03 15:11:22 UTC (rev 782) +++ trunk/OpenMPT/mptrack/Moddoc.h 2011-01-03 19:08:33 UTC (rev 783) @@ -182,6 +182,9 @@ vector<FileHistory> m_FileHistory; // File edit history time_t m_creationTime; +public: + std::bitset<MAX_INSTRUMENTS> m_bsInstrumentModified; // which instruments have been modified? (for ITP functionality) + protected: // create from serialization only CModDoc(); DECLARE_SERIAL(CModDoc) Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2011-01-03 15:11:22 UTC (rev 782) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2011-01-03 19:08:33 UTC (rev 783) @@ -451,7 +451,7 @@ // -> CODE#0023 // -> DESC="IT project files (.itp)" strcpy(m_SndFile.m_szInstrumentPath[newins - 1], m_SndFile.m_szInstrumentPath[nDuplicate - 1]); - m_SndFile.instrumentModified[newins - 1] = false; + m_bsInstrumentModified.reset(newins - 1); // -! NEW_FEATURE#0023 } else { Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2011-01-03 15:11:22 UTC (rev 782) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2011-01-03 19:08:33 UTC (rev 783) @@ -968,9 +968,9 @@ if((pSndFile->m_dwSongFlags & SONG_ITPROJECT) != 0) { // path info for ITP instruments - bool pathOk = pSndFile->m_szInstrumentPath[nIns-1][0] != '\0'; - bool instOk = pSndFile->instrumentModified[nIns-1] == false; - wsprintf(s, pathOk ? (instOk ? "%3d: %s" : "%3d: * %s") : "%3d: ? %s", nIns, (LPCTSTR)pSndFile->GetInstrumentName(nIns)); + const bool pathOk = pSndFile->m_szInstrumentPath[nIns - 1][0] != '\0'; + const bool instMod = pDoc->m_bsInstrumentModified.test(nIns - 1); + wsprintf(s, pathOk ? (instMod ? "%3d: * %s" : "%3d: %s") : "%3d: ? %s", nIns, (LPCTSTR)pSndFile->GetInstrumentName(nIns)); } else { wsprintf(s, "%3d: %s", nIns, (LPCTSTR)pSndFile->GetInstrumentName(nIns)); @@ -3050,7 +3050,8 @@ strcpy(pSndFile->m_szInstrumentPath[modItemID - 1], files.first_file.c_str()); } - if(pSndFile->m_szInstrumentPath[modItemID - 1][0] != '\0'){ + if(pSndFile->m_szInstrumentPath[modItemID - 1][0] != '\0') + { int size = strlen(pSndFile->m_szInstrumentPath[modItemID - 1]); BOOL iti = _stricmp(&pSndFile->m_szInstrumentPath[modItemID - 1][size-3],"iti") == 0; BOOL xi = _stricmp(&pSndFile->m_szInstrumentPath[modItemID - 1][size-2],"xi") == 0; @@ -3060,7 +3061,7 @@ if(xi || (!xi && !iti && pSndFile->m_nType == MOD_TYPE_XM)) pSndFile->SaveXIInstrument((INSTRUMENTINDEX)modItemID, pSndFile->m_szInstrumentPath[modItemID - 1]); - pSndFile->instrumentModified[modItemID - 1] = false; + pModDoc->m_bsInstrumentModified.reset(modItemID - 1); } if(pModDoc) pModDoc->UpdateAllViews(NULL, HINT_MODTYPE); Modified: trunk/OpenMPT/soundlib/Sampleio.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sampleio.cpp 2011-01-03 15:11:22 UTC (rev 782) +++ trunk/OpenMPT/soundlib/Sampleio.cpp 2011-01-03 19:08:33 UTC (rev 783) @@ -11,6 +11,9 @@ #include "sndfile.h" #include "it_defs.h" #include "wavConverter.h" +#ifdef MODPLUG_TRACKER +#include "../mptrack/Moddoc.h" +#endif //MODPLUG_TRACKER #include "Wav.h" #pragma warning(disable:4244) @@ -116,8 +119,13 @@ // -> CODE#0023 // -> DESC="IT project files (.itp)" - m_szInstrumentPath[nInstr-1][0] = '\0'; - instrumentModified[nInstr-1] = false; + m_szInstrumentPath[nInstr - 1][0] = '\0'; +#ifdef MODPLUG_TRACKER + if(GetpModDoc()) + { + GetpModDoc()->m_bsInstrumentModified.reset(nInstr - 1); + } +#endif // MODPLUG_TRACKER // -! NEW_FEATURE#0023 MODINSTRUMENT *pIns = Instruments[nInstr]; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2011-01-03 15:11:22 UTC (rev 782) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-01-03 19:08:33 UTC (rev 783) @@ -484,7 +484,6 @@ for(UINT i = 0; i < MAX_INSTRUMENTS; i++) { m_szInstrumentPath[i][0] = '\0'; - instrumentModified[i] = false; } // -! NEW_FEATURE#0023 Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2011-01-03 15:11:22 UTC (rev 782) +++ trunk/OpenMPT/soundlib/Sndfile.h 2011-01-03 19:08:33 UTC (rev 783) @@ -643,7 +643,6 @@ // -> CODE#0023 // -> DESC="IT project files (.itp)" CHAR m_szInstrumentPath[MAX_INSTRUMENTS][_MAX_PATH]; - bool instrumentModified[MAX_INSTRUMENTS]; // -! NEW_FEATURE#0023 public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-01-15 16:25:35
|
Revision: 785 http://modplug.svn.sourceforge.net/modplug/?rev=785&view=rev Author: saga-games Date: 2011-01-15 16:25:29 +0000 (Sat, 15 Jan 2011) Log Message: ----------- [Imp] Instrument Editor: When pressing the up arrow key in the sample map while the cursor is on the lowest note (C-0), the sample map doesn't lose focus anymore. [Imp] Instrument Editor: It is not possible anymore to move the sample map by clicking the area above the lowest note (C-0). [Fix] Instrument Editor: The note mapping doesn't allow items anymore that aren't notes (such as "no note" or "note cut"). Such notes couldn't be entered manually, however when converting from other formats this was possible and it could crash the tracker (http://bugs.openmpt.org/view.php?id=61). [Fix] IT Loader / IT Saver: Note mapping items that aren't notes are now ignored. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/modcommand.h Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-01-03 22:00:34 UTC (rev 784) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-01-15 16:25:29 UTC (rev 785) @@ -125,7 +125,7 @@ //------------------------------------------ { if (nNote == m_nNote) return TRUE; - if (nNote >= NOTE_MAX) return FALSE; + if (!NOTE_IS_VALID(nNote + 1)) return FALSE; m_nNote = nNote; InvalidateRect(NULL, FALSE); return TRUE; @@ -189,14 +189,14 @@ if ((pIns) && (nPos >= 0) && (nPos < NOTE_MAX) && (pIns->NoteMap[nPos])) { UINT n = pIns->NoteMap[nPos]; - if(n < NOTE_MIN_SPECIAL) + if(NOTE_IS_VALID(n)) { string temp = pSndFile->GetNoteName(n, m_nInstrument); temp.resize(4); wsprintf(s, "%s", temp.c_str()); } else { - strcpy(s, szSpecialNoteNames[pIns->NoteMap[n] - NOTE_MIN_SPECIAL]); + strcpy(s, "???"); } } FillRect(hdc, &rect, (bHighLight) ? CMainFrame::brushHighLight : CMainFrame::brushWindow); @@ -275,9 +275,11 @@ CRect rcClient; GetClientRect(&rcClient); int nNotes = (rcClient.bottom + m_cyFont - 1) / m_cyFont; - UINT n = (pt.y / m_cyFont) + m_nNote - (nNotes/2); - m_nNote = n; - InvalidateRect(NULL, FALSE); + int n = (pt.y / m_cyFont) + m_nNote - (nNotes/2); + if(n >= 0) + { + SetCurrentNote(n); + } } SetFocus(); } @@ -314,21 +316,21 @@ AppendMenu(hMenu, MF_STRING, ID_INSTRUMENT_SAMPLEMAP, "Edit Sample &Map\t" + ih->GetKeyTextFromCommand(kcInsNoteMapEditSampleMap)); if (hSubMenu) { - BYTE smpused[(MAX_SAMPLES+7)/8]; - memset(smpused, 0, sizeof(smpused)); + const SAMPLEINDEX numSamps = pSndFile->GetNumSamples(); + vector<bool> smpused(numSamps + 1, false); for (UINT i=1; i<NOTE_MAX; i++) { - UINT nsmp = pIns->Keyboard[i]; - if (nsmp < MAX_SAMPLES) smpused[nsmp>>3] |= 1 << (nsmp & 7); + SAMPLEINDEX nsmp = pIns->Keyboard[i]; + if (nsmp <= numSamps) smpused[nsmp] = true; } - for (UINT j=1; j<MAX_SAMPLES; j++) + for (SAMPLEINDEX j = 1; j <= numSamps; j++) { - if (smpused[j>>3] & (1 << (j & 7))) + if (smpused[j]) { wsprintf(s, "%d: ", j); UINT l = strlen(s); - memcpy(s+l, pSndFile->m_szNames[j], MAX_SAMPLENAME); - s[l+32] = 0; + memcpy(s + l, pSndFile->m_szNames[j], MAX_SAMPLENAME); + s[l + MAX_SAMPLENAME] = 0; AppendMenu(hSubMenu, MF_STRING, ID_NOTEMAP_EDITSAMPLE+j, s); } } @@ -340,11 +342,11 @@ if(pSndFile->GetType() != MOD_TYPE_XM) { - if(pIns->NoteMap[m_nNote] < NOTE_MIN_SPECIAL) + if(NOTE_IS_VALID(pIns->NoteMap[m_nNote])) + { wsprintf(s, "Map all ¬es to %s\t" + ih->GetKeyTextFromCommand(kcInsNoteMapCopyCurrentNote), pSndFile->GetNoteName(pIns->NoteMap[m_nNote], m_nInstrument).c_str()); - else - wsprintf(s, "Map all ¬es to %s\t" + ih->GetKeyTextFromCommand(kcInsNoteMapCopyCurrentNote), szSpecialNoteNames[pIns->NoteMap[m_nNote] - NOTE_MIN_SPECIAL]); - AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_COPY_NOTE, s); + AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_COPY_NOTE, s); + } AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_TRANS_UP, "Transpose map &up\t" + ih->GetKeyTextFromCommand(kcInsNoteMapTransposeUp)); AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_TRANS_DOWN, "Transpose map &down\t" + ih->GetKeyTextFromCommand(kcInsNoteMapTransposeDown)); } @@ -714,14 +716,15 @@ } } return true; + default: + return false; } if (bRedraw) { InvalidateRect(NULL, FALSE); - return true; } - return false; + return true; } @@ -1162,7 +1165,7 @@ BOOL bITandMPT = ((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE; //rewbs.instroVSTi - BOOL bITandXM = (((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) || (m_pSndFile->m_nType == MOD_TYPE_XM)) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE; + BOOL bITandXM = ((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM)) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE; bool bMPTOnly = ((m_pSndFile->m_nType == MOD_TYPE_MPT) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE; ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT10), bITandXM); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT11), bITandXM); @@ -1183,7 +1186,7 @@ else m_SpinFadeOut.SetRange(0, 8192); - // Panning ranges + // Panning ranges (0...64 for IT, 0...256 for MPTM) m_SpinPanning.SetRange(0, (m_pModDoc->GetModType() & MOD_TYPE_IT) ? 64 : 256); m_NoteMap.EnableWindow(bITandXM); Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-03 22:00:34 UTC (rev 784) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-15 16:25:29 UTC (rev 785) @@ -302,13 +302,13 @@ SpaceToNullStringFixed<12>(pIns->filename); pIns->nFadeOut = pis->fadeout << 6; pIns->nGlobalVol = 64; - for (UINT j=0; j<NOTE_MAX; j++) + for (UINT j = 0; j < 120; j++) { UINT note = pis->keyboard[j*2]; UINT ins = pis->keyboard[j*2+1]; if (ins < MAX_SAMPLES) pIns->Keyboard[j] = ins; - if (note < 128) pIns->NoteMap[j] = note+1; - else if (note >= 0xFE) pIns->NoteMap[j] = note; + if (note < 120) pIns->NoteMap[j] = note + 1; + else pIns->NoteMap[j] = j + 1; } if (pis->flags & 0x01) pIns->VolEnv.dwFlags |= ENV_ENABLED; if (pis->flags & 0x02) pIns->VolEnv.dwFlags |= ENV_LOOP; @@ -361,8 +361,8 @@ UINT note = pis->keyboard[j*2]; UINT ins = pis->keyboard[j*2+1]; if (ins < MAX_SAMPLES) pIns->Keyboard[j] = ins; - if (note < 128) pIns->NoteMap[j] = note+1; - else if (note >= 0xFE) pIns->NoteMap[j] = note; + if (note < 120) pIns->NoteMap[j] = note + 1; + else pIns->NoteMap[j] = j + 1; } // Olivier's MPT Instrument Extension if (*((int *)pis->dummy) == 'MPTX') @@ -1548,7 +1548,7 @@ smpcount[smp>>3] |= 1 << (smp&7); iti.nos++; } - iti.keyboard[i*2] = pIns->NoteMap[i] - 1; + iti.keyboard[i*2] = (pIns->NoteMap[i] >= NOTE_MIN && pIns->NoteMap[i] <= NOTE_MAX) ? (pIns->NoteMap[i] - 1) : i; iti.keyboard[i*2+1] = smp; if (smp > 0xff) bKbdEx = true; keyboardex[i] = (smp>>8); @@ -2143,7 +2143,7 @@ smpcount[smp>>3] |= 1 << (smp&7); iti.nos++; } - iti.keyboard[i*2] = pIns->NoteMap[i] - 1; + iti.keyboard[i*2] = (pIns->NoteMap[i] >= NOTE_MIN && pIns->NoteMap[i] <= NOTE_MAX) ? (pIns->NoteMap[i] - 1) : i; iti.keyboard[i*2+1] = smp; //if (smp > 0xFF) bKbdEx = true; // no extended sample map in compat mode keyboardex[i] = (smp>>8); Modified: trunk/OpenMPT/soundlib/modcommand.h =================================================================== --- trunk/OpenMPT/soundlib/modcommand.h 2011-01-03 22:00:34 UTC (rev 784) +++ trunk/OpenMPT/soundlib/modcommand.h 2011-01-15 16:25:29 UTC (rev 785) @@ -14,6 +14,7 @@ #define NOTE_MAX 120 //Defines maximum notevalue(with index starting from 1) as well as maximum number of notes. #define NOTE_MAX_SPECIAL NOTE_KEYOFF #define NOTE_MIN_SPECIAL NOTE_PCS +#define NOTE_IS_VALID(n) ((n) == NOTE_NONE || ((n) >= NOTE_MIN && (n) <= NOTE_MAX)) // Checks whether a number represents a valid note (a "normal" note or no note, but not something like note off) //============== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-01-15 16:27:57
|
Revision: 786 http://modplug.svn.sourceforge.net/modplug/?rev=786&view=rev Author: saga-games Date: 2011-01-15 16:27:50 +0000 (Sat, 15 Jan 2011) Log Message: ----------- [Fix] Pattern Editor: Queueing a "---" or "+++" item now automatically moves the queue "cursor" to the next available pattern. Previously, queueing a "---" pattern restarted the song. [Imp] Pattern Editor: Just like normal selections, the row selection feature now also suppresses pattern scrolling. [Mod] OpenMPT: Version is now 1.19.00.19 Modified Paths: -------------- trunk/OpenMPT/installer/install-unmo3-free.iss trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/installer/install-unmo3-free.iss =================================================================== --- trunk/OpenMPT/installer/install-unmo3-free.iss 2011-01-15 16:25:29 UTC (rev 785) +++ trunk/OpenMPT/installer/install-unmo3-free.iss 2011-01-15 16:27:50 UTC (rev 786) @@ -12,33 +12,50 @@ #define DOWNLOAD_MO3 #define BaseNameAddition "_sf" #include "install.iss" +#include "it_download.iss" -[_ISToolDownload] -Source: http://openmpt.com/download/unmo3.dll; DestDir: {tmp}; DestName: openmpt-unmo3.dll.tmp; Tasks: downloadmo3 [Code] // Verify checksum of downloaded file, and if it is OK, copy it to the app directory. procedure VerifyUNMO3Checksum(); begin if(IsTaskSelected('downloadmo3') And FileExists(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'))) then begin - if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '2e17f7bb6d19ce326851333b918070c5357cacd1') then - begin - MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.com/ and verify its checksum.', mbCriticalError, MB_OK) - end else - begin - FileCopy(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'), ExpandConstant('{app}\unmo3.dll'), true); - end; - DeleteFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')); + if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '2e17f7bb6d19ce326851333b918070c5357cacd1') then + begin + MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.com/ and verify its checksum.', mbCriticalError, MB_OK) + end else + begin + FileCopy(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'), ExpandConstant('{app}\unmo3.dll'), true); + end; + DeleteFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')); end; end; function IsUNMO3Installed(): Boolean; begin - Result := FileExists(ExpandConstant('{app}\unmo3.dll')); + Result := FileExists(ExpandConstant('{app}\unmo3.dll')); end; +procedure InitializeWizard(); +begin + ITD_Init(); + ITD_DownloadAfter(wpReady); +end; + // Function generated by ISTool. -function NextButtonClick(CurPage: Integer): Boolean; +procedure CurPageChanged(CurPage: Integer); begin - Result := istool_download(CurPage); + case CurPage of + CurPage: + begin + if(IsTaskSelected('downloadmo3')) then + begin + ITD_AddMirror('http://openmpt.org/download/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')); + ITD_AddFile('ftp://ftp.untergrund.net/users/sagamusix/openmpt/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')); + end else + begin + ITD_ClearFiles(); + end; + end; + end; end; Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2011-01-15 16:25:29 UTC (rev 785) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2011-01-15 16:27:50 UTC (rev 786) @@ -1041,7 +1041,7 @@ if(bPatternExists) break; } - DWORD greyed = bPatternExists ? 0 : MF_GRAYED; + const DWORD greyed = bPatternExists ? 0 : MF_GRAYED; CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler(); @@ -1432,13 +1432,24 @@ CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); if(pSndFile == nullptr) return; + const PATTERNINDEX nIgnore = pSndFile->Order.GetIgnoreIndex(); + const PATTERNINDEX nInvalid = pSndFile->Order.GetInvalidPatIndex(); + const ORDERINDEX nLength = pSndFile->Order.GetLength(); ORDERINDEX nOrder = GetOrderFromPoint(rect, pt); - if (nOrder < pSndFile->Order.GetLength()) + // If this is not a playable order item, find the next valid item. + while(nOrder < nLength && (pSndFile->Order[nOrder] == nIgnore || pSndFile->Order[nOrder] == nInvalid)) { - if (pSndFile->m_nSeqOverride == static_cast<UINT>(nOrder) + 1) { + nOrder++; + } + + if (nOrder < nLength) + { + if (pSndFile->m_nSeqOverride == static_cast<UINT>(nOrder) + 1) + { pSndFile->m_nSeqOverride = 0; - } else { + } else + { pSndFile->m_nSeqOverride = nOrder + 1; } InvalidateRect(NULL, FALSE); Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-01-15 16:25:29 UTC (rev 785) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-01-15 16:27:50 UTC (rev 786) @@ -3018,7 +3018,7 @@ m_pEffectVis->SetPlayCursor(nPat, nRow); } - if ((m_dwStatus & (PATSTATUS_FOLLOWSONG|PATSTATUS_DRAGVSCROLL|PATSTATUS_DRAGHSCROLL|PATSTATUS_MOUSEDRAGSEL)) == PATSTATUS_FOLLOWSONG) + if ((m_dwStatus & (PATSTATUS_FOLLOWSONG|PATSTATUS_DRAGVSCROLL|PATSTATUS_DRAGHSCROLL|PATSTATUS_MOUSEDRAGSEL|PATSTATUS_SELECTROW)) == PATSTATUS_FOLLOWSONG) { if (nPat < pSndFile->Patterns.Size()) { Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-01-15 16:25:29 UTC (rev 785) +++ trunk/OpenMPT/mptrack/version.h 2011-01-15 16:27:50 UTC (rev 786) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 19 #define VER_MINOR 00 -#define VER_MINORMINOR 18 +#define VER_MINORMINOR 19 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |