From: <sag...@us...> - 2013-04-02 18:00:33
|
Revision: 1704 http://sourceforge.net/p/modplug/code/1704 Author: saga-games Date: 2013-04-02 18:00:27 +0000 (Tue, 02 Apr 2013) Log Message: ----------- [Imp] ITP: If an instrument cannot be saved, a warning is shown. [Fix] When inputting MIDI notes > B-9, they are now properly clamped to B-9 and stopped properly (live fixing at Revision, tx Knoeki) [Ref] Removed more unused stuff. Modified Paths: -------------- trunk/OpenMPT/common/stdafx.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/soundlib/Snd_rvb.cpp Modified: trunk/OpenMPT/common/stdafx.h =================================================================== --- trunk/OpenMPT/common/stdafx.h 2013-04-02 17:39:47 UTC (rev 1703) +++ trunk/OpenMPT/common/stdafx.h 2013-04-02 18:00:27 UTC (rev 1704) @@ -50,31 +50,6 @@ #include <fstream> #include <strstream> -#ifndef OFN_FORCESHOWHIDDEN -#define OFN_FORCESHOWHIDDEN 0x10000000 -#endif - -#ifndef _WAVEFORMATEXTENSIBLE_ -#define _WAVEFORMATEXTENSIBLE_ - -typedef struct { - WAVEFORMATEX Format; - union { - WORD wValidBitsPerSample; /* bits of precision */ - WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */ - WORD wReserved; /* If neither applies, set to zero. */ - } Samples; - DWORD dwChannelMask; /* which channels are */ - /* present in stream */ - GUID SubFormat; -} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; - -#endif // !_WAVEFORMATEXTENSIBLE_ - -#if !defined(WAVE_FORMAT_EXTENSIBLE) -#define WAVE_FORMAT_EXTENSIBLE 0xFFFE -#endif // !defined(WAVE_FORMAT_EXTENSIBLE) - // Use inline assembly at all #define ENABLE_ASM @@ -112,7 +87,7 @@ // Define to build without MO3 support. //#define NO_MO3_SUPPORT - + // Define to build without DirectSound support. //#define NO_DSOUND Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-04-02 17:39:47 UTC (rev 1703) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-04-02 18:00:27 UTC (rev 1704) @@ -1595,11 +1595,9 @@ m_WaveFile.m_nInstruments = 1; m_WaveFile.m_nTempoMode = tempo_mode_classic; m_WaveFile.m_nMixLevels = mixLevels_compatible; - m_WaveFile.Order.resize(2); + m_WaveFile.Order.resize(1); m_WaveFile.Order[0] = 0; - m_WaveFile.Order[1] = 1; m_WaveFile.Patterns.Insert(0, 64); - m_WaveFile.Patterns.Insert(1, 1); } @@ -1625,14 +1623,10 @@ m[63 * 4].note = NOTE_NOTECUT; m[63 * 4 + 1].note = NOTE_NOTECUT; } + m[63 * 4 + 2].command = CMD_POSITIONJUMP; + m[63 * 4 + 3].command = CMD_PATTERNBREAK; + m[63 * 4 + 3].param = 63; } - - m = m_WaveFile.Patterns[1]; - if(m) - { - m->command = CMD_POSITIONJUMP; - m->param = 1; - } } Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2013-04-02 17:39:47 UTC (rev 1703) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2013-04-02 18:00:27 UTC (rev 1704) @@ -518,24 +518,28 @@ bool CModDoc::SaveInstrument(INSTRUMENTINDEX instr) //------------------------------------------------- { + bool success = false; if(instr > 0 && instr <= GetNumInstruments()) { instr--; if(!m_SndFile.m_szInstrumentPath[instr].empty()) { const size_t len = m_SndFile.m_szInstrumentPath[instr].length(); - const bool iti = _stricmp(&m_SndFile.m_szInstrumentPath[instr][len - 3], "iti") == 0; - const bool xi = _stricmp(&m_SndFile.m_szInstrumentPath[instr][len - 2], "xi") == 0; + const bool iti = !_stricmp(&m_SndFile.m_szInstrumentPath[instr][len - 3], "iti"); + const bool xi = !_stricmp(&m_SndFile.m_szInstrumentPath[instr][len - 2], "xi"); - if(iti || (!iti && !xi && m_SndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) - m_SndFile.SaveITIInstrument(instr + 1, m_SndFile.m_szInstrumentPath[instr], false); - if(xi || (!xi && !iti && m_SndFile.GetType() == MOD_TYPE_XM)) - m_SndFile.SaveXIInstrument(instr + 1, m_SndFile.m_szInstrumentPath[instr]); - m_bsInstrumentModified.reset(instr); - return true; + if(iti || (!xi && m_SndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) + success = m_SndFile.SaveITIInstrument(instr + 1, m_SndFile.m_szInstrumentPath[instr], false); + else + success = m_SndFile.SaveXIInstrument(instr + 1, m_SndFile.m_szInstrumentPath[instr]); + + if(success) + m_bsInstrumentModified.reset(instr); + else + Reporting::Error(("Error while saving\n" + m_SndFile.m_szInstrumentPath[instr] + "!").c_str()); } } - return false; + return success; } // -! NEW_FEATURE#0023 Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2013-04-02 17:39:47 UTC (rev 1703) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2013-04-02 18:00:27 UTC (rev 1704) @@ -2158,8 +2158,8 @@ CSoundFile* pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr; if(!pSndFile) return 0; - const BYTE nNote = midiByte1 + NOTE_MIN; - int nVol = midiByte2; + uint8 nNote = midiByte1 + NOTE_MIN; + int nVol = midiByte2; MIDIEvents::EventType event = MIDIEvents::GetTypeFromEvent(dwMidiData); if((event == MIDIEvents::evNoteOn) && !nVol) event = MIDIEvents::evNoteOff; //Convert event to note-off if req'd @@ -2188,8 +2188,9 @@ midiByte2 = 0; case MIDIEvents::evNoteOn: // Note On + LimitMax(nNote, NOTE_MAX); pModDoc->NoteOff(nNote, false, m_nInstrument); - if (midiByte2 & 0x7F) + if(midiByte2 & 0x7F) { nVol = CMainFrame::ApplyVolumeRelatedSettings(dwMidiData, midivolume); pModDoc->PlayNote(nNote, m_nInstrument, 0, false, nVol); Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2013-04-02 17:39:47 UTC (rev 1703) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2013-04-02 18:00:27 UTC (rev 1704) @@ -4702,6 +4702,11 @@ } CSoundFile &sndFile = pModDoc->GetrSoundFile(); + if(note < NOTE_MIN_SPECIAL) + { + Limit(note, sndFile.GetModSpecifications().noteMin, sndFile.GetModSpecifications().noteMax); + } + const bool liveRecord = IsLiveRecord(); const bool isSplit = IsNoteSplit(note); UINT ins = 0; Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2013-04-02 17:39:47 UTC (rev 1703) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2013-04-02 18:00:27 UTC (rev 1704) @@ -2621,7 +2621,7 @@ CSoundFile* pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : NULL; if (!pSndFile) return 0; - const BYTE nNote = midibyte1 + NOTE_MIN; + uint8 nNote = midibyte1 + NOTE_MIN; int nVol = midibyte2; MIDIEvents::EventType event = MIDIEvents::GetTypeFromEvent(dwMidiData); if(event == MIDIEvents::evNoteOn && !nVol) @@ -2644,6 +2644,7 @@ midibyte2 = 0; case MIDIEvents::evNoteOn: // Note On + LimitMax(nNote, NOTE_MAX); pModDoc->NoteOff(nNote, true); if(midibyte2 & 0x7F) { Modified: trunk/OpenMPT/soundlib/Snd_rvb.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_rvb.cpp 2013-04-02 17:39:47 UTC (rev 1703) +++ trunk/OpenMPT/soundlib/Snd_rvb.cpp 2013-04-02 18:00:27 UTC (rev 1704) @@ -1054,33 +1054,3 @@ } return fresult; } - - -//#define _ASM_MATH -#ifdef _ASM_MATH - -// pow(a,b) returns a^^b -> 2^^(b.log2(a)) -static float pow(float a, float b) -{ - long tmpint; - float result; - _asm { - fld b // Load b - fld a // Load a - fyl2x // ST(0) = b.log2(a) - fist tmpint // Store integer exponent - fisub tmpint // ST(0) = -1 <= (b*log2(a)) <= 1 - f2xm1 // ST(0) = 2^(x)-1 - fild tmpint // load integer exponent - fld1 // Load 1 - fscale // ST(0) = 2^ST(1) - fstp ST(1) // Remove the integer from the stack - fmul ST(1), ST(0) // multiply with fractional part - faddp ST(1), ST(0) // add integer_part - fstp result // Store the result - } - return result; -} -#else -#include <math.h> -#endif // _ASM_MATH This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |