From: <sag...@us...> - 2012-02-25 21:56:31
|
Revision: 1195 http://modplug.svn.sourceforge.net/modplug/?rev=1195&view=rev Author: saga-games Date: 2012-02-25 21:56:25 +0000 (Sat, 25 Feb 2012) Log Message: ----------- [Mod] Macro Editor: Added "Unused" as a fixed macro preset. [Imp] Macro Editor: Fixed macro preset name is now updated instantly when inputting a macro. Modified Paths: -------------- trunk/OpenMPT/mptrack/MIDIMacroDialog.cpp trunk/OpenMPT/soundlib/MIDIMacros.cpp trunk/OpenMPT/soundlib/MIDIMacros.h Modified: trunk/OpenMPT/mptrack/MIDIMacroDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMacroDialog.cpp 2012-02-25 20:51:28 UTC (rev 1194) +++ trunk/OpenMPT/mptrack/MIDIMacroDialog.cpp 2012-02-25 21:56:25 UTC (rev 1195) @@ -180,16 +180,12 @@ const parameteredMacroType macroType = m_MidiCfg.GetParameteredMacroType(m); switch (macroType) { - case sfx_cc: - s.Format("MIDI CC %d", m_MidiCfg.MacroToMidiCC(m)); - break; - case sfx_plug: s.Format("Control Plugin Param %d", m_MidiCfg.MacroToPlugParam(m)); break; default: - s = m_MidiCfg.GetParameteredMacroName(macroType); + s = m_MidiCfg.GetParameteredMacroName(m, 0, m_SndFile); break; } m_EditMacroType[m].SetWindowText(s); @@ -350,6 +346,7 @@ m_EditZxx.GetWindowText(s, MACRO_LENGTH); StringFixer::SetNullTerminator(s); memcpy(m_MidiCfg.szMidiZXXExt[zxx], s, MACRO_LENGTH); + m_CbnZxxPreset.SetCurSel(m_MidiCfg.GetFixedMacroType()); } } } Modified: trunk/OpenMPT/soundlib/MIDIMacros.cpp =================================================================== --- trunk/OpenMPT/soundlib/MIDIMacros.cpp 2012-02-25 20:51:28 UTC (rev 1194) +++ trunk/OpenMPT/soundlib/MIDIMacros.cpp 2012-02-25 21:56:25 UTC (rev 1195) @@ -47,22 +47,26 @@ //------------------------------------------------------- { // Compare with all possible preset patterns - for(size_t i = 1; i < zxx_max; i++) + for(size_t i = 0; i < zxx_max; i++) { - // Prepare macro pattern to compare - char macros[128][MACRO_LENGTH]; - CreateFixedMacro(macros, static_cast<fixedMacroType>(i)); + fixedMacroType zxx = static_cast<fixedMacroType>(i); + if(zxx != zxx_custom) + { + // Prepare macro pattern to compare + char macros[128][MACRO_LENGTH]; + CreateFixedMacro(macros, zxx); - bool bFound = true; - for(size_t j = 0; j < 128; j++) - { - if(strncmp(macros[j], szMidiZXXExt[j], MACRO_LENGTH)) + bool found = true; + for(size_t j = 0; j < 128; j++) { - bFound = false; - break; + if(strncmp(macros[j], szMidiZXXExt[j], MACRO_LENGTH)) + { + found = false; + break; + } } + if(found) return zxx; } - if(bFound) return static_cast<fixedMacroType>(i); } return zxx_custom; // Custom setup } @@ -112,6 +116,10 @@ { switch(macroType) { + case zxx_unused: + strcpy(fixedMacros[i], ""); + break; + case zxx_reso4Bit: // Type 1 - Z80 - Z8F controls resonance if (i < 16) sprintf(fixedMacros[i], "F0F001%02X", i * 8); @@ -242,6 +250,8 @@ { switch(macroType) { + case zxx_unused: + return _T("Unused"); case zxx_reso4Bit: return _T("Z80 - Z8F controls Resonant Filter Resonance"); case zxx_reso7Bit: Modified: trunk/OpenMPT/soundlib/MIDIMacros.h =================================================================== --- trunk/OpenMPT/soundlib/MIDIMacros.h 2012-02-25 20:51:28 UTC (rev 1194) +++ trunk/OpenMPT/soundlib/MIDIMacros.h 2012-02-25 21:56:25 UTC (rev 1195) @@ -37,7 +37,7 @@ // Fixed macro presets enum fixedMacroType { - zxx_custom = 0, + zxx_unused = 0, zxx_reso4Bit, // Type 1 - Z80 - Z8F controls resonant filter resonance zxx_reso7Bit, // Type 2 - Z80 - ZFF controls resonant filter resonance zxx_cutoff, // Type 3 - Z80 - ZFF controls resonant filter cutoff @@ -45,6 +45,7 @@ zxx_resomode, // Type 5 - Z80 - Z9F controls resonance + filter mode zxx_channelAT, // Type 6 - Z80 - ZFF controls Channel Aftertouch zxx_polyAT, // Type 7 - Z80 - ZFF controls Poly Aftertouch + zxx_custom, zxx_max }; @@ -88,7 +89,9 @@ fixedMacroType GetFixedMacroType() const; // Create a new macro +protected: void CreateParameteredMacro(char (¶meteredMacro)[MACRO_LENGTH], parameteredMacroType macroType, int subType) const; +public: void CreateParameteredMacro(size_t macroIndex, parameteredMacroType macroType, int subType = 0) { CreateParameteredMacro(szMidiSFXExt[macroIndex], macroType, subType); @@ -100,7 +103,9 @@ return std::string(parameteredMacro); }; +protected: void CreateFixedMacro(char (&fixedMacros)[128][MACRO_LENGTH], fixedMacroType macroType) const; +public: void CreateFixedMacro(fixedMacroType macroType) { CreateFixedMacro(szMidiZXXExt, macroType); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |