From: <sag...@us...> - 2012-07-01 17:50:51
|
Revision: 1314 http://modplug.svn.sourceforge.net/modplug/?rev=1314&view=rev Author: saga-games Date: 2012-07-01 17:50:45 +0000 (Sun, 01 Jul 2012) Log Message: ----------- [Fix] Fade song emitted a noise burst since revision 1282. [Mod] OpenMPT: Version is now 1.20.01.11 Revision Links: -------------- http://modplug.svn.sourceforge.net/modplug/?rev=1282&view=rev Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-07-01 17:23:31 UTC (rev 1313) +++ trunk/OpenMPT/mptrack/version.h 2012-07-01 17:50:45 UTC (rev 1314) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 01 -#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/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2012-07-01 17:23:31 UTC (rev 1313) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2012-07-01 17:50:45 UTC (rev 1314) @@ -1695,8 +1695,6 @@ } -extern int gbInitPlugins; - void CSoundFile::ProcessPlugins(UINT nCount) //------------------------------------------ { @@ -1710,11 +1708,6 @@ && plugin.pMixState->pOutBufferR != nullptr) { SNDMIXPLUGINSTATE *pState = plugin.pMixState; - // Init plugins ? - /*if (gbInitPlugins) - { //ToDo: do this in resume. - pPlugin->pMixPlugin->Init(gdwMixingFreq, (gbInitPlugins & 2) ? TRUE : FALSE); - }*/ //We should only ever reach this point if the song is playing. if (!plugin.pMixPlugin->IsSongPlaying()) @@ -1832,7 +1825,6 @@ } } FloatToStereoMix(pMixL, pMixR, MixSoundBuffer, nCount); - gbInitPlugins = 0; } ////////////////////////////////////////////////////////////////////////////////////////// Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2012-07-01 17:23:31 UTC (rev 1313) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2012-07-01 17:50:45 UTC (rev 1314) @@ -51,7 +51,6 @@ PMIXPLUGINCREATEPROC CSoundFile::gpMixPluginCreateProc = NULL; LONG gnDryROfsVol = 0; LONG gnDryLOfsVol = 0; -int gbInitPlugins = 0; bool gbInitTables = 0; typedef DWORD (MPPASMCALL * LPCONVERTPROC)(LPVOID, int *, DWORD); @@ -242,7 +241,6 @@ #ifdef ENABLE_EQ InitializeEQ(bReset); #endif - gbInitPlugins = (bReset) ? 3 : 1; return TRUE; } @@ -254,7 +252,7 @@ if (nsamples <= 0) return FALSE; if (nsamples > 0x100000) nsamples = 0x100000; m_nBufferCount = nsamples; - samplecount_t nRampLength = m_nBufferCount; + int nRampLength = static_cast<int>(m_nBufferCount); // Ramp everything down for (UINT noff=0; noff < m_nMixChannels; noff++) { @@ -2410,7 +2408,7 @@ ModCommand::NOTE realNote = note; if(ModCommand::IsNote(note)) realNote = pIns->NoteMap[note - 1]; - pPlugin->MidiCommand(GetBestMidiChannel(nChn), pIns->nMidiProgram, pIns->wMidiBank, realNote, pChn->nVolume, nChn); + pPlugin->MidiCommand(GetBestMidiChannel(nChn), pIns->nMidiProgram, pIns->wMidiBank, realNote, static_cast<uint16>(pChn->nVolume), nChn); } else if (volcmd == VOLCMD_VOLUME) { pPlugin->MidiCC(GetBestMidiChannel(nChn), MIDIEvents::MIDICC_Volume_Fine, vol, nChn); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-07-07 14:57:23
|
Revision: 1318 http://modplug.svn.sourceforge.net/modplug/?rev=1318&view=rev Author: saga-games Date: 2012-07-07 14:57:16 +0000 (Sat, 07 Jul 2012) Log Message: ----------- [Mod] Updated release notes. [Mod] Installer: Config directory shortcut is no longer placed in start menu (it was created even when start menu icons were not selected and it was kind of pointless). [Mod] OpenMPT: Version is now 1.20.02.00 Modified Paths: -------------- trunk/OpenMPT/installer/install.iss trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/packageTemplate/History.txt trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html Added Paths: ----------- trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.20/quick_channel_settings.png Modified: trunk/OpenMPT/installer/install.iss =================================================================== --- trunk/OpenMPT/installer/install.iss 2012-07-06 23:15:18 UTC (rev 1317) +++ trunk/OpenMPT/installer/install.iss 2012-07-07 14:57:16 UTC (rev 1318) @@ -102,7 +102,6 @@ Name: {group}\{cm:LaunchProgram,OpenMPT}; Filename: {app}\mptrack.exe Name: {group}\{cm:UninstallProgram,OpenMPT}; Filename: {uninstallexe} Name: {group}\ModPlug Central; Filename: {app}\ModPlug Central.url -Name: {group}\Configuration files; Filename: {userappdata}\OpenMPT\; Tasks: not portable ; app's directory and keymaps directory (for ease of use) Name: {app}\Configuration files; Filename: {userappdata}\OpenMPT\; Tasks: not portable Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-07-06 23:15:18 UTC (rev 1317) +++ trunk/OpenMPT/mptrack/version.h 2012-07-07 14:57:16 UTC (rev 1318) @@ -18,8 +18,8 @@ //Version definitions. The only thing that needs to be changed when changing version number. #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 -#define VER_MINOR 01 -#define VER_MINORMINOR 11 +#define VER_MINOR 02 +#define VER_MINORMINOR 00 //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 2012-07-06 23:15:18 UTC (rev 1317) +++ trunk/OpenMPT/packageTemplate/History.txt 2012-07-07 14:57:16 UTC (rev 1318) @@ -24,8 +24,85 @@ <ks> coda / Ken Snyder -v1.20.01.00 (May 2012, revision 1263) -------------------------------------- +v1.20.02.00 (7 July 2012, revision 1318) +---------------------------------------- +Pattern tab + [New] <js> Middle-clicking or Ctrl-right-clicking a channel header shows the Quick Channel Settings dialog, where channel name, volume and panning settings can be quickly set up. + [Imp] <js> After selecting a column through a double click, it is possible to extend this selection to other channels by keeping the mouse button down after the second click (http://bugs.openmpt.org/view.php?id=245). + [Mod] <js> Order list display is now "blanked" after maximum supported length instead of internal size. + [Mod] <js> Interpolation and transpose context menu items have been moved to sub menus. + [Fix] <js> Shift-Click behaviour was inconsistent if a selection has already been made (http://bugs.openmpt.org/view.php?id=249). + [Fix] <js> An order list beginning with a separator and a stop pattern won't hang the tracker anymore (http://bugs.openmpt.org/view.php?id=255). + [Fix] <js> Moving channels through Drag&Drop didn't update the channel names properly. + [Fix] <ks> Pressing and releasing superflous modifier keys made some pattern selection shortcuts get stuck. + [Reg] <js> Removed the "Rename Channel" context menu entry in favour of the new Quick Channel Settings. + +Sample tab + [Imp] <js> Improved AIFF support (added support for loop points, up to 32-Bit sample resolution, AIFF-C files and little-endian sample data). + [Imp] <js> Added support for arbitrary bit resolutions between 1 and 32 bits in WAV files (f.e. 20-Bit sample data). + [Imp] <js> If zooming the current selection is impossible, the zoom context menu item is greyed out. + [Fix] <js> Shouldn't crash anymore when cleaning up Undo memory (http://bugs.openmpt.org/view.php?id=232). + +Instrument tab + [Mod] <js> When right-clicking an envelope point, "Insert Point" will now insert the new point a tick to the right instead of inserting no point at all. + +Mod Conversion + [Mod] <js> When converting to XM, pattern breaks for fixing the FT2 E6x bug are now only inserted when necessary. + +VST / DMO Plugins + [Imp] <js> Plugin selection dialog makes use of plugin categories (as reported by the plugins) now. + [Imp] <js> The current playback position is now also reported correctly to plugins when jumping around in the order list (Previously, it was always reset to the song start). + +VST::Specific Plugin Fixes + [Fix] <js> The Korg Wavestation GUI did not work until song was played for the first time since OpenMPT 1.20. This may also fix the GUI of older versions of the Korg M1 plugin. + +Playback + [Fix] <js> Fixed frequency slide inaccuracies (tx BeRo). + [Fix] <js> Removed portamento speed A01 "fix". At speed 1, use fine pitch slides instead of normal ones (they behave identically to what OpenMPT did previously at speed 1). + +IT + [Reg] <js> Random filter variation settings are not supported anymore when editing IT files. Please use the MPTM format instead. Importing old files with random filter settings does still work. + +IT::Compatible Playback Mode + [Fix] <js> Combinations of Qxy (retrigger) with a pattern delay at Speed y should now work as intended. + [Fix] <js> Combinations of SDx with x greater than the current spend and tick delay commands didn't work. + +IT::Loading + [Fix] <js> Loading IT files made with older versions of OpenMPT replaces SC0 with ^^ instead of v00 now. + +XM + [Fix] <js> Set Finetune (E5x) should now work as in Fasttracker 2. + [Fix] <js> Volume column command gxx did not have memory (tx coda). Combinations of gxx and Gxx in the same pattern cell work correctly now. + +XM::Compatible Playback Mode + [Fix] <js> Tremor (Txy) behaves more like in Fasttracker 2 now. + [Fix] <js> Volume column command l00 sets the panning to full left on every tick but the first. + +S3M::Loading + [Fix] <js> Empty patterns were not loaded correctly. + +MOD + [Fix] <js> Set Finetune (E5x) should now behave more like in ProTracker. + +Other formats + [New] <js> AMS (Velvet Studio) support is finally back (not crashing the tracker this time :). AMS (Extreme's Tracker) support has been improved as well. + [Imp] <js> WAV Loader also imports loop points when reading a WAV file as a module. + [Imp] <js> STM Loader imports some effects more correctly now. + [Imp] <js> UMX Loader checks for a few more contained module formats that are also supported by Galaxy Sound System (STM, 669, FAR). + [Fix] <js> MDL Loader was severely broken in OpenMPT 1.20.01.00. + [Fix] <js> MED Loader: Sample transpose should work as intended (at least for MMD1 modules), MMD2 order list works again as well, Tempo vs Speed precence for value 32 should be correct now. + +Misc + [New] <js> Keyboard Settings: Shortcuts can now also be found by pressing the sought-after key combination. Click search field to reset filter. + [Fix] <js> F1 was accidentally hardcoded to opening the help file (tx Diamond). + [Fix] <js> Song Length Estimation also takes per-pattern time signatures into account now. + +Bundled plugins + [Fix] <js> When using more than one instance of the MIDI Input / Output plugin at a time, killing one plugin instance killed all other instances as well. + [Fix] <ks> The MIDI Input / Output plugin could sometimes send garbage data. + +v1.20.01.00 (5 May 2012, revision 1263) +--------------------------------------- General tab [Imp] <js> Like the plugin preset box, the plugin parameter selection box is now only populated when it is focussed, to avoid delays with plugins that have tons of parameters. [Imp] <js> Default global volume display is now limited to 0...64 (instead of 0...128) for S3M (http://forum.openmpt.org/index.php?topic=4658.0). @@ -130,7 +207,6 @@ [Fix] <js> MIDI Macros for controlling plugin parameters 128 through 131 were broken since probably forever (they did nothing). VST / DMO Plugins - [New] <js> OpenMPT ships with a MIDI Input / Output plugin now. It can be used to send incoming MIDI Events to other plugins or send MIDI events to external MIDI gear. [New] <js> Plugins can now send MIDI events to chained plugins. Useful for e.g. LFO or arpeggiator plugins. [New] <js> Added "mappped" MIDI channels (like in Impulse Tracker). If a plugin's MIDI Channel is set to "mapped" in the instrument editor, note data is transmitted on a triggered note's pattern channel modulo 16. [New] <js> Experimental built-in support for JBridge. If you run OpenMPT with admin privileges now, you can directly run 64-Bit VST plugins in OpenMPT. @@ -187,7 +263,7 @@ [Fix] <js> New filter mode which pretty much sounds like Impulse Tracker's resonant filter (http://bugs.openmpt.org/view.php?id=8). The new filter mode is used iff "More IT compatible playback" is turned on and extended filter range is turned off. [Fix] <js> The filter is turned on iff either the cutoff is not at maximum or the resonance is not at minimum. [Fix] <js> No pan swing, panbrello, panning envelopes, etc. is applied on surround channels in compatible mode anymore (unless Quad Surround mode is enabled). - [Fix] <js> Sample and instrument panning overrides surround if Quad Surround is disabled (Test case: SmpInsPanSurround.it) + [Fix] <js> Sample and instrument panning overrides surround if Quad Surround is disabled. [Fix] <js> NNA settings are only recalled when a note entry is found. [Fix] <js> A high offset effect next to a note erroneously applied the offset instantly. [Fix] <js> Fixed behaviour when picking up notes after a SCx effect. @@ -210,7 +286,6 @@ XM [Mod] <js> Newly created XM files have compatible playback mode enabled by default. - [Mod] <js> Some compatibility settings are now always applied (not only in XM compatible mode) and files saved with older versions of OpenMPT are "fixed" automatically to still work with the new settings. Affected settings are: Out-of-range global volume handling, portamento vs. offset priority. [Fix] <js> Vibrato "ramp down" waveform is now played correctly (was previously played as "ramp up"). [Fix] <js> Panning slide nibble priority (when both nibbles of the slide parameter are set) was wrong for XM files. [Fix] <js> The first tick on a row was always "on" for XM tremor. @@ -232,6 +307,7 @@ XM::Loading and Saving [Imp] <js> Volume Column panning is now scaled better when loading or saving XM files, so it is translated to a 0...64 range instead of 2...62. [Imp] <js> Saving: Samples that are not associated to any instrument are now tried to be written to XM files anyway (http://bugs.openmpt.org/view.php?id=234). + [Mod] <js> Some compatibility settings are now always applied (not only in XM compatible mode) and files saved with older versions of OpenMPT are "fixed" automatically to still work with the new settings. Affected settings are: Out-of-range global volume handling, portamento vs. offset priority. [Fix] <js> Saving: When saving an XM with no instruments, garbage instrument settings were written. S3M @@ -249,9 +325,9 @@ [Fix] <js> Some malicious S3M files could previously crash OpenMPT. MOD - [Fix] <js> Amiga limits are now enfored correctly in ProTracker 1.x mode. [Imp] <js> Rewrote MOD magic parsing code a bit; can handle anything from 1 to 99 channel MODs now. [Mod] <js> Removed MOD compatibility export, it is now always applied (but only oneshot samples are modified, and they are not modified in memory anymore). + [Fix] <js> Amiga limits are now enfored correctly in ProTracker 1.x mode. Other formats [Imp] <js> Added hack-ish support for 32-bit float data to the WAV loader (the one that loads WAVs as modules, not as samples). @@ -285,7 +361,7 @@ [Imp] <js> Added "Show Settings Folder" menu item to help menu. [Imp] <js> Keyboard Settings: Added a search box, so finding a shortcut by name should be much easier now. [Imp] <js> The "Amplify MIDI Velocity" option has been changed to use a freely adjustable amplification factor (instead of fixed x2 amplification). - [Mod] <js> Removed horribly esoteric sample "fixing" for MOD / S3M files that was applied when loading MOD / S3M files or modifying samples in them - it could very well break some totally fine samples. + [Mod] <js> Removed horribly esoteric sample "fixing" that was applied when loading MOD / S3M files or modifying samples in them - it could very well break some totally fine samples. [Mod] <js> Channel Manager: Playback is not stopped anymore when stopping when reordering / removing channels. [Mod] <js> Song Properties: Modern and Alternative tempo mode is not shown for XM / IT files anymore by default, and deprecated playback flags are now greyed out unless used by the current module. Song flags are not updated "live" anymore. [Mod] <js> Revamped MIDI Mapping and Tuning dialogs a bit. @@ -293,16 +369,19 @@ [Mod] <js> Compatibility export hints are now hideable. [Mod] <js> Updated libraries: unmo3.dll (2.4.0.3), SoundTouch (1.6.0), zlib (1.2.7). [Fix] <js> Wave Export: Fixed infinitely looping export (http://forum.openmpt.org/index.php?topic=3874.0). - [Fix] <js> BPM approximation even works reliably when a module is not playing now. - [Fix] <js> Song length approximation for alternative tempo mode was compltely wrong (tx Bavi H). + [Fix] <js> BPM approximation also works reliably when a module is not playing now. + [Fix] <js> Song length estimation for alternative tempo mode was compltely wrong (tx Bavi H). [Fix] <js> Combo boxes will not disappear randomly that often anymore. [Fix] <js> Comments tab: C-5 frequency is now displayed correctly in all formats. [Fix] <js> MP3 Export shortcut was broken (http://bugs.openmpt.org/view.php?id=201). [Reg] <js> Saving to another module format requires explicit module conversion now, as it was causing more trouble than doing good. Previously, it was possible to simply enter a different file extension in the "Save As" dialog, so editing an IT file and saving it as "foo.mod" would have saved it as a ProTracker MOD instead of an IT file with .mod extension. +Bundled plugins + [New] <js> OpenMPT ships with a MIDI Input / Output plugin now. It can be used to send incoming MIDI Events to other plugins or send MIDI events to external MIDI gear. -v1.19.04.00 (September 2011, revision 1027) -------------------------------------------- + +v1.19.04.00 (9 September 2011, revision 1027) +--------------------------------------------- Pattern tab [Imp] <js> MIDI controller changes that are not covered by MIDI Mapping also create an undo point now. [Fix] <js> Parameter Control Event automation via MIDI Mapping didn't create an undo point if the cursor was in the first row or column (and if it wasn't, it stored too much undo data). @@ -331,8 +410,8 @@ [Fix] <js> Adding plugins through the main menu didn't mark the module as modified (http://bugs.openmpt.org/view.php?id=163). -v1.19.03.00 (July 2011, revision 921) -------------------------------------- +v1.19.03.00 (22 July 2011, revision 921) +---------------------------------------- General tab [Imp] <js> When editing panning, surround is disabled and when enabling surround, panning is reset. [Imp] <js> When moving a plugin to another slot, plugins routing their output to the selected plugin are now taken into account when choosing a default slot to move the plugin to. @@ -385,8 +464,8 @@ [Fix] <js> Setup Dialog: Fixed the checkbox list so that it doesn't look weird under Wine and doesn't crash when compiling OpenMPT with VS2010 (tx jmkz). -v1.19.02.00 (May 2011, revision 871) ------------------------------------- +v1.19.02.00 (13 May 2011, revision 871) +--------------------------------------- Pattern tab [New] <js> Channels can now be moved by dragging their channel header. Holding Shift while doing so duplicates the channel. [Imp] <js> Moving channels through the channel manager creates an undo point now. @@ -436,8 +515,8 @@ [Reg] <js> Removed hidden INI flag to suppress warnings when encountering keymaps with unknown items. This option was introduced when faulty keymaps threw multiple message boxes, but now it's just one and it shouldn't be ignored... -v1.19.01.00 (April 2011, revision 836) --------------------------------------- +v1.19.01.00 (1 April 2011, revision 836) +---------------------------------------- Pattern tab [New] <js> Clicking and dragging the row numbers selects the whole row in Excel / Calc style (http://bugs.openmpt.org/view.php?id=45) [New] <js> The new keyboard shortcuts "Select beat" and "Select measure" can be used to automatically extend the current selection to the beat / measure boundaries. @@ -609,8 +688,8 @@ [Reg] <js> "Set highlights to songs' time signatures" is gone. Custom song highlighting is now always applied, and the values found in the colour options are now always applied to new modules. -v1.18.03.00 (August 2010, revision 673) ---------------------------------------- +v1.18.03.00 (4 August 2010, revision 673) +----------------------------------------- General tab [Imp] <js> To prevent OpenMPT from hanging while switching between plugins (or switching to the general tab), the preset box is only filled when it gets the focus. This makes working with Synth1 a lot easier, since it has an insane amount of presets... :) [Mod] <js> Changed tab order of the lower panel (now it's more logical to me) @@ -700,8 +779,8 @@ [Fix] <js> Colour Setup: Some colours in the MPT default colour scheme were not set up properly when switching between presets. -v1.18.02.00 (May 2010, revision 610) ------------------------------------- +v1.18.02.00 (30 May 2010, revision 610) +--------------------------------------- General tab [Imp] <js> Disabled tempo slider for MOD files (it was just confusing) [Imp] <js> Disabled global volume slider for MOD files, instead enabled the sample pre-amp slider (so it is also possible to make output louder) @@ -885,21 +964,20 @@ [Mod] <js> Updated internet links (ModPlug Central Forums link is now a permalink) [Fix] <js> Multi window edit: When (un)muting a channel from the general tab in window 1, it was instantly shown in the pattern editor of window 2, but not vice versa. [Fix] <js> Channel Manager: When removing channels using the channel manager, their names were not cleared properly. - [Fix] <js> Song Length Detection: *Much* more accurate song length detection! Doesn't get tricked by pattern jumps anymore, hehe. :) - [Fix] <al, js> Instrument I/O: Flags from old ITI / XI files are loaded correctly again (broken in 1.18.00.00). + [Fix] <js> Song Length Estimation: Increased accurary *a lot*! Doesn't get tricked by pattern jumps anymore, hehe. :) + [Fix] <al, js> Instrument I/O: OpenMPT-specific flags in old ITI / XI files are loaded correctly again (broken in 1.18.00.00). [Fix] <js> When using the "close file" shortcut several times in a row so that multiple message boxes popped up, it was possible to crash OpenMPT. [Reg] <js> Removed AutodetectITplaystyle option, since the tracker detection works reliably enough now. Tracker detection can not be ignored anymore now. Installer/release package [New] <js> Ladies and gentlemen... we finally have an installer. :) - [Mod] <js> Added OpenMPT 1.18 release notes documents. [Mod] <js> Updated DE_jojo.mkb. [Mod] <js> Updated Paul Legovitch's keymap (now also suitable for desktop keyboards). [Mod] <al> Updated default keybindings. -v1.18.00.00 (January 2010, revision 475) internal test build ------------------------------------------------------------- +v1.18.00.00 (26 January 2010, revision 475) internal test build +--------------------------------------------------------------- General tab [Fix] <js> Channel name input field was not limited properly. @@ -1056,9 +1134,9 @@ MP3/Wav export [New] <js> Wave Convert: Normalization is back as experimental feature. - [New] <js> Wav/Mp3 export: Show estimated remaining time. - [Imp] <js> Mp3 export: Removed 60 minutes limit. - [Fix] <js> Mp3 export: Fixed possible issue with very long mod files (such as Skaven's "Beyond the Network"). + [New] <js> Wav/MP3 export: Show estimated remaining time. + [Imp] <js> MP3 export: Removed 60 minutes limit. + [Fix] <js> MP3 export: Fixed possible issue with very long mod files (such as Skaven's "Beyond the Network"). [Fix] <js> Wave Convert: The wave convert dialog had two default buttons, one of them (the "default default button") didn't make sense. Colour setup @@ -1109,11 +1187,11 @@ [Fix] <al> Fixes to handling of 32 chars long instrument name. -v1.17.03.02 (September 2009, revision 371) internal test build --------------------------------------------------------------- +v1.17.03.02 (22 September 2009, revision 371) internal test build +----------------------------------------------------------------- General tab - [Imp] <js> Modtype Dialog: Added suffixes "IT" and "S3M" to some mod flags for more clarity. - [Fix] <js> Modtype dialog will revert mod flags to previous values if user presses the Cancel button. + [Imp] <js> Song Settings dialog: Added suffixes "IT" and "S3M" to some mod flags for more clarity. + [Fix] <js> Song Settings dialog will revert play flags to previous values if user presses the Cancel button. [Fix] <js> VSTi / Sample volume sliders only go up to 255 instead of 256. [Fix] <js> Document will now be set modified when moving or inserting plugins. @@ -1250,21 +1328,21 @@ IT::Compatible Playback Mode [Imp] <js> More improvements to Vibrato, Tremolo and Panbrello. - [Imp] <js> Retrigger (Qxy) works like in Impulse Tracker now (when in compatible mode) (test #15) - [Imp] <js> Tremor (Ixy) works like in Impulse Tracker now (when in compatible mode) + [Imp] <js> Retrigger (Qxy) works like in Impulse Tracker now (test #15). + [Imp] <js> Tremor (Ixy) works like in Impulse Tracker now. [Fix] <js> Better sample vibrato compatibility. Vibrato Sweep isn't perfect yet, though. [Fix] <js> Offset beyond sample range. [Fix] <js> Don't reset Tremolo on new note, don't ignore tremolo if note volume is 0. [Fix] <js> Ignore S[345]x with x > 3. - [Fix] <js> Multisample instruments change with no entry in the instrument column (fixes spx-shuttledeparture.it) (test me). + [Fix] <js> Multisample instruments change with no entry in the instrument column (fixes spx-shuttledeparture.it). [Fix] <js> Pattern loop count won't be reset on pattern transition (fixes gm-trippy01.it). [Fix] <js> Tempo slides won't exceed 255 BPM in compatible mode. - [Fix] <js> Random waveforms (vibrato, tremolo, panbrello) (test #19). - [Fix] <js> Fixed handling of very short pitch / filter envelopes (test #24). + [Fix] <js> Random vibrato, tremolo, panbrello waveforms (test #19). + [Fix] <js> Fixed handling of pitch / filter envelope loops (test #24). [Fix] <js> Panning effects (Xxx, S8x, pxx) override pan swing (test #20). - [Fix] <js> SD0 / SC0 is now interpreted as SD1 / SC1 in compatibility mode (test #22). + [Fix] <js> SD0 / SC0 is now interpreted as SD1 / SC1. (test #22). [Fix] <js> Portamento up / down resets the destination of tone portamento (test #23). - [Fix] <js> Out of range global volume, local global volume slides. + [Fix] <js> Out of range global volume, per-channel global volume slides. S3M::Saving [Imp] <js> Orderlist is now as small as possible (multiple of 2 instead of multiple of 16); Using ST3's default UltraClick value. @@ -1277,7 +1355,7 @@ [Imp] <js> Smarter Zxx conversion without message box (heuristic detection). [Fix] <js> Minimum sample preamp value is now 16 (like in ST3). [Fix] <js> Small modifications to pattern loader to load somewhat broken S3M files (fix from xmp). - [Fix] <js> Don't reset global volume to max if it is 0 for "new" S3M modules. + [Fix] <js> Don't reset global volume to max if it is 0 for S3M modules made with ST3.20 or newer. [Fix] <js> Disable loop for sample with very short loop at the beginning. [Fix] <js> Samples with very short loops (2 bytes) will now load correctly. This fixes for example 94hitmix.s3m and spectral.s3m. @@ -1368,15 +1446,15 @@ [Fix] <js> Patterns: Reset pattern name when deleting pattern. -v1.17.02.54 (June 2009, revision 274) -------------------------------------- +v1.17.02.54 (24 June 2009, revision 274) +---------------------------------------- [Fix] <al> Pattern tab: It's now possible to use the old note fade behaviour when playing notes (see setup->general). (rev. 267) [Fix] <al> Pattern tab: Fixed wrong interpretations of "Old style pattern context menu"-option. (rev. 267) [Fix] <al> Misc: Some internal fixes. (rev. 267) -v1.17.02.53 (May 2009, revision 259) ------------------------------------- +v1.17.02.53 (17 May 2009, revision 259) +--------------------------------------- General [New] <js> Can now import MO3 files using external library. (rev. 248) @@ -1428,7 +1506,7 @@ [Fix] <js> Playing sample selection didn't work properly in all cases (http://forum.openmpt.org/index.php?topic=1700.0). (rev. 231) [Fix] <js> 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] <js> Notes from MIDI should now be handled the same way as notes from keyboard. (rev. 246) + [Mod] <js> Notes from MIDI are now handled the same way as notes from keyboard when making sample selections. (rev. 246) [Mod] <js> Play sample button now stops previous note even if mod is playing (http://forum.openmpt.org/index.php?topic=1366.0) (rev. 231) [Mod] <js> Sustain loop will now be enabled when setting it to sample selection. (rev. 231) [Mod] <js> Sample editing: If possible, use loop points as trim limits if there's no selection chosen. (rev. 230) @@ -1513,14 +1591,14 @@ [Fix] <al> Mixmode tool tip in general tab was in some cases shown on unrelated controls (http://forum.openmpt.org/index.php?topic=2176.0). [Fix] <al> 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] <al> 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] <al> Pattern effectdata paste was broken for MOD (probably since .46) (http://forum.openmpt.org/index.php?topic=1938.0). + [Fix] <al> Pattern paste was broken for MOD (probably since .46) (http://forum.openmpt.org/index.php?topic=1938.0). [Fix] <al> Continuous pattern navigation fixes (http://forum.openmpt.org/index.php?topic=1960.0, http://forum.openmpt.org/index.php?topic=1959.0). [Fix] <al> Keyboard split related fix (http://forum.openmpt.org/index.php?topic=1887.0). [Fix] <al> 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 [Fix] <al> Fixed MIDI mapping not checking MIDI event, which could cause events like pitch bend to trigger some mapping item. [Fix] <al> 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] <al> Fix for faulty tabs when switching between modtypes with and without instrumenttab (http://forum.openmpt.org/index.php?topic=1614.0). + [Fix] <al> Fix for wrong tabs being displayed when converting between module formats with and without instrument support (http://forum.openmpt.org/index.php?topic=1614.0). [Fix] <al> Fix for possible crash on save/load when using more than 64 channels with MPTM. [Reg] <al> Removed buggy rearrange samples (http://forum.openmpt.org/index.php?topic=2148.0). @@ -1614,7 +1692,7 @@ [New] <al> 32-bit float wav import [New] <al> Playback control additions: 'Solo on transition' & 'Mute on transition'. Available from pattern view context menu(right click). [New] <al> Envelope points can be scaled by a factor through context menu on envelopeview(right click) - [New] <al> Calculator of playback time (measured from start) at the beginning of any row of any pattern (uses existing song length calculator). + [New] <al> Calculator of playback time (measured from start) at the beginning of any row of any pattern (uses existing song length estimation). - Known limitation: When the row is within pattern loop, doesn't give all possible times. [New] <rf> SCx now sends note-off to VSTis at tick x. [New] <rf> New mixmode (called 1.17RC3): bypass global preamp, force soft panning, provide explicit dB value for sample attenuation. WARNING: this mixmode is subject to change. Modified: trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html =================================================================== --- trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html 2012-07-06 23:15:18 UTC (rev 1317) +++ trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html 2012-07-07 14:57:16 UTC (rev 1318) @@ -83,6 +83,11 @@ display: inline; color: #006; } + + tt + { + font-family: monospace; + } </style> </head> @@ -106,24 +111,31 @@ </div> <ul> <li>OpenMPT 1.20 introduces a <strong>template system</strong> that can be used to quickly access often used plugin, pattern, sample and instrument combinations.</li> - <li>When closing OpenMPT, a single dialog with a <strong>list of unsaved files</strong> is now shown instead of one message boxes for each modified file.</li> + <li>When closing OpenMPT, a single dialog with a <strong>list of unsaved files</strong> is now shown instead of one message box for each modified file.</li> <li><strong>Crash recovery</strong>: When a crash is encountered, OpenMPT will try to save modified documents to a temporary location and close the audio device. The latter can especially help with ASIO drivers that become unusable after a program crash.</li> <li><strong>MIDI CCs</strong> that are being received from an external MIDI device can now be mapped to pattern / sample / instrument editor shortcuts.</li> <li>The <strong>treeview</strong> can now handle more than 32 open modules.</li> + <li>The keyboard settings dialog can now be used to <strong>search for shortcuts</strong> by name and by key combination.</li> <li>At last, OpenMPT comes with a <strong>manual</strong> again!</li> </ul> <h3>Pattern Editor</h3> + <div class="screenshots"> + <a href="ReleaseNotesImages/1.20/quick_channel_settings.png"><img src="ReleaseNotesImages/1.20/quick_channel_settings.png" width="240" height="84" alt="Quick Channel Settings dialog" title="Quick Channel Settings dialog (click to view big screenshot)" /></a> + </div> <ul> <li><strong>Adding and removing channels</strong> creates an undo point now instead of clearing the undo log.</li> <li>There is now an option to <strong>select a channel</strong> by double-clicking a pattern cell.</li> <li>Like in Impulse Tracker, it is now possible to show the <strong>default sample volume</strong> if there is no volume command next to a note.</li> - <li>OpenMPT can now recording incoming <strong>aftertouch MIDI messages</strong> to patterns as either volume commands or MIDI macros.</li> + <li>OpenMPT can now record incoming <strong>aftertouch MIDI messages</strong> to patterns as either volume commands or MIDI macros.</li> + <li>Middle-clicking or Ctrl-right-clicking a channel header opens the new <strong>quick channel settings</strong> dialog, which can be used to quickly adjust volumem, panning and channel names.</li> </ul> <h3>Sample Editor</h3> <ul> <li>The new <strong>sample tuner</strong> can be used to tune samples to a given note.</li> + <li>Improved support for <strong>AIFF samples</strong> (up to 32-Bit PCM and floating point audio as well as little-endian PCM samples) and WAV samples with abitrary bit resolutiosn up to 32-Bit (e.g. 20-Bit). + <li>Editing large samples will not crash the tracker anymore.</li> </ul> <h3>Macro System</h3> @@ -138,7 +150,9 @@ <li>Searching for multiple <strong>unknown plugins</strong> will now open only one browser window.</li> <li>Some <strong>multi-output plugins</strong> like Kontakt (64 channels version) won't crash anymore.</li> <li>Built-in support for <strong>jBridge</strong> to provide support for 64-Bit plugins and other plugins that won't load in OpenMPT.</li> - <li>Exception handling for crashed plugins does finally work again, so the <strong>overall stability</strong> of OpenMPT as a VST host has increased. Note that a few plugins don't seem to like exception handling and might crash now.</li> + <li>Exception handling for crashed plugins does finally work again, so the <strong>overall stability</strong> of OpenMPT as a VST host has increased. Note that a few plugins don't seem to like exception handling and might crash now.</li> + <li>The current <strong>playback position</strong> is now also reported correctly to plugins when jumping around in the order list. Previously, it was always reset to the song start. This enhances support for sequencer plugins like Maschine.</li> + <li>Effect plugins are now sorted into <strong>plugin categories</strong> (as reported by the plugins) in the plugin selection dialog. Delete the <tt>plugin.cache</tt> file in OpenMPT's settings directory to rebuild the plugin cache with categories. Loading a plugin into a module will also update the cache.</li> </ul> <h3>There's more...</h3> Added: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.20/quick_channel_settings.png =================================================================== (Binary files differ) Property changes on: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.20/quick_channel_settings.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-07-07 18:03:11
|
Revision: 1320 http://modplug.svn.sourceforge.net/modplug/?rev=1320&view=rev Author: saga-games Date: 2012-07-07 18:03:04 +0000 (Sat, 07 Jul 2012) Log Message: ----------- Damn typos, how could those slip through -.- Modified Paths: -------------- trunk/OpenMPT/installer/packageTemplate/readme.txt trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html trunk/OpenMPT/packageTemplate/readme.txt Modified: trunk/OpenMPT/installer/packageTemplate/readme.txt =================================================================== --- trunk/OpenMPT/installer/packageTemplate/readme.txt 2012-07-07 16:00:18 UTC (rev 1319) +++ trunk/OpenMPT/installer/packageTemplate/readme.txt 2012-07-07 18:03:04 UTC (rev 1320) @@ -49,7 +49,7 @@ stretching feature. readme.txt: this document unmo3.dll: Used in MO3-file import. -OMPT_1.19_ReleaseNotes.html: Release notes for this version. +OMPT_1.20_ReleaseNotes.html: Release notes for this version. Misc: ----- Modified: trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html =================================================================== --- trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html 2012-07-07 16:00:18 UTC (rev 1319) +++ trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html 2012-07-07 18:03:04 UTC (rev 1320) @@ -128,13 +128,13 @@ <li>There is now an option to <strong>select a channel</strong> by double-clicking a pattern cell.</li> <li>Like in Impulse Tracker, it is now possible to show the <strong>default sample volume</strong> if there is no volume command next to a note.</li> <li>OpenMPT can now record incoming <strong>aftertouch MIDI messages</strong> to patterns as either volume commands or MIDI macros.</li> - <li>Middle-clicking or Ctrl-right-clicking a channel header opens the new <strong>quick channel settings</strong> dialog, which can be used to quickly adjust volumem, panning and channel names.</li> + <li>Middle-clicking or Ctrl-right-clicking a channel header opens the new <strong>quick channel settings</strong> dialog, which can be used to quickly adjust volume, panning and channel names.</li> </ul> <h3>Sample Editor</h3> <ul> <li>The new <strong>sample tuner</strong> can be used to tune samples to a given note.</li> - <li>Improved support for <strong>AIFF samples</strong> (up to 32-Bit PCM and floating point audio as well as little-endian PCM samples) and WAV samples with abitrary bit resolutiosn up to 32-Bit (e.g. 20-Bit). + <li>Improved support for <strong>AIFF samples</strong> (up to 32-Bit PCM and floating point audio as well as little-endian PCM samples) and WAV samples with arbitrary bit resolutions up to 32-Bit (e.g. 20-Bit). <li>Editing large samples will not crash the tracker anymore.</li> </ul> Modified: trunk/OpenMPT/packageTemplate/readme.txt =================================================================== --- trunk/OpenMPT/packageTemplate/readme.txt 2012-07-07 16:00:18 UTC (rev 1319) +++ trunk/OpenMPT/packageTemplate/readme.txt 2012-07-07 18:03:04 UTC (rev 1320) @@ -67,7 +67,7 @@ stretching feature. readme.txt: this document unmo3.dll: Used in MO3-file import. -OMPT_1.19_ReleaseNotes.html: Release notes for this version. +OMPT_1.20_ReleaseNotes.html: Release notes for this version. Misc: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-07-09 16:13:29
|
Revision: 1322 http://modplug.svn.sourceforge.net/modplug/?rev=1322&view=rev Author: saga-games Date: 2012-07-09 16:13:18 +0000 (Mon, 09 Jul 2012) Log Message: ----------- [New] Plugins can also receive tracker portamento (Hxx / 4xx) now. At a pitch wheel depth of +/-2 semitones, the behaviour is identical to sample vibrato. Modified Paths: -------------- trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/ModChannel.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/plugins/PlugInterface.h Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2012-07-09 00:54:37 UTC (rev 1321) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2012-07-09 16:13:18 UTC (rev 1322) @@ -2369,12 +2369,13 @@ //-------------------------------------------------------------------------------------- { const int16 increment = static_cast<int16>(nParam * 0x2000 / 0xFF); - int16 newPitchBendPos = m_nMidiPitchBendPos[nMidiCh] + increment; + int16 newPitchBendPos = (m_nMidiPitchBendPos[nMidiCh] & vstPitchBendMask) + increment; Limit(newPitchBendPos, int16(MIDIEvents::pitchBendMin), int16(MIDIEvents::pitchBendMax)); MidiPitchBend(nMidiCh, newPitchBendPos); } + //Set midi pitch for given midi channel using uncoverted midi value (0-16383) void CVstPlugin::MidiPitchBend(uint8 nMidiCh, int16 newPitchBendPos) //------------------------------------------------------------------ @@ -2385,6 +2386,28 @@ } +void CVstPlugin::MidiVibrato(uint8 nMidiCh, int16 depth) +//------------------------------------------------------ +{ + if(depth != 0 || (m_nMidiPitchBendPos[nMidiCh] & vstVibratoFlag)) + { + // Temporarily add vibrato offset to current pitch + int16 pitch = (m_nMidiPitchBendPos[nMidiCh] & vstPitchBendMask) + depth; + Limit(pitch, static_cast<int16>(MIDIEvents::pitchBendMin), static_cast<int16>(MIDIEvents::pitchBendMax)); + MidiSend(MIDIEvents::BuildPitchBendEvent(nMidiCh, pitch)); + } + + // Update vibrato status + if(depth != 0) + { + m_nMidiPitchBendPos[nMidiCh] |= vstVibratoFlag; + } else + { + m_nMidiPitchBendPos[nMidiCh] &= ~vstVibratoFlag; + } +} + + //rewbs.introVST - many changes to MidiCommand, still to be refined. void CVstPlugin::MidiCommand(uint8 nMidiCh, uint8 nMidiProg, uint16 wMidiBank, uint16 note, uint16 vol, CHANNELINDEX trackChannel) //-------------------------------------------------------------------------------------------------------------------------------- Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2012-07-09 00:54:37 UTC (rev 1321) +++ trunk/OpenMPT/mptrack/Vstplug.h 2012-07-09 16:13:18 UTC (rev 1322) @@ -129,6 +129,9 @@ { // Number of MIDI events that can be sent to a plugin at once (the internal queue is not affected by this number, it can hold any number of events) vstNumProcessEvents = 256, + + vstPitchBendMask = 0x7FFF, + vstVibratoFlag = 0x8000, }; ULONG m_nRefCount; @@ -145,7 +148,7 @@ SNDMIXPLUGINSTATE m_MixState; UINT m_nInputs, m_nOutputs; VSTInstrChannel m_MidiCh[16]; - short m_nMidiPitchBendPos[16]; + int16 m_nMidiPitchBendPos[16]; // Current pitch wheel depth. Highest bit is used for indicating that vibrato was applied. Vibrato offset itself is not stored in this value. CModDoc* m_pModDoc; //rewbs.plugDocAware CSoundFile* m_pSndFile; //rewbs.plugDocAware @@ -235,6 +238,7 @@ bool MidiSend(DWORD dwMidiCode); void MidiCC(uint8 nMidiCh, MIDIEvents::MidiCC nController, uint8 nParam, CHANNELINDEX trackChannel); void MidiPitchBend(uint8 nMidiCh, int nParam, CHANNELINDEX trackChannel); + void MidiVibrato(uint8 nMidiCh, int16 depth); void MidiCommand(uint8 nMidiCh, uint8 nMidiProg, uint16 wMidiBank, uint16 note, uint16 vol, CHANNELINDEX trackChannel); void HardAllNotesOff(); //rewbs.VSTiNoteHoldonStopFix bool isPlaying(UINT note, UINT midiChn, UINT trackerChn); //rewbs.instroVST Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-07-09 00:54:37 UTC (rev 1321) +++ trunk/OpenMPT/mptrack/version.h 2012-07-09 16:13:18 UTC (rev 1322) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 02 -#define VER_MINORMINOR 00 +#define VER_MINORMINOR 01 //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/ModChannel.h =================================================================== --- trunk/OpenMPT/soundlib/ModChannel.h 2012-07-09 00:54:37 UTC (rev 1321) +++ trunk/OpenMPT/soundlib/ModChannel.h 2012-07-09 16:13:18 UTC (rev 1322) @@ -44,6 +44,7 @@ // 2nd cache line DWORD nLength; DWORD dwFlags; + DWORD dwOldFlags; // Flags from previous tick DWORD nLoopStart; DWORD nLoopEnd; int nRampRightVol; @@ -61,9 +62,8 @@ int nPeriod, nC5Speed, nPortamentoDest; int nCalcVolume; // Calculated channel volume, 14-Bit (without global volume, pre-amp etc applied) - for MIDI macros ModInstrument *pModInstrument; // Currently assigned instrument slot - ModChannelEnvInfo VolEnv, PanEnv, PitchEnv; // Envelope playback info + ModChannelEnvInfo VolEnv, PanEnv, PitchEnv; // Envelope playback info ModSample *pModSample; // Currently assigned sample slot - CHANNELINDEX nMasterChn; DWORD nVUMeter; int nGlobalVol; // Channel volume (CV in ITTECH.TXT) int nInsVol; // Sample / Instrument volume (SV * IV in ITTECH.TXT) @@ -78,6 +78,7 @@ int nRetrigCount, nRetrigParam; ROWINDEX nPatternLoop; UINT nNoteSlideCounter, nNoteSlideSpeed, nNoteSlideStep; + CHANNELINDEX nMasterChn; // 8-bit members BYTE nRestoreResonanceOnNewNote; //Like above BYTE nRestoreCutoffOnNewNote; //Like above @@ -169,11 +170,11 @@ // Default pattern channel settings -struct ModChannelSettings +struct __declspec(align(32)) ModChannelSettings { - UINT nPan; // Initial pan - UINT nVolume; // Initial channel volume - DWORD dwFlags; // Channel flags + uint16 nPan; // Initial pan + uint16 nVolume; // Initial channel volume + uint32 dwFlags; // Channel flags PLUGINDEX nMixPlugin; // Assigned plugin CHAR szName[MAX_CHANNELNAME]; // Channel name }; Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-07-09 00:54:37 UTC (rev 1321) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-07-09 16:13:18 UTC (rev 1322) @@ -2624,34 +2624,18 @@ } } + void CSoundFile::MidiPortamento(CHANNELINDEX nChn, int param) //----------------------------------------------------------- { - if((Chn[nChn].dwFlags & (CHN_MUTE | CHN_SYNCMUTE)) != 0) + IMixPlugin *plugin = GetChannelInstrumentPlugin(nChn); + if(plugin != nullptr) { - // Don't process portamento on muted channels. Note that this might have a side-effect - // on other channels which trigger notes on the same MIDI channel of the same plugin, - // as those won't be pitch-bent anymore. - return; + plugin->MidiPitchBend(GetBestMidiChannel(nChn), param, 0); } - - //Send midi pitch bend event if there's a plugin: - const ModInstrument *pIns = Chn[nChn].pModInstrument; - if (pIns && pIns->HasValidMIDIChannel()) - { - // instro sends to a midi chan - UINT nPlug = pIns->nMixPlug; - if ((nPlug) && (nPlug <= MAX_MIXPLUGINS)) - { - IMixPlugin *pPlug = (IMixPlugin*)m_MixPlugins[nPlug-1].pMixPlugin; - if (pPlug) - { - pPlug->MidiPitchBend(GetBestMidiChannel(nChn), param, 0); - } - } - } } + void CSoundFile::FinePortamentoUp(ModChannel *pChn, UINT param) //------------------------------------------------------------- { @@ -4580,21 +4564,48 @@ // Unlike channel settings, pModInstrument is copied from the original chan to the NNA chan, // so we don't need to worry about finding the master chan. - PLUGINDEX nPlugin = 0; - if (Chn[nChn].pModInstrument) + PLUGINDEX plug = 0; + if(Chn[nChn].pModInstrument != nullptr) { if (respectMutes == RespectMutes && Chn[nChn].pModSample && (Chn[nChn].pModSample->uFlags & CHN_MUTE)) { - nPlugin = 0; + plug = 0; } else { - nPlugin = Chn[nChn].pModInstrument->nMixPlug; + plug = Chn[nChn].pModInstrument->nMixPlug; } } - return nPlugin; + return plug; } +// Retrieve the plugin that is associated with the channel's current instrument. +// No plugin is returned if the channel is muted or if the instrument doesn't have a MIDI channel set up, +// As this is meant to be used with instrument plugins. +IMixPlugin *CSoundFile::GetChannelInstrumentPlugin(CHANNELINDEX chn) const +//------------------------------------------------------------------------ +{ + if((Chn[chn].dwFlags & (CHN_MUTE | CHN_SYNCMUTE)) != 0) + { + // Don't process portamento on muted channels. Note that this might have a side-effect + // on other channels which trigger notes on the same MIDI channel of the same plugin, + // as those won't be pitch-bent anymore. + return nullptr; + } + + const ModInstrument *pIns = Chn[chn].pModInstrument; + if(pIns != nullptr && pIns->HasValidMIDIChannel()) + { + // Instrument sends to a MIDI channel + if(pIns->nMixPlug != 0 && pIns->nMixPlug <= MAX_MIXPLUGINS) + { + return m_MixPlugins[pIns->nMixPlug - 1].pMixPlugin; + } + } + return nullptr; +} + + uint8 CSoundFile::GetBestMidiChannel(CHANNELINDEX nChn) const //---------------------------------------------------------- { Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2012-07-09 00:54:37 UTC (rev 1321) +++ trunk/OpenMPT/soundlib/Sndfile.h 2012-07-09 16:13:18 UTC (rev 1322) @@ -531,7 +531,7 @@ void ProcessPanbrello(ModChannel *pChn); void ProcessArpeggio(ModChannel *pChn, int &period, CTuning::NOTEINDEXTYPE &arpeggioSteps); - void ProcessVibrato(ModChannel *pChn, int &period, CTuning::RATIOTYPE &vibratoFactor); + void ProcessVibrato(CHANNELINDEX nChn, int &period, CTuning::RATIOTYPE &vibratoFactor); void ProcessSampleAutoVibrato(ModChannel *pChn, int &period, CTuning::RATIOTYPE &vibratoFactor, int &nPeriodFrac); void ProcessRamping(ModChannel *pChn); @@ -712,6 +712,7 @@ private: PLUGINDEX __cdecl GetChannelPlugin(CHANNELINDEX nChn, PluginMutePriority respectMutes) const; PLUGINDEX __cdecl GetActiveInstrumentPlugin(CHANNELINDEX, PluginMutePriority respectMutes) const; + IMixPlugin *__cdecl GetChannelInstrumentPlugin(CHANNELINDEX chn) const; void HandlePatternTransitionEvents(); Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2012-07-09 00:54:37 UTC (rev 1321) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2012-07-09 16:13:18 UTC (rev 1322) @@ -1016,7 +1016,8 @@ { if(IsCompatibleMode(TRK_FASTTRACKER2)) { - // Weird XM tremor. + // FT2 Compatibility: Weird XM tremor. + // Test case: Tremor.xm if(pChn->nTremorCount & 0x80) { if(!(m_dwSongFlags & SONG_FIRSTTICK) && pChn->nCommand == CMD_TREMOR) @@ -1539,33 +1540,34 @@ } -void CSoundFile::ProcessVibrato(ModChannel *pChn, int &period, CTuning::RATIOTYPE &vibratoFactor) +void CSoundFile::ProcessVibrato(CHANNELINDEX nChn, int &period, CTuning::RATIOTYPE &vibratoFactor) //----------------------------------------------------------------------------------------------- { - if (pChn->dwFlags & CHN_VIBRATO) + ModChannel &chn = Chn[nChn]; + + if(chn.dwFlags & CHN_VIBRATO) { - UINT vibpos = pChn->nVibratoPos; + UINT vibpos = chn.nVibratoPos; - int vdelta = GetVibratoDelta(pChn->nVibratoType, vibpos); - if((GetType() & MOD_TYPE_XM) && (pChn->nVibratoType & 0x03) == 1) + int vdelta = GetVibratoDelta(chn.nVibratoType, vibpos); + if((GetType() & MOD_TYPE_XM) && (chn.nVibratoType & 0x03) == 1) { // FT2 compatibility: Vibrato ramp down table is upside down. // Test case: VibratoWaveforms.xm vdelta = -vdelta; } - if(GetType() == MOD_TYPE_MPT && pChn->pModInstrument && pChn->pModInstrument->pTuning) + if(GetType() == MOD_TYPE_MPT && chn.pModInstrument && chn.pModInstrument->pTuning) { //Hack implementation: Scaling vibratofactor to [0.95; 1.05] //using figure from above tables and vibratodepth parameter - vibratoFactor += 0.05F * vdelta * pChn->m_VibratoDepth / 128.0F; - pChn->m_CalculateFreq = true; - pChn->m_ReCalculateFreqOnFirstTick = false; + vibratoFactor += 0.05F * vdelta * chn.m_VibratoDepth / 128.0F; + chn.m_CalculateFreq = true; + chn.m_ReCalculateFreqOnFirstTick = false; if(m_nTickCount + 1 == m_nMusicSpeed) - pChn->m_ReCalculateFreqOnFirstTick = true; - } - else + chn.m_ReCalculateFreqOnFirstTick = true; + } else { // Original behaviour @@ -1584,12 +1586,14 @@ vdepth = 6; vdelta = -vdelta; } - } - else + } else { vdepth = ((!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) || (m_dwSongFlags & SONG_ITOLDEFFECTS)) ? 6 : 7; } - vdelta = (vdelta * (int)pChn->nVibratoDepth) >> vdepth; + + vdelta = (vdelta * (int)chn.nVibratoDepth) >> vdepth; + int16 midiDelta = static_cast<int16>(-vdelta); // Periods are upside down + if ((m_dwSongFlags & SONG_LINEARSLIDES) && (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))) { int l = vdelta; @@ -1605,15 +1609,33 @@ } } period += vdelta; + + // Process MIDI vibrato for plugins: + IMixPlugin *plugin = GetChannelInstrumentPlugin(nChn); + if(plugin != nullptr) + { + midiDelta *= (MIDIEvents::pitchBendMax - MIDIEvents::pitchBendCentre) / 127; + plugin->MidiVibrato(GetBestMidiChannel(nChn), midiDelta); + } } - if ((m_nTickCount) || ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS)))) + + // Advance vibrato position + if(m_nTickCount || ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS)))) { // IT compatibility: IT has its own, more precise tables if(IsCompatibleMode(TRK_IMPULSETRACKER)) - pChn->nVibratoPos = (vibpos + 4 * pChn->nVibratoSpeed) & 0xFF; + chn.nVibratoPos = (vibpos + 4 * chn.nVibratoSpeed) & 0xFF; else - pChn->nVibratoPos = (vibpos + pChn->nVibratoSpeed) & 0x3F; + chn.nVibratoPos = (vibpos + chn.nVibratoSpeed) & 0x3F; } + } else if(chn.dwOldFlags & CHN_VIBRATO) + { + // Stop MIDI vibrato for plugins: + IMixPlugin *plugin = GetChannelInstrumentPlugin(nChn); + if(plugin != nullptr) + { + plugin->MidiVibrato(GetBestMidiChannel(nChn), 0); + } } } @@ -2067,12 +2089,17 @@ ProcessMacroOnChannel(nChn); // After MIDI macros have been processed, we can also process the pitch / filter envelope and other pitch-related things. - if (samplePlaying) + if(samplePlaying) { + ProcessPitchFilterEnvelope(pChn, period); + } + + // Plugins may also receive vibrato + ProcessVibrato(nChn, period, vibratoFactor); + + if(samplePlaying) + { int nPeriodFrac = 0; - - ProcessPitchFilterEnvelope(pChn, period); - ProcessVibrato(pChn, period, vibratoFactor); ProcessSampleAutoVibrato(pChn, period, vibratoFactor, nPeriodFrac); // Final Period @@ -2333,6 +2360,8 @@ pChn->nLeftVol = pChn->nRightVol = 0; pChn->nLength = 0; } + + pChn->dwOldFlags = pChn->dwFlags; } // Checking Max Mix Channels reached: ordering by volume Modified: trunk/OpenMPT/soundlib/plugins/PlugInterface.h =================================================================== --- trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2012-07-09 00:54:37 UTC (rev 1321) +++ trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2012-07-09 16:13:18 UTC (rev 1322) @@ -43,6 +43,7 @@ virtual bool MidiSend(DWORD dwMidiCode) = 0; virtual void MidiCC(uint8 nMidiCh, MIDIEvents::MidiCC nController, uint8 nParam, CHANNELINDEX trackChannel) = 0; virtual void MidiPitchBend(uint8 nMidiCh, int nParam, CHANNELINDEX trackChannel) = 0; + virtual void MidiVibrato(uint8 nMidiCh, int16 depth) = 0; virtual void MidiCommand(uint8 nMidiCh, uint8 nMidiProg, uint16 wMidiBank, uint16 note, uint16 vol, CHANNELINDEX trackChannel) = 0; virtual void HardAllNotesOff() = 0; //rewbs.VSTCompliance virtual void RecalculateGain() = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-07-13 18:45:23
|
Revision: 1325 http://modplug.svn.sourceforge.net/modplug/?rev=1325&view=rev Author: saga-games Date: 2012-07-13 18:45:15 +0000 (Fri, 13 Jul 2012) Log Message: ----------- [Fix] OpenMPT didn't write more than 255 plugins to the settings file (http://bugs.openmpt.org/view.php?id=267) [Imp] Mod Upgrade: gxx/3xx combinations in XM files made with older versions of OpenMPT are now tried to be upgraded to the new behaviour. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2012-07-09 22:07:00 UTC (rev 1324) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2012-07-13 18:45:15 UTC (rev 1325) @@ -1576,7 +1576,7 @@ m_bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MPTRACK)); wsprintf(s, "Build Date: %s", gszBuildDate); SetDlgItemText(IDC_EDIT2, s); - SetDlgItemText(IDC_EDIT3, CString("OpenMPT ") + MptVersion::str + " (development build)"); + SetDlgItemText(IDC_EDIT3, CString("OpenMPT ") + MptVersion::str); m_heContact.SetWindowText( "Contact / Discussion:\r\n" @@ -1584,10 +1584,11 @@ "\r\nUpdates:\r\n" "http://openmpt.org/download"); - const char* const pArrCredit = { + static const char* const pArrCredit = + { "OpenMPT / ModPlug Tracker|" "Copyright \xA9 2004-2012 Contributors|" - "Copyright \xA9 1997-2003 Olivier Lapicque (ol...@mo...)|" + "Copyright \xA9 1997-2003 Olivier Lapicque|" "|" "Contributors:|" "Johannes Schultz (2008-2012)|" @@ -1633,16 +1634,16 @@ "||||||" }; - m_static.SubclassDlgItem(IDC_CREDITS,this); - m_static.SetCredits(pArrCredit); - m_static.SetSpeed(DISPLAY_SLOW); - m_static.SetColor(BACKGROUND_COLOR, RGB(138, 165, 219)); // Background Colour - m_static.SetTransparent(); // Set parts of bitmaps with RGB(192,192,192) transparent - m_static.SetGradient(GRADIENT_LEFT_DARK); // Background goes from blue to black from left to right - // m_static.SetBkImage(IDB_BITMAP1); // Background image - m_static.StartScrolling(); - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + m_static.SubclassDlgItem(IDC_CREDITS,this); + m_static.SetCredits(pArrCredit); + m_static.SetSpeed(DISPLAY_SLOW); + m_static.SetColor(BACKGROUND_COLOR, RGB(138, 165, 219)); // Background Colour + m_static.SetTransparent(); // Set parts of bitmaps with RGB(192,192,192) transparent + m_static.SetGradient(GRADIENT_LEFT_DARK); // Background goes from blue to black from left to right + // m_static.SetBkImage(IDB_BITMAP1); // Background image + m_static.StartScrolling(); + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE } @@ -2176,11 +2177,10 @@ //----------------------------------- { TCHAR s[_MAX_PATH], tmp[32]; - LONG nPlugins; m_pPluginManager = new CVstPluginManager; - if (!m_pPluginManager) return FALSE; - nPlugins = GetPrivateProfileInt("VST Plugins", "NumPlugins", 0, m_szConfigFileName); + if(!m_pPluginManager) return FALSE; + const size_t numPlugins = GetPrivateProfileInt("VST Plugins", "NumPlugins", 0, m_szConfigFileName); #ifndef NO_VST char buffer[64]; @@ -2210,10 +2210,10 @@ CString nonFoundPlugs; const CString failedPlugin = CMainFrame::GetPrivateProfileCString("VST Plugins", "FailedPlugin", "", m_szConfigFileName); - for (LONG iPlug=0; iPlug<nPlugins; iPlug++) + for(size_t plug = 0; plug < numPlugins; plug++) { s[0] = 0; - wsprintf(tmp, "Plugin%d", iPlug); + wsprintf(tmp, "Plugin%d", plug); GetPrivateProfileString("VST Plugins", tmp, "", s, sizeof(s), m_szConfigFileName); if (s[0]) { @@ -2227,7 +2227,7 @@ continue; } } - m_pPluginManager->AddPlugin(s, TRUE, true, &nonFoundPlugs); + m_pPluginManager->AddPlugin(s, true, true, &nonFoundPlugs); } } if(nonFoundPlugs.GetLength() > 0) @@ -2242,31 +2242,31 @@ BOOL CTrackApp::UninitializeDXPlugins() //------------------------------------- { - if (!m_pPluginManager) return FALSE; + if(!m_pPluginManager) return FALSE; #ifndef NO_VST TCHAR s[_MAX_PATH], tmp[32]; VSTPluginLib *pPlug; pPlug = m_pPluginManager->GetFirstPlugin(); - PLUGINDEX iPlug = 0; - while (pPlug) + size_t plug = 0; + while(pPlug) { - if (pPlug->dwPluginId1 != kDmoMagic) + if(pPlug->dwPluginId1 != kDmoMagic) { s[0] = 0; - wsprintf(tmp, "Plugin%d", iPlug); + wsprintf(tmp, "Plugin%d", plug); strcpy(s, pPlug->szDllPath); if(theApp.IsPortableMode()) { AbsolutePathToRelative(s); } WritePrivateProfileString("VST Plugins", tmp, s, m_szConfigFileName); - iPlug++; + plug++; } pPlug = pPlug->pNext; } - wsprintf(s, "%d", iPlug); + wsprintf(s, "%d", plug); WritePrivateProfileString("VST Plugins", "NumPlugins", s, m_szConfigFileName); #endif // NO_VST Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2012-07-09 22:07:00 UTC (rev 1324) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2012-07-13 18:45:15 UTC (rev 1325) @@ -2121,8 +2121,8 @@ if(pSndFile->GetType() == MOD_TYPE_XM) { - if(pSndFile->m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 19, 00, 00) || - (!pSndFile->IsCompatibleMode(TRK_FASTTRACKER2) && pSndFile->m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 20, 00, 00))) + if(pSndFile->m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 19, 00, 00) + || (!pSndFile->IsCompatibleMode(TRK_FASTTRACKER2) && pSndFile->m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 20, 00, 00))) { if(m.command == CMD_OFFSET && m.volcmd == VOLCMD_TONEPORTAMENTO) { @@ -2131,6 +2131,18 @@ m.command = CMD_NONE; } } + + if(pSndFile->m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 20, 01, 10) + && pSndFile->m_dwLastSavedWithVersion != MAKE_VERSION_NUMERIC(1, 20, 00, 00) // Ignore compatibility export + && m.volcmd == VOLCMD_TONEPORTAMENTO && m.command == CMD_TONEPORTAMENTO + && (m.vol != 0 || pSndFile->IsCompatibleMode(TRK_FASTTRACKER2)) && m.param != 0) + { + // Mx and 3xx on the same row does weird things in FT2: 3xx is completely ignored and the Mx parameter is doubled. Fixed in revision 1312 / OpenMPT 1.20.01.10 + // Previously the values were just added up, so let's fix this! + m.volcmd = VOLCMD_NONE; + const uint16 param = static_cast<uint16>(m.param) + static_cast<uint16>(m.vol << 4); + m.param = static_cast<uint8>(Util::Min(param, uint16(0xFF))); + } } chn++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-07-17 21:08:22
|
Revision: 1328 http://modplug.svn.sourceforge.net/modplug/?rev=1328&view=rev Author: saga-games Date: 2012-07-17 21:08:15 +0000 (Tue, 17 Jul 2012) Log Message: ----------- [Int] Removed muParser files - we won't need those anymore (Sample Generator will be using Lua once I'm done with everything). [Int] Removed long unused files (mix graph, pattern randomizer) - we won't need those anymore Modified Paths: -------------- trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/mptrack/resource.h Removed Paths: ------------- trunk/OpenMPT/mptrack/PatternRandomizer.cpp trunk/OpenMPT/mptrack/PatternRandomizer.h trunk/OpenMPT/mptrack/PatternRandomizerGUI.cpp trunk/OpenMPT/mptrack/PatternRandomizerGUI.h trunk/OpenMPT/mptrack/PatternRandomizerGUIEffect.cpp trunk/OpenMPT/mptrack/PatternRandomizerGUIEffect.h trunk/OpenMPT/mptrack/PatternRandomizerGUIInstrument.cpp trunk/OpenMPT/mptrack/PatternRandomizerGUIInstrument.h trunk/OpenMPT/mptrack/PatternRandomizerGUINote.cpp trunk/OpenMPT/mptrack/PatternRandomizerGUINote.h trunk/OpenMPT/mptrack/PatternRandomizerGUIVolCmd.cpp trunk/OpenMPT/mptrack/PatternRandomizerGUIVolCmd.h trunk/OpenMPT/muParser/ Deleted: trunk/OpenMPT/mptrack/PatternRandomizer.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizer.cpp 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizer.cpp 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,30 +0,0 @@ -#include "stdafx.h" -#include "mptrack.h" -#include ".\patternrandomizer.h" -#include ".\patternrandomizerGUI.h" -#include "mainfrm.h" -#include "moddoc.h" -#include "dlg_misc.h" -#include "globals.h" -#include ".\view_pat.h" - -CPatternRandomizer::CPatternRandomizer(CViewPattern* viewPat) -{ - m_pViewPattern = viewPat; - m_pRandomizerGUI = new CPatternRandomizerGUI(this, (CWnd*) m_pViewPattern); -} - -CPatternRandomizer::~CPatternRandomizer(void) -{ - delete m_pRandomizerGUI; -} - -bool CPatternRandomizer::showGUI() -{ - return m_pRandomizerGUI->openEditor(); -} - -bool CPatternRandomizer::isGUIVisible() -{ - return m_pRandomizerGUI->isVisible(); -} \ No newline at end of file Deleted: trunk/OpenMPT/mptrack/PatternRandomizer.h =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizer.h 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizer.h 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,21 +0,0 @@ -#pragma once - -class CViewPattern; -class CPatternRandomizerGUI; - -class CPatternRandomizer -{ -public: - CPatternRandomizer(CViewPattern* viewPat); - ~CPatternRandomizer(void); - bool showGUI(void); - bool isGUIVisible(void); - -private: - CPatternRandomizerGUI* m_pRandomizerGUI; - CViewPattern* m_pViewPattern; - - bool m_bRandomizeNotes, m_bRandomizeInstruments, - m_bRandomizeVolCmds, m_bRandomizeEffects; - -}; Deleted: trunk/OpenMPT/mptrack/PatternRandomizerGUI.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizerGUI.cpp 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizerGUI.cpp 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,128 +0,0 @@ -// PatternRandomizerGUI.cpp : implementation file -// -#include "stdafx.h" -#include "mptrack.h" -#include ".\patternrandomizergui.h" - - -// CPatternRandomizerGUI dialog - -IMPLEMENT_DYNAMIC(CPatternRandomizerGUI, CDialog) -CPatternRandomizerGUI::CPatternRandomizerGUI(CPatternRandomizer *patRandom, CWnd* pParent /*=NULL*/) - : CDialog(CPatternRandomizerGUI::IDD, pParent) -{ - m_pParentWindow = pParent; - m_pPatternRandomizer = patRandom; - m_pCurrentTab = NULL; - Create(IDD_PATTERNRANDOMIZER, m_pParentWindow); -} - -CPatternRandomizerGUI::~CPatternRandomizerGUI() -{ -} - -void CPatternRandomizerGUI::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_TAB1, m_RandomizerTabs); -} - - -BEGIN_MESSAGE_MAP(CPatternRandomizerGUI, CDialog) - ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnRandomiserTabChange) - ON_WM_CLOSE() -END_MESSAGE_MAP() - - -// CPatternRandomizerGUI message handlers - -BOOL CPatternRandomizerGUI::OnInitDialog() -//---------------------------------------- -{ - CDialog::OnInitDialog(); - - CRect rect; - GetDlgItem(IDC_RANDOM_PLACEHOLDER)->GetWindowRect(rect); - int hOff = 8, vOff = 86; - //int width = 100, height = 200; - - m_RandomizerNote.Create(CPatternRandomizerGUINote::IDD, (CWnd*)this); - m_RandomizerNote.MoveWindow(hOff, vOff, rect.Width(), rect.Height()); - m_RandomizerInstrument.Create(CPatternRandomizerGUIInstrument::IDD, (CWnd*)this); - m_RandomizerInstrument.MoveWindow(hOff, vOff, rect.Width(), rect.Height()); - m_RandomizerVolCmd.Create(CPatternRandomizerGUIVolCmd::IDD, (CWnd*)this); - m_RandomizerVolCmd.MoveWindow(hOff, vOff, rect.Width(), rect.Height()); - m_RandomizerEffect.Create(CPatternRandomizerGUIEffect::IDD, (CWnd*)this); - m_RandomizerEffect.MoveWindow(hOff, vOff, rect.Width(), rect.Height()); - -/* m_RandomizerNote.Create(CPatternRandomizerGUINote::IDD, (CWnd*)this); - m_RandomizerNote.MoveWindow(hOff, vOff, width, height); - m_RandomizerInstrument.Create(CPatternRandomizerGUIInstrument::IDD, (CWnd*)this); - m_RandomizerInstrument.MoveWindow(hOff, vOff, width, height); - m_RandomizerVolCmd.Create(CPatternRandomizerGUIVolCmd::IDD, (CWnd*)this); - m_RandomizerVolCmd.MoveWindow(hOff, vOff, width, height); - m_RandomizerEffect.Create(CPatternRandomizerGUIEffect::IDD, (CWnd*)this); - m_RandomizerEffect.MoveWindow(hOff, vOff, width, height); -*/ - m_RandomizerTabs.InsertItem(tab_rand_notes, "Notes"); - m_RandomizerTabs.InsertItem(tab_rand_instruments, "Instruments"); - m_RandomizerTabs.InsertItem(tab_rand_volcmds, "Vol Commands"); - m_RandomizerTabs.InsertItem(tab_rand_effects, "Effects"); - - setTab(&m_RandomizerNote); - return TRUE; -} - -bool CPatternRandomizerGUI::openEditor() { -//---------------------------------- - ShowWindow(SW_SHOW); - return TRUE; -} - -bool CPatternRandomizerGUI::isVisible() { -//---------------------------------- - return IsWindowVisible() ? true : false; -} - - -void CPatternRandomizerGUI::setTab(CWnd *newTab) { -//------------------------------------------------ - if (m_pCurrentTab != NULL) { - m_pCurrentTab->ShowWindow(SW_HIDE); - } - m_pCurrentTab = newTab; - //m_pCurrentTab->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE); - m_pCurrentTab->ShowWindow(SW_SHOW); -} - - -void CPatternRandomizerGUI::OnRandomiserTabChange(NMHDR* /*pNMHDR*/, LRESULT *pResult) -//-------------------------------------------------------------------------------- -{ - int nActiveTab = m_RandomizerTabs.GetCurSel(); - - switch(nActiveTab) { - case tab_rand_notes: - setTab(&m_RandomizerNote); - break; - case tab_rand_instruments: - setTab(&m_RandomizerInstrument); - break; - case tab_rand_volcmds: - setTab(&m_RandomizerVolCmd); - break; - case tab_rand_effects: - setTab(&m_RandomizerEffect); - break; - default: - ASSERT(false); - } - - *pResult = 0; -} - -void CPatternRandomizerGUI::OnClose() -{ - // TODO: Add your message handler code here and/or call default - CDialog::OnClose(); -} Deleted: trunk/OpenMPT/mptrack/PatternRandomizerGUI.h =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizerGUI.h 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizerGUI.h 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,54 +0,0 @@ -#pragma once -#include "afxcmn.h" -#include "PatternRandomizerGUINote.h" -#include "PatternRandomizerGUIInstrument.h" -#include "PatternRandomizerGUIVolCmd.h" -#include "PatternRandomizerGUIEffect.h" - -class CPatternRandomizer; - - -// CPatternRandomizerGUI dialog -enum { - tab_rand_notes = 0, - tab_rand_instruments, - tab_rand_volcmds, - tab_rand_effects, -}; - -class CPatternRandomizerGUI : public CDialog -{ - DECLARE_DYNAMIC(CPatternRandomizerGUI) - -public: - CPatternRandomizerGUI(CPatternRandomizer* patRandom, CWnd* pParent = NULL); // standard constructor - virtual ~CPatternRandomizerGUI(); - - bool openEditor(); - bool isVisible(); - -// Dialog Data - enum { IDD = IDD_PATTERNRANDOMIZER }; - -protected: - CWnd* m_pParentWindow; - CPatternRandomizer* m_pPatternRandomizer; - - CWnd* m_pCurrentTab; - CPatternRandomizerGUINote m_RandomizerNote; - CPatternRandomizerGUIInstrument m_RandomizerInstrument; - CPatternRandomizerGUIEffect m_RandomizerEffect; - CPatternRandomizerGUIVolCmd m_RandomizerVolCmd; - CTabCtrl m_RandomizerTabs; - - void setTab(CWnd *newTab); - - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - DECLARE_MESSAGE_MAP() - - -public: - afx_msg void OnRandomiserTabChange(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnClose(); -}; Deleted: trunk/OpenMPT/mptrack/PatternRandomizerGUIEffect.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizerGUIEffect.cpp 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizerGUIEffect.cpp 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,31 +0,0 @@ -// PatternRandomizerGUIEffect.cpp : implementation file -// - -#include "stdafx.h" -#include "mptrack.h" -#include "PatternRandomizerGUIEffect.h" - - -// CPatternRandomizerGUIEffect dialog - -IMPLEMENT_DYNAMIC(CPatternRandomizerGUIEffect, CDialog) -CPatternRandomizerGUIEffect::CPatternRandomizerGUIEffect(CWnd* pParent /*=NULL*/) - : CDialog(CPatternRandomizerGUIEffect::IDD, pParent) -{ -} - -CPatternRandomizerGUIEffect::~CPatternRandomizerGUIEffect() -{ -} - -void CPatternRandomizerGUIEffect::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - - -BEGIN_MESSAGE_MAP(CPatternRandomizerGUIEffect, CDialog) -END_MESSAGE_MAP() - - -// CPatternRandomizerGUIEffect message handlers Deleted: trunk/OpenMPT/mptrack/PatternRandomizerGUIEffect.h =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizerGUIEffect.h 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizerGUIEffect.h 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,21 +0,0 @@ -#pragma once - - -// CPatternRandomizerGUIEffect dialog - -class CPatternRandomizerGUIEffect : public CDialog -{ - DECLARE_DYNAMIC(CPatternRandomizerGUIEffect) - -public: - CPatternRandomizerGUIEffect(CWnd* pParent = NULL); // standard constructor - virtual ~CPatternRandomizerGUIEffect(); - -// Dialog Data - enum { IDD = IDD_PATTERNRANDOMIZER_EFFECT }; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - DECLARE_MESSAGE_MAP() -}; Deleted: trunk/OpenMPT/mptrack/PatternRandomizerGUIInstrument.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizerGUIInstrument.cpp 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizerGUIInstrument.cpp 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,38 +0,0 @@ -// PatternRandomizerGUIInstrument.cpp : implementation file -// - -#include "stdafx.h" -#include "mptrack.h" -#include "PatternRandomizerGUIInstrument.h" -#include ".\patternrandomizerguiinstrument.h" - - -// CPatternRandomizerGUIInstrument dialog - -IMPLEMENT_DYNAMIC(CPatternRandomizerGUIInstrument, CDialog) -CPatternRandomizerGUIInstrument::CPatternRandomizerGUIInstrument(CWnd* pParent /*=NULL*/) - : CDialog(CPatternRandomizerGUIInstrument::IDD, pParent) -{ -} - -CPatternRandomizerGUIInstrument::~CPatternRandomizerGUIInstrument() -{ -} - -void CPatternRandomizerGUIInstrument::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - - -BEGIN_MESSAGE_MAP(CPatternRandomizerGUIInstrument, CDialog) - ON_BN_CLICKED(65535, OnBnClicked65535) -END_MESSAGE_MAP() - - -// CPatternRandomizerGUIInstrument message handlers - -void CPatternRandomizerGUIInstrument::OnBnClicked65535() -{ - // TODO: Add your control notification handler code here -} Deleted: trunk/OpenMPT/mptrack/PatternRandomizerGUIInstrument.h =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizerGUIInstrument.h 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizerGUIInstrument.h 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,23 +0,0 @@ -#pragma once - - -// CPatternRandomizerGUIInstrument dialog - -class CPatternRandomizerGUIInstrument : public CDialog -{ - DECLARE_DYNAMIC(CPatternRandomizerGUIInstrument) - -public: - CPatternRandomizerGUIInstrument(CWnd* pParent = NULL); // standard constructor - virtual ~CPatternRandomizerGUIInstrument(); - -// Dialog Data - enum { IDD = IDD_PATTERNRANDOMIZER_INSTRUMENT }; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnBnClicked65535(); -}; Deleted: trunk/OpenMPT/mptrack/PatternRandomizerGUINote.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizerGUINote.cpp 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizerGUINote.cpp 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,31 +0,0 @@ -// PatternRandomizerGUINote.cpp : implementation file -// - -#include "stdafx.h" -#include "mptrack.h" -#include "PatternRandomizerGUINote.h" - - -// CPatternRandomizerGUINote dialog - -IMPLEMENT_DYNAMIC(CPatternRandomizerGUINote, CDialog) -CPatternRandomizerGUINote::CPatternRandomizerGUINote(CWnd* pParent /*=NULL*/) - : CDialog(CPatternRandomizerGUINote::IDD, pParent) -{ -} - -CPatternRandomizerGUINote::~CPatternRandomizerGUINote() -{ -} - -void CPatternRandomizerGUINote::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - - -BEGIN_MESSAGE_MAP(CPatternRandomizerGUINote, CDialog) -END_MESSAGE_MAP() - - -// CPatternRandomizerGUINote message handlers Deleted: trunk/OpenMPT/mptrack/PatternRandomizerGUINote.h =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizerGUINote.h 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizerGUINote.h 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,21 +0,0 @@ -#pragma once - - -// CPatternRandomizerGUINote dialog - -class CPatternRandomizerGUINote : public CDialog -{ - DECLARE_DYNAMIC(CPatternRandomizerGUINote) - -public: - CPatternRandomizerGUINote(CWnd* pParent = NULL); // standard constructor - virtual ~CPatternRandomizerGUINote(); - -// Dialog Data - enum { IDD = IDD_PATTERNRANDOMIZER_NOTE }; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - DECLARE_MESSAGE_MAP() -}; Deleted: trunk/OpenMPT/mptrack/PatternRandomizerGUIVolCmd.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizerGUIVolCmd.cpp 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizerGUIVolCmd.cpp 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,31 +0,0 @@ -// PatternRandomizerGUIVolCmd.cpp : implementation file -// - -#include "stdafx.h" -#include "mptrack.h" -#include "PatternRandomizerGUIVolCmd.h" - - -// CPatternRandomizerGUIVolCmd dialog - -IMPLEMENT_DYNAMIC(CPatternRandomizerGUIVolCmd, CDialog) -CPatternRandomizerGUIVolCmd::CPatternRandomizerGUIVolCmd(CWnd* pParent /*=NULL*/) - : CDialog(CPatternRandomizerGUIVolCmd::IDD, pParent) -{ -} - -CPatternRandomizerGUIVolCmd::~CPatternRandomizerGUIVolCmd() -{ -} - -void CPatternRandomizerGUIVolCmd::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - - -BEGIN_MESSAGE_MAP(CPatternRandomizerGUIVolCmd, CDialog) -END_MESSAGE_MAP() - - -// CPatternRandomizerGUIVolCmd message handlers Deleted: trunk/OpenMPT/mptrack/PatternRandomizerGUIVolCmd.h =================================================================== --- trunk/OpenMPT/mptrack/PatternRandomizerGUIVolCmd.h 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/PatternRandomizerGUIVolCmd.h 2012-07-17 21:08:15 UTC (rev 1328) @@ -1,21 +0,0 @@ -#pragma once - - -// CPatternRandomizerGUIVolCmd dialog - -class CPatternRandomizerGUIVolCmd : public CDialog -{ - DECLARE_DYNAMIC(CPatternRandomizerGUIVolCmd) - -public: - CPatternRandomizerGUIVolCmd(CWnd* pParent = NULL); // standard constructor - virtual ~CPatternRandomizerGUIVolCmd(); - -// Dialog Data - enum { IDD = IDD_PATTERNRANDOMIZER_VOLCMD }; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - DECLARE_MESSAGE_MAP() -}; Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/mptrack.rc 2012-07-17 21:08:15 UTC (rev 1328) @@ -1553,78 +1553,6 @@ DEFPUSHBUTTON "OK",IDOK,90,60,32,14 END -IDD_PATTERNRANDOMIZER DIALOGEX 0, 0, 246, 255 -STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -EXSTYLE WS_EX_TOOLWINDOW | WS_EX_APPWINDOW -CAPTION "Pattern Randomizer - NOT YET FUNCTIONAL" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - PUSHBUTTON "Load",IDC_BUTTON1,112,13,30,14 - PUSHBUTTON "Save",IDC_BUTTON2,143,13,30,14 - EDITTEXT IDC_EDIT1,9,13,99,14,ES_AUTOHSCROLL - GROUPBOX "Profile:",IDC_STATIC,4,3,238,35 - CONTROL "",IDC_TAB1,"SysTabControl32",0x0,4,40,238,190 - PUSHBUTTON "Apply",IDC_APPLY,192,235,50,14 - LTEXT "Static",IDC_RANDOM_PLACEHOLDER,6,53,232,175 -END - -IDD_PATTERNRANDOMIZER_NOTE DIALOGEX 0, 0, 235, 172 -STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "",IDC_STATIC,5,5,224,164 - CONTROL "Randomize Notes",IDC_RANDOMIZE_NOTE_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,4,72,10 - CONTROL "Range",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,11,17,37,10 - CONTROL "Use the following notes:",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,11,29,91,10 - CONTROL "",IDC_LIST2,"SysListView32",LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,11,41,210,83 - EDITTEXT IDC_EDIT1,48,16,20,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "semitones around current note.",IDC_STATIC,71,18,98,8 - GROUPBOX "Include random...",IDC_STATIC,11,130,107,33 - CONTROL "Notes",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,141,35,10 - CONTROL "Note offs",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,150,45,10 - CONTROL "Note cuts",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,150,47,10 - CONTROL "Blank rows",IDC_CHECK8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,140,51,10 - GROUPBOX "Overwrite existing...",IDC_STATIC,117,130,105,33 - CONTROL "Notes",IDC_CHECK9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,123,141,35,10 - CONTROL "Note offs",IDC_CHECK10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,123,150,45,10 - CONTROL "Note cuts",IDC_CHECK11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,150,44,10 - CONTROL "Blank rows",IDC_CHECK12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,140,49,10 -END - -IDD_PATTERNRANDOMIZER_INSTRUMENT DIALOGEX 0, 0, 236, 172 -STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "",-1,5,5,225,164 - CONTROL "Randomize Instruments",IDC_RANDOMIZE_NOTE_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,4,89,10 - LTEXT "Use the following instruments:",-1,12,18,94,8 - LISTBOX IDC_LIST1,11,30,125,135,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP -END - -IDD_PATTERNRANDOMIZER_VOLCMD DIALOGEX 0, 0, 235, 172 -STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "",IDC_STATIC,5,5,224,164 - CONTROL "Use existing commands.",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,14,27,92,10 - CONTROL "Use the following:",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,14,38,72,10 - GROUPBOX "Command types:",IDC_STATIC,11,16,211,147 - LISTBOX IDC_LIST1,15,49,91,108,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO1,122,49,96,96,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Min:",IDC_STATIC,136,69,14,8 - CONTROL "Randomize Volume Commands",IDC_RANDOMIZE_NOTE_ENABLE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,4,113,10 - EDITTEXT IDC_EDIT2,152,67,20,12,ES_AUTOHSCROLL - LTEXT "Max:",IDC_STATIC,178,69,16,8 - EDITTEXT IDC_EDIT3,195,67,20,12,ES_AUTOHSCROLL - GROUPBOX "Command parameters:",IDC_STATIC,115,16,107,147 - CONTROL "Radio1",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,123,68,10,10 - CONTROL "Radio1",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,123,83,10,10 - EDITTEXT IDC_EDIT4,136,82,17,12,ES_AUTOHSCROLL - LTEXT "around current",IDC_STATIC,156,84,49,8 -END - IDD_ADDSILENCE DIALOGEX 0, 0, 184, 82 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Add Silence / Resize" @@ -1642,29 +1570,7 @@ CONTROL "Resize to",IDC_RADIO_RESIZETO,"Button",BS_AUTORADIOBUTTON,12,60,102,8 END -IDD_PATTERNRANDOMIZER_EFFECT DIALOGEX 0, 0, 235, 172 -STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - GROUPBOX "",IDC_STATIC,5,5,224,164 - CONTROL "Use existing effects.",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,14,27,79,10 - CONTROL "Use the following effects:",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,14,38,95,10 - GROUPBOX "Effect types:",IDC_STATIC,11,16,211,147 - LISTBOX IDC_LIST1,15,49,91,108,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO1,122,49,96,96,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Min:",IDC_STATIC,136,69,14,8 - CONTROL "Randomize Effects",IDC_RANDOMIZE_NOTE_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,4,75,10 - EDITTEXT IDC_EDIT2,152,67,20,12,ES_AUTOHSCROLL - LTEXT "Max:",IDC_STATIC,178,69,16,8 - EDITTEXT IDC_EDIT3,195,67,20,12,ES_AUTOHSCROLL - GROUPBOX "Effect parameters:",IDC_STATIC,115,16,107,147 - CONTROL "Radio1",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,123,68,10,10 - CONTROL "Radio1",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,123,83,10,10 - EDITTEXT IDC_EDIT4,136,82,17,12,ES_AUTOHSCROLL - LTEXT "around current",IDC_STATIC,156,84,49,8 -END - ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO @@ -1925,33 +1831,6 @@ TOPMARGIN, 4 END - IDD_PATTERNRANDOMIZER, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 242 - TOPMARGIN, 3 - BOTTOMMARGIN, 249 - END - - IDD_PATTERNRANDOMIZER_NOTE, DIALOG - BEGIN - RIGHTMARGIN, 229 - BOTTOMMARGIN, 169 - END - - IDD_PATTERNRANDOMIZER_INSTRUMENT, DIALOG - BEGIN - RIGHTMARGIN, 230 - TOPMARGIN, 4 - BOTTOMMARGIN, 169 - END - - IDD_PATTERNRANDOMIZER_VOLCMD, DIALOG - BEGIN - RIGHTMARGIN, 229 - BOTTOMMARGIN, 169 - END - IDD_ADDSILENCE, DIALOG BEGIN LEFTMARGIN, 7 @@ -1959,12 +1838,6 @@ TOPMARGIN, 7 BOTTOMMARGIN, 75 END - - IDD_PATTERNRANDOMIZER_EFFECT, DIALOG - BEGIN - RIGHTMARGIN, 229 - BOTTOMMARGIN, 169 - END END #endif // APSTUDIO_INVOKED Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2012-07-17 21:08:15 UTC (rev 1328) @@ -609,134 +609,6 @@ > </File> <Filter - Name="PatternRandomizer" - > - <File - RelativePath=".\PatternRandomizer.cpp" - > - </File> - <File - RelativePath=".\PatternRandomizer.h" - > - </File> - <File - RelativePath=".\PatternRandomizerGUI.cpp" - > - </File> - <File - RelativePath=".\PatternRandomizerGUI.h" - > - </File> - <File - RelativePath=".\PatternRandomizerGUIEffect.cpp" - > - </File> - <File - RelativePath=".\PatternRandomizerGUIEffect.h" - > - </File> - <File - RelativePath=".\PatternRandomizerGUIInstrument.cpp" - > - </File> - <File - RelativePath=".\PatternRandomizerGUIInstrument.h" - > - </File> - <File - RelativePath=".\PatternRandomizerGUINote.cpp" - > - </File> - <File - RelativePath=".\PatternRandomizerGUINote.h" - > - </File> - <File - RelativePath=".\PatternRandomizerGUIVolCmd.cpp" - > - </File> - <File - RelativePath=".\PatternRandomizerGUIVolCmd.h" - > - </File> - </Filter> - <Filter - Name="MixGraph" - > - <File - RelativePath=".\ChannelNode.cpp" - > - </File> - <File - RelativePath=".\ChannelNode.h" - > - </File> - <File - RelativePath=".\ctrl_graph.cpp" - > - </File> - <File - RelativePath=".\ctrl_graph.h" - > - </File> - <File - RelativePath=".\EffectNode.cpp" - > - </File> - <File - RelativePath=".\EffectNode.h" - > - </File> - <File - RelativePath=".\FinalNode.cpp" - > - </File> - <File - RelativePath=".\FinalNode.h" - > - </File> - <File - RelativePath=".\Graph.cpp" - > - </File> - <File - RelativePath=".\Graph.h" - > - </File> - <File - RelativePath=".\InstrumentNode.cpp" - > - </File> - <File - RelativePath=".\InstrumentNode.h" - > - </File> - <File - RelativePath=".\Node.cpp" - > - </File> - <File - RelativePath=".\Node.h" - > - </File> - <File - RelativePath=".\Vertex.cpp" - > - </File> - <File - RelativePath=".\Vertex.h" - > - </File> - <File - RelativePath=".\view_graph.cpp" - > - </File> - <File - RelativePath=".\view_graph.h" - > - </File> - </Filter> - <Filter Name="Tuning" > <File Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2012-07-17 21:08:15 UTC (rev 1328) @@ -277,21 +277,6 @@ <ClCompile Include="vstplug.cpp" /> <ClCompile Include="..\soundlib\Waveform.cpp" /> <ClCompile Include="..\soundlib\WindowedFIR.cpp" /> - <ClCompile Include="PatternRandomizer.cpp" /> - <ClCompile Include="PatternRandomizerGUI.cpp" /> - <ClCompile Include="PatternRandomizerGUIEffect.cpp" /> - <ClCompile Include="PatternRandomizerGUIInstrument.cpp" /> - <ClCompile Include="PatternRandomizerGUINote.cpp" /> - <ClCompile Include="PatternRandomizerGUIVolCmd.cpp" /> - <ClCompile Include="ChannelNode.cpp" /> - <ClCompile Include="ctrl_graph.cpp" /> - <ClCompile Include="EffectNode.cpp" /> - <ClCompile Include="FinalNode.cpp" /> - <ClCompile Include="Graph.cpp" /> - <ClCompile Include="InstrumentNode.cpp" /> - <ClCompile Include="Node.cpp" /> - <ClCompile Include="Vertex.cpp" /> - <ClCompile Include="view_graph.cpp" /> <ClCompile Include="..\soundlib\tuning.cpp" /> <ClCompile Include="..\soundlib\tuningbase.cpp" /> <ClCompile Include="..\soundlib\tuningCollection.cpp" /> @@ -360,22 +345,7 @@ <ClInclude Include="MIDIMapping.h" /> <ClInclude Include="PatternClipboard.h" /> <ClInclude Include="PatternCursor.h" /> - <ClInclude Include="PatternRandomizer.h" /> - <ClInclude Include="PatternRandomizerGUI.h" /> - <ClInclude Include="PatternRandomizerGUIEffect.h" /> - <ClInclude Include="PatternRandomizerGUIInstrument.h" /> - <ClInclude Include="PatternRandomizerGUINote.h" /> - <ClInclude Include="PatternRandomizerGUIVolCmd.h" /> - <ClInclude Include="ChannelNode.h" /> - <ClInclude Include="ctrl_graph.h" /> - <ClInclude Include="EffectNode.h" /> - <ClInclude Include="FinalNode.h" /> - <ClInclude Include="Graph.h" /> - <ClInclude Include="InstrumentNode.h" /> - <ClInclude Include="Node.h" /> <ClInclude Include="SelectPluginDialog.h" /> - <ClInclude Include="Vertex.h" /> - <ClInclude Include="view_graph.h" /> <ClInclude Include="AbstractVstEditor.h" /> <ClInclude Include="AutoSaver.h" /> <ClInclude Include="ChannelManagerDlg.h" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2012-07-17 21:08:15 UTC (rev 1328) @@ -136,21 +136,6 @@ <ClCompile Include="globals.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="ChannelNode.cpp"> - <Filter>Source Files\MixGraph</Filter> - </ClCompile> - <ClCompile Include="ctrl_graph.cpp"> - <Filter>Source Files\MixGraph</Filter> - </ClCompile> - <ClCompile Include="EffectNode.cpp"> - <Filter>Source Files\MixGraph</Filter> - </ClCompile> - <ClCompile Include="FinalNode.cpp"> - <Filter>Source Files\MixGraph</Filter> - </ClCompile> - <ClCompile Include="Graph.cpp"> - <Filter>Source Files\MixGraph</Filter> - </ClCompile> <ClCompile Include="HyperEdit.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -163,9 +148,6 @@ <ClCompile Include="InputHandler.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="InstrumentNode.cpp"> - <Filter>Source Files\MixGraph</Filter> - </ClCompile> <ClCompile Include="..\soundlib\Message.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -208,24 +190,6 @@ <ClCompile Include="mod2midi.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="Node.cpp"> - <Filter>Source Files\MixGraph</Filter> - </ClCompile> - <ClCompile Include="PatternRandomizerGUI.cpp"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClCompile> - <ClCompile Include="PatternRandomizerGUIEffect.cpp"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClCompile> - <ClCompile Include="PatternRandomizerGUIInstrument.cpp"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClCompile> - <ClCompile Include="PatternRandomizerGUINote.cpp"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClCompile> - <ClCompile Include="PatternRandomizerGUIVolCmd.cpp"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClCompile> <ClCompile Include="..\soundlib\pattern.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -328,15 +292,6 @@ <ClCompile Include="PatternGotoDialog.cpp"> <Filter>Source Files\Dialogs</Filter> </ClCompile> - <ClCompile Include="PatternRandomizer.cpp"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClCompile> - <ClCompile Include="Vertex.cpp"> - <Filter>Source Files\MixGraph</Filter> - </ClCompile> - <ClCompile Include="view_graph.cpp"> - <Filter>Source Files\MixGraph</Filter> - </ClCompile> <ClCompile Include="..\soundlib\PlaybackEventer.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -516,27 +471,9 @@ <ClInclude Include="globals.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="ChannelNode.h"> - <Filter>Source Files\MixGraph</Filter> - </ClInclude> - <ClInclude Include="ctrl_graph.h"> - <Filter>Source Files\MixGraph</Filter> - </ClInclude> - <ClInclude Include="EffectNode.h"> - <Filter>Source Files\MixGraph</Filter> - </ClInclude> - <ClInclude Include="FinalNode.h"> - <Filter>Source Files\MixGraph</Filter> - </ClInclude> - <ClInclude Include="Graph.h"> - <Filter>Source Files\MixGraph</Filter> - </ClInclude> <ClInclude Include="InputHandler.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="InstrumentNode.h"> - <Filter>Source Files\MixGraph</Filter> - </ClInclude> <ClInclude Include="mainbar.h"> <Filter>Header Files</Filter> </ClInclude> @@ -567,24 +504,6 @@ <ClInclude Include="..\soundlib\ModSequence.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="Node.h"> - <Filter>Source Files\MixGraph</Filter> - </ClInclude> - <ClInclude Include="PatternRandomizerGUIVolCmd.h"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClInclude> - <ClInclude Include="PatternRandomizerGUI.h"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClInclude> - <ClInclude Include="PatternRandomizerGUIEffect.h"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClInclude> - <ClInclude Include="PatternRandomizerGUIInstrument.h"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClInclude> - <ClInclude Include="PatternRandomizerGUINote.h"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClInclude> <ClInclude Include="..\soundlib\WindowedFIR.h"> <Filter>Header Files</Filter> </ClInclude> @@ -657,15 +576,6 @@ <ClInclude Include="PatternEditorDialogs.h"> <Filter>Header Files\Dialogs</Filter> </ClInclude> - <ClInclude Include="PatternRandomizer.h"> - <Filter>Source Files\PatternRandomizer</Filter> - </ClInclude> - <ClInclude Include="Vertex.h"> - <Filter>Source Files\MixGraph</Filter> - </ClInclude> - <ClInclude Include="view_graph.h"> - <Filter>Source Files\MixGraph</Filter> - </ClInclude> <ClInclude Include="ColourEdit.h"> <Filter>Header Files</Filter> </ClInclude> @@ -918,12 +828,6 @@ <UniqueIdentifier>{cd3e5871-5f13-4cdf-a869-f807737d2906}</UniqueIdentifier> <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> </Filter> - <Filter Include="Source Files\MixGraph"> - <UniqueIdentifier>{f0af5cea-2ec1-45c0-abe8-b93aa90e1df2}</UniqueIdentifier> - </Filter> - <Filter Include="Source Files\PatternRandomizer"> - <UniqueIdentifier>{f0e1b59c-04c9-4620-8314-06fd4ea21616}</UniqueIdentifier> - </Filter> <Filter Include="Header Files\Tuning"> <UniqueIdentifier>{86c7663b-6b61-4512-8a39-043d9b87ea1d}</UniqueIdentifier> </Filter> Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2012-07-14 22:15:55 UTC (rev 1327) +++ trunk/OpenMPT/mptrack/resource.h 2012-07-17 21:08:15 UTC (rev 1328) @@ -125,11 +125,6 @@ #define IDD_EDIT_GOTO 444 #define IDD_DIALOG1 501 #define IDD_MOVEFXSLOT 501 -#define IDD_PATTERNRANDOMIZER 502 -#define IDD_PATTERNRANDOMIZER_NOTE 503 -#define IDD_PATTERNRANDOMIZER_INSTRUMENT 504 -#define IDD_PATTERNRANDOMIZER_VOLCMD 505 -#define IDD_PATTERNRANDOMIZER_EFFECT 506 #define IDD_CONTROL_GRAPH 507 #define IDD_SCALE_ENV_POINTS 510 #define IDD_TUNING 511 @@ -751,10 +746,6 @@ #define IDC_CLONEPLUG 2236 #define IDC_INSERTFXSLOT 2237 #define IDC_FILTERMODE 2238 -#define IDC_RANDOMIZE_NOTE_ENABLE 2240 -#define IDC_LIST2 2241 -#define IDC_APPLY 2243 -#define IDC_RANDOM_PLACEHOLDER 2244 #define IDC_AUTOSAVE_USECUSTOMDIR 2245 #define IDC_BUTTON_MODTYPE2 2246 #define IDC_BUTTON_PLAYERPROPS 2247 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-07-20 18:34:08
|
Revision: 1332 http://modplug.svn.sourceforge.net/modplug/?rev=1332&view=rev Author: saga-games Date: 2012-07-20 18:33:59 +0000 (Fri, 20 Jul 2012) Log Message: ----------- [New] Playback can now be locked to an order range. Order range can be specified by right-clicking a selection in the order list or by using shortcuts. All keymaps have been updated to contain such shortcuts. [Imp] Added keyboard shortcut for quick channel settings. [Imp] Keyboard settings dialog: Searching for shortcuts does now also work with MIDI CCs. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb trunk/OpenMPT/packageTemplate/extraKeymaps/FI_FT2Style_cce.mkb trunk/OpenMPT/packageTemplate/extraKeymaps/FR_FT2Style_(goor00).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_(legovitch).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_classic_(vanisherIII).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/NO_mpt_classic_(rakib).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/SE_laptop_(ganja).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/US_it2_(lpchip).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/US_mpt_classic_(nobuyuki).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/US_mpt_classic_(snu).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/US_mptit_(coda).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/dvorak_(snu).mkb trunk/OpenMPT/packageTemplate/extraKeymaps/es-LA_it-mpt_jmkz.mkb trunk/OpenMPT/packageTemplate/extraKeymaps/es-LA_mpt_jmkz.mkb trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2012-07-20 18:33:59 UTC (rev 1332) @@ -523,7 +523,7 @@ //rewbs.graph DefineKeyCommand(kcViewGraph, 1769, _T("View Graph"), kcHidden, kcNoDummy); // while there's no graph yet, let's just disable it for now //end rewbs.graph - DefineKeyCommand(kcToggleChanMuteOnPatTransition, 1770, _T("(Un)mute chan on pat transition")); + DefineKeyCommand(kcToggleChanMuteOnPatTransition, 1770, _T("(Un)mute channel on pattern transition")); DefineKeyCommand(kcChannelUnmuteAll, 1771, _T("Unmute all channels")); DefineKeyCommand(kcShowPatternProperties, 1772, _T("Show Pattern Properties")); DefineKeyCommand(kcShowMacroConfig, 1773, _T("Show MIDI Macro Configuration")); @@ -600,7 +600,7 @@ DefineKeyCommand(kcInsNoteMapTransposeOctUp, 1845, _T("Transpose +12 (Note Map)")); DefineKeyCommand(kcInsNoteMapCopyCurrentNote, 1846, _T("Map all notes to selected note")); DefineKeyCommand(kcInsNoteMapCopyCurrentSample, 1847, _T("Map all notes to selected sample")); - DefineKeyCommand(kcInsNoteMapReset, 1848, _T("Reset Note nMapping")); + DefineKeyCommand(kcInsNoteMapReset, 1848, _T("Reset Note Mapping")); DefineKeyCommand(kcInsNoteMapEditSample, 1849, _T("Edit Current Sample")); DefineKeyCommand(kcInsNoteMapEditSampleMap, 1850, _T("Edit Sample Map")); DefineKeyCommand(kcInstrumentCtrlDuplicate, 1851, _T("Duplicate Instrument")); @@ -627,6 +627,9 @@ DefineKeyCommand(kcSetOctaveStop7, 1872, _T(""), kcHidden); DefineKeyCommand(kcSetOctaveStop8, 1873, _T(""), kcHidden); DefineKeyCommand(kcSetOctaveStop9, 1874, _T(""), kcHidden); + DefineKeyCommand(kcOrderlistLockPlayback, 1875, _T("Lock Playback to Selection")); + DefineKeyCommand(kcOrderlistUnlockPlayback, 1876, _T("Unlock Playback")); + DefineKeyCommand(kcChannelSettings, 1877, _T("Quick Channel Settings")); // Add new key commands here. #ifdef _DEBUG Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/mptrack/CommandSet.h 2012-07-20 18:33:59 UTC (rev 1332) @@ -251,13 +251,16 @@ kcTimeAtRow, kcEndPatternEditMisc=kcTimeAtRow, - kcChannelMute, + kcStartChannelKeys, + kcChannelMute = kcStartChannelKeys, kcChannelSolo, kcChannelUnmuteAll, kcToggleChanMuteOnPatTransition, kcUnmuteAllChnOnPatTransition, kcSoloChnOnPatTransition, kcChannelReset, + kcChannelSettings, + kcEndChannelKeys = kcChannelSettings, kcCopyAndLoseSelection, kcTransposeUp, kcTransposeDown, @@ -1071,7 +1074,12 @@ kcOrderlistPatIgnore, kcOrderlistPatInvalid, kcEndOrderlistNum=kcOrderlistPatInvalid, - kcEndOrderlistCommands=kcEndOrderlistNum, + // Playback lock + kcStartOrderlistLock, + kcOrderlistLockPlayback = kcStartOrderlistLock, + kcOrderlistUnlockPlayback, + kcEndOrderlistLock = kcOrderlistUnlockPlayback, + kcEndOrderlistCommands=kcEndOrderlistLock, kcNumCommands, }; Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2012-07-20 18:33:59 UTC (rev 1332) @@ -151,6 +151,8 @@ afx_msg LRESULT OnHelpHitTest(WPARAM, LPARAM lParam); afx_msg void OnSelectSequence(UINT nid); afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM); + afx_msg void OnLockPlayback(); + afx_msg void OnUnlockPlayback(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-07-20 18:33:59 UTC (rev 1332) @@ -72,6 +72,8 @@ ON_COMMAND(ID_ORDERLIST_COPY, OnDuplicatePattern) ON_COMMAND(ID_PATTERNCOPY, OnPatternCopy) ON_COMMAND(ID_PATTERNPASTE, OnPatternPaste) + ON_COMMAND(ID_ORDERLIST_LOCKPLAYBACK, OnLockPlayback) + ON_COMMAND(ID_ORDERLIST_UNLOCKPLAYBACK, OnUnlockPlayback) ON_COMMAND_RANGE(ID_SEQUENCE_ITEM, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 2, OnSelectSequence) ON_MESSAGE(WM_MOD_DRAGONDROPPING, OnDragonDropping) ON_MESSAGE(WM_HELPHITTEST, OnHelpHitTest) @@ -282,6 +284,7 @@ const BYTE nShownLength = GetLength(); InvalidateSelection(); *nOrder = sel; + if (!m_bScrolling) { const BYTE nMargins = GetMargins(GetMarginsMax(nShownLength)); @@ -322,7 +325,9 @@ pMainFrm->ResetNotificationBuffer(); //rewbs.toCheck pSndFile->m_nNextRow = 0; - } else if (m_pParent->GetFollowSong()) + // Users wants to go somewhere else, so let him do that. + OnUnlockPlayback(); + } else if(m_pParent->GetFollowSong()) { CriticalSection cs; @@ -336,6 +341,9 @@ pSndFile->m_SongFlags.set(pausedFlags); if (bIsPlaying) pMainFrm->ResetNotificationBuffer(); + + // Users wants to go somewhere else, so let him do that. + OnUnlockPlayback(); } m_pParent->SetCurrentPattern(n); } @@ -475,6 +483,11 @@ case kcUnmuteAllChnOnPatTransition: ::PostMessage(m_pParent->GetViewWnd(), WM_MOD_KEYCOMMAND, wParam, 0); return wParam; + case kcOrderlistLockPlayback: + OnLockPlayback(); return wParam; + case kcOrderlistUnlockPlayback: + OnUnlockPlayback(); return wParam; + case kcDuplicatePattern: OnDuplicatePattern(); return wParam; case kcNewPattern: @@ -882,7 +895,7 @@ if(IsCtrlKeyPressed()) { - // queue pattern + // Queue pattern QueuePattern(pt); } else { @@ -1048,9 +1061,9 @@ CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - bool bMultiSelection = (m_nScrollPos2nd != ORDERINDEX_INVALID); + bool multiSelection = (m_nScrollPos2nd != ORDERINDEX_INVALID); - if(!bMultiSelection) SetCurSel(GetOrderFromPoint(rect, pt)); + if(!multiSelection) SetCurSel(GetOrderFromPoint(rect, pt)); SetFocus(); HMENU hMenu = ::CreatePopupMenu(); if(!hMenu) return; @@ -1069,7 +1082,7 @@ CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler(); - if(bMultiSelection) + if(multiSelection) { // several patterns are selected. AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_INSERT, "&Insert Patterns\t" + ih->GetKeyTextFromCommand(kcOrderlistEditInsert)); @@ -1121,14 +1134,18 @@ } if (pSndFile->Order.GetNumSequences() < MAX_SEQUENCES) { - AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES, TEXT("Duplicate current sequence")); - AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 1, TEXT("Create empty sequence")); + AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES, TEXT("&Duplicate current sequence")); + AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 1, TEXT("&Create empty sequence")); } if (pSndFile->Order.GetNumSequences() > 1) - AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 2, TEXT("Delete current sequence")); + AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 2, TEXT("D&elete current sequence")); } } AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); + AppendMenu(hMenu, ((selection.nOrdLo == pSndFile->m_lockOrderStart && selection.nOrdHi == pSndFile->m_lockOrderEnd) ? (MF_STRING | MF_CHECKED) : MF_STRING), ID_ORDERLIST_LOCKPLAYBACK, "&Lock Playback to Selection\t" + ih->GetKeyTextFromCommand(kcOrderlistLockPlayback)); + AppendMenu(hMenu, (pSndFile->m_lockOrderStart == ORDERINDEX_INVALID ? (MF_STRING | MF_GRAYED) : MF_STRING), ID_ORDERLIST_UNLOCKPLAYBACK, "&Unlock Playback\t" + ih->GetKeyTextFromCommand(kcOrderlistUnlockPlayback)); + + AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); AppendMenu(hMenu, MF_STRING | greyed, ID_ORDERLIST_RENDER, "Render to &Wave"); ClientToScreen(&pt); @@ -1478,6 +1495,8 @@ m_pParent->SetCurrentPattern(rSf.Order[m_nScrollPos]); UpdateScrollInfo(); + // This won't make sense anymore in the new sequence. + OnUnlockPlayback(); cs.Leave(); @@ -1516,8 +1535,36 @@ pSndFile->m_nSeqOverride = 0; } else { + // Users wants to go somewhere else, so let him do that. + OnUnlockPlayback(); + pSndFile->m_nSeqOverride = nOrder + 1; } InvalidateRect(NULL, FALSE); } } + + +void COrderList::OnLockPlayback() +//------------------------------- +{ + CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); + + ORD_SELECTION selection = GetCurSel(false); + if(selection.nOrdLo == pSndFile->m_lockOrderStart && selection.nOrdHi == pSndFile->m_lockOrderEnd) + { + OnUnlockPlayback(); + } else + { + pSndFile->m_lockOrderStart = selection.nOrdLo; + pSndFile->m_lockOrderEnd = selection.nOrdHi; + } +} + + +void COrderList::OnUnlockPlayback() +//---------------------------------- +{ + CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); + pSndFile->m_lockOrderStart = pSndFile->m_lockOrderEnd = ORDERINDEX_INVALID; +} \ No newline at end of file Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2012-07-20 18:33:59 UTC (rev 1332) @@ -59,6 +59,7 @@ void CCustEdit::SetKey(UINT inMod, UINT inCode) +//--------------------------------------------- { mod = inMod; code = inCode; @@ -68,13 +69,20 @@ void CCustEdit::OnSetFocus(CWnd* pOldWnd) +//--------------------------------------- { CEdit::OnSetFocus(pOldWnd); - //lock the input handler + // Lock the input handler CMainFrame::GetInputHandler()->Bypass(true); + // Accept MIDI input + CMainFrame::GetMainFrame()->SetMidiRecordWnd(m_hWnd); + isFocussed = true; } + + void CCustEdit::OnKillFocus(CWnd* pNewWnd) +//---------------------------------------- { CEdit::OnKillFocus(pNewWnd); //unlock the input handler @@ -155,8 +163,6 @@ m_bChoiceModified = false; m_sFullPathName = CMainFrame::GetSettings().m_szKbdFile; - CMainFrame::GetMainFrame()->SetMidiRecordWnd(m_eCustHotKey.m_hWnd); - plocalCmdSet = new CCommandSet(); plocalCmdSet->Copy(CMainFrame::GetInputHandler()->activeCommandSet); @@ -231,6 +237,7 @@ newCat.commands.Add(c); newCat.separators.Add(kcEndOrderlistNavigation); //-------------------------------------- newCat.separators.Add(kcEndOrderlistEdit); //-------------------------------------- + newCat.separators.Add(kcEndOrderlistNum); //-------------------------------------- commandCategories.Add(newCat); } @@ -257,9 +264,9 @@ for(int c = kcClearRow; c <= kcInsertAllRows; c++) newCat.commands.Add(c); newCat.separators.Add(kcInsertAllRows); //-------------------------------------- - for(int c = kcChannelMute; c <= kcChannelReset; c++) + for(int c = kcStartChannelKeys; c <= kcEndChannelKeys; c++) newCat.commands.Add(c); - newCat.separators.Add(kcChannelReset); //-------------------------------------- + newCat.separators.Add(kcEndChannelKeys); //-------------------------------------- for(int c = kcTransposeUp; c <= kcTransposeOctDown; c++) newCat.commands.Add(c); newCat.separators.Add(kcTransposeOctDown); //-------------------------------------- Modified: trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb =================================================================== --- trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -382,3 +382,5 @@ 19:1818:0:189:5 //Decrease pattern index: - (KeyDown|KeyHold) 19:1853:0:83:1 //Separator (+++) Index: S (KeyDown) 19:1854:0:32:1 //Stop (---) Index: SPACE (KeyDown) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/mptrack/resource.h 2012-07-20 18:33:59 UTC (rev 1332) @@ -1203,6 +1203,8 @@ #define ID_HELP_SHOWSETTINGSFOLDER 44600 #define ID_FILE_CLOSEALL 44601 #define ID_HELPSHOW 44602 +#define ID_ORDERLIST_LOCKPLAYBACK 44603 +#define ID_ORDERLIST_UNLOCKPLAYBACK 44604 // Next default values for new objects // @@ -1210,7 +1212,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 535 -#define _APS_NEXT_COMMAND_VALUE 44603 +#define _APS_NEXT_COMMAND_VALUE 44605 #define _APS_NEXT_CONTROL_VALUE 2439 #define _APS_NEXT_SYMED_VALUE 901 #endif Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/mptrack/version.h 2012-07-20 18:33:59 UTC (rev 1332) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 02 -#define VER_MINORMINOR 02 +#define VER_MINORMINOR 03 //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/extraKeymaps/DE_jojo.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -338,7 +338,7 @@ 17:1849:2:69:1 //Edit Current Sample: Ctrl+E (KeyDown) 17:1846:3:77:1 //Map all notes to selected note: Shift+Ctrl+M (KeyDown) 17:1847:2:77:1 //Map all notes to selected sample: Ctrl+M (KeyDown) -17:1848:2:82:1 //Reset Note nMapping: Ctrl+R (KeyDown) +17:1848:2:82:1 //Reset Note Mapping: Ctrl+R (KeyDown) 17:1843:2:81:1 //Transpose +1 (Note Map): Ctrl+Q (KeyDown) 17:1842:2:65:1 //Transpose -1 (Note Map): Ctrl+A (KeyDown) 17:1845:3:81:1 //Transpose +12 (Note Map): Shift+Ctrl+Q (KeyDown) @@ -383,3 +383,5 @@ 19:1818:0:189:5 //Decrease pattern index: - (KeyDown|KeyHold) 19:1853:0:73:1 //Separator (+++) Index: I (KeyDown) 19:1854:0:32:1 //Stop (---) Index: LEER (KeyDown) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/FI_FT2Style_cce.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/FI_FT2Style_cce.mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/FI_FT2Style_cce.mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -328,3 +328,5 @@ 19:1817:0:187:5 //Increase pattern index : + (KeyDown|KeyHold) 19:1818:0:109:1 //Decrease pattern index: NUM MIINUS (KeyDown) 19:1818:0:189:1 //Decrease pattern index: - (KeyDown) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/FR_FT2Style_(goor00).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/FR_FT2Style_(goor00).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/FR_FT2Style_(goor00).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -322,3 +322,5 @@ 19:1817:0:187:5 //Increase pattern index : + (KeyDown|KeyHold) 19:1818:0:109:1 //Decrease pattern index: NUM SUB (KeyDown) 19:1818:0:189:1 //Decrease pattern index: - (KeyDown) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_(legovitch).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_(legovitch).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_(legovitch).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -364,3 +364,5 @@ 19:1817:0:187:5 //Increase pattern index : = (KeyDown|KeyHold) 19:1818:0:40:5 //Decrease pattern index: BAS (KeyDown|KeyHold) 19:1818:0:189:5 //Decrease pattern index: (KeyDown|KeyHold) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_classic_(vanisherIII).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_classic_(vanisherIII).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/FR_mpt_classic_(vanisherIII).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -308,3 +308,5 @@ 19:1817:0:187:5 //Increase pattern index : + (KeyDown|KeyHold) 19:1818:0:109:1 //Decrease pattern index: NUM SUB (KeyDown) 19:1818:0:189:1 //Decrease pattern index: - (KeyDown) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/NO_mpt_classic_(rakib).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/NO_mpt_classic_(rakib).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/NO_mpt_classic_(rakib).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -352,3 +352,5 @@ 19:1817:0:187:5 //Increase pattern index : + (KeyDown|KeyHold) 19:1818:0:109:5 //Decrease pattern index: NUM MINUS (KeyDown|KeyHold) 19:1818:0:189:5 //Decrease pattern index: - (KeyDown|KeyHold) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/SE_laptop_(ganja).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/SE_laptop_(ganja).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/SE_laptop_(ganja).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -232,3 +232,5 @@ 19:1817:0:187:5 //Increase pattern index : + (KeyDown|KeyHold) 19:1818:0:109:1 //Decrease pattern index: NUM SUB (KeyDown) 19:1818:0:189:1 //Decrease pattern index: - (KeyDown) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -329,3 +329,5 @@ 19:1817:0:187:5 //Increase pattern index : = (KeyDown|KeyHold) 19:1818:0:109:1 //Decrease pattern index: NUM SUB (KeyDown) 19:1818:0:189:1 //Decrease pattern index: - (KeyDown) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/US_it2_(lpchip).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/US_it2_(lpchip).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/US_it2_(lpchip).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -300,3 +300,5 @@ 19:1817:0:187:5 //Increase pattern index : + (KeyDown|KeyHold) 19:1818:0:109:1 //Decrease pattern index: NUM SUB (KeyDown) 19:1818:0:189:1 //Decrease pattern index: - (KeyDown) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/US_mpt_classic_(nobuyuki).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/US_mpt_classic_(nobuyuki).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/US_mpt_classic_(nobuyuki).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -313,3 +313,5 @@ 19:1817:0:187:5 //Increase pattern index : = (KeyDown|KeyHold) 19:1818:0:109:5 //Decrease pattern index: Num - (KeyDown|KeyHold) 19:1818:0:189:5 //Decrease pattern index: - (KeyDown|KeyHold) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/US_mpt_classic_(snu).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/US_mpt_classic_(snu).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/US_mpt_classic_(snu).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -367,3 +367,5 @@ 19:1817:0:187:5 //Increase pattern index : = (KeyDown|KeyHold) 19:1818:0:109:5 //Decrease pattern index: NUM SUB (KeyDown|KeyHold) 19:1818:0:189:5 //Decrease pattern index: - (KeyDown|KeyHold) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/US_mptit_(coda).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/US_mptit_(coda).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/US_mptit_(coda).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -336,3 +336,5 @@ 19:1818:0:189:5 //Decrease pattern index: - (KeyDown|KeyHold) 19:1853:0:73:1 //Ignore (+++) Index: I (KeyDown) 19:1854:0:32:1 //Invalid (---) Index: Space (KeyDown) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/dvorak_(snu).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/dvorak_(snu).mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/dvorak_(snu).mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -367,3 +367,5 @@ 19:1817:0:187:5 //Increase pattern index : = (KeyDown|KeyHold) 19:1818:0:109:5 //Decrease pattern index: NUM SUB (KeyDown|KeyHold) 19:1818:0:189:5 //Decrease pattern index: - (KeyDown|KeyHold) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/es-LA_it-mpt_jmkz.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/es-LA_it-mpt_jmkz.mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/es-LA_it-mpt_jmkz.mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -365,3 +365,5 @@ 19:1817:0:187:5 //Increase pattern index : + (KeyDown|KeyHold) 19:1818:0:109:5 //Decrease pattern index: TECLA DE SUSTRACCION (KeyDown|KeyHold) 19:1818:0:189:5 //Decrease pattern index: - (KeyDown|KeyHold) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/es-LA_mpt_jmkz.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/es-LA_mpt_jmkz.mkb 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/es-LA_mpt_jmkz.mkb 2012-07-20 18:33:59 UTC (rev 1332) @@ -375,3 +375,5 @@ 19:1817:0:187:5 //Increase pattern index : + (KeyDown|KeyHold) 19:1818:0:109:5 //Decrease pattern index: TECLA DE SUSTRACCION (KeyDown|KeyHold) 19:1818:0:189:5 //Decrease pattern index: - (KeyDown|KeyHold) +19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) +19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2012-07-20 18:33:59 UTC (rev 1332) @@ -443,6 +443,10 @@ m_nTempoMode = tempo_mode_classic; m_bIsRendering = false; +#ifdef MODPLUG_TRACKER + m_lockOrderStart = m_lockOrderEnd = ORDERINDEX_INVALID; +#endif // MODPLUG_TRACKER + m_ModFlags = 0; m_bITBidiMode = false; @@ -799,7 +803,7 @@ m_pConfig->SetMixLevels(m_nMixLevels); RecalculateGainForAllPlugs(); - if (m_nType) + if(m_nType != MOD_TYPE_NONE) { SetModSpecsPointer(m_pModSpecs, m_nType); const ORDERINDEX nMinLength = (std::min)(ModSequenceSet::s_nCacheSize, GetModSpecifications().ordersMax); Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/soundlib/Sndfile.h 2012-07-20 18:33:59 UTC (rev 1332) @@ -261,6 +261,12 @@ ROWINDEX m_nNextPatStartRow; // for FT2's E60 bug PATTERNINDEX m_nPattern; ORDERINDEX m_nCurrentOrder, m_nNextOrder, m_nRestartPos, m_nSeqOverride; + +#ifdef MODPLUG_TRACKER + // Lock playback between two orders + ORDERINDEX m_lockOrderStart, m_lockOrderEnd; +#endif // MODPLUG_TRACKER + bool m_bPatternTransitionOccurred; UINT m_nMasterVolume, m_nGlobalVolume, m_nSamplesToGlobalVolRampDest, m_nGlobalVolumeRampAmount, m_nGlobalVolumeDestination, m_nSamplePreAmp, m_nVSTiVolume; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2012-07-20 16:49:43 UTC (rev 1331) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2012-07-20 18:33:59 UTC (rev 1332) @@ -683,8 +683,17 @@ m_nTickCount = 0; m_nRow = m_nNextRow; // Reset Pattern Loop Effect - if (m_nCurrentOrder != m_nNextOrder) + if(m_nCurrentOrder != m_nNextOrder) m_nCurrentOrder = m_nNextOrder; + +#ifdef MODPLUG_TRACKER + // "Lock order" editing feature + if(m_lockOrderStart != ORDERINDEX_INVALID && (m_nCurrentOrder < m_lockOrderStart || m_nCurrentOrder > m_lockOrderEnd)) + { + m_nCurrentOrder = m_lockOrderStart; + } +#endif // MODPLUG_TRACKER + // Check if pattern is valid if(!m_SongFlags[SONG_PATTERNLOOP]) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-07-21 00:14:57
|
Revision: 1334 http://modplug.svn.sourceforge.net/modplug/?rev=1334&view=rev Author: saga-games Date: 2012-07-21 00:14:49 +0000 (Sat, 21 Jul 2012) Log Message: ----------- [Fix] Quick Channel Settings: Tab order is now correct. [New] Quick Channel Settings: Added freely assignable keyboard shortcuts for switching between channels and returning to the pattern editor. (Already added shortcuts to DE_jojo.mkb) [Imp] Order list: If playback is locked to some orders, those orders are now shown in grey. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/PatternEditorDialogs.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2012-07-20 18:46:14 UTC (rev 1333) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2012-07-21 00:14:49 UTC (rev 1334) @@ -630,6 +630,9 @@ DefineKeyCommand(kcOrderlistLockPlayback, 1875, _T("Lock Playback to Selection")); DefineKeyCommand(kcOrderlistUnlockPlayback, 1876, _T("Unlock Playback")); DefineKeyCommand(kcChannelSettings, 1877, _T("Quick Channel Settings")); + DefineKeyCommand(kcChnSettingsPrev, 1878, _T("Previous Channel")); + DefineKeyCommand(kcChnSettingsNext, 1879, _T("Next Channel")); + DefineKeyCommand(kcChnSettingsClose, 1880, _T("Switch to Pattern Editor")); // Add new key commands here. #ifdef _DEBUG @@ -1846,7 +1849,8 @@ case kCtxCtrlComments: return "Comments Context [top]"; case kCtxCtrlOrderlist: return "Orderlist"; case kCtxVSTGUI: return "Plugin GUI Context"; - case kCtxUnknownContext: + case kCtxChannelSettings: return "Quick Channel Settings Context"; + case kCtxUnknownContext: default: return "Unknown Context"; } }; @@ -2097,6 +2101,7 @@ m_isParentContext[kCtxCtrlComments][kCtxAllContexts] = true; m_isParentContext[kCtxCtrlSamples][kCtxAllContexts] = true; m_isParentContext[kCtxCtrlOrderlist][kCtxAllContexts] = true; + m_isParentContext[kCtxChannelSettings][kCtxAllContexts] = true; m_isParentContext[kCtxViewPatternsNote][kCtxViewPatterns] = true; m_isParentContext[kCtxViewPatternsIns][kCtxViewPatterns] = true; Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2012-07-20 18:46:14 UTC (rev 1333) +++ trunk/OpenMPT/mptrack/CommandSet.h 2012-07-21 00:14:49 UTC (rev 1334) @@ -43,7 +43,8 @@ kCtxCtrlSamples, kCtxCtrlInstruments, kCtxCtrlComments, - kCtxCtrlOrderlist, + kCtxCtrlOrderlist, + kCtxChannelSettings, kCtxMaxInputContexts }; @@ -1081,6 +1082,12 @@ kcEndOrderlistLock = kcOrderlistUnlockPlayback, kcEndOrderlistCommands=kcEndOrderlistLock, + kcStartChnSettingsCommands, + kcChnSettingsPrev = kcStartChnSettingsCommands, + kcChnSettingsNext, + kcChnSettingsClose, + kcEndChnSettingsCommands = kcChnSettingsClose, + kcNumCommands, }; Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-07-20 18:46:14 UTC (rev 1333) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-07-21 00:14:49 UTC (rev 1334) @@ -809,20 +809,29 @@ maxEntries = Util::Max(maxEntries, pSndFile->Order.GetLengthTailTrimmed()); } - //Scrolling the shown orders(the showns rectangles)? + // Scrolling the shown orders(the showns rectangles)? while (rect.left < rcClient.right) { bool bHighLight = ((bFocus) && (nIndex >= selection.nOrdLo && nIndex <= selection.nOrdHi)); const PATTERNINDEX nPat = (nIndex < pSndFile->Order.GetLength()) ? pSndFile->Order[nIndex] : PATTERNINDEX_INVALID; if ((rect.right = rect.left + m_cxFont) > rcClient.right) rect.right = rcClient.right; rect.right--; - if (bHighLight) { + + if(bHighLight) + { + // Currently selected order item FillRect(dc.m_hDC, &rect, CMainFrame::brushHighLight); - } else { + } else if(nIndex >= pSndFile->m_lockOrderStart && nIndex <= pSndFile->m_lockOrderEnd) + { + // "Playback lock" indicator + FillRect(dc.m_hDC, &rect, CMainFrame::brushGray); + } else + { + // Normal, unselected item. FillRect(dc.m_hDC, &rect, CMainFrame::brushWindow); } - //Drawing the shown pattern-indicator or drag position. + // Drawing the shown pattern-indicator or drag position. if (nIndex == ((m_bDragging) ? m_nDropPos : m_nScrollPos)) { rect.InflateRect(-1, -1); @@ -832,18 +841,18 @@ MoveToEx(dc.m_hDC, rect.right, rect.top, NULL); LineTo(dc.m_hDC, rect.right, rect.bottom); - //Drawing the 'ctrl-transition' indicator + // Drawing the 'ctrl-transition' indicator if(nIndex == pSndFile->m_nSeqOverride - 1) { - MoveToEx(dc.m_hDC, rect.left+4, rect.bottom-4, NULL); - LineTo(dc.m_hDC, rect.right-4, rect.bottom-4); - } + MoveToEx(dc.m_hDC, rect.left + 4, rect.bottom - 4, NULL); + LineTo(dc.m_hDC, rect.right - 4, rect.bottom - 4); + } - //Drawing 'playing'-indicator. + // Drawing 'playing'-indicator. if(nIndex == pSndFile->GetCurrentOrder() && CMainFrame::GetMainFrame()->IsPlaying()) { - MoveToEx(dc.m_hDC, rect.left+4, rect.top+2, NULL); - LineTo(dc.m_hDC, rect.right-4, rect.top+2); + MoveToEx(dc.m_hDC, rect.left + 4, rect.top + 2, NULL); + LineTo(dc.m_hDC, rect.right - 4, rect.top + 2); } s[0] = '\0'; @@ -1558,6 +1567,7 @@ { pSndFile->m_lockOrderStart = selection.nOrdLo; pSndFile->m_lockOrderEnd = selection.nOrdHi; + InvalidateRect(NULL, FALSE); } } @@ -1567,4 +1577,5 @@ { CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); pSndFile->m_lockOrderStart = pSndFile->m_lockOrderEnd = ORDERINDEX_INVALID; + InvalidateRect(NULL, FALSE); } \ No newline at end of file Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2012-07-20 18:46:14 UTC (rev 1333) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2012-07-21 00:14:49 UTC (rev 1334) @@ -243,6 +243,15 @@ } { + CommandCategory newCat(" Pattern Editor - Quick Channel Settings", kCtxChannelSettings); + + for(int c = kcStartChnSettingsCommands; c <= kcEndChnSettingsCommands; c++) + newCat.commands.Add(c); + + commandCategories.Add(newCat); + } + + { CommandCategory newCat(" Pattern Editor - General", kCtxViewPatterns); for(int c = kcStartPlainNavigate; c <= kcEndPlainNavigate; c++) Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2012-07-20 18:46:14 UTC (rev 1333) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2012-07-21 00:14:49 UTC (rev 1334) @@ -1618,6 +1618,7 @@ ON_COMMAND(IDC_CHECK2, OnSurroundChanged) ON_COMMAND(IDC_BUTTON1, OnPrevChannel) ON_COMMAND(IDC_BUTTON2, OnNextChannel) + ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg) END_MESSAGE_MAP() @@ -1876,14 +1877,72 @@ void QuickChannelProperties::OnPrevChannel() //------------------------------------------ { - channel--; - UpdateDisplay(); + if(channel > 0) + { + channel--; + UpdateDisplay(); + } } void QuickChannelProperties::OnNextChannel() //------------------------------------------ { - channel++; - UpdateDisplay(); + if(channel < document->GetNumChannels() - 1) + { + channel++; + UpdateDisplay(); + } +} + + +BOOL QuickChannelProperties::PreTranslateMessage(MSG *pMsg) +//--------------------------------------------------------- +{ + if(pMsg) + { + //We handle keypresses before Windows has a chance to handle them (for alt etc..) + if((pMsg->message == WM_SYSKEYUP) || (pMsg->message == WM_KEYUP) || + (pMsg->message == WM_SYSKEYDOWN) || (pMsg->message == WM_KEYDOWN)) + { + CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler(); + + //Translate message manually + UINT nChar = pMsg->wParam; + UINT nRepCnt = LOWORD(pMsg->lParam); + UINT nFlags = HIWORD(pMsg->lParam); + KeyEventType kT = ih->GetKeyEventType(nFlags); + + if(ih->KeyEvent(kCtxChannelSettings, nChar, nRepCnt, nFlags, kT, this) != kcNull) + { + return true; // Mapped to a command, no need to pass message on. + } + } + + } + + return CDialog::PreTranslateMessage(pMsg); +} + + +LRESULT QuickChannelProperties::OnCustomKeyMsg(WPARAM wParam, LPARAM) +//------------------------------------------------------------------- +{ + if (wParam == kcNull) + return 0; + + switch(wParam) + { + case kcChnSettingsPrev: + OnPrevChannel(); + return wParam; + case kcChnSettingsNext: + OnNextChannel(); + return wParam; + case kcChnSettingsClose: + OnActivate(WA_INACTIVE, nullptr, FALSE); + return wParam; + } + + return 0; } \ No newline at end of file Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.h =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2012-07-20 18:46:14 UTC (rev 1333) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2012-07-21 00:14:49 UTC (rev 1334) @@ -376,6 +376,9 @@ afx_msg void OnNameChanged(); afx_msg void OnPrevChannel(); afx_msg void OnNextChannel(); + afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM); + BOOL PreTranslateMessage(MSG *pMsg); + DECLARE_MESSAGE_MAP(); }; Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2012-07-20 18:46:14 UTC (rev 1333) +++ trunk/OpenMPT/mptrack/mptrack.rc 2012-07-21 00:14:49 UTC (rev 1334) @@ -227,20 +227,20 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN + CONTROL "Channel 1:",IDC_STATIC_CHANNEL_NAME,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,6,8,45,8 + EDITTEXT IDC_EDIT3,60,6,126,12,ES_AUTOHSCROLL + PUSHBUTTON "<<",IDC_BUTTON1,192,6,18,12 + PUSHBUTTON ">>",IDC_BUTTON2,216,6,18,12 + LTEXT "Initial Volume:",IDC_STATIC,6,30,45,8 + CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,54,24,92,22 EDITTEXT IDC_EDIT1,150,30,36,12,ES_NUMBER CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY,174,30,11,14 - CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,54,24,92,22 + CONTROL "Mute",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,192,30,42,12 + LTEXT "Initial Pan:",IDC_STATIC,6,54,34,8 + CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,54,48,92,22 EDITTEXT IDC_EDIT2,150,54,36,12,ES_NUMBER CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY,174,54,11,14 - CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,54,48,92,22 - CONTROL "Mute",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,192,30,42,12 CONTROL "Surround",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,192,54,42,12 - LTEXT "Initial Volume:",IDC_STATIC,6,30,45,8 - LTEXT "Initial Pan:",IDC_STATIC,6,54,34,8 - PUSHBUTTON "<<",IDC_BUTTON1,192,6,18,12 - PUSHBUTTON ">>",IDC_BUTTON2,216,6,18,12 - EDITTEXT IDC_EDIT3,60,6,126,12,ES_AUTOHSCROLL - CONTROL "Channel 1:",IDC_STATIC_CHANNEL_NAME,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,6,8,45,8 END Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-07-20 18:46:14 UTC (rev 1333) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-07-21 00:14:49 UTC (rev 1334) @@ -385,3 +385,8 @@ 19:1854:0:32:1 //Stop (---) Index: LEER (KeyDown) 19:1875:2:76:1 //Lock Playback to Selection: Ctrl+L (KeyDown) 19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) + +//----( Quick Channel Settings Context (20) )------------ +20:1878:2:8:5 //Previous Channel: Ctrl+R\xDCCK (KeyDown|KeyHold) +20:1879:0:13:5 //Next Channel: EINGABE (KeyDown|KeyHold) +20:1880:1:13:1 //Switch to Pattern Editor: Shift+EINGABE (KeyDown) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-07-21 18:01:04
|
Revision: 1336 http://modplug.svn.sourceforge.net/modplug/?rev=1336&view=rev Author: saga-games Date: 2012-07-21 18:00:54 +0000 (Sat, 21 Jul 2012) Log Message: ----------- [Imp] Playback lock is now ignored when exporting to WAV. [Imp] Various other improvements to playback lock when navigating in the order list. [Ref] CSoundFile::m_nSeqOverride uses ORDERINDEX_INVALID instead of 0 as its "not set" value now. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/ModSequence.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2012-07-21 00:21:58 UTC (rev 1335) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2012-07-21 18:00:54 UTC (rev 1336) @@ -406,7 +406,7 @@ break; case CTRLMSG_GETCURRENTORDER: - return m_OrderList.GetCurSel(true).nOrdLo; + return m_OrderList.GetCurSel(true).firstOrd; case CTRLMSG_SETCURRENTINSTRUMENT: case CTRLMSG_PAT_SETINSTRUMENT: @@ -457,11 +457,11 @@ break; case CTRLMSG_PREVORDER: - m_OrderList.SetCurSel(m_OrderList.GetCurSel(true).nOrdLo - 1, TRUE); + m_OrderList.SetCurSel(m_OrderList.GetCurSel(true).firstOrd - 1, TRUE); break; case CTRLMSG_NEXTORDER: - m_OrderList.SetCurSel(m_OrderList.GetCurSel(true).nOrdLo + 1, TRUE); + m_OrderList.SetCurSel(m_OrderList.GetCurSel(true).firstOrd + 1, TRUE); break; //rewbs.customKeys @@ -664,7 +664,7 @@ void CCtrlPatterns::OnSequencePrev() //---------------------------------- { - m_OrderList.SetCurSel(m_OrderList.GetCurSel(true).nOrdLo - 1); + m_OrderList.SetCurSel(m_OrderList.GetCurSel(true).firstOrd - 1); m_OrderList.SetFocus(); } @@ -672,7 +672,7 @@ void CCtrlPatterns::OnSequenceNext() //---------------------------------- { - m_OrderList.SetCurSel(m_OrderList.GetCurSel(true).nOrdLo + 1); + m_OrderList.SetCurSel(m_OrderList.GetCurSel(true).firstOrd + 1); m_OrderList.SetFocus(); } @@ -801,7 +801,7 @@ if (m_pModDoc) { CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - ORDERINDEX nCurOrd = m_OrderList.GetCurSel(true).nOrdLo; + ORDERINDEX nCurOrd = m_OrderList.GetCurSel(true).firstOrd; PATTERNINDEX nCurPat = pSndFile->Order[nCurOrd]; ROWINDEX rows = 64; if(pSndFile->Patterns.IsValidPat(nCurPat)) @@ -838,9 +838,9 @@ { CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - ORD_SELECTION selection = m_OrderList.GetCurSel(false); - ORDERINDEX nInsertCount = selection.nOrdHi - selection.nOrdLo; - ORDERINDEX nInsertWhere = selection.nOrdLo + nInsertCount + 1; + OrdSelection selection = m_OrderList.GetCurSel(false); + ORDERINDEX nInsertCount = selection.lastOrd - selection.firstOrd; + ORDERINDEX nInsertWhere = selection.firstOrd + nInsertCount + 1; if (nInsertWhere >= pSndFile->GetModSpecifications().ordersMax) return; bool bSuccess = false; @@ -849,7 +849,7 @@ for(ORDERINDEX i = 0; i <= nInsertCount; i++) { - PATTERNINDEX nCurPat = pSndFile->Order[selection.nOrdLo + i]; + PATTERNINDEX nCurPat = pSndFile->Order[selection.firstOrd + i]; if (pSndFile->Patterns.IsValidIndex(nCurPat) && patReplaceIndex[nCurPat] == PATTERNINDEX_INVALID) { ROWINDEX rows = pSndFile->Patterns[nCurPat].GetNumRows(); @@ -883,7 +883,7 @@ } else { // Invalid pattern, or it has been duplicated before (multiselect) - for (int j = pSndFile->Order.size() - 1; j > selection.nOrdLo + i + nInsertCount + 1; j--) pSndFile->Order[j] = pSndFile->Order[j - 1]; + for (int j = pSndFile->Order.size() - 1; j > selection.firstOrd + i + nInsertCount + 1; j--) pSndFile->Order[j] = pSndFile->Order[j - 1]; PATTERNINDEX nNewPat; if(nCurPat < pSndFile->Patterns.Size() && patReplaceIndex[nCurPat] != PATTERNINDEX_INVALID) @@ -892,12 +892,12 @@ nNewPat = patReplaceIndex[nCurPat]; } else { - nNewPat = pSndFile->Order[selection.nOrdLo + i]; + nNewPat = pSndFile->Order[selection.firstOrd + i]; } - if (selection.nOrdLo + i + nInsertCount + 1 < pSndFile->Order.GetLength()) + if (selection.firstOrd + i + nInsertCount + 1 < pSndFile->Order.GetLength()) { - pSndFile->Order[selection.nOrdLo + i + nInsertCount + 1] = nNewPat; + pSndFile->Order[selection.firstOrd + i + nInsertCount + 1] = nNewPat; } bSuccess = true; @@ -919,7 +919,7 @@ m_pModDoc->SetModified(); m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE | HINT_PATNAMES, this); - if(selection.nOrdHi != selection.nOrdLo) m_OrderList.m_nScrollPos2nd = nInsertWhere + nInsertCount; + if(selection.lastOrd != selection.firstOrd) m_OrderList.m_nScrollPos2nd = nInsertWhere + nInsertCount; } } SwitchToView(); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2012-07-21 00:21:58 UTC (rev 1335) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2012-07-21 18:00:54 UTC (rev 1336) @@ -17,11 +17,11 @@ class COrderList; class CCtrlPatterns; -struct ORD_SELECTION +struct OrdSelection { - ORDERINDEX nOrdLo; - ORDERINDEX nOrdHi; - ORDERINDEX GetSelCount() const {return nOrdHi - nOrdLo + 1;} + ORDERINDEX firstOrd; + ORDERINDEX lastOrd; + ORDERINDEX GetSelCount() const {return lastOrd - firstOrd + 1;} }; //=========================== @@ -69,7 +69,7 @@ // Get the currently selected pattern(s). // Set bIgnoreSelection to true if only the first selected point is important. - ORD_SELECTION GetCurSel(bool bIgnoreSelection) const; + OrdSelection GetCurSel(bool bIgnoreSelection) const; // Sets target margin value and returns the effective margin value. BYTE SetMargins(int); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-07-21 00:21:58 UTC (rev 1335) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-07-21 18:00:54 UTC (rev 1336) @@ -252,22 +252,22 @@ } -ORD_SELECTION COrderList::GetCurSel(bool bIgnoreSelection) const +OrdSelection COrderList::GetCurSel(bool bIgnoreSelection) const //-------------------------------------------------------------- { // returns the currently selected order(s) - ORD_SELECTION result; - result.nOrdLo = result.nOrdHi = m_nScrollPos; + OrdSelection result; + result.firstOrd = result.lastOrd = m_nScrollPos; // bIgnoreSelection: true if only first selection marker is important. if(!bIgnoreSelection && m_nScrollPos2nd != ORDERINDEX_INVALID) { if(m_nScrollPos2nd < m_nScrollPos) // ord2 < ord1 - result.nOrdLo = m_nScrollPos2nd; + result.firstOrd = m_nScrollPos2nd; else - result.nOrdHi = m_nScrollPos2nd; + result.lastOrd = m_nScrollPos2nd; } - LimitMax(result.nOrdLo, m_pModDoc->GetSoundFile()->Order.GetLastIndex()); - LimitMax(result.nOrdHi, m_pModDoc->GetSoundFile()->Order.GetLastIndex()); + LimitMax(result.firstOrd, m_pModDoc->GetSoundFile()->Order.GetLastIndex()); + LimitMax(result.lastOrd, m_pModDoc->GetSoundFile()->Order.GetLastIndex()); return result; } @@ -289,7 +289,8 @@ { const BYTE nMargins = GetMargins(GetMarginsMax(nShownLength)); if ((*nOrder < m_nXScroll + nMargins) || (!m_cxFont) || (!m_cyFont)) - { // Must move first shown sequence item to left in order to show + { + // Must move first shown sequence item to left in order to show // the new active order. m_nXScroll = max(0, *nOrder - nMargins); SetScrollPos(SB_HORZ, m_nXScroll); @@ -299,7 +300,8 @@ ORDERINDEX maxsel = nShownLength; if (maxsel) maxsel--; if (*nOrder - m_nXScroll >= maxsel - nMargins) - { // Must move first shown sequence item to right in order to show + { + // Must move first shown sequence item to right in order to show // the new active order. m_nXScroll = *nOrder - (maxsel - nMargins); SetScrollPos(SB_HORZ, m_nXScroll); @@ -313,24 +315,24 @@ PATTERNINDEX n = pSndFile->Order[m_nScrollPos]; if ((n < pSndFile->Patterns.Size()) && (pSndFile->Patterns[n]) && !bShiftClick) { - bool bIsPlaying = (pMainFrm->GetModPlaying() == m_pModDoc); - if(bIsPlaying && pSndFile->m_SongFlags[SONG_PATTERNLOOP]) + CriticalSection cs; + + bool isPlaying = (pMainFrm->GetModPlaying() == m_pModDoc); + bool changedPos = false; + + if(isPlaying && pSndFile->m_SongFlags[SONG_PATTERNLOOP]) { - CriticalSection cs; // update channel parameters and play time m_pModDoc->SetElapsedTime(m_nScrollPos, 0); pSndFile->m_nPattern = n; pSndFile->m_nCurrentOrder = pSndFile->m_nNextOrder = m_nScrollPos; - pMainFrm->ResetNotificationBuffer(); //rewbs.toCheck + pMainFrm->ResetNotificationBuffer(); pSndFile->m_nNextRow = 0; - // Users wants to go somewhere else, so let him do that. - OnUnlockPlayback(); + changedPos = true; } else if(m_pParent->GetFollowSong()) { - CriticalSection cs; - SongFlags pausedFlags = pSndFile->m_SongFlags & (SONG_PAUSED | SONG_STEP | SONG_PATTERNLOOP); // update channel parameters and play time @@ -340,11 +342,16 @@ pSndFile->SetCurrentOrder(m_nScrollPos); pSndFile->m_SongFlags.set(pausedFlags); - if (bIsPlaying) pMainFrm->ResetNotificationBuffer(); + if(isPlaying) pMainFrm->ResetNotificationBuffer(); + changedPos = true; + } + if(changedPos && pSndFile->Order.IsPositionLocked(m_nScrollPos)) + { // Users wants to go somewhere else, so let him do that. OnUnlockPlayback(); } + m_pParent->SetCurrentPattern(n); } } @@ -660,7 +667,7 @@ CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); if ((!pMainFrm)) return; - const ORD_SELECTION ordsel = GetCurSel(false); + const OrdSelection ordsel = GetCurSel(false); DWORD dwMemSize; HGLOBAL hCpy; @@ -689,7 +696,7 @@ wsprintf(p, szClipboardOrdCountFieldHdr, ordsel.GetSelCount()); strcat(p, szClipboardOrdersFieldHdr); p += strlen(p); - for(ORDERINDEX i = ordsel.nOrdLo; i <= ordsel.nOrdHi; i++) + for(ORDERINDEX i = ordsel.firstOrd; i <= ordsel.lastOrd; i++) { std::string str; if (seq[i] == seq.GetInvalidPatIndex()) @@ -800,7 +807,7 @@ GetClientRect(&rcClient); rect = rcClient; ORDERINDEX nIndex = m_nXScroll; - ORD_SELECTION selection = GetCurSel(false); + OrdSelection selection = GetCurSel(false); ORDERINDEX maxEntries = pSndFile->GetModSpecifications().ordersMax; if(pSndFile->Order.GetLength() > maxEntries) @@ -812,7 +819,7 @@ // Scrolling the shown orders(the showns rectangles)? while (rect.left < rcClient.right) { - bool bHighLight = ((bFocus) && (nIndex >= selection.nOrdLo && nIndex <= selection.nOrdHi)); + bool bHighLight = ((bFocus) && (nIndex >= selection.firstOrd && nIndex <= selection.lastOrd)); const PATTERNINDEX nPat = (nIndex < pSndFile->Order.GetLength()) ? pSndFile->Order[nIndex] : PATTERNINDEX_INVALID; if ((rect.right = rect.left + m_cxFont) > rcClient.right) rect.right = rcClient.right; rect.right--; @@ -821,7 +828,7 @@ { // Currently selected order item FillRect(dc.m_hDC, &rect, CMainFrame::brushHighLight); - } else if(pSndFile->m_lockOrderStart != ORDERINDEX_INVALID && (nIndex < pSndFile->m_lockOrderStart || nIndex > pSndFile->m_lockOrderEnd)) + } else if(pSndFile->Order.IsPositionLocked(nIndex)) { // "Playback lock" indicator - grey out all order items which aren't played. FillRect(dc.m_hDC, &rect, CMainFrame::brushGray); @@ -842,7 +849,7 @@ LineTo(dc.m_hDC, rect.right, rect.bottom); // Drawing the 'ctrl-transition' indicator - if(nIndex == pSndFile->m_nSeqOverride - 1) + if(nIndex == pSndFile->m_nSeqOverride) { MoveToEx(dc.m_hDC, rect.left + 4, rect.bottom - 4, NULL); LineTo(dc.m_hDC, rect.right - 4, rect.bottom - 4); @@ -912,10 +919,10 @@ const int oldXScroll = m_nXScroll; ORDERINDEX nOrder = GetOrderFromPoint(rect, pt); - ORD_SELECTION selection = GetCurSel(false); + OrdSelection selection = GetCurSel(false); // check if cursor is in selection - if it is, only react on MouseUp as the user might want to drag those orders - if(m_nScrollPos2nd == ORDERINDEX_INVALID || nOrder < selection.nOrdLo || nOrder > selection.nOrdHi) + if(m_nScrollPos2nd == ORDERINDEX_INVALID || nOrder < selection.firstOrd || nOrder > selection.lastOrd) { m_nScrollPos2nd = ORDERINDEX_INVALID; SetCurSel(nOrder, true, IsSelectionKeyPressed()); @@ -924,7 +931,7 @@ if(m_bDragging == true) { - m_nDragOrder = GetCurSel(true).nOrdLo; + m_nDragOrder = GetCurSel(true).firstOrd; m_nDropPos = m_nDragOrder; SetCapture(); } @@ -955,15 +962,15 @@ if ((n != ORDERINDEX_INVALID) && (n == m_nDropPos) && (m_pModDoc)) { // drag multiple orders (not quite as easy...) - ORD_SELECTION selection = GetCurSel(false); + OrdSelection selection = GetCurSel(false); // move how many orders from where? - ORDERINDEX moveCount = (selection.nOrdHi - selection.nOrdLo), nMovePos = selection.nOrdLo; + ORDERINDEX moveCount = (selection.lastOrd - selection.firstOrd), nMovePos = selection.firstOrd; // drop before or after the selection bool moveBack = !(m_nDragOrder < m_nDropPos); // don't do anything if drop position is inside the selection - if((m_nDropPos >= selection.nOrdLo && m_nDropPos <= selection.nOrdHi) || m_nDragOrder == m_nDropPos) return; + if((m_nDropPos >= selection.firstOrd && m_nDropPos <= selection.lastOrd) || m_nDragOrder == m_nDropPos) return; // drag one order or multiple orders? - bool multiSelection = (selection.nOrdLo != selection.nOrdHi); + bool multiSelection = (selection.firstOrd != selection.lastOrd); for(int i = 0; i <= moveCount; i++) { @@ -994,10 +1001,10 @@ } else { ORDERINDEX nOrder = GetOrderFromPoint(rect, pt); - ORD_SELECTION selection = GetCurSel(false); + OrdSelection selection = GetCurSel(false); // this should actually have equal signs but that breaks multiselect: nOrder >= selection.nOrdLo && nOrder <= section.nOrdHi - if(pt.y < rect.bottom && m_nScrollPos2nd != ORDERINDEX_INVALID && nOrder > selection.nOrdLo && nOrder < selection.nOrdHi) + if(pt.y < rect.bottom && m_nScrollPos2nd != ORDERINDEX_INVALID && nOrder > selection.firstOrd && nOrder < selection.lastOrd) { // Remove selection if we didn't drag anything but multiselect was active m_nScrollPos2nd = ORDERINDEX_INVALID; @@ -1079,8 +1086,8 @@ // check if at least one pattern in the current selection exists bool bPatternExists = false; - ORD_SELECTION selection = GetCurSel(false); - for(ORDERINDEX nOrd = selection.nOrdLo; nOrd <= selection.nOrdHi; nOrd++) + OrdSelection selection = GetCurSel(false); + for(ORDERINDEX nOrd = selection.firstOrd; nOrd <= selection.lastOrd; nOrd++) { bPatternExists = ((pSndFile->Order[nOrd] < pSndFile->Patterns.Size()) && (pSndFile->Patterns[pSndFile->Order[nOrd]] != nullptr)); @@ -1151,7 +1158,7 @@ } } AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); - AppendMenu(hMenu, ((selection.nOrdLo == pSndFile->m_lockOrderStart && selection.nOrdHi == pSndFile->m_lockOrderEnd) ? (MF_STRING | MF_CHECKED) : MF_STRING), ID_ORDERLIST_LOCKPLAYBACK, "&Lock Playback to Selection\t" + ih->GetKeyTextFromCommand(kcOrderlistLockPlayback)); + AppendMenu(hMenu, ((selection.firstOrd == pSndFile->m_lockOrderStart && selection.lastOrd == pSndFile->m_lockOrderEnd) ? (MF_STRING | MF_CHECKED) : MF_STRING), ID_ORDERLIST_LOCKPLAYBACK, "&Lock Playback to Selection\t" + ih->GetKeyTextFromCommand(kcOrderlistLockPlayback)); AppendMenu(hMenu, (pSndFile->m_lockOrderStart == ORDERINDEX_INVALID ? (MF_STRING | MF_GRAYED) : MF_STRING), ID_ORDERLIST_UNLOCKPLAYBACK, "&Unlock Playback\t" + ih->GetKeyTextFromCommand(kcOrderlistUnlockPlayback)); AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); @@ -1241,8 +1248,8 @@ { CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - const ORD_SELECTION selection = GetCurSel(false); - const ORDERINDEX nInsertCount = selection.nOrdHi - selection.nOrdLo, nInsertEnd = selection.nOrdHi; + const OrdSelection selection = GetCurSel(false); + const ORDERINDEX nInsertCount = selection.lastOrd - selection.firstOrd, nInsertEnd = selection.lastOrd; for(ORDERINDEX i = 0; i <= nInsertCount; i++) { @@ -1289,10 +1296,10 @@ { CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - const ORD_SELECTION selection = GetCurSel(true); - ORDERINDEX insertPos = selection.nOrdLo; + const OrdSelection selection = GetCurSel(true); + ORDERINDEX insertPos = selection.firstOrd; - if(pSndFile->Order[selection.nOrdLo] != pSndFile->Order.GetInvalidPatIndex()) + if(pSndFile->Order[selection.firstOrd] != pSndFile->Order.GetInvalidPatIndex()) { // If we're not inserting on a stop (---) index, we move on by one position. insertPos++; @@ -1302,7 +1309,7 @@ if(pSndFile->Order.GetLength() < pSndFile->GetModSpecifications().ordersMax) pSndFile->Order.Append(); } - for(int j = pSndFile->Order.GetLastIndex(); j > selection.nOrdLo; j--) + for(int j = pSndFile->Order.GetLastIndex(); j > selection.firstOrd; j--) pSndFile->Order[j] = pSndFile->Order[j - 1]; } @@ -1319,8 +1326,8 @@ void COrderList::OnRenderOrder() //------------------------------ { - ORD_SELECTION selection = GetCurSel(false); - m_pModDoc->OnFileWaveConvert(selection.nOrdLo, selection.nOrdHi); + OrdSelection selection = GetCurSel(false); + m_pModDoc->OnFileWaveConvert(selection.firstOrd, selection.lastOrd); } @@ -1331,18 +1338,18 @@ { CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - ORD_SELECTION selection = GetCurSel(false); + OrdSelection selection = GetCurSel(false); // remove selection m_nScrollPos2nd = ORDERINDEX_INVALID; - pSndFile->Order.Remove(selection.nOrdLo, selection.nOrdHi); + pSndFile->Order.Remove(selection.firstOrd, selection.lastOrd); m_pModDoc->SetModified(); InvalidateRect(NULL, FALSE); m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this); - SetCurSel(selection.nOrdLo); - PATTERNINDEX nNewPat = pSndFile->Order[selection.nOrdLo]; + SetCurSel(selection.firstOrd); + PATTERNINDEX nNewPat = pSndFile->Order[selection.firstOrd]; if ((nNewPat < pSndFile->Patterns.Size()) && (pSndFile->Patterns[nNewPat] != nullptr) && (m_pParent)) { m_pParent->SetCurrentPattern(nNewPat); @@ -1421,27 +1428,27 @@ } -LRESULT COrderList::OnDragonDropping(WPARAM bDoDrop, LPARAM lParam) +LRESULT COrderList::OnDragonDropping(WPARAM doDrop, LPARAM lParam) //----------------------------------------------------------------- { LPDRAGONDROP pDropInfo = (LPDRAGONDROP)lParam; ORDERINDEX posdest; - BOOL bCanDrop; + BOOL canDrop; CSoundFile *pSndFile; CPoint pt; if ((!pDropInfo) || (!m_pModDoc) || (m_pModDoc != pDropInfo->pModDoc) || (!m_cxFont)) return FALSE; pSndFile = m_pModDoc->GetSoundFile(); - bCanDrop = FALSE; + canDrop = FALSE; switch(pDropInfo->dwDropType) { case DRAGONDROP_ORDER: if (pDropInfo->dwDropItem >= pSndFile->Order.size()) break; case DRAGONDROP_PATTERN: - bCanDrop = TRUE; + canDrop = TRUE; break; } - if ((!bCanDrop) || (!bDoDrop)) return bCanDrop; + if(!canDrop || !doDrop) return canDrop; GetCursorPos(&pt); ScreenToClient(&pt); if (pt.x < 0) pt.x = 0; @@ -1457,14 +1464,14 @@ pSndFile->Order[posdest] = pSndFile->Order[pDropInfo->dwDropItem]; break; } - if (bCanDrop) + if (canDrop) { InvalidateRect(NULL, FALSE); m_pModDoc->SetModified(); m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this); SetCurSel(posdest, true); } - return bCanDrop; + return canDrop; } @@ -1482,7 +1489,7 @@ CMainFrame::GetMainFrame()->ResetNotificationBuffer(); CSoundFile& rSf = *m_pModDoc->GetSoundFile(); - if (nSeq == MAX_SEQUENCES + 2) + if(nSeq == MAX_SEQUENCES + 2) { CString strParam; strParam.Format(TEXT("%u: %s"), rSf.Order.GetCurrentSequenceIndex(), (LPCTSTR)rSf.Order.m_sName); CString str; @@ -1494,9 +1501,9 @@ return; } } - else if (nSeq == MAX_SEQUENCES || nSeq == MAX_SEQUENCES + 1) + else if(nSeq == MAX_SEQUENCES || nSeq == MAX_SEQUENCES + 1) rSf.Order.AddSequence((nSeq == MAX_SEQUENCES)); - else if (nSeq < rSf.Order.GetNumSequences()) + else if(nSeq < rSf.Order.GetNumSequences()) rSf.Order.SetSequence(nSeq); ORDERINDEX nPosCandidate = rSf.Order.GetLengthTailTrimmed() - 1; SetCurSel(min(m_nScrollPos, nPosCandidate), true, false, true); @@ -1522,32 +1529,36 @@ GetClientRect(&rect); if(!rect.PtInRect(pt)) return; - if (m_pModDoc == nullptr) return; + if(m_pModDoc == nullptr) return; 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); + const PATTERNINDEX ignoreIndex = pSndFile->Order.GetIgnoreIndex(); + const PATTERNINDEX stopIndex = pSndFile->Order.GetInvalidPatIndex(); + const ORDERINDEX length = pSndFile->Order.GetLength(); + ORDERINDEX order = GetOrderFromPoint(rect, pt); // If this is not a playable order item, find the next valid item. - while(nOrder < nLength && (pSndFile->Order[nOrder] == nIgnore || pSndFile->Order[nOrder] == nInvalid)) + while(order < length && (pSndFile->Order[order] == ignoreIndex || pSndFile->Order[order] == stopIndex)) { - nOrder++; + order++; } - if (nOrder < nLength) + if(order < length) { - if (pSndFile->m_nSeqOverride == static_cast<UINT>(nOrder) + 1) + if(pSndFile->m_nSeqOverride == order) { - pSndFile->m_nSeqOverride = 0; + // This item is already queued: Dequeue it. + pSndFile->m_nSeqOverride = ORDERINDEX_INVALID; } else { - // Users wants to go somewhere else, so let him do that. - OnUnlockPlayback(); + if(pSndFile->Order.IsPositionLocked(order)) + { + // Users wants to go somewhere else, so let him do that. + OnUnlockPlayback(); + } - pSndFile->m_nSeqOverride = nOrder + 1; + pSndFile->m_nSeqOverride = order; } InvalidateRect(NULL, FALSE); } @@ -1559,14 +1570,14 @@ { CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - ORD_SELECTION selection = GetCurSel(false); - if(selection.nOrdLo == pSndFile->m_lockOrderStart && selection.nOrdHi == pSndFile->m_lockOrderEnd) + OrdSelection selection = GetCurSel(false); + if(selection.firstOrd == pSndFile->m_lockOrderStart && selection.lastOrd == pSndFile->m_lockOrderEnd) { OnUnlockPlayback(); } else { - pSndFile->m_lockOrderStart = selection.nOrdLo; - pSndFile->m_lockOrderEnd = selection.nOrdHi; + pSndFile->m_lockOrderStart = selection.firstOrd; + pSndFile->m_lockOrderEnd = selection.lastOrd; InvalidateRect(NULL, FALSE); } } @@ -1578,4 +1589,4 @@ CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); pSndFile->m_lockOrderStart = pSndFile->m_lockOrderEnd = ORDERINDEX_INVALID; InvalidateRect(NULL, FALSE); -} \ No newline at end of file +} Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2012-07-21 00:21:58 UTC (rev 1335) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2012-07-21 18:00:54 UTC (rev 1336) @@ -590,13 +590,23 @@ } // Remove order name + fill up with empty patterns. m_sName = ""; - const ORDERINDEX nMinLength = (std::min)(ModSequenceSet::s_nCacheSize, m_pSndFile->GetModSpecifications().ordersMax); - if (GetLength() < nMinLength) + const ORDERINDEX nMinLength = Util::Min(ModSequenceSet::s_nCacheSize, m_pSndFile->GetModSpecifications().ordersMax); + if(GetLength() < nMinLength) resize(nMinLength); return true; } +#ifdef MODPLUG_TRACKER +// Check if a playback position is currently locked (inaccessible) +bool ModSequence::IsPositionLocked(ORDERINDEX position) +{ + return(m_pSndFile->m_lockOrderStart != ORDERINDEX_INVALID + && (position < m_pSndFile->m_lockOrderStart || position > m_pSndFile->m_lockOrderEnd)); +} +#endif // MODPLUG_TRACKER + + ///////////////////////////////////// // Read/Write ///////////////////////////////////// Modified: trunk/OpenMPT/soundlib/ModSequence.h =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.h 2012-07-21 00:21:58 UTC (rev 1335) +++ trunk/OpenMPT/soundlib/ModSequence.h 2012-07-21 18:00:54 UTC (rev 1336) @@ -108,6 +108,13 @@ // Returns true if the IT orderlist datafield is not sufficient to store orderlist information. bool NeedsExtraDatafield() const; +#ifdef MODPLUG_TRACKER + // Check if a playback position is currently locked (inaccessible) + bool IsPositionLocked(ORDERINDEX position); +#endif // MODPLUG_TRACKER + + + protected: iterator begin() {return m_pArray;} const_iterator begin() const {return m_pArray;} Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-07-21 00:21:58 UTC (rev 1335) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-07-21 18:00:54 UTC (rev 1336) @@ -1742,7 +1742,9 @@ { // XM: Key-Off + Sample == Note Cut (BUT: Only if no instr number or volume effect is present!) - if ((note == NOTE_KEYOFF) && ((!instr && volcmd == VOLCMD_NONE && cmd != CMD_VOLUME) || !IsCompatibleMode(TRK_FASTTRACKER2)) && ((!pChn->pModInstrument) || (!(pChn->pModInstrument->VolEnv.dwFlags & ENV_ENABLED)))) + if(note == NOTE_KEYOFF + && ((!instr && volcmd == VOLCMD_NONE && cmd != CMD_VOLUME) || !IsCompatibleMode(TRK_FASTTRACKER2)) + && (pChn->pModInstrument == nullptr || !pChn->pModInstrument->VolEnv.dwFlags[ENV_ENABLED])) { pChn->dwFlags.set(CHN_FASTVOLRAMP); pChn->nVolume = 0; @@ -2417,9 +2419,9 @@ case CMD_POSITIONJUMP: m_nNextPatStartRow = 0; // FT2 E60 bug nPosJump = param; - if(m_SongFlags[SONG_PATTERNLOOP] && m_nSeqOverride == 0) + if(m_SongFlags[SONG_PATTERNLOOP] && m_nSeqOverride == ORDERINDEX_INVALID) { - m_nSeqOverride = param + 1; + m_nSeqOverride = param; //Releasing pattern loop after position jump could cause //instant jumps - modifying behavior so that now position jumps //occurs also when pattern loop is enabled. @@ -4678,14 +4680,14 @@ return; // MPT sequence override - if ((m_nSeqOverride > 0) && (m_nSeqOverride <= Order.size())) + if(m_nSeqOverride != ORDERINDEX_INVALID && m_nSeqOverride < Order.size()) { if(m_SongFlags[SONG_PATTERNLOOP]) { - m_nPattern = Order[m_nSeqOverride - 1]; + m_nPattern = Order[m_nSeqOverride]; } - m_nNextOrder = m_nSeqOverride - 1; - m_nSeqOverride = 0; + m_nNextOrder = m_nSeqOverride; + m_nSeqOverride = ORDERINDEX_INVALID; } // Channel mutes Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2012-07-21 00:21:58 UTC (rev 1335) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2012-07-21 18:00:54 UTC (rev 1336) @@ -436,7 +436,7 @@ m_nMinPeriod = MIN_PERIOD; m_nMaxPeriod = 0x7FFF; m_nRepeatCount = 0; - m_nSeqOverride = 0; + m_nSeqOverride = ORDERINDEX_INVALID; m_bPatternTransitionOccurred = false; m_nDefaultRowsPerBeat = m_nCurrentRowsPerBeat = (CMainFrame::GetSettings().m_nRowHighlightBeats) ? CMainFrame::GetSettings().m_nRowHighlightBeats : 4; m_nDefaultRowsPerMeasure = m_nCurrentRowsPerMeasure = (CMainFrame::GetSettings().m_nRowHighlightMeasures >= m_nDefaultRowsPerBeat) ? CMainFrame::GetSettings().m_nRowHighlightMeasures : m_nDefaultRowsPerBeat * 4; @@ -513,7 +513,7 @@ m_nCurrentOrder = 0; m_nNextOrder = 0; m_nNextPatStartRow = 0; - m_nSeqOverride = 0; + m_nSeqOverride = ORDERINDEX_INVALID; m_nRestartPos = 0; m_nMinPeriod = 16; m_nMaxPeriod = 32767; Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2012-07-21 00:21:58 UTC (rev 1335) +++ trunk/OpenMPT/soundlib/Sndfile.h 2012-07-21 18:00:54 UTC (rev 1336) @@ -263,7 +263,7 @@ ORDERINDEX m_nCurrentOrder, m_nNextOrder, m_nRestartPos, m_nSeqOverride; #ifdef MODPLUG_TRACKER - // Lock playback between two orders + // Lock playback between two orders. Lock is active if lock start != ORDERINDEX_INVALID). ORDERINDEX m_lockOrderStart, m_lockOrderEnd; #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2012-07-21 00:21:58 UTC (rev 1335) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2012-07-21 18:00:54 UTC (rev 1336) @@ -688,7 +688,7 @@ #ifdef MODPLUG_TRACKER // "Lock order" editing feature - if(m_lockOrderStart != ORDERINDEX_INVALID && (m_nCurrentOrder < m_lockOrderStart || m_nCurrentOrder > m_lockOrderEnd)) + if(Order.IsPositionLocked(m_nCurrentOrder) && !(gdwSoundSetup & SNDMIX_DIRECTTODISK)) { m_nCurrentOrder = m_lockOrderStart; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-07-26 18:14:55
|
Revision: 1337 http://modplug.svn.sourceforge.net/modplug/?rev=1337&view=rev Author: saga-games Date: 2012-07-26 18:14:47 +0000 (Thu, 26 Jul 2012) Log Message: ----------- [Fix] Save All / Save None buttons in the Unsaved Files dialog didn't always work if there was only one unsaved file (http://bugs.openmpt.org/view.php?id=206, fix by coda) [Fix] Order list: When switching to the pattern tab for the first time, it shouldn't scroll the order list anymore if not necessary. [Fix] IT Loader: Silent samples were sometimes loaded into sample slots that were actually supposed to be empty. [Mod] Updated DE_jojo.mkb [Mod] OpenMPT: Version is now 1.20.02.04 Modified Paths: -------------- trunk/OpenMPT/mptrack/CloseMainDialog.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/mptrack/CloseMainDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/CloseMainDialog.cpp 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/mptrack/CloseMainDialog.cpp 2012-07-26 18:14:47 UTC (rev 1337) @@ -110,7 +110,10 @@ void CloseMainDialog::OnSaveAll() //------------------------------- { - m_List.SelItemRange(TRUE, 0, m_List.GetCount() - 1); + if(m_List.GetCount() == 1) + m_List.SetSel(0, TRUE); // SelItemRange can't select one item: http://support.microsoft.com/kb/129428/en-us + else + m_List.SelItemRange(TRUE, 0, m_List.GetCount() - 1); OnOK(); } @@ -118,7 +121,10 @@ void CloseMainDialog::OnSaveNone() //-------------------------------- { - m_List.SelItemRange(FALSE, 0, m_List.GetCount() - 1); + if(m_List.GetCount() == 1) + m_List.SetSel(0, FALSE); // SelItemRange can't select one item: http://support.microsoft.com/kb/129428/en-us + else + m_List.SelItemRange(FALSE, 0, m_List.GetCount() - 1); OnOK(); } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2012-07-26 18:14:47 UTC (rev 1337) @@ -703,12 +703,11 @@ void CCtrlPatterns::OnOrderListMarginsChanged() //--------------------------------------------- { - BYTE i; + ORDERINDEX i; if((m_EditOrderListMargins.m_hWnd) && (m_EditOrderListMargins.IsWindowVisible()) && (m_EditOrderListMargins.GetWindowTextLength() > 0)) { i = m_OrderList.SetMargins(GetDlgItemInt(IDC_EDIT_ORDERLIST_MARGINS)); - } - else + } else { i = m_OrderList.GetMargins(); } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2012-07-26 18:14:47 UTC (rev 1337) @@ -38,13 +38,13 @@ //m_nScrollPos2nd: 2nd selection point if multiple orders are selected // (not neccessarily the higher order - GetCurSel() is taking care of that.) ORDERINDEX m_nXScroll, m_nScrollPos, m_nScrollPos2nd, m_nDropPos; - bool m_bScrolling, m_bDragging; ORDERINDEX m_nDragOrder; //To tell how many orders('orderboxes') to show at least //on both sides of current order(when updating orderslist position). int m_nOrderlistMargins; CModDoc *m_pModDoc; CCtrlPatterns *m_pParent; + bool m_bScrolling, m_bDragging; public: COrderList(); @@ -56,7 +56,8 @@ UINT GetCurrentPattern() const; // make the current selection the secondary selection (used for keyboard orderlist navigation) inline void SetCurSelTo2ndSel(bool isSelectionKeyPressed) - { if(isSelectionKeyPressed && m_nScrollPos2nd == ORDERINDEX_INVALID) m_nScrollPos2nd = m_nScrollPos; + { + if(isSelectionKeyPressed && m_nScrollPos2nd == ORDERINDEX_INVALID) m_nScrollPos2nd = m_nScrollPos; else if(!isSelectionKeyPressed && m_nScrollPos2nd != ORDERINDEX_INVALID) m_nScrollPos2nd = ORDERINDEX_INVALID; }; bool SetCurSel(ORDERINDEX sel, bool bEdit = true, bool bShiftClick = false, bool bIgnoreCurSel = false); @@ -72,24 +73,24 @@ OrdSelection GetCurSel(bool bIgnoreSelection) const; // Sets target margin value and returns the effective margin value. - BYTE SetMargins(int); + ORDERINDEX SetMargins(int); // Returns the effective margin value. - BYTE GetMargins() { return GetMargins(GetMarginsMax()); } + ORDERINDEX GetMargins() { return GetMargins(GetMarginsMax()); } // Returns the effective margin value. - BYTE GetMargins(const BYTE nMaxMargins) const { return Util::Min(nMaxMargins, static_cast<BYTE>(m_nOrderlistMargins)); } + ORDERINDEX GetMargins(const ORDERINDEX maxMargins) const { return Util::Min(maxMargins, static_cast<ORDERINDEX>(m_nOrderlistMargins)); } // Returns maximum margin value given current window width. - BYTE GetMarginsMax() { return GetMarginsMax(GetLength()); } + ORDERINDEX GetMarginsMax() { return GetMarginsMax(GetLength()); } // Returns maximum margin value when shown sequence has nLength orders. // For example: If length is 4 orders -> maxMargins = 4/2 - 1 = 1; // if maximum is 5 -> maxMargins = (int)5/2 = 2 - BYTE GetMarginsMax(const BYTE nLength) const { return (nLength > 0 && nLength % 2 == 0) ? nLength / 2 - 1 : nLength / 2; } + ORDERINDEX GetMarginsMax(const ORDERINDEX length) const { return (length > 0 && length % 2 == 0) ? length / 2 - 1 : length / 2; } // Returns the number of sequence items visible in the list. - BYTE GetLength(); + ORDERINDEX GetLength(); // Return true if given order is in margins given that first shown order // is 'startOrder'. Begin part of the whole sequence @@ -158,6 +159,8 @@ }; +// CPatEdit: Edit control that switches back to the pattern view if Tab key is pressed. + //========================== class CPatEdit: public CEdit //========================== @@ -166,7 +169,7 @@ CCtrlPatterns *m_pParent; public: - CPatEdit() { m_pParent = NULL; } + CPatEdit() { m_pParent = nullptr; } void SetParent(CCtrlPatterns *parent) { m_pParent = parent; } virtual BOOL PreTranslateMessage(MSG *pMsg); }; Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-07-26 18:14:47 UTC (rev 1337) @@ -85,7 +85,7 @@ bool COrderList::IsOrderInMargins(int order, int startOrder) //---------------------------------------------------------- { - const BYTE nMargins = GetMargins(); + const ORDERINDEX nMargins = GetMargins(); return ((startOrder != 0 && order - startOrder < nMargins) || order - startOrder >= GetLength() - nMargins); } @@ -237,23 +237,23 @@ } -BYTE COrderList::GetLength() -//-------------------------- +ORDERINDEX COrderList::GetLength() +//-------------------------------- { CRect rcClient; GetClientRect(&rcClient); if(m_cxFont > 0) - return static_cast<BYTE>(rcClient.right / m_cxFont); + return static_cast<ORDERINDEX>(rcClient.right / m_cxFont); else { const int nFontWidth = GetFontWidth(); - return (nFontWidth > 0) ? static_cast<BYTE>(rcClient.right / nFontWidth) : 0; + return (nFontWidth > 0) ? static_cast<ORDERINDEX>(rcClient.right / nFontWidth) : 0; } } OrdSelection COrderList::GetCurSel(bool bIgnoreSelection) const -//-------------------------------------------------------------- +//------------------------------------------------------------- { // returns the currently selected order(s) OrdSelection result; @@ -277,33 +277,33 @@ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - ORDERINDEX *nOrder = (bShiftClick) ? &m_nScrollPos2nd : &m_nScrollPos; + ORDERINDEX &nOrder = bShiftClick ? m_nScrollPos2nd : m_nScrollPos; if ((sel < 0) || (sel >= pSndFile->Order.GetLength()) || (!m_pParent) || (!pMainFrm)) return false; - if (!bIgnoreCurSel && sel == *nOrder) return true; - const BYTE nShownLength = GetLength(); + if (!bIgnoreCurSel && sel == nOrder) return true; + const ORDERINDEX nShownLength = GetLength(); InvalidateSelection(); - *nOrder = sel; + nOrder = sel; if (!m_bScrolling) { - const BYTE nMargins = GetMargins(GetMarginsMax(nShownLength)); - if ((*nOrder < m_nXScroll + nMargins) || (!m_cxFont) || (!m_cyFont)) + const ORDERINDEX nMargins = GetMargins(GetMarginsMax(nShownLength)); + if(nOrder < m_nXScroll + nMargins) { // Must move first shown sequence item to left in order to show // the new active order. - m_nXScroll = max(0, *nOrder - nMargins); + m_nXScroll = Util::Max(ORDERINDEX(0), static_cast<ORDERINDEX>(nOrder - nMargins)); SetScrollPos(SB_HORZ, m_nXScroll); InvalidateRect(NULL, FALSE); } else { ORDERINDEX maxsel = nShownLength; if (maxsel) maxsel--; - if (*nOrder - m_nXScroll >= maxsel - nMargins) + if (nOrder - m_nXScroll >= maxsel - nMargins) { // Must move first shown sequence item to right in order to show // the new active order. - m_nXScroll = *nOrder - (maxsel - nMargins); + m_nXScroll = nOrder - (maxsel - nMargins); SetScrollPos(SB_HORZ, m_nXScroll); InvalidateRect(NULL, FALSE); } @@ -1475,8 +1475,8 @@ } -BYTE COrderList::SetMargins(int i) -//-------------------------------- +ORDERINDEX COrderList::SetMargins(int i) +//-------------------------------------- { m_nOrderlistMargins = i; return GetMargins(); Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/mptrack/version.h 2012-07-26 18:14:47 UTC (rev 1337) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 02 -#define VER_MINORMINOR 03 +#define VER_MINORMINOR 04 //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/extraKeymaps/DE_jojo.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-07-26 18:14:47 UTC (rev 1337) @@ -387,6 +387,8 @@ 19:1876:2:85:1 //Unlock Playback: Ctrl+U (KeyDown) //----( Quick Channel Settings Context (20) )------------ -20:1878:2:8:5 //Previous Channel: Ctrl+R\xDCCK (KeyDown|KeyHold) -20:1879:0:13:5 //Next Channel: EINGABE (KeyDown|KeyHold) -20:1880:1:13:1 //Switch to Pattern Editor: Shift+EINGABE (KeyDown) +20:1878:1:37:5 //Previous Channel: Shift+NACH-LINKS (KeyDown|KeyHold) +20:1878:1:8:5 //Previous Channel: Shift+R\xDCCK (KeyDown|KeyHold) +20:1879:1:39:5 //Next Channel: Shift+NACH-RECHTS (KeyDown|KeyHold) +20:1879:1:13:5 //Next Channel: Shift+EINGABE (KeyDown|KeyHold) +20:1880:0:13:1 //Switch to Pattern Editor: EINGABE (KeyDown) Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2012-07-21 18:00:54 UTC (rev 1336) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2012-07-26 18:14:47 UTC (rev 1337) @@ -756,13 +756,16 @@ for (UINT nsmp = 0; nsmp < m_nSamples; nsmp++) if ((smppos[nsmp]) && (smppos[nsmp] <= dwMemLength - sizeof(ITSample))) { ITSample *pis = (ITSample *)(lpStream+smppos[nsmp]); - if (pis->id == LittleEndian(ITSample::magic)) + if(pis->id == LittleEndian(ITSample::magic)) { size_t sampleOffset = pis->ConvertToMPT(Samples[nsmp + 1]); StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[nsmp + 1], pis->name); - lastSampleOffset = Util::Max(lastSampleOffset, sampleOffset + pis->GetSampleFormat(itHeader.cwtv).ReadSample(Samples[nsmp + 1], (LPSTR)(lpStream + sampleOffset), dwMemLength - sampleOffset)); + if(sampleOffset < dwMemLength) + { + lastSampleOffset = Util::Max(lastSampleOffset, sampleOffset + pis->GetSampleFormat(itHeader.cwtv).ReadSample(Samples[nsmp + 1], lpStream + sampleOffset, dwMemLength - sampleOffset)); + } } } m_nSamples = max(1, m_nSamples); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-08-01 20:32:12
|
Revision: 1338 http://modplug.svn.sourceforge.net/modplug/?rev=1338&view=rev Author: saga-games Date: 2012-08-01 20:32:06 +0000 (Wed, 01 Aug 2012) Log Message: ----------- [Fix] MOD Loader: 15 sample Soundtracker mods wouldn't load under some circumstances. [Fix] VST: Randomize params doesn't ask the plugin if a parameter is automatable anymore, as some plugins seem to set this incorrectly. Modified Paths: -------------- trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/Load_mod.cpp Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2012-07-26 18:14:47 UTC (rev 1337) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2012-08-01 20:32:06 UTC (rev 1338) @@ -1644,10 +1644,7 @@ for(PlugParamIndex p = minParam; p < maxParam; p++) { - if(CanAutomateParameter(p)) - { - SetParameter(p, (float(rand()) / float(RAND_MAX))); - } + SetParameter(p, (float(rand()) / float(RAND_MAX))); } return true; @@ -2453,10 +2450,10 @@ // Specific Note Off - if (note > NOTE_KEYOFF) //rewbs.vstiLive + if (note > NOTE_MAX_SPECIAL) //rewbs.vstiLive { note -= NOTE_MIN; - uint8 i = static_cast<uint8>(note - NOTE_KEYOFF); + uint8 i = static_cast<uint8>(note - NOTE_MAX_SPECIAL); if(channel.uNoteOnMap[i][trackChannel]) { channel.uNoteOnMap[i][trackChannel]--; Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2012-07-26 18:14:47 UTC (rev 1337) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2012-08-01 20:32:06 UTC (rev 1338) @@ -453,6 +453,9 @@ } } + // Re-read file header, as it is found at another position in M15 files. + file.Read(fileHeader); + // Sanity checks... if(GetNumSamples() == 15) { @@ -462,9 +465,6 @@ } } - // Re-read file header, as it is found at another position in M15 files. - file.Read(fileHeader); - Order.ReadFromArray(fileHeader.orderList); ORDERINDEX realOrders = fileHeader.numOrders; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-08-05 18:06:27
|
Revision: 1339 http://modplug.svn.sourceforge.net/modplug/?rev=1339&view=rev Author: saga-games Date: 2012-08-05 18:06:20 +0000 (Sun, 05 Aug 2012) Log Message: ----------- [Fix] Improved loading of 669 files (improvements mostly taken from Schism Tracker) [Mod] OpenMPT: Version is now 1.20.02.05 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Load_669.cpp Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-08-01 20:32:06 UTC (rev 1338) +++ trunk/OpenMPT/mptrack/version.h 2012-08-05 18:06:20 UTC (rev 1339) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 02 -#define VER_MINORMINOR 04 +#define VER_MINORMINOR 05 //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_669.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_669.cpp 2012-08-01 20:32:06 UTC (rev 1338) +++ trunk/OpenMPT/soundlib/Load_669.cpp 2012-08-05 18:06:20 UTC (rev 1339) @@ -2,9 +2,9 @@ * Load_669.cpp * ------------ * Purpose: 669 Composer / UNIS 669 module loader - * Notes : (currently none) + * Notes : <opinion humble="false">This is better than Schism's 669 loader</opinion> :) + * (some of this code is "heavily inspired" by Storlek's code from Schism Tracker, and improvements have been made where necessary.) * Authors: Olivier Lapicque - * Adam Goode (endian and char fixes for PPC) * OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ @@ -24,12 +24,12 @@ }; uint16 sig; // 'if' or 'JN' - char songmessage[108]; // Song Message + char songMessage[108]; // Song Message uint8 samples; // number of samples (1-64) uint8 patterns; // number of patterns (1-128) - uint8 restartpos; + uint8 restartPos; uint8 orders[128]; - uint8 tempolist[128]; + uint8 tempoList[128]; uint8 breaks[128]; // Convert all multi-byte numeric values to current platform's endianness or vice versa. @@ -41,6 +41,7 @@ STATIC_ASSERT(sizeof(_669FileHeader) == 497); + struct _669Sample { char filename[13]; @@ -55,6 +56,30 @@ SwapBytesLE(loopStart); SwapBytesLE(loopEnd); } + + // Convert a 669 sample header to OpenMPT's internal sample header. + void ConvertToMPT(ModSample &mptSmp) const + { + mptSmp.Initialize(); + + mptSmp.nLength = length; + mptSmp.nLoopStart = loopStart; + mptSmp.nLoopEnd = loopEnd; + + if(mptSmp.nLoopEnd > mptSmp.nLength && mptSmp.nLoopStart == 0) + { + mptSmp.nLoopEnd = 0; + } + LimitMax(mptSmp.nLoopEnd, mptSmp.nLength); + if(mptSmp.nLoopStart >= mptSmp.nLoopEnd) + { + mptSmp.nLoopStart = mptSmp.nLoopEnd = 0; + } + if(mptSmp.nLoopEnd != 0) + { + mptSmp.uFlags = CHN_LOOP; + } + } }; STATIC_ASSERT(sizeof(_669Sample) == 25); @@ -79,7 +104,7 @@ } //bool has669Ext = fileHeader.sig == _669FileHeader::magic669Ext; - if(fileHeader.samples > 64 || fileHeader.restartpos >= 128 + if(fileHeader.samples > 64 || fileHeader.restartPos >= 128 || fileHeader.patterns > 128) { return false; @@ -89,50 +114,38 @@ m_SongFlags = SONG_LINEARSLIDES; m_nMinPeriod = 28 << 2; m_nMaxPeriod = 1712 << 3; - m_nDefaultTempo = 125; - m_nDefaultSpeed = 6; + m_nDefaultTempo = 78; + m_nDefaultSpeed = 4; m_nChannels = 8; m_nSamples = fileHeader.samples; for(SAMPLEINDEX smp = 1; smp <= m_nSamples; smp++) { - _669Sample sample; - if(!file.ReadConvertEndianness(sample)) + _669Sample sampleHeader; + if(!file.ReadConvertEndianness(sampleHeader)) { return false; } - - SmpLength len = sample.length; - SmpLength loopstart = sample.loopStart; - SmpLength loopend = sample.loopEnd; - if((loopend > len) && (!loopstart)) loopend = 0; - if(loopend > len) loopend = len; - if(loopstart + 4 >= loopend) loopstart = loopend = 0; - Samples[smp].nLength = len; - Samples[smp].nLoopStart = loopstart; - Samples[smp].nLoopEnd = loopend; - if(loopend) Samples[smp].uFlags |= CHN_LOOP; - StringFixer::ReadString<StringFixer::maybeNullTerminated>(m_szNames[smp], sample.filename); - Samples[smp].nVolume = 256; - Samples[smp].nGlobalVol = 64; - Samples[smp].nPan = 128; + sampleHeader.ConvertToMPT(Samples[smp]); + StringFixer::ReadString<StringFixer::maybeNullTerminated>(m_szNames[smp], sampleHeader.filename); } // Copy first song message line into song title - StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[0], fileHeader.songmessage, 36); + StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[0], fileHeader.songMessage, 36); // Song Message - ReadFixedLineLengthMessage(reinterpret_cast<const BYTE *>(fileHeader.songmessage), 108, 36, 0); + ReadFixedLineLengthMessage(reinterpret_cast<const BYTE *>(fileHeader.songMessage), 108, 36, 0); // Reading Orders Order.ReadFromArray(fileHeader.orders); - m_nRestartPos = fileHeader.restartpos; + m_nRestartPos = fileHeader.restartPos; if(Order[m_nRestartPos] >= fileHeader.patterns) m_nRestartPos = 0; // Set up panning for(CHANNELINDEX chn = 0; chn < 8; chn++) { - ChnSettings[chn].nPan = (chn & 1) ? 0x30 : 0xD0; + ChnSettings[chn].nPan = (chn & 1) ? 0xD0 : 0x30; ChnSettings[chn].nVolume = 64; + ChnSettings[chn].dwFlags.reset(); } // Reading Patterns @@ -140,77 +153,122 @@ { if(Patterns.Insert(pat, 64)) { + file.Skip(64 * 8 * 3); continue; } - ModCommand *m = Patterns[pat]; + vector<uint8> effect(8, 0xFF); for(ROWINDEX row = 0; row < 64; row++) { - ModCommand *mspeed = m; + PatternRow m = Patterns[pat].GetRow(row); - for(CHANNELINDEX n = 0; n < 8; n++, m++) + for(CHANNELINDEX chn = 0; chn < 8; chn++, m++) { uint8 data[3]; - if(!file.ReadArray(data)) - { - break; - } + file.ReadArray(data); uint8 note = data[0] >> 2; uint8 instr = ((data[0] & 0x03) << 4) | (data[1] >> 4); uint8 vol = data[1] & 0x0F; - if (data[0] < 0xFE) + if(data[0] < 0xFE) { m->note = note + 36 + NOTE_MIN; m->instr = instr + 1; + effect[chn] = 0xFF; } - if (data[0] <= 0xFE) + if(data[0] <= 0xFE) { m->volcmd = VOLCMD_VOLUME; - m->vol = (vol << 2) + 2; + m->vol = ((vol * 64 + 8) / 15); } - if (data[2] != 0xFF) + + if(data[2] != 0xFF) { - uint8 command = data[2] >> 4; - uint8 param = data[2] & 0x0F; - switch(command) + effect[chn] = data[2]; + } + if((data[2] & 0x0F) == 0 && data[2] != 0x30) + { + // A param value of 0 resets the effect. + effect[chn] = 0xFF; + } + if(effect[chn] == 0xFF) + { + continue; + } + + m->param = effect[chn] & 0x0F; + + static const ModCommand::COMMAND effTrans[] = + { + CMD_PORTAMENTOUP, CMD_PORTAMENTODOWN, CMD_TONEPORTAMENTO, CMD_PORTAMENTOUP, + CMD_ARPEGGIO, CMD_SPEED, CMD_PANNINGSLIDE, CMD_RETRIG, + }; + + if((effect[chn] >> 4) < CountOf(effTrans)) + { + m->command = effTrans[effect[chn] >> 4]; + } else + { + m->command = CMD_NONE; + continue; + } + + // Fix some commands + switch(effect[chn] >> 4) + { + case 3: + // D - frequency adjust + if(m->param) { - case 0x00: command = CMD_PORTAMENTOUP; break; - case 0x01: command = CMD_PORTAMENTODOWN; break; - case 0x02: command = CMD_TONEPORTAMENTO; break; - case 0x03: command = CMD_MODCMDEX; param |= 0x50; break; - case 0x04: command = CMD_VIBRATO; param |= 0x40; break; - case 0x05: if (param) command = CMD_SPEED; else command = 0; param += 2; break; - case 0x06: if (param == 0) { command = CMD_PANNINGSLIDE; param = 0xFE; } else - if (param == 1) { command = CMD_PANNINGSLIDE; param = 0xEF; } else - command = 0; - break; - default: command = 0; + m->param |= 0xF0; + } else + { + // Restore original note + m->command = CMD_TONEPORTAMENTO; + m->param = 0xFF; } - if (command) + effect[chn] = 0xFF; + break; + + case 4: + // E - frequency vibrato - sounds like an arpeggio, sometimes goes up, sometimes goes down, + // depending on when you restart playback? weird! + m->param |= (m->param << 4); + break; + + case 5: + // F - set tempo + // TODO: param 0 is a "super fast tempo" in extended mode (?) + effect[chn] = 0xFF; + break; + + case 6: + // G - subcommands (extended) + switch(m->param) { - if (command == CMD_SPEED) mspeed = NULL; - m->command = command; - m->param = param; + case 0: + // balance fine slide left + m->param = 0x8F; + break; + case 1: + // balance fine slide right + m->param = 0xF8; + break; + default: + m->command = CMD_NONE; } - } - } - if ((!row) && (mspeed)) - { - for (UINT i=0; i<8; i++) if (!mspeed[i].command) - { - mspeed[i].command = CMD_SPEED; - mspeed[i].param = fileHeader.tempolist[pat] + 2; break; } } + } - // Write pattern break - if(fileHeader.breaks[pat] < 63) - { - Patterns[pat].WriteEffect(EffectWriter(CMD_PATTERNBREAK, 0).Row(fileHeader.breaks[pat]).Retry(EffectWriter::rmTryNextRow)); - } + // Write pattern break + if(fileHeader.breaks[pat] < 63) + { + Patterns[pat].WriteEffect(EffectWriter(CMD_PATTERNBREAK, 0).Row(fileHeader.breaks[pat]).Retry(EffectWriter::rmTryNextRow)); } + // And of course the speed... + Patterns[pat].WriteEffect(EffectWriter(CMD_SPEED, fileHeader.tempoList[pat]).Retry(EffectWriter::rmTryNextRow)); } // Reading Samples This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-08-05 18:32:38
|
Revision: 1340 http://modplug.svn.sourceforge.net/modplug/?rev=1340&view=rev Author: saga-games Date: 2012-08-05 18:32:31 +0000 (Sun, 05 Aug 2012) Log Message: ----------- [Fix] Some changes in the 669 required the format to be converted to S3M internally. Forgot to commit this change. [Mod] Since the DSound driver seems to be buggy (see various reports on the issue tracker), OpenMPT defaults to WaveOut now if there's no ASIO driver present. [Ref] Some small cleanups. Modified Paths: -------------- trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/soundlib/Load_itp.cpp trunk/OpenMPT/soundlib/ModChannel.cpp trunk/OpenMPT/soundlib/load_j2b.cpp Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2012-08-05 18:06:20 UTC (rev 1339) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2012-08-05 18:32:31 UTC (rev 1340) @@ -506,7 +506,7 @@ case ID_ADD_SOUNDBANK: s="Add Sound &Bank...\t"; c = kcFileAddSoundBank; break; case ID_PLAYER_PLAY: s="Pause / &Resume\t"; c = kcPlayPauseSong; break; - case ID_PLAYER_PLAYFROMSTART: s="&Play from start\t"; c = kcPlaySongFromStart; break; + case ID_PLAYER_PLAYFROMSTART: s="&Play from Start\t"; c = kcPlaySongFromStart; break; case ID_PLAYER_STOP: s="&Stop\t"; c = kcStopSong; break; case ID_PLAYER_PAUSE: s="P&ause\t"; c = kcPauseSong; break; case ID_MIDI_RECORD: s="&MIDI Record\t"; c = kcMidiRecord; break; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2012-08-05 18:06:20 UTC (rev 1339) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2012-08-05 18:32:31 UTC (rev 1340) @@ -374,7 +374,6 @@ bModified = FALSE; break; case MOD_TYPE_AMF0: - case MOD_TYPE_669: m_SndFile.ChangeModTypeTo(MOD_TYPE_MOD); break; case MOD_TYPE_MED: @@ -387,6 +386,7 @@ m_SndFile.m_nType = MOD_TYPE_XM; } break; + case MOD_TYPE_669: case MOD_TYPE_FAR: case MOD_TYPE_PTM: case MOD_TYPE_STM: Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2012-08-05 18:06:20 UTC (rev 1339) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2012-08-05 18:32:31 UTC (rev 1340) @@ -301,11 +301,7 @@ rgbCustomColors[ncol] = CMainFrame::GetPrivateProfileDWord("Display", s, rgbCustomColors[ncol], iniFile); } -#ifndef NO_DSOUND - DWORD defaultDevice = SNDDEV_BUILD_ID(0, SNDDEV_DSOUND); // first DirectSound device -#else DWORD defaultDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); // first WaveOut device -#endif // NO_DSOUND #ifndef NO_ASIO // If there's an ASIO device available, prefer it over DirectSound if(EnumerateSoundDevices(SNDDEV_ASIO, 0, nullptr, 0)) Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2012-08-05 18:06:20 UTC (rev 1339) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2012-08-05 18:32:31 UTC (rev 1340) @@ -212,13 +212,13 @@ m_CheckBox6.SetCheck(m_pSndFile->m_SongFlags[SONG_ITPEMBEDIH] ? MF_CHECKED : 0); // -! NEW_FEATURE#0023 - const DWORD allowedFlags = m_pSndFile->GetModSpecifications(type).songFlags; - m_CheckBox1.EnableWindow((allowedFlags & SONG_LINEARSLIDES) != 0); - m_CheckBox2.EnableWindow((allowedFlags & SONG_FASTVOLSLIDES) != 0); - m_CheckBox3.EnableWindow((allowedFlags & SONG_ITOLDEFFECTS) != 0); - m_CheckBox4.EnableWindow((allowedFlags & SONG_ITCOMPATGXX) != 0); - m_CheckBox5.EnableWindow((allowedFlags & SONG_EXFILTERRANGE) != 0); - m_CheckBoxPT1x.EnableWindow((allowedFlags & SONG_PT1XMODE) != 0); + const FlagSet<SongFlags> allowedFlags(m_pSndFile->GetModSpecifications(type).songFlags); + m_CheckBox1.EnableWindow(allowedFlags[SONG_LINEARSLIDES]); + m_CheckBox2.EnableWindow(allowedFlags[SONG_FASTVOLSLIDES]); + m_CheckBox3.EnableWindow(allowedFlags[SONG_ITOLDEFFECTS]); + m_CheckBox4.EnableWindow(allowedFlags[SONG_ITCOMPATGXX]); + m_CheckBox5.EnableWindow(allowedFlags[SONG_EXFILTERRANGE]); + m_CheckBoxPT1x.EnableWindow(allowedFlags[SONG_PT1XMODE]); // -> CODE#0023 // -> DESC="IT project files (.itp)" Modified: trunk/OpenMPT/soundlib/Load_itp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_itp.cpp 2012-08-05 18:06:20 UTC (rev 1339) +++ trunk/OpenMPT/soundlib/Load_itp.cpp 2012-08-05 18:32:31 UTC (rev 1340) @@ -324,7 +324,8 @@ fwrite(&id, 1, sizeof(id), f); // channel config data - for(i=0; i<m_nChannels; i++){ + for(i=0; i<m_nChannels; i++) + { id = ChnSettings[i].nPan; fwrite(&id, 1, sizeof(id), f); id = ChnSettings[i].dwFlags; Modified: trunk/OpenMPT/soundlib/ModChannel.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModChannel.cpp 2012-08-05 18:06:20 UTC (rev 1339) +++ trunk/OpenMPT/soundlib/ModChannel.cpp 2012-08-05 18:32:31 UTC (rev 1340) @@ -21,7 +21,7 @@ pModSample = nullptr; pModInstrument = nullptr; nPortamentoDest = 0; - nCommand = 0; + nCommand = CMD_NONE; nPatternLoopCount = 0; nPatternLoop = 0; nFadeOutVol = 0; Modified: trunk/OpenMPT/soundlib/load_j2b.cpp =================================================================== --- trunk/OpenMPT/soundlib/load_j2b.cpp 2012-08-05 18:06:20 UTC (rev 1339) +++ trunk/OpenMPT/soundlib/load_j2b.cpp 2012-08-05 18:32:31 UTC (rev 1340) @@ -550,7 +550,7 @@ //--------------------------------------------------------------------------------------- { // Effect translation LUT - static const uint8 amEffTrans[] = + static const ModCommand::COMMAND amEffTrans[] = { CMD_ARPEGGIO, CMD_PORTAMENTOUP, CMD_PORTAMENTODOWN, CMD_TONEPORTAMENTO, CMD_VIBRATO, CMD_TONEPORTAVOL, CMD_VIBRATOVOL, CMD_TREMOLO, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-08-05 18:38:15
|
Revision: 1341 http://modplug.svn.sourceforge.net/modplug/?rev=1341&view=rev Author: saga-games Date: 2012-08-05 18:38:07 +0000 (Sun, 05 Aug 2012) Log Message: ----------- [Ref] Also made ModSample::uFlags a flagset. Modified Paths: -------------- trunk/OpenMPT/common/FlagSet.h trunk/OpenMPT/installer/vst_scan.iss trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/Undo.h trunk/OpenMPT/soundlib/LOAD_DMF.CPP trunk/OpenMPT/soundlib/LOAD_DSM.CPP trunk/OpenMPT/soundlib/Load_gdm.cpp trunk/OpenMPT/soundlib/Load_okt.cpp trunk/OpenMPT/soundlib/Load_psm.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/ModSample.cpp trunk/OpenMPT/soundlib/ModSample.h trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/WAVTools.cpp trunk/OpenMPT/soundlib/WAVTools.h Modified: trunk/OpenMPT/common/FlagSet.h =================================================================== --- trunk/OpenMPT/common/FlagSet.h 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/common/FlagSet.h 2012-08-05 18:38:07 UTC (rev 1341) @@ -10,18 +10,18 @@ #include <string> -template <typename enum_t> +template <typename enum_t, typename store_t = enum_t> class FlagSet { public: // Default constructor (no flags set) - FlagSet() : flags(enum_t(0)) + FlagSet() : flags(store_t(0)) { } // Value constructor - explicit FlagSet(enum_t value) : flags(value) + explicit FlagSet(enum_t value) : flags(static_cast<store_t>(value)) { } @@ -29,7 +29,7 @@ // Explicit conversion operator operator enum_t() const { - return flags; + return static_cast<enum_t>(flags); } operator std::string() const @@ -56,38 +56,31 @@ return str; } - // Set all flags. - FlagSet &set() - { - flags = ~enum_t(0); - return *this; - } - // Set one or more flags. FlagSet &set(enum_t flag) { - flags = (flags | flag); + flags = (flags | static_cast<store_t>(flag)); return *this; } // Set or clear one or more flags. FlagSet &set(enum_t flag, bool val) { - flags = (val ? (flags | flag) : (flags & ~flag)); + flags = (val ? (flags | static_cast<store_t>(flag)) : (flags & ~static_cast<store_t>(flag))); return *this; } // Clear or flags. FlagSet &reset() { - flags = enum_t(0); + flags = store_t(0); return *this; } // Clear one or more flags. FlagSet &reset(enum_t flag) { - flags &= ~flag; + flags &= ~static_cast<store_t>(flag); return *this; } @@ -101,7 +94,7 @@ // Toggle one or more flags. FlagSet &flip(enum_t flag) { - flags ^= flag; + flags ^= static_cast<store_t>(flag); return *this; } @@ -114,7 +107,7 @@ // Test if one or more flags are set. Returns true if at least one of the given flags is set. bool test(enum_t flag) const { - return (flags & flag) > 0; + return (flags & static_cast<store_t>(flag)) > 0; } // Test if any flag is set. @@ -129,26 +122,26 @@ return flags == 0; } - FlagSet<enum_t> &operator = (const enum_t other) + FlagSet<enum_t, store_t> &operator = (const enum_t other) { - flags = other; + flags = static_cast<store_t>(other); return *this; } - FlagSet<enum_t> &operator &= (const enum_t other) + FlagSet<enum_t, store_t> &operator &= (const enum_t other) { - flags &= other; + flags &= static_cast<store_t>(other); return *this; } - FlagSet<enum_t> &operator |= (const enum_t other) + FlagSet<enum_t, store_t> &operator |= (const enum_t other) { - flags |= other; + flags |= static_cast<store_t>(other); return *this; } private: - enum_t flags; + store_t flags; }; Modified: trunk/OpenMPT/installer/vst_scan.iss =================================================================== --- trunk/OpenMPT/installer/vst_scan.iss 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/installer/vst_scan.iss 2012-08-05 18:38:07 UTC (rev 1341) @@ -42,6 +42,7 @@ // Try not to call a function for every file // as this could take a very long time. // . + MsgBox(FilePath, mbInformation, MB_OK); SetIniString('VST Plugins', 'Plugin' + IntToStr(VSTPluginNumber), FilePath, INIFile); VSTPluginNumber := VSTPluginNumber + 1; // <-- End action. @@ -76,7 +77,7 @@ OldVSTPluginNumber := VSTPluginNumber; // The folder to scan. - Dir := ExpandConstant('{pf}\Steinberg\VstPlugins'); + Dir := ExpandConstant('E:\VST-Plugins\'); RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\VST', 'VSTPluginsPath', Dir); // won't touch Dir if registry path does not exist // The progress page. ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'), @@ -87,6 +88,8 @@ // Make the Cancel button visible during the operation. ;WizardForm.CancelButton.Visible := TRUE; // Scan the folder. + MsgBox(Dir, mbInformation, MB_OK); + MsgBox(INIFile, mbInformation, MB_OK); ProcessDirectory (Dir, TRUE, INIFile); // Hide the progress page. try Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/mptrack/Undo.cpp 2012-08-05 18:38:07 UTC (rev 1341) @@ -211,8 +211,8 @@ // Check if an undo buffer actually exists. -bool CPatternUndo::CanUndo() -//-------------------------- +bool CPatternUndo::CanUndo() const +//-------------------------------- { return (UndoBuffer.size() > 0); } @@ -236,7 +236,7 @@ void CPatternUndo::RemoveLastUndoStep() //------------------------------------- { - if(CanUndo() == false) return; + if(!CanUndo()) return; DeleteUndoStep(UndoBuffer.size() - 1); } @@ -296,7 +296,7 @@ const ModSample &oldsample = pSndFile->GetSample(smp); // Save old sample header - MemCopy(sUndo.OldSample, oldsample); + sUndo.OldSample = oldsample; MemCopy(sUndo.szOldName, pSndFile->m_szNames[smp]); sUndo.nChangeType = changeType; Modified: trunk/OpenMPT/mptrack/Undo.h =================================================================== --- trunk/OpenMPT/mptrack/Undo.h 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/mptrack/Undo.h 2012-08-05 18:38:07 UTC (rev 1341) @@ -64,7 +64,7 @@ void ClearUndo(); bool PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, bool linkToPrevious = false, bool storeChannelInfo = false); PATTERNINDEX Undo(); - bool CanUndo(); + bool CanUndo() const; void RemoveLastUndoStep(); void SetParent(CModDoc *pModDoc) { m_pModDoc = pModDoc; } Modified: trunk/OpenMPT/soundlib/LOAD_DMF.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2012-08-05 18:38:07 UTC (rev 1341) @@ -759,7 +759,7 @@ dwMemPos += sizeof(DMFCHUNK_SAMPLEHEADER); ModSample &sample = pSndFile->GetSample(nSmp); - MemsetZero(sample); + sample.Initialize(); sample.nLength = LittleEndian(smpHead->length); sample.nSustainEnd = min(sample.nLength, LittleEndian(smpHead->loopEnd)); sample.nSustainStart = min(sample.nSustainEnd, LittleEndian(smpHead->loopStart)); @@ -778,7 +778,6 @@ sample.nVolume = 256; } sampleFlags = smpHead->flags; - sample.uFlags = 0; if((sampleFlags & DMFSMP_LOOP) != 0 && sample.nSustainEnd > sample.nSustainStart) { sample.uFlags |= CHN_SUSTAINLOOP; Modified: trunk/OpenMPT/soundlib/LOAD_DSM.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2012-08-05 18:38:07 UTC (rev 1341) @@ -223,7 +223,7 @@ StringFixer::ReadString<StringFixer::nullTerminated>(sample.filename, pSmp->filename); sample.nC5Speed = pSmp->c2spd; - sample.uFlags = (WORD)((pSmp->flags & 1) ? CHN_LOOP : 0); + sample.uFlags.set(CHN_LOOP, (pSmp->flags & 1) != 0); sample.nLength = pSmp->length; sample.nLoopStart = pSmp->loopstart; sample.nLoopEnd = pSmp->loopend; Modified: trunk/OpenMPT/soundlib/Load_gdm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_gdm.cpp 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/Load_gdm.cpp 2012-08-05 18:38:07 UTC (rev 1341) @@ -238,7 +238,7 @@ } } - Samples[smp].uFlags = 0; + Samples[smp].uFlags.reset(); if(gdmSample.flags & GDMSampleHeader::smpLoop) Samples[smp].uFlags |= CHN_LOOP; // Loop sample if(gdmSample.flags & GDMSampleHeader::smpVolume) Modified: trunk/OpenMPT/soundlib/Load_okt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_okt.cpp 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/Load_okt.cpp 2012-08-05 18:38:07 UTC (rev 1341) @@ -83,7 +83,7 @@ oktSmp.volume = oktSmp.volume; oktSmp.type = oktSmp.type; - MemsetZero(mptSmp); + mptSmp.Initialize(); StringFixer::ReadString<StringFixer::maybeNullTerminated>(pSndFile->m_szNames[nSmp], oktSmp.name); mptSmp.nC5Speed = 8287; @@ -91,7 +91,7 @@ mptSmp.nVolume = min(oktSmp.volume, 64) * 4; mptSmp.nLength = oktSmp.length & ~1; // round down // parse loops - if (oktSmp.loopLength > 2 && ((UINT)oktSmp.loopStart) + ((UINT)oktSmp.loopLength) <= mptSmp.nLength) + if (oktSmp.loopLength > 2 && static_cast<SmpLength>(oktSmp.loopStart) + static_cast<SmpLength>(oktSmp.loopLength) <= mptSmp.nLength) { mptSmp.nSustainStart = oktSmp.loopStart; mptSmp.nSustainEnd = oktSmp.loopStart + oktSmp.loopLength; Modified: trunk/OpenMPT/soundlib/Load_psm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_psm.cpp 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/Load_psm.cpp 2012-08-05 18:38:07 UTC (rev 1341) @@ -143,7 +143,7 @@ mptSmp.nLoopEnd = loopEnd; // Hmm... apparently we should add +1 for Extreme Pinball tunes here? See sample 8 in the medieval table music. mptSmp.nPan = 128; mptSmp.nVolume = (defaultVolume + 1) * 2; - mptSmp.uFlags = (flags & 0x80) ? CHN_LOOP : 0; + mptSmp.uFlags.set(CHN_LOOP, (flags & 0x80) != 0); LimitMax(mptSmp.nLoopEnd, mptSmp.nLength); LimitMax(mptSmp.nLoopStart, mptSmp.nLoopEnd); } @@ -201,7 +201,7 @@ mptSmp.nLoopEnd = loopEnd; mptSmp.nPan = 128; mptSmp.nVolume = (defaultVolume + 1) * 2; - mptSmp.uFlags = (flags & 0x80) ? CHN_LOOP : 0; + mptSmp.uFlags.set(CHN_LOOP, (flags & 0x80) != 0); LimitMax(mptSmp.nLoopEnd, mptSmp.nLength); LimitMax(mptSmp.nLoopStart, mptSmp.nLoopEnd); } @@ -1049,7 +1049,7 @@ mptSmp.nVolume = volume << 2; mptSmp.nGlobalVol = 256; - mptSmp.uFlags = 0; + mptSmp.uFlags.reset(); if(flags & PSM16SampleHeader::smp16Bit) { mptSmp.uFlags |= CHN_16BIT; Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2012-08-05 18:38:07 UTC (rev 1341) @@ -105,13 +105,13 @@ command = '\\'; break; case CMD_XFINEPORTAUPDOWN: - if(param & 0x0F) switch(param & 0xF0) + switch(param & 0xF0) { case 0x10: command = 'F'; param = (param & 0x0F) | 0xE0; break; case 0x20: command = 'E'; param = (param & 0x0F) | 0xE0; break; case 0x90: command = 'S'; break; default: command = 0; - } else command = 0; + } break; case CMD_MODCMDEX: { @@ -300,13 +300,13 @@ mptSmp.nLength = length; mptSmp.nLoopStart = min(loopStart, mptSmp.nLength - 1); mptSmp.nLoopEnd = min(loopEnd, mptSmp.nLength); - mptSmp.uFlags = (flags & smpLoop) ? CHN_LOOP : 0; + mptSmp.uFlags.set(CHN_LOOP, (flags & smpLoop) != 0); } if(mptSmp.nLoopEnd < 2 || mptSmp.nLoopStart >= mptSmp.nLoopEnd || mptSmp.nLoopEnd - mptSmp.nLoopStart < 1) { mptSmp.nLoopStart = mptSmp.nLoopEnd = 0; - mptSmp.uFlags = 0; + mptSmp.uFlags.reset(); } // Volume / Panning @@ -369,19 +369,18 @@ // Retrieve the internal sample format flags for this sample. SampleIO GetSampleFormat(bool signedSamples) const { - SampleIO format( - (flags & S3MSampleHeader::smp16Bit) ? SampleIO::_16bit : SampleIO::_8bit, - (flags & S3MSampleHeader::smpStereo) ? SampleIO::stereoSplit : SampleIO::mono, - SampleIO::littleEndian, - signedSamples ? SampleIO::signedPCM : SampleIO::unsignedPCM); - - // MODPlugin :( - if(!(flags & S3MSampleHeader::smp16Bit) && pack == S3MSampleHeader::pADPCM) + if(pack == S3MSampleHeader::pADPCM && !(flags & S3MSampleHeader::smp16Bit) && !(flags & S3MSampleHeader::smpStereo)) { - format |= SampleIO::ADPCM; + // MODPlugin :( + return SampleIO(SampleIO::_8bit, SampleIO::mono, SampleIO::littleEndian, SampleIO::ADPCM); + } else + { + return SampleIO( + (flags & S3MSampleHeader::smp16Bit) ? SampleIO::_16bit : SampleIO::_8bit, + (flags & S3MSampleHeader::smpStereo) ? SampleIO::stereoSplit : SampleIO::mono, + SampleIO::littleEndian, + signedSamples ? SampleIO::signedPCM : SampleIO::unsignedPCM); } - - return format; } }; Modified: trunk/OpenMPT/soundlib/ModSample.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSample.cpp 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/ModSample.cpp 2012-08-05 18:38:07 UTC (rev 1341) @@ -107,10 +107,10 @@ nVibSweep = 0; nVibDepth = 0; nVibRate = 0; - uFlags &= ~(CHN_PANNING | CHN_SUSTAINLOOP | CHN_LOOP); + uFlags.reset(CHN_PANNING | CHN_SUSTAINLOOP | CHN_LOOP); if(type == MOD_TYPE_XM) { - uFlags |= CHN_PANNING; + uFlags.set(CHN_PANNING); } filename[0] = '\0'; } Modified: trunk/OpenMPT/soundlib/ModSample.h =================================================================== --- trunk/OpenMPT/soundlib/ModSample.h 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/ModSample.h 2012-08-05 18:38:07 UTC (rev 1341) @@ -17,20 +17,26 @@ SmpLength nLoopStart, nLoopEnd; // Dito SmpLength nSustainStart, nSustainEnd; // Dito LPSTR pSample; // Pointer to sample data - uint32 nC5Speed; // Frequency of middle c, in Hz (for IT/S3M/MPTM) + uint32 nC5Speed; // Frequency of middle-C, in Hz (for IT/S3M/MPTM) uint16 nPan; // Default sample panning (if pan flag is set) uint16 nVolume; // Default volume uint16 nGlobalVol; // Global volume (sample volume is multiplied by this) - uint16 uFlags; // Sample flags + FlagSet<ChannelFlags, uint16> uFlags; // Sample flags int8 RelativeTone; // Relative note to middle c (for MOD/XM) int8 nFineTune; // Finetune period (for MOD/XM) uint8 nVibType; // Auto vibrato type uint8 nVibSweep; // Auto vibrato sweep (i.e. how long it takes until the vibrato effect reaches its full strength) uint8 nVibDepth; // Auto vibrato depth uint8 nVibRate; // Auto vibrato rate (speed) - //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 name[MAX_SAMPLENAME]; // Maybe it would be nicer to have sample names here, but that would require some refactoring. Also, the current structure size is 64 Bytes - would adding the sample name here slow down the mixer (cache misses)? char filename [MAX_SAMPLEFILENAME]; + ModSample(MODTYPE type = MOD_TYPE_NONE) + { + pSample = nullptr; + Initialize(type); + } + // Return the size of one (elementary) sample in bytes. uint8 GetElementarySampleSize() const { return (uFlags & CHN_16BIT) ? 2 : 1; } Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2012-08-05 18:38:07 UTC (rev 1341) @@ -65,19 +65,26 @@ if (((psig[0] == LittleEndian(0x46464952)) && (psig[2] == LittleEndian(0x45564157))) // RIFF....WAVE signature || ((psig[0] == LittleEndian(0x5453494C)) && (psig[2] == LittleEndian(0x65766177))) // LIST....wave || (psig[76/4] == LittleEndian(0x53524353)) // S3I signature - || ((psig[0] == BigEndian(0x464F524D)) && (psig[2] == BigEndian(0x46464941))) // AIFF signature - || ((psig[0] == BigEndian(0x464F524D)) && (psig[2] == BigEndian(0x41494643))) // AIFF-C signature + || ((psig[0] == BigEndian(0x464F524D)) && (psig[2] == LittleEndian(0x46464941))) // AIFF signature + || ((psig[0] == BigEndian(0x464F524D)) && (psig[2] == LittleEndian(0x43464941))) // AIFF-C signature || ((psig[0] == BigEndian(0x464F524D)) && (psig[2] == LittleEndian(0x58565338))) // 8SVX signature || (psig[0] == LittleEndian(ITSample::magic)) // ITS signature ) { + // Scanning free sample + SAMPLEINDEX nSample = GetNextFreeSample(nInstr); + if(nSample == SAMPLEINDEX_INVALID) + { + return false; + } + // Loading Instrument ModInstrument *pIns; try { - pIns = new ModInstrument(); + pIns = new ModInstrument(nSample); } catch(MPTMemoryException) { return false; @@ -86,19 +93,17 @@ DestroyInstrument(nInstr, deleteAssociatedSamples); Instruments[nInstr] = pIns; - // Scanning free sample - SAMPLEINDEX nSample = GetNextFreeSample(nInstr); - if(nSample == SAMPLEINDEX_INVALID) + ReadSampleFromFile(nSample, lpMemFile, dwFileLength); + + if(nSample > GetNumSamples()) { - return false; - } else if(nSample > GetNumSamples()) - { m_nSamples = nSample; } + if(nInstr > GetNumInstruments()) + { + m_nInstruments = nInstr; + } - Instruments[nInstr]->AssignSample(nSample); - - ReadSampleFromFile(nSample, lpMemFile, dwFileLength); return true; } return false; @@ -306,6 +311,7 @@ if(!wavFile.IsValid() || wavFile.GetNumChannels() == 0 || wavFile.GetNumChannels() > 2 + || wavFile.GetBitsPerSample() == 0 || wavFile.GetBitsPerSample() > 32 || (wavFile.GetSampleFormat() != WAVFormatChunk::fmtPCM && wavFile.GetSampleFormat() != WAVFormatChunk::fmtFloat && wavFile.GetSampleFormat() != WAVFormatChunk::fmtIMA_ADPCM)) { @@ -336,21 +342,14 @@ } else { // PCM / Float + static const SampleIO::Bitdepth bitDepth[] = { SampleIO::_8bit, SampleIO::_16bit, SampleIO::_24bit, SampleIO::_32bit }; + SampleIO sampleIO( - SampleIO::_8bit, + bitDepth[(wavFile.GetBitsPerSample() - 1) / 8], (wavFile.GetNumChannels() > 1) ? SampleIO::stereoInterleaved : SampleIO::mono, SampleIO::littleEndian, (wavFile.GetBitsPerSample() > 8) ? SampleIO::signedPCM : SampleIO::unsignedPCM); - if(wavFile.GetBitsPerSample() <= 8) - sampleIO |= SampleIO::_8bit; - else if(wavFile.GetBitsPerSample() <= 16) - sampleIO |= SampleIO::_16bit; - else if(wavFile.GetBitsPerSample() <= 24) - sampleIO |= SampleIO::_24bit; - else if(wavFile.GetBitsPerSample() <= 32) - sampleIO |= SampleIO::_32bit; - if(wavFile.GetSampleFormat() == WAVFormatChunk::fmtFloat) { sampleIO |= SampleIO::floatPCM; @@ -1346,22 +1345,25 @@ // Is this a proper sample? if(sampleInfo.numSampleFrames == 0 - || sampleInfo.numChannels < 1 || sampleInfo.numChannels > 2 - || sampleInfo.sampleSize < 1 || sampleInfo.sampleSize > 32) + || sampleInfo.numChannels == 0 || sampleInfo.numChannels > 2 + || sampleInfo.sampleSize == 0 || sampleInfo.sampleSize > 32) { return false; } // Read compression type in AIFF-C files. uint8 compression[4] = { 'N', 'O', 'N', 'E' }; - bool littleEndian = false; + SampleIO::Endianness endian = SampleIO::bigEndian; if(fileHeader.type == AIFFHeader::idAIFC) { if(!commChunk.ReadArray(compression)) { return false; } - littleEndian = !memcmp(compression, "twos", 4); + if(!memcmp(compression, "twos", 4)) + { + endian = SampleIO::littleEndian; + } } // Read SSND chunk @@ -1373,34 +1375,13 @@ return false; } - SampleIO sampleIO(SampleIO::_8bit, SampleIO::mono, SampleIO::bigEndian, SampleIO::signedPCM); - if(littleEndian) - { - sampleIO |= SampleIO::littleEndian; - } + static const SampleIO::Bitdepth bitDepth[] = { SampleIO::_8bit, SampleIO::_16bit, SampleIO::_24bit, SampleIO::_32bit }; - if(sampleInfo.numChannels == 2) - { - sampleIO |= SampleIO::stereoInterleaved; - } + SampleIO sampleIO(bitDepth[(sampleInfo.sampleSize - 1) / 8], + (sampleInfo.numChannels == 2) ? SampleIO::stereoInterleaved : SampleIO::mono, + endian, + SampleIO::signedPCM); - if(sampleInfo.sampleSize <= 8) - { - sampleIO |= SampleIO::_8bit; - } else if(sampleInfo.sampleSize <= 16) - { - sampleIO |= SampleIO::_16bit; - } else if(sampleInfo.sampleSize <= 24) - { - sampleIO |= SampleIO::_24bit; - } else if(sampleInfo.sampleSize <= 32) - { - sampleIO |= SampleIO::_32bit; - } else - { - return false; - } - if(!memcmp(compression, "fl32", 4) || !memcmp(compression, "FL32", 4)) { sampleIO |= SampleIO::floatPCM; @@ -1437,12 +1418,14 @@ if(instrHeader.sustainLoop.playMode != AIFFInstrumentLoop::noLoop) { - mptSample.uFlags |= CHN_SUSTAINLOOP | (instrHeader.sustainLoop.playMode == AIFFInstrumentLoop::loopBidi ? CHN_PINGPONGSUSTAIN : 0); + mptSample.uFlags.set(CHN_SUSTAINLOOP); + mptSample.uFlags.set(CHN_PINGPONGSUSTAIN, instrHeader.sustainLoop.playMode == AIFFInstrumentLoop::loopBidi); } if(instrHeader.releaseLoop.playMode != AIFFInstrumentLoop::noLoop) { - mptSample.uFlags |= CHN_LOOP | (instrHeader.releaseLoop.playMode == AIFFInstrumentLoop::loopBidi ? CHN_PINGPONGLOOP : 0); + mptSample.uFlags.set(CHN_LOOP); + mptSample.uFlags.set(CHN_PINGPONGLOOP, instrHeader.releaseLoop.playMode == AIFFInstrumentLoop::loopBidi); } // Read markers @@ -1471,12 +1454,12 @@ if(mptSample.nSustainStart >= mptSample.nSustainEnd) { mptSample.nSustainStart = mptSample.nSustainEnd = 0; - mptSample.uFlags &= ~CHN_SUSTAINLOOP; + mptSample.uFlags.reset(CHN_SUSTAINLOOP); } if(mptSample.nLoopStart >= mptSample.nLoopEnd) { mptSample.nLoopStart = mptSample.nLoopEnd = 0; - mptSample.uFlags &= ~CHN_LOOP; + mptSample.uFlags.reset(CHN_LOOP); } } @@ -1734,7 +1717,7 @@ void ReadExtendedInstrumentProperties(ModInstrument* pIns, const LPCBYTE pDataStart, const size_t nMemLength) //----------------------------------------------------------------------------------------------------------- { - if(pIns == 0 || pDataStart == 0 || nMemLength < 4) + if(pIns == nullptr || pDataStart == nullptr || nMemLength < 4) return; LPCBYTE pData = pDataStart; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2012-08-05 18:38:07 UTC (rev 1341) @@ -465,7 +465,6 @@ // -! NEW_FEATURE#0023 MemsetZero(ChnMix); - MemsetZero(Samples); MemsetZero(Instruments); MemsetZero(m_szNames); MemsetZero(m_MixPlugins); @@ -522,7 +521,6 @@ m_nMaxOrderPosition = 0; m_lpszSongComments = nullptr; m_nMixLevels = mixLevels_compatible; // Will be overridden if appropriate. - MemsetZero(Samples); MemsetZero(ChnMix); MemsetZero(Instruments); MemsetZero(m_szNames); @@ -1582,7 +1580,7 @@ if (!from || from >= MAX_SAMPLES || !to || to >= MAX_SAMPLES) return false; if (/*!Ins[from].pSample ||*/ Samples[to].pSample) return true; - MemCopy(Samples[to], Samples[from]); + Samples[to] = Samples[from]; Samples[from].pSample = nullptr; Samples[from].nLength = 0; Modified: trunk/OpenMPT/soundlib/WAVTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/WAVTools.cpp 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/WAVTools.cpp 2012-08-05 18:38:07 UTC (rev 1341) @@ -12,6 +12,10 @@ #include "WAVTools.h" +/////////////////////////////////////////////////////////// +// WAV Reading + + WAVReader::WAVReader(FileReader &inputFile) : file(inputFile) //----------------------------------------------------------- { @@ -69,10 +73,10 @@ // Read sample data sampleData = chunks.GetChunk(RIFFChunk::iddata); - if(!sampleData.IsValid() && chunks.ChunkExists(RIFFChunk::idpcm_)) + if(!sampleData.IsValid()) { // The old IMA ADPCM loader code looked for the "pcm " chunk instead of the "data" chunk... - // Dunno why, but we will just look for both. + // Dunno why (Windows XP's audio recorder saves IMA ADPCM files with a "data" chunk), but we will just look for both. sampleData = chunks.GetChunk(RIFFChunk::idpcm_); } @@ -86,19 +90,7 @@ } // Read sample loop points - FileReader smplChunk(chunks.GetChunk(RIFFChunk::idsmpl)); - WAVSampleInfoChunk sampleInfo; - if(smplChunk.ReadConvertEndianness(sampleInfo)) - { - for(size_t i = 0; i < sampleInfo.numLoops; i++) - { - WAVSampleLoop loopData; - if(smplChunk.ReadConvertEndianness(loopData)) - { - sampleLoops.push_back(loopData); - } - } - } + smplChunk = chunks.GetChunk(RIFFChunk::idsmpl); // Read text chunks ChunkReader listChunk = chunks.GetChunk(RIFFChunk::idLIST); @@ -131,27 +123,31 @@ // Read software name const bool isOldMPT = infoChunk.GetChunk(RIFFChunk::idISFT).ReadMagic("Modplug Tracker"); - sample.uFlags &= ~(CHN_LOOP | CHN_PINGPONGLOOP | CHN_SUSTAINLOOP | CHN_PINGPONGSUSTAIN); + sample.uFlags.reset(CHN_LOOP | CHN_PINGPONGLOOP | CHN_SUSTAINLOOP | CHN_PINGPONGSUSTAIN); // Convert loops - if(!sampleLoops.empty()) + WAVSampleInfoChunk sampleInfo; + smplChunk.Rewind(); + if(smplChunk.ReadConvertEndianness(sampleInfo)) { - size_t normalLoopIndex = 0; - if(sampleLoops.size() > 1) + WAVSampleLoop loopData; + if(sampleInfo.numLoops > 1 && smplChunk.ReadConvertEndianness(loopData)) { - sampleLoops[0].ApplyToSample(sample.nSustainStart, sample.nSustainEnd, sample.nLength, sample.uFlags, CHN_SUSTAINLOOP, CHN_PINGPONGSUSTAIN, isOldMPT); - normalLoopIndex = 1; + // First loop: Sustain loop + loopData.ApplyToSample(sample.nSustainStart, sample.nSustainEnd, sample.nLength, sample.uFlags, CHN_SUSTAINLOOP, CHN_PINGPONGSUSTAIN, isOldMPT); } - sampleLoops[normalLoopIndex].ApplyToSample(sample.nLoopStart, sample.nLoopEnd, sample.nLength, sample.uFlags, CHN_LOOP, CHN_PINGPONGLOOP, isOldMPT); + // First loop (if only one loop is present) or second loop (if more than one loop is present): Normal sample loop + if(smplChunk.ReadConvertEndianness(loopData)) + { + loopData.ApplyToSample(sample.nLoopStart, sample.nLoopEnd, sample.nLength, sample.uFlags, CHN_LOOP, CHN_PINGPONGLOOP, isOldMPT); + } } + // Read MPT extra info WAVExtraChunk mptInfo; xtraChunk.Rewind(); if(xtraChunk.ReadConvertEndianness(mptInfo)) { - if(mptInfo.flags & WAVExtraChunk::bidiLoop) sample.uFlags |= CHN_PINGPONGLOOP; - if(mptInfo.flags & WAVExtraChunk::sustainLoop) sample.uFlags |= CHN_SUSTAINLOOP; - if(mptInfo.flags & WAVExtraChunk::sustainBidi) sample.uFlags |= CHN_PINGPONGSUSTAIN; if(mptInfo.flags & WAVExtraChunk::setPanning) sample.uFlags |= CHN_PANNING; sample.nPan = Util::Min(mptInfo.defaultPan, uint16(256)); @@ -172,8 +168,8 @@ } -void WAVSampleLoop::ApplyToSample(SmpLength &start, SmpLength &end, uint32 sampleLength, uint16 &flags, uint16 enableFlag, uint16 bidiFlag, bool mptLoopFix) const -//---------------------------------------------------------------------------------------------------------------------------------------------------------------- +void WAVSampleLoop::ApplyToSample(SmpLength &start, SmpLength &end, uint32 sampleLength, FlagSet<ChannelFlags, uint16> &flags, ChannelFlags enableFlag, ChannelFlags bidiFlag, bool mptLoopFix) const +//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- { start = Util::Min(static_cast<SmpLength>(loopStart), sampleLength); end = Clamp(static_cast<SmpLength>(loopEnd), start, sampleLength); @@ -183,9 +179,9 @@ end++; } - flags |= enableFlag; + flags.set(enableFlag); if(loopType == loopBidi) { - flags |= bidiFlag; + flags.set(bidiFlag); } } Modified: trunk/OpenMPT/soundlib/WAVTools.h =================================================================== --- trunk/OpenMPT/soundlib/WAVTools.h 2012-08-05 18:32:31 UTC (rev 1340) +++ trunk/OpenMPT/soundlib/WAVTools.h 2012-08-05 18:38:07 UTC (rev 1341) @@ -73,11 +73,18 @@ return SwapBytesLE(l); } - ChunkIdentifiers GetID() const + id_type GetID() const { uint32 i = id; - return static_cast<ChunkIdentifiers>(SwapBytesLE(i)); + return static_cast<id_type>(SwapBytesLE(i)); } + + // Convert all multi-byte numeric values to current platform's endianness or vice versa. + void ConvertEndianness() + { + SwapBytesLE(id); + SwapBytesLE(length); + } }; @@ -120,6 +127,7 @@ uint16 validBitsPerSample; uint32 channelMask; uint16 subFormat; + uint8 guid[14]; // Convert all multi-byte numeric values to current platform's endianness or vice versa. void ConvertEndianness() @@ -138,7 +146,7 @@ uint32 manufacturer; uint32 product; uint32 samplePeriod; // 1000000000 / sampleRate - uint32 baseNote; // 3Ch = C-4 -> 60 + RelativeTone + uint32 baseNote; // MIDI base note of sample uint32 pitchFraction; uint32 SMPTEFormat; uint32 SMPTEOffset; @@ -190,7 +198,25 @@ SwapBytesLE(playCount); } - void ApplyToSample(SmpLength &start, SmpLength &end, uint32 sampleLength, uint16 &flags, uint16 enableFlag, uint16 bidiFlag, bool mptLoopFix) const; + void ApplyToSample(SmpLength &start, SmpLength &end, uint32 sampleLength, FlagSet<ChannelFlags, uint16> &flags, ChannelFlags enableFlag, ChannelFlags bidiFlag, bool mptLoopFix) const; + + // Set up a loop. + void ConvertToWAV(SmpLength start, SmpLength end, bool bidi) + { + identifier = 0; + loopType = bidi ? loopBidi : loopForward; + loopStart = start; + // Loop ends are *inclusive* in the RIFF standard, while they're *exclusive* in OpenMPT. + if(end> start) + { + loopEnd = end - 1; + } else + { + loopEnd = start; + } + fraction = 0; + playCount = 0; + } }; @@ -199,9 +225,6 @@ { enum Flags { - bidiLoop = 0x04, - sustainLoop = 0x08, - sustainBidi = 0x10, setPanning = 0x20, }; @@ -226,20 +249,44 @@ }; +// Sample cue point structure for the "cue " chunk +struct WAVCuePoint +{ + uint32 id; // Unique identification value + uint32 position; // Play order position + uint32 riffChunkID; // RIFF ID of corresponding data chunk + uint32 chunkStart; // Byte Offset of Data Chunk + uint32 blockStart; // Byte Offset to sample of First Channel + uint32 offset; // Byte Offset to sample byte of First Channel + + // Convert all multi-byte numeric values to current platform's endianness or vice versa. + void ConvertEndianness() + { + SwapBytesLE(id); + SwapBytesLE(position); + SwapBytesLE(riffChunkID); + SwapBytesLE(chunkStart); + SwapBytesLE(blockStart); + SwapBytesLE(offset); + } +}; + + #pragma pack(pop) +//============= class WAVReader +//============= { protected: ChunkReader file; - FileReader sampleData, xtraChunk, wsmpChunk; + FileReader sampleData, smplChunk, xtraChunk, wsmpChunk; ChunkReader::ChunkList<RIFFChunk> infoChunk; size_t sampleLength; bool isDLS; WAVFormatChunk formatInfo; - std::vector<WAVSampleLoop> sampleLoops; public: WAVReader(FileReader &inputFile); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-08-26 23:36:02
|
Revision: 1345 http://modplug.svn.sourceforge.net/modplug/?rev=1345&view=rev Author: saga-games Date: 2012-08-26 23:35:54 +0000 (Sun, 26 Aug 2012) Log Message: ----------- [Fix] IT Compatibility: Revision 1344 broke note-off + portamento handling with Compatible Gxx enabled. [Mod] OpenMPT: Version is now 1.20.02.07 Revision Links: -------------- http://modplug.svn.sourceforge.net/modplug/?rev=1344&view=rev Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-08-20 23:42:49 UTC (rev 1344) +++ trunk/OpenMPT/mptrack/version.h 2012-08-26 23:35:54 UTC (rev 1345) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 02 -#define VER_MINORMINOR 06 +#define VER_MINORMINOR 07 //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 2012-08-20 23:42:49 UTC (rev 1344) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-08-26 23:35:54 UTC (rev 1345) @@ -1107,9 +1107,9 @@ } } - // IT compatibility: Don't reset key-off flag on porta notes - // Test case: Off-Porta.it - if(IsCompatibleMode(TRK_IMPULSETRACKER) && bPorta) + // IT compatibility: Don't reset key-off flag on porta notes unless Compat Gxx is enabled + // Test case: Off-Porta.it, Off-Porta-CompatGxx.it + if(IsCompatibleMode(TRK_IMPULSETRACKER) && bPorta && !m_SongFlags[SONG_ITCOMPATGXX]) pChn->dwFlags.reset(CHN_EXTRALOUD); else pChn->dwFlags.reset(CHN_EXTRALOUD | CHN_KEYOFF); @@ -1157,13 +1157,13 @@ if (pIns->nVolSwing) { const double delta = 2 * (((double) rand()) / RAND_MAX) - 1; - pChn->nVolSwing = (LONG)std::floor(delta * (IsCompatibleMode(TRK_IMPULSETRACKER) ? pChn->nInsVol : ((pChn->nVolume + 1) / 2)) * pIns->nVolSwing / 100.0); + pChn->nVolSwing = static_cast<int32>(std::floor(delta * (IsCompatibleMode(TRK_IMPULSETRACKER) ? pChn->nInsVol : ((pChn->nVolume + 1) / 2)) * pIns->nVolSwing / 100.0)); } // Pan Swing if (pIns->nPanSwing) { const double delta = 2 * (((double) rand()) / RAND_MAX) - 1; - pChn->nPanSwing = (LONG)std::floor(delta * (IsCompatibleMode(TRK_IMPULSETRACKER) ? 4 : 1) * pIns->nPanSwing); + pChn->nPanSwing = static_cast<int32>(std::floor(delta * (IsCompatibleMode(TRK_IMPULSETRACKER) ? 4 : 1) * pIns->nPanSwing)); if(!IsCompatibleMode(TRK_IMPULSETRACKER)) { pChn->nRestorePanOnNewNote = pChn->nPan + 1; @@ -1172,15 +1172,15 @@ // Cutoff Swing if (pIns->nCutSwing) { - int d = ((LONG)pIns->nCutSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128; - pChn->nCutSwing = (signed short)((d * pChn->nCutOff + 1) / 128); + int32 d = ((int32)pIns->nCutSwing * (int32)((rand() & 0xFF) - 0x7F)) / 128; + pChn->nCutSwing = (int16)((d * pChn->nCutOff + 1) / 128); pChn->nRestoreCutoffOnNewNote = pChn->nCutOff + 1; } // Resonance Swing if (pIns->nResSwing) { - int d = ((LONG)pIns->nResSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128; - pChn->nResSwing = (signed short)((d * pChn->nResonance + 1) / 128); + int32 d = ((int32)pIns->nResSwing * (int32)((rand() & 0xFF) - 0x7F)) / 128; + pChn->nResSwing = (int16)((d * pChn->nResonance + 1) / 128); pChn->nRestoreResonanceOnNewNote = pChn->nResonance + 1; } } @@ -2902,7 +2902,7 @@ { if (pChn->nPeriod < pChn->nPortamentoDest) { - LONG delta = (int)pChn->nPortamentoSlide; + int32 delta = pChn->nPortamentoSlide; if(m_SongFlags[SONG_LINEARSLIDES] && !(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2))) { UINT n = pChn->nPortamentoSlide >> 2; @@ -2917,7 +2917,7 @@ } else if (pChn->nPeriod > pChn->nPortamentoDest) { - LONG delta = - (int)pChn->nPortamentoSlide; + int32 delta = -pChn->nPortamentoSlide; if(m_SongFlags[SONG_LINEARSLIDES] && !(GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) { UINT n = pChn->nPortamentoSlide >> 2; @@ -3043,7 +3043,6 @@ void CSoundFile::PanningSlide(ModChannel *pChn, UINT param) //--------------------------------------------------------- { - LONG nPanSlide = 0; if (param) pChn->nOldPanSlide = param; else @@ -3061,6 +3060,8 @@ } } + int32 nPanSlide = 0; + if (GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT|MOD_TYPE_STM)) { if (((param & 0x0F) == 0x0F) && (param & 0xF0)) @@ -4032,7 +4033,7 @@ pChn->dwFlags.set(CHN_FASTVOLRAMP); } UINT nNote = pChn->nNewNote; - LONG nOldPeriod = pChn->nPeriod; + int32 nOldPeriod = pChn->nPeriod; if ((nNote) && (nNote <= NOTE_MAX) && (pChn->nLength)) CheckNNA(nChn, 0, nNote, TRUE); bool bResetEnv = false; if (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) @@ -4080,7 +4081,7 @@ if (!pChn->nPeriod) return; if(m_SongFlags[SONG_LINEARSLIDES] && !(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2))) { - LONG nOldPeriod = pChn->nPeriod; + int32 nOldPeriod = pChn->nPeriod; if (nFreqSlide < 0) { UINT n = (- nFreqSlide) >> 2; @@ -4518,7 +4519,7 @@ //----------------------------------------------------------------------------------- { if (!period) return 0; - if (m_nType & (MOD_TYPE_MED|MOD_TYPE_MOD|MOD_TYPE_MTM|MOD_TYPE_669|MOD_TYPE_OKT|MOD_TYPE_AMF0)) + if (GetType() & (MOD_TYPE_MED|MOD_TYPE_MOD|MOD_TYPE_MTM|MOD_TYPE_669|MOD_TYPE_OKT|MOD_TYPE_AMF0)) { return (3546895L*4) / period; } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-09-11 14:42:07
|
Revision: 1349 http://modplug.svn.sourceforge.net/modplug/?rev=1349&view=rev Author: saga-games Date: 2012-09-11 14:41:55 +0000 (Tue, 11 Sep 2012) Log Message: ----------- [Fix] Pattern Editor: Order list selection rectangle colour was a bit off in some cases with the latest colour improvements [Imp] Instrument Editor: Sustain / Loop points cannot be enabled anymore if there are no evelope points. [Ref] Other small changes Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/soundlib/Load_med.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/RowVisitor.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-09-05 21:24:20 UTC (rev 1348) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-09-11 14:41:55 UTC (rev 1349) @@ -820,6 +820,7 @@ // Scrolling the shown orders(the showns rectangles)? while (rect.left < rcClient.right) { + dc.SetTextColor(colorText); bool bHighLight = ((bFocus) && (nIndex >= selection.firstOrd && nIndex <= selection.lastOrd)); const PATTERNINDEX nPat = (nIndex < pSndFile->Order.GetLength()) ? pSndFile->Order[nIndex] : PATTERNINDEX_INVALID; if ((rect.right = rect.left + m_cxFont) > rcClient.right) rect.right = rcClient.right; Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2012-09-05 21:24:20 UTC (rev 1348) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2012-09-11 14:41:55 UTC (rev 1349) @@ -718,6 +718,7 @@ { if(GetModuleFileName(NULL, m_szExePath, CountOf(m_szExePath))) { + StringFixer::SetNullTerminator(m_szExePath); TCHAR szDrive[_MAX_DRIVE] = "", szDir[_MAX_PATH] = ""; _splitpath(m_szExePath, szDrive, szDir, NULL, NULL); strcpy(m_szExePath, szDrive); @@ -1576,7 +1577,11 @@ m_bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MPTRACK)); wsprintf(s, "Build Date: %s", gszBuildDate); SetDlgItemText(IDC_EDIT2, s); - SetDlgItemText(IDC_EDIT3, CString("OpenMPT ") + MptVersion::str); + SetDlgItemText(IDC_EDIT3, CString("OpenMPT ") + MptVersion::str +#if (MPT_VERSION_NUMERIC & 0xFF) != 0 + + CString(" (Test Build)") +#endif + ); m_heContact.SetWindowText( "Contact / Discussion:\r\n" Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2012-09-05 21:24:20 UTC (rev 1348) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2012-09-11 14:41:55 UTC (rev 1349) @@ -531,7 +531,7 @@ //--------------------------------------------------------------------- { InstrumentEnvelope *envelope = GetEnvelopePtr(); - if(envelope == nullptr) return false; + if(envelope == nullptr || envelope->nNodes == 0) return false; bool modified = envelope->dwFlags[flag] != enable; envelope->dwFlags.set(flag, enable); Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2012-09-05 21:24:20 UTC (rev 1348) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2012-09-11 14:41:55 UTC (rev 1349) @@ -1068,7 +1068,7 @@ _tcsftime(szDate, CountOf(szDate), _T("%d %b %Y, %H:%M:%S"), &hist->loadDate); // Time + stuff uint32 duration = (uint32)((double)(hist->openTime) / HISTORY_TIMER_PRECISION); - s.AppendFormat(_T("Loaded %s, open in the editor for %luh %02lum %02lus\r\n"), + s.AppendFormat(_T("Loaded %s, open for %luh %02lum %02lus\r\n"), szDate, duration / 3600, (duration / 60) % 60, duration % 60); } if(num == 0) Modified: trunk/OpenMPT/soundlib/Load_med.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_med.cpp 2012-09-05 21:24:20 UTC (rev 1348) +++ trunk/OpenMPT/soundlib/Load_med.cpp 2012-09-11 14:41:55 UTC (rev 1349) @@ -672,7 +672,7 @@ { MMD2PLAYSEQ *pmps = (MMD2PLAYSEQ *)(lpStream + pseq); if (!m_szNames[0][0]) memcpy(m_szNames[0], pmps->name, 31); - UINT n = BigEndianW(pmps->length); + uint16 n = BigEndianW(pmps->length); if (pseq+n <= dwMemLength) { Order.resize(nOrders + n); @@ -775,7 +775,7 @@ #ifdef MED_LOG Log("SampleData %d: stype=0x%02X len=%d\n", iSmp, BigEndianW(psdh->type), len); #endif - if ((len > MAX_SAMPLE_LENGTH) || (dwPos + len + 6 > dwMemLength)) len = 0; + if(dwPos + len + 6 > dwMemLength) len = 0; UINT stype = BigEndianW(psdh->type); LPSTR psdata = (LPSTR)(lpStream + dwPos + 6); Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2012-09-05 21:24:20 UTC (rev 1348) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2012-09-11 14:41:55 UTC (rev 1349) @@ -11,7 +11,9 @@ #include "stdafx.h" #include "sndfile.h" #include "ModSequence.h" +#ifdef MODPLUG_TRACKER #include "../mptrack/moddoc.h" +#endif // MODPLUG_TRACKER #include "../mptrack/version.h" #include "../mptrack/serialization_utils.h" #include "../common/Reporting.h" Modified: trunk/OpenMPT/soundlib/RowVisitor.h =================================================================== --- trunk/OpenMPT/soundlib/RowVisitor.h 2012-09-05 21:24:20 UTC (rev 1348) +++ trunk/OpenMPT/soundlib/RowVisitor.h 2012-09-11 14:41:55 UTC (rev 1349) @@ -55,7 +55,7 @@ // Returns whether a given row has been visited yet. // If autoSet is true, the queried row will automatically be marked as visited. // Use this parameter instead of consecutive IsRowVisited / SetRowVisited calls. - bool IsVisited(ORDERINDEX nOrd, ROWINDEX nRow, bool autoSet); + bool IsVisited(ORDERINDEX order, ROWINDEX row, bool autoSet); // Get the needed vector size for a given pattern. size_t GetVisitedRowsVectorSize(PATTERNINDEX pattern) const; @@ -77,6 +77,6 @@ // (Un)sets a given row as visited. // order, row - which row should be (un)set // If visited is true, the row will be set as visited. - void SetVisited(ORDERINDEX nOrd, ROWINDEX nRow, bool visited); + void SetVisited(ORDERINDEX order, ROWINDEX row, bool visited); }; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2012-09-05 21:24:20 UTC (rev 1348) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2012-09-11 14:41:55 UTC (rev 1349) @@ -11,13 +11,7 @@ #include "stdafx.h" -// -> CODE#0022 -// -> DESC="alternative BPM/Speed interpretation method" -#include "../mptrack/mptrack.h" -#include "../mptrack/moddoc.h" -#include "../mptrack/MainFrm.h" -#include "../common/misc_util.h" -// -! NEW_FEATURE#0022 +#include "../mptrack/MainFrm.h" // TODO: Mix Settings shouldn't require CMainFrame #include "sndfile.h" #include "MIDIEvents.h" #include "tuning.h" @@ -879,7 +873,7 @@ pChn->nLeftVol = pChn->nNewLeftVol; pChn->nRightVol = pChn->nNewRightVol; pChn->dwFlags.reset(CHN_PORTAMENTO | CHN_VIBRATO | CHN_TREMOLO | CHN_PANBRELLO); - pChn->nCommand = 0; + pChn->nCommand = CMD_NONE; pChn->m_plugParamValueStep = 0; } @@ -1330,7 +1324,7 @@ { // Limit to last envelope point start = end = insEnv.Ticks[insEnv.nNodes - 1]; - if (position > end) + if(position > end) { // Env of envelope endReached = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-09-11 15:09:10
|
Revision: 1350 http://modplug.svn.sourceforge.net/modplug/?rev=1350&view=rev Author: saga-games Date: 2012-09-11 15:08:58 +0000 (Tue, 11 Sep 2012) Log Message: ----------- [Imp] DMF Loader: Improved effect conversion (effect merging, effect memory) [Fix] 8SVX Loader: Loops are now also loaded properly if the loop end is precisely at the sample end. [Mod] OpenMPT: Version is now 1.20.02.09 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/LOAD_AMF.CPP trunk/OpenMPT/soundlib/LOAD_DMF.CPP trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/modcommand.cpp Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-09-11 14:41:55 UTC (rev 1349) +++ trunk/OpenMPT/mptrack/version.h 2012-09-11 15:08:58 UTC (rev 1350) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 02 -#define VER_MINORMINOR 08 +#define VER_MINORMINOR 09 //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_AMF.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2012-09-11 14:41:55 UTC (rev 1349) +++ trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2012-09-11 15:08:58 UTC (rev 1350) @@ -132,7 +132,7 @@ file.ReadArray(data); p->note = NOTE_NONE; - if(data[0]) + if(data[0] && data[0] + 12 + NOTE_MIN <= NOTE_MAX) { p->note = data[0] + 12 + NOTE_MIN; } Modified: trunk/OpenMPT/soundlib/LOAD_DMF.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2012-09-11 14:41:55 UTC (rev 1349) +++ trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2012-09-11 15:08:58 UTC (rev 1350) @@ -195,6 +195,70 @@ } +// Try using effect memory (zero paramer) to give the effect swapper some optimization hints. +void ApplyEffectMemory(const ModCommand *m, ROWINDEX row, CHANNELINDEX numChannels, uint8 effect, uint8 ¶m) +//------------------------------------------------------------------------------------------------------------- +{ + if(effect == CMD_NONE || param == 0) + { + return; + } + + const bool isTonePortaEffect = (effect == CMD_PORTAMENTOUP || effect == CMD_PORTAMENTODOWN || effect == CMD_TONEPORTAMENTO); + const bool isVolSlideEffect = (effect == CMD_VOLUMESLIDE || effect == CMD_TONEPORTAVOL || effect == CMD_VIBRATOVOL); + + while(row > 0) + { + m -= numChannels; + row--; + + // First, keep some extra rules in mind for portamento, where effect memory is shared between various commands. + bool isSame = (effect == m->command); + if(isTonePortaEffect && (m->command == CMD_PORTAMENTOUP || m->command == CMD_PORTAMENTODOWN || m->command == CMD_TONEPORTAMENTO)) + { + if(m->param < 0xE0) + { + // Avoid effect param for fine slides, or else we could accidentally put this command in the volume column, where fine slides won't work! + isSame = true; + } else + { + return; + } + } else if(isVolSlideEffect && (m->command == CMD_VOLUMESLIDE || m->command == CMD_TONEPORTAVOL || m->command == CMD_VIBRATOVOL)) + { + isSame = true; + } + if(isTonePortaEffect + && (m->volcmd == VOLCMD_PORTAUP || m->volcmd == VOLCMD_PORTADOWN || m->volcmd == VOLCMD_TONEPORTAMENTO) + && m->vol != 0) + { + // Uuh... Don't even try + return; + } else if(isVolSlideEffect + && (m->volcmd == VOLCMD_FINEVOLUP || m->volcmd == VOLCMD_FINEVOLDOWN || m->volcmd == VOLCMD_VOLSLIDEUP || m->volcmd == VOLCMD_VOLSLIDEDOWN) + && m->vol != 0) + { + // Same! + return; + } + + if(isSame) + { + if(param != m->param && m->param != 0) + { + // No way to optimize this + return; + } else if(param == m->param) + { + // Yay! + param = 0; + return; + } + } + } +} + + PATTERNINDEX ConvertDMFPattern(const LPCBYTE lpStream, const DWORD dwMemLength, DMF_PATTERNSETTINGS &settings, CSoundFile *pSndFile) //---------------------------------------------------------------------------------------------------------------------------------- { @@ -427,6 +491,7 @@ uint8 effect1 = CMD_NONE, effect2 = CMD_NONE, effect3 = CMD_NONE; uint8 effectParam1 = 0, effectParam2 = 0, effectParam3 = 0; + bool useMem2 = false, useMem3 = false; // Effect can use memory if necessary //////////////////////////////////////////////////////////////// // 0x10: Volume @@ -532,14 +597,17 @@ { effect2 = CMD_NONE; } + useMem2 = true; break; case 3: // Arpeggio effect2 = CMD_ARPEGGIO; + useMem2 = true; break; case 4: // Portamento Up case 5: // Portamento Down effectParam2 = DMFporta2MPT(effectParam2, settings.internalTicks, true); effect2 = static_cast<ModCommand::COMMAND>(effect2 == 4 ? CMD_PORTAMENTOUP : CMD_PORTAMENTODOWN); + useMem2 = true; break; case 6: // Portamento to Note if(m->note == NOTE_NONE) @@ -548,11 +616,13 @@ } effectParam2 = DMFporta2MPT(effectParam2, settings.internalTicks, false); effect2 = CMD_TONEPORTAMENTO; + useMem2 = true; break; case 7: // Scratch to Note (neat! but we don't have such an effect...) m->note = CLAMP(effectParam2 + 25, NOTE_MIN, NOTE_MAX); effect2 = CMD_TONEPORTAMENTO; effectParam2 = 0xFF; + useMem2 = true; break; case 8: // Vibrato Sine case 9: // Vibrato Triangle (ramp down should be close enough) @@ -564,10 +634,12 @@ } effect2 = CMD_VIBRATO; effectParam2 = DMFvibrato2MPT(effectParam2, settings.internalTicks); + useMem2 = true; break; case 11: // Note Tremolo effectParam2 = DMFtremor2MPT(effectParam2, settings.internalTicks); effect2 = CMD_TREMOR; + useMem2 = true; break; case 12: // Note Cut effectParam2 = DMFdelay2MPT(effectParam2, settings.internalTicks); @@ -580,6 +652,7 @@ effect2 = CMD_NONE; m->note = NOTE_NOTECUT; } + useMem2 = true; break; default: effect2 = CMD_NONE; @@ -601,10 +674,12 @@ case 2: // Volume Slide Down effectParam3 = DMFslide2MPT(effectParam3, settings.internalTicks, (effect3 == 1)); effect3 = CMD_VOLUMESLIDE; + useMem3 = true; break; case 3: // Volume Tremolo (actually this is Tremor) effectParam3 = DMFtremor2MPT(effectParam3, settings.internalTicks); effect3 = CMD_TREMOR; + useMem3 = true; break; case 4: // Tremolo Sine case 5: // Tremolo Triangle (ramp down should be close enough) @@ -616,6 +691,7 @@ } effect3 = CMD_TREMOLO; effectParam3 = DMFvibrato2MPT(effectParam3, settings.internalTicks); + useMem3 = true; break; case 7: // Set Balance effect3 = CMD_PANNING8; @@ -624,10 +700,12 @@ case 9: // Slide Balance Right effectParam3 = DMFslide2MPT(effectParam3, settings.internalTicks, (effect3 == 8)); effect3 = CMD_PANNINGSLIDE; + useMem3 = true; break; case 10: // Balance Vibrato Left/Right (always sine modulated) effect3 = CMD_PANBRELLO; effectParam3 = DMFvibrato2MPT(effectParam3, settings.internalTicks); + useMem3 = true; break; default: effect3 = CMD_NONE; @@ -635,6 +713,16 @@ } } + // Let's see if we can help the effect swapper by reducing some effect parameters to "continue" parameters. + if(useMem2) + { + ApplyEffectMemory(m, nRow, pSndFile->GetNumChannels(), effect2, effectParam2); + } + if(useMem3) + { + ApplyEffectMemory(m, nRow, pSndFile->GetNumChannels(), effect3, effectParam3); + } + // I guess this is close enough to "not retriggering the note" if(slideNote && m->IsNote()) { Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2012-09-11 14:41:55 UTC (rev 1349) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2012-09-11 15:08:58 UTC (rev 1350) @@ -1857,7 +1857,7 @@ if (len > 4) { sample.nLength = len; - if ((sample.nLoopStart + 4 < sample.nLoopEnd) && (sample.nLoopEnd < sample.nLength)) sample.uFlags |= CHN_LOOP; + if ((sample.nLoopStart + 4 < sample.nLoopEnd) && (sample.nLoopEnd <= sample.nLength)) sample.uFlags |= CHN_LOOP; SampleIO( SampleIO::_8bit, Modified: trunk/OpenMPT/soundlib/modcommand.cpp =================================================================== --- trunk/OpenMPT/soundlib/modcommand.cpp 2012-09-11 14:41:55 UTC (rev 1349) +++ trunk/OpenMPT/soundlib/modcommand.cpp 2012-09-11 15:08:58 UTC (rev 1350) @@ -853,8 +853,9 @@ case CMD_VIBRATO: if(force) param = min(param & 0x0F, 9); - else if((param & 0x0F) > 9) + else if((param & 0x0F) > 9 || (param & 0xF0) != 0) return false; + param &= 0x0F; effect = VOLCMD_VIBRATODEPTH; break; case CMD_FINEVIBRATO: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-09-18 20:10:05
|
Revision: 1352 http://modplug.svn.sourceforge.net/modplug/?rev=1352&view=rev Author: saga-games Date: 2012-09-18 20:09:56 +0000 (Tue, 18 Sep 2012) Log Message: ----------- [New/Fix/Imp] Refined VSTi portamento system: Specify the plugin's pitch wheel depth in the instrument settings and all portamentos and vibratos made with this instrument will sound identical to sample portamentos / vibratos. For old files, there is a compatible mode with the old behaviour (to be found in the song properties). For modules made with OpenMPT 1.20.02.01 - 1.20.02.09, pitch wheel depth has to be reset to 2 for proper VSTi vibrato. [Ref] A bit of VST code cleanup (reordering of variables for better struct packing and removal of unused variables) [Mod] OpenMPT: Version is now 1.20.02.10 Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/Loaders.h trunk/OpenMPT/soundlib/ModInstrument.cpp trunk/OpenMPT/soundlib/ModInstrument.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/XMTools.cpp trunk/OpenMPT/soundlib/plugins/PlugInterface.h Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2012-09-18 20:09:56 UTC (rev 1352) @@ -795,6 +795,7 @@ ON_EN_CHANGE(IDC_EDIT10, OnMPRChanged) ON_EN_CHANGE(IDC_EDIT11, OnMBKChanged) //rewbs.MidiBank ON_EN_CHANGE(IDC_EDIT15, OnPPSChanged) + ON_EN_CHANGE(IDC_PITCHWHEELDEPTH, OnPitchWheelDepthChanged) // -> CODE#0027 // -> DESC="per-instrument volume ramping setup (refered as attack)" @@ -809,9 +810,9 @@ ON_CBN_SELCHANGE(IDC_COMBO6, OnMixPlugChanged) //rewbs.instroVSTi ON_CBN_SELCHANGE(IDC_COMBO9, OnResamplingChanged) ON_CBN_SELCHANGE(IDC_FILTERMODE, OnFilterModeChanged) - ON_CBN_SELCHANGE(IDC_PLUGIN_VELOCITYSTYLE, OnPluginVelocityHandlingChanged) - ON_CBN_SELCHANGE(IDC_PLUGIN_VOLUMESTYLE, OnPluginVolumeHandlingChanged) - ON_COMMAND(ID_INSTRUMENT_SAMPLEMAP, OnEditSampleMap) + ON_CBN_SELCHANGE(IDC_PLUGIN_VOLUMESTYLE, OnPluginVolumeHandlingChanged) + ON_COMMAND(IDC_PLUGIN_VELOCITYSTYLE, OnPluginVelocityHandlingChanged) + ON_COMMAND(ID_INSTRUMENT_SAMPLEMAP, OnEditSampleMap) //}}AFX_MSG_MAP ON_CBN_SELCHANGE(IDC_COMBOTUNING, OnCbnSelchangeCombotuning) ON_EN_CHANGE(IDC_EDIT_PITCHTEMPOLOCK, OnEnChangeEditPitchtempolock) @@ -864,8 +865,9 @@ DDX_Control(pDX, IDC_COMBOTUNING, m_ComboTuning); DDX_Control(pDX, IDC_CHECK_PITCHTEMPOLOCK, m_CheckPitchTempoLock); DDX_Control(pDX, IDC_EDIT_PITCHTEMPOLOCK, m_EditPitchTempoLock); - DDX_Control(pDX, IDC_PLUGIN_VELOCITYSTYLE, m_CbnPluginVelocityHandling); - DDX_Control(pDX, IDC_PLUGIN_VOLUMESTYLE, m_CbnPluginVolumeHandling); + DDX_Control(pDX, IDC_PLUGIN_VOLUMESTYLE, m_CbnPluginVolumeHandling); + DDX_Control(pDX, IDC_PLUGIN_VELOCITYSTYLE, velocityStyle); + DDX_Control(pDX, IDC_SPIN2, pwdSpin); //}}AFX_DATA_MAP } @@ -945,8 +947,6 @@ m_CbnFilterMode.SetItemData(m_CbnFilterMode.AddString("Force highpass"), FLTMODE_HIGHPASS); //VST velocity/volume handling - m_CbnPluginVelocityHandling.AddString("Use note volume"); - m_CbnPluginVelocityHandling.AddString("Process as volume"); m_CbnPluginVolumeHandling.AddString("MIDI volume"); m_CbnPluginVolumeHandling.AddString("Dry/Wet ratio"); m_CbnPluginVolumeHandling.AddString("None"); @@ -973,6 +973,8 @@ m_SpinInstrument.SetFocus(); + GetDlgItem(IDC_PITCHWHEELDEPTH)->EnableWindow(FALSE); + BuildTuningComboBox(); CheckDlgButton(IDC_CHECK_PITCHTEMPOLOCK, MF_UNCHECKED); @@ -1195,6 +1197,14 @@ // Panning ranges (0...64 for IT, 0...256 for MPTM) m_SpinPanning.SetRange(0, (m_pSndFile->GetType() & MOD_TYPE_IT) ? 64 : 256); + // Pitch Wheel Depth + if(m_pSndFile->GetType() == MOD_TYPE_XM) + pwdSpin.SetRange(0, 36); + else + pwdSpin.SetRange(-128, 127); + GetDlgItem(IDC_PITCHWHEELDEPTH)->EnableWindow(bITandXM); + pwdSpin.EnableWindow(bITandXM); + m_NoteMap.EnableWindow(bITandXM); m_CbnResampling.EnableWindow(bITandXM); @@ -1339,30 +1349,23 @@ m_CheckPitchTempoLock.EnableWindow(m_EditPitchTempoLock.IsWindowEnabled()); CheckDlgButton(IDC_CHECK_PITCHTEMPOLOCK, (pIns->wPitchToTempoLock > 0 ? MF_CHECKED : MF_UNCHECKED)); + // Pitch Wheel Depth + SetDlgItemInt(IDC_PITCHWHEELDEPTH, pIns->midiPWD, TRUE); + OnBnClickedCheckPitchtempolock(); if(m_pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) { - if(m_CbnMixPlug.GetCurSel() > 0 && m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION) == false) - { - m_CbnPluginVelocityHandling.EnableWindow(TRUE); - m_CbnPluginVolumeHandling.EnableWindow(TRUE); - } - else - { - m_CbnPluginVelocityHandling.EnableWindow(FALSE); - m_CbnPluginVolumeHandling.EnableWindow(FALSE); - } - + BOOL enableVol = (m_CbnMixPlug.GetCurSel() > 0 && !m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION)) ? TRUE : FALSE; + velocityStyle.EnableWindow(enableVol); + m_CbnPluginVolumeHandling.EnableWindow(enableVol); } } else { m_EditName.SetWindowText(""); m_EditFileName.SetWindowText(""); - m_CbnPluginVelocityHandling.EnableWindow(FALSE); + velocityStyle.EnableWindow(FALSE); m_CbnPluginVolumeHandling.EnableWindow(FALSE); - m_CbnPluginVelocityHandling.SetCurSel(-1); - m_CbnPluginVolumeHandling.SetCurSel(-1); if(m_nInstrument > m_pSndFile->GetNumInstruments()) SetCurrentInstrument(m_pSndFile->GetNumInstruments()); @@ -1587,13 +1590,19 @@ if(pIns->nMixPlug < 1) return FALSE; if(m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION)) { - m_CbnPluginVelocityHandling.EnableWindow(FALSE); + velocityStyle.EnableWindow(FALSE); m_CbnPluginVolumeHandling.EnableWindow(FALSE); strcpy(pszText, "To enable, clear Plugin volume command bug emulation flag from Song Properties"); return TRUE; + } else + { + if(uId == IDC_PLUGIN_VELOCITYSTYLE) + { + strcpy(pszText, "Volume commands (vxx) next to a note are sent as note velocity instead."); + return TRUE; + } + return FALSE; } - else - return FALSE; case IDC_COMBO5: // MIDI Channel @@ -1624,6 +1633,10 @@ wsprintf(pszText, "\xB1%d resonance variation", pIns->nResSwing); return TRUE; + case IDC_PITCHWHEELDEPTH: + strcpy(pszText, "Set this to the actual Pitch Wheel Depth used in your plugin on this channel."); + return TRUE; + } } return FALSE; @@ -2125,17 +2138,11 @@ if (pIns) { - if(nPlug < 1 || m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION)) - { - m_CbnPluginVelocityHandling.EnableWindow(FALSE); - m_CbnPluginVolumeHandling.EnableWindow(FALSE); - } else - { - m_CbnPluginVelocityHandling.EnableWindow(); - m_CbnPluginVolumeHandling.EnableWindow(); - } + BOOL enableVol = (nPlug < 1 || m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION)) ? FALSE : TRUE; + velocityStyle.EnableWindow(enableVol); + m_CbnPluginVolumeHandling.EnableWindow(enableVol); - if (nPlug>=0 && nPlug <= MAX_MIXPLUGINS) + if(nPlug >= 0 && nPlug <= MAX_MIXPLUGINS) { if ((!IsLocked()) && pIns->nMixPlug != nPlug) { @@ -2143,7 +2150,8 @@ SetInstrumentModified(true); m_pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, this); } - m_CbnPluginVelocityHandling.SetCurSel(pIns->nPluginVelocityHandling); + + velocityStyle.SetCheck(pIns->nPluginVelocityHandling == PLUGIN_VELOCITYHANDLING_CHANNEL ? BST_CHECKED : BST_UNCHECKED); m_CbnPluginVolumeHandling.SetCurSel(pIns->nPluginVolumeHandling); if(pIns->nMixPlug) @@ -2719,15 +2727,10 @@ { if(IsLocked() || !m_pModDoc || !m_pSndFile || !m_nInstrument || !m_pSndFile->Instruments[m_nInstrument]) return; - const TEMPO MINTEMPO = m_pSndFile->GetModSpecifications().tempoMin; - const TEMPO MAXTEMPO = m_pSndFile->GetModSpecifications().tempoMax; char buffer[7]; m_EditPitchTempoLock.GetWindowText(buffer, 6); - int ptlTempo = atoi(buffer); - if(ptlTempo < MINTEMPO) - ptlTempo = MINTEMPO; - if(ptlTempo > MAXTEMPO) - ptlTempo = MAXTEMPO; + TEMPO ptlTempo = atoi(buffer); + Limit(ptlTempo, m_pSndFile->GetModSpecifications().tempoMin, m_pSndFile->GetModSpecifications().tempoMax); CriticalSection cs; m_pSndFile->Instruments[m_nInstrument]->wPitchToTempoLock = ptlTempo; @@ -2737,14 +2740,20 @@ void CCtrlInstruments::OnPluginVelocityHandlingChanged() -//------------------------------------------------ +//------------------------------------------------------ { ModInstrument *pIns = m_pSndFile->Instruments[m_nInstrument]; - if ((!IsLocked()) && (pIns)) + if(!IsLocked() && pIns != nullptr) { - BYTE n = static_cast<BYTE>(m_CbnPluginVelocityHandling.GetCurSel()); + uint8 n = static_cast<uint8>(velocityStyle.GetCheck() != BST_UNCHECKED ? PLUGIN_VELOCITYHANDLING_CHANNEL : PLUGIN_VELOCITYHANDLING_VOLUME); if(n != pIns->nPluginVelocityHandling) { + if(n == PLUGIN_VELOCITYHANDLING_VOLUME && m_CbnPluginVolumeHandling.GetCurSel() == PLUGIN_VOLUMEHANDLING_IGNORE) + { + // This combination doesn't make sense. + m_CbnPluginVolumeHandling.SetCurSel(PLUGIN_VOLUMEHANDLING_MIDI); + } + pIns->nPluginVelocityHandling = n; SetInstrumentModified(true); } @@ -2756,11 +2765,18 @@ //---------------------------------------------- { ModInstrument *pIns = m_pSndFile->Instruments[m_nInstrument]; - if ((!IsLocked()) && (pIns)) + if(!IsLocked() && pIns != nullptr) { - BYTE n = static_cast<BYTE>(m_CbnPluginVolumeHandling.GetCurSel()); + uint8 n = static_cast<uint8>(m_CbnPluginVolumeHandling.GetCurSel()); if(n != pIns->nPluginVolumeHandling) { + + if(velocityStyle.GetCheck() == BST_UNCHECKED && n == PLUGIN_VOLUMEHANDLING_IGNORE) + { + // This combination doesn't make sense. + velocityStyle.SetCheck(BST_CHECKED); + } + pIns->nPluginVolumeHandling = n; SetInstrumentModified(true); } @@ -2768,6 +2784,26 @@ } +void CCtrlInstruments::OnPitchWheelDepthChanged() +//----------------------------------------------- +{ + ModInstrument *pIns = m_pSndFile->Instruments[m_nInstrument]; + if(!IsLocked() && pIns != nullptr) + { + int pwd = GetDlgItemInt(IDC_PITCHWHEELDEPTH, NULL, TRUE); + if(m_pSndFile->GetType() == MOD_TYPE_XM) + Limit(pwd, 0, 36); + else + Limit(pwd, -128, 127); + if(pwd != pIns->midiPWD) + { + pIns->midiPWD = static_cast<int8>(pwd); + SetInstrumentModified(true); + } + } +} + + void CCtrlInstruments::OnBnClickedCheckPitchtempolock() //----------------------------------------------------- { @@ -2791,14 +2827,14 @@ char buffer[7]; m_EditPitchTempoLock.GetWindowText(buffer, 6); ptl = atoi(buffer); + } else + { + ptl = m_pSndFile->m_nDefaultTempo; } - else - ptl = m_pSndFile->m_nDefaultTempo; } m_EditPitchTempoLock.SetWindowText(Stringify(ptl).c_str()); //SetModified() comes with SetWindowText(.). - } - else + } else { m_EditPitchTempoLock.EnableWindow(FALSE); if(m_pSndFile && m_nInstrument && m_pSndFile->Instruments[m_nInstrument] && Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2012-09-18 20:09:56 UTC (rev 1352) @@ -90,10 +90,10 @@ protected: CModControlBar m_ToolBar; CSpinButtonCtrl m_SpinInstrument, m_SpinFadeOut, m_SpinGlobalVol, m_SpinPanning; - CSpinButtonCtrl m_SpinMidiPR, m_SpinPPS, m_SpinMidiBK; - CComboBox m_ComboNNA, m_ComboDCT, m_ComboDCA, m_ComboPPC, m_CbnMidiCh, m_CbnMixPlug, m_CbnResampling, m_CbnFilterMode, m_CbnPluginVelocityHandling, m_CbnPluginVolumeHandling; + CSpinButtonCtrl m_SpinMidiPR, m_SpinPPS, m_SpinMidiBK, pwdSpin; + CComboBox m_ComboNNA, m_ComboDCT, m_ComboDCA, m_ComboPPC, m_CbnMidiCh, m_CbnMixPlug, m_CbnResampling, m_CbnFilterMode, m_CbnPluginVolumeHandling; CEdit m_EditName, m_EditFileName, m_EditGlobalVol, m_EditPanning, m_EditPPS, m_EditFadeOut; - CButton m_CheckPanning, m_CheckCutOff, m_CheckResonance; + CButton m_CheckPanning, m_CheckCutOff, m_CheckResonance, velocityStyle; CSliderCtrl m_SliderVolSwing, m_SliderPanSwing, m_SliderCutSwing, m_SliderResSwing, m_SliderCutOff, m_SliderResonance; CNoteMapWnd m_NoteMap; @@ -174,6 +174,7 @@ afx_msg void OnFilterModeChanged(); afx_msg void OnPluginVelocityHandlingChanged(); afx_msg void OnPluginVolumeHandlingChanged(); + afx_msg void OnPitchWheelDepthChanged(); // -> CODE#0027 Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2012-09-18 20:09:56 UTC (rev 1352) @@ -1311,7 +1311,6 @@ m_nInputs = m_nOutputs = 0; m_nEditorX = m_nEditorY = -1; m_pModDoc = nullptr; //rewbs.plugDocAware - m_nPreviousMidiChan = nInvalidMidiChan; //rewbs.VSTCompliance m_pProcessFP = nullptr; // Insert ourselves in the beginning of the list @@ -1333,13 +1332,12 @@ m_bSongPlaying = false; //rewbs.VSTCompliance m_bPlugResumed = false; - m_bModified = false; m_nSampleRate = nInvalidSampleRate; //rewbs.VSTCompliance: gets set on Resume() MemsetZero(m_MidiCh); - for (int ch=0; ch<16; ch++) + for(int ch = 0; ch < 16; ch++) { - m_nMidiPitchBendPos[ch] = MIDIEvents::pitchBendCentre; //centre pitch bend on all channels + m_MidiCh[ch].midiPitchBendPos = EncodePitchBendParam(MIDIEvents::pitchBendCentre); //centre pitch bend on all channels } } @@ -1521,10 +1519,10 @@ } -int CVstPlugin::Release() -//----------------------- +size_t CVstPlugin::Release() +//-------------------------- { - if (!(--m_nRefCount)) + if(!(--m_nRefCount)) { try { @@ -2364,47 +2362,75 @@ } -// Bend MIDI pitch for given MIDI channel using tracker param (0x00-0xFF) -void CVstPlugin::MidiPitchBend(uint8 nMidiCh, int nParam, CHANNELINDEX /*trackChannel*/) -//-------------------------------------------------------------------------------------- +void CVstPlugin::ApplyPitchWheelDepth(int32 &value, int8 pwd) +//----------------------------------------------------------- { - const int16 increment = static_cast<int16>((nParam * 0x800) / 0xFF); - int16 newPitchBendPos = (m_nMidiPitchBendPos[nMidiCh] & vstPitchBendMask) + increment; - Limit(newPitchBendPos, int16(MIDIEvents::pitchBendMin), int16(MIDIEvents::pitchBendMax)); + if(pwd != 0) + { + // 16383 / 127 = 129 + value = (value * ((MIDIEvents::pitchBendMax - MIDIEvents::pitchBendMin) / 127)) / pwd; + } else + { + value = 0; + } +} + +// Bend MIDI pitch for given MIDI channel using fine tracker param (one unit = 1/64th of a note step) +void CVstPlugin::MidiPitchBend(uint8 nMidiCh, int32 increment, int8 pwd) +//---------------------------------------------------------------------- +{ + if(m_pSndFile && m_pSndFile->GetModFlag(MSF_OLD_MIDI_PITCHBENDS)) + { + // OpenMPT Legacy: Old pitch slides never were really accurate, but setting the PWD to 13 in plugins would give the closest results. + increment = (increment * 0x800 * 13) / (0xFF * pwd); + increment = EncodePitchBendParam(increment); + } else + { + increment = EncodePitchBendParam(increment); + ApplyPitchWheelDepth(increment, pwd); + } + + int32 newPitchBendPos = (increment + m_MidiCh[nMidiCh].midiPitchBendPos) & vstPitchBendMask; + Limit(newPitchBendPos, EncodePitchBendParam(MIDIEvents::pitchBendMin), EncodePitchBendParam(MIDIEvents::pitchBendMax)); + MidiPitchBend(nMidiCh, newPitchBendPos); } -//Set MIDI pitch for given MIDI channel using uncoverted midi value (0-16383) -void CVstPlugin::MidiPitchBend(uint8 nMidiCh, int16 newPitchBendPos) +//Set MIDI pitch for given MIDI channel using fixed point pitch bend value (converted back to 0-16383 MIDI range) +void CVstPlugin::MidiPitchBend(uint8 nMidiCh, int32 newPitchBendPos) //------------------------------------------------------------------ { - ASSERT(MIDIEvents::pitchBendMin <= newPitchBendPos && newPitchBendPos <= MIDIEvents::pitchBendMax); - m_nMidiPitchBendPos[nMidiCh] = newPitchBendPos; - MidiSend(MIDIEvents::BuildPitchBendEvent(nMidiCh, newPitchBendPos)); + ASSERT(EncodePitchBendParam(MIDIEvents::pitchBendMin) <= newPitchBendPos && newPitchBendPos <= EncodePitchBendParam(MIDIEvents::pitchBendMax)); + m_MidiCh[nMidiCh].midiPitchBendPos = newPitchBendPos; + MidiSend(MIDIEvents::BuildPitchBendEvent(nMidiCh, DecodePitchBendParam(newPitchBendPos))); } // Apply vibrato effect through pitch wheel commands on a given MIDI channel. -void CVstPlugin::MidiVibrato(uint8 nMidiCh, int16 depth) -//------------------------------------------------------ +void CVstPlugin::MidiVibrato(uint8 nMidiCh, int32 depth, int8 pwd) +//---------------------------------------------------------------- { - if(depth != 0 || (m_nMidiPitchBendPos[nMidiCh] & vstVibratoFlag)) + depth = EncodePitchBendParam(depth); + if(depth != 0 || (m_MidiCh[nMidiCh].midiPitchBendPos & vstVibratoFlag)) { + ApplyPitchWheelDepth(depth, pwd); + // Temporarily add vibrato offset to current pitch - int16 pitch = (m_nMidiPitchBendPos[nMidiCh] & vstPitchBendMask) + depth; - Limit(pitch, int16(MIDIEvents::pitchBendMin), int16(MIDIEvents::pitchBendMax)); - MidiSend(MIDIEvents::BuildPitchBendEvent(nMidiCh, pitch)); + int32 newPitchBendPos = (depth + m_MidiCh[nMidiCh].midiPitchBendPos) & vstPitchBendMask; + Limit(newPitchBendPos, EncodePitchBendParam(MIDIEvents::pitchBendMin), EncodePitchBendParam(MIDIEvents::pitchBendMax)); + + MidiSend(MIDIEvents::BuildPitchBendEvent(nMidiCh, DecodePitchBendParam(newPitchBendPos))); } // Update vibrato status if(depth != 0) { - m_nMidiPitchBendPos[nMidiCh] |= vstVibratoFlag; + m_MidiCh[nMidiCh].midiPitchBendPos |= vstVibratoFlag; } else { - m_nMidiPitchBendPos[nMidiCh] &= ~vstVibratoFlag; + m_MidiCh[nMidiCh].midiPitchBendPos &= ~vstVibratoFlag; } } @@ -2415,8 +2441,8 @@ { VSTInstrChannel &channel = m_MidiCh[nMidiCh]; - bool bankChanged = (channel.wMidiBank != --wMidiBank) && (wMidiBank < 0x4000); - bool progChanged = (channel.nProgram != --nMidiProg) && (nMidiProg < 0x80); + bool bankChanged = (channel.currentBank != --wMidiBank) && (wMidiBank < 0x4000); + bool progChanged = (channel.currentProgram != --nMidiProg) && (nMidiProg < 0x80); //get vol in [0,128[ uint8 volume = static_cast<uint8>(Util::Min(vol / 2, 127)); @@ -2426,7 +2452,7 @@ uint8 high = static_cast<uint8>(wMidiBank >> 7); uint8 low = static_cast<uint8>(wMidiBank & 0x7F); - if((channel.wMidiBank >> 7) != high) + if((channel.currentBank >> 7) != high) { // High byte changed MidiSend(MIDIEvents::BuildCCEvent(MIDIEvents::MIDICC_BankSelect_Coarse, nMidiCh, high)); @@ -2435,7 +2461,7 @@ //GetSoundFile()->ProcessMIDIMacro(trackChannel, false, GetSoundFile()->m_MidiCfg.szMidiGlb[MIDIOUT_BANKSEL], 0); MidiSend(MIDIEvents::BuildCCEvent(MIDIEvents::MIDICC_BankSelect_Fine, nMidiCh, low)); - channel.wMidiBank = wMidiBank; + channel.currentBank = wMidiBank; } // Program change @@ -2443,7 +2469,7 @@ // Thus we send program changes also if only the bank has changed. if(nMidiProg < 0x80 && (progChanged || bankChanged)) { - channel.nProgram = nMidiProg; + channel.currentProgram = nMidiProg; //GetSoundFile()->ProcessMIDIMacro(trackChannel, false, GetSoundFile()->m_MidiCfg.szMidiGlb[MIDIOUT_PROGRAM], 0); MidiSend(MIDIEvents::BuildProgramChangeEvent(nMidiCh, nMidiProg)); } @@ -2507,9 +2533,9 @@ // Reset pitch bend on each new note, tracker style. // This is done if the pitch wheel has been moved or there was a vibrato on the previous row (in which case the highest bit of the pitch bend memory is set) - if(m_nMidiPitchBendPos[nMidiCh] != MIDIEvents::pitchBendCentre) + if(m_MidiCh[nMidiCh].midiPitchBendPos != EncodePitchBendParam(MIDIEvents::pitchBendCentre)) { - MidiPitchBend(nMidiCh, MIDIEvents::pitchBendCentre); + MidiPitchBend(nMidiCh, EncodePitchBendParam(MIDIEvents::pitchBendCentre)); } // count instances of active notes. @@ -2522,9 +2548,6 @@ MidiSend(MIDIEvents::BuildNoteOnEvent(nMidiCh, static_cast<uint8>(note), volume)); } - - m_nPreviousMidiChan = nMidiCh; - } @@ -2628,7 +2651,6 @@ if ((m_pEffect) && (m_pMixStruct)) { m_pMixStruct->defaultProgram = -1; - m_bModified = false; if ((m_pEffect->flags & effFlagsProgramChunks) && (Dispatch(effIdentify, 0,0, nullptr, 0.0f) == 'NvEf')) @@ -2816,21 +2838,6 @@ //rewbs.defaultPlugGui: CVstEditor now COwnerVstEditor -//rewbs.VSTcompliance -bool CVstPlugin::GetSpeakerArrangement() -//-------------------------------------- -{ - VstSpeakerArrangement **pSA = nullptr; - Dispatch(effGetSpeakerArrangement, 0, 0, pSA, 0); - if (pSA) - { - MemCopy(speakerArrangement, **pSA); - } - - return true; -} - - void CVstPlugin::NotifySongPlaying(bool playing) //---------------------------------------------- { Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/mptrack/Vstplug.h 2012-09-18 20:09:56 UTC (rev 1352) @@ -104,10 +104,10 @@ struct VSTInstrChannel { - //BYTE uNoteOnMap[128/8]; rewbs.deMystifyMidiNoteMap + int32 midiPitchBendPos; // Current Pitch Wheel position, in 16.11 fixed point format. Lowest bit is used for indicating that vibrato was applied. Vibrato offset itself is not stored in this value. + uint16 currentProgram; + uint16 currentBank; //rewbs.MidiBank uint8 uNoteOnMap[128][MAX_CHANNELS]; - uint32 nProgram; - uint16 wMidiBank; //rewbs.MidiBank }; @@ -130,11 +130,12 @@ // Number of MIDI events that can be sent to a plugin at once (the internal queue is not affected by this number, it can hold any number of events) vstNumProcessEvents = 256, - vstPitchBendMask = 0x7FFF, - vstVibratoFlag = 0x8000, + // Pitch wheel constants + vstPitchBendShift = 12, // Use lowest 12 bits for fractional part and vibrato flag => 16.11 fixed point precision + vstPitchBendMask = (~1), + vstVibratoFlag = 1, }; - ULONG m_nRefCount; CVstPlugin *m_pNext, *m_pPrev; HINSTANCE m_hLibrary; VSTPluginLib *m_pFactory; @@ -142,30 +143,26 @@ AEffect *m_pEffect; void (*m_pProcessFP)(AEffect*, float**, float**, VstInt32); //Function pointer to AEffect processReplacing if supported, else process. CAbstractVstEditor *m_pEditor; //rewbs.defaultPlugGUI - static const UINT nInvalidSampleRate = UINT_MAX; - UINT m_nSampleRate; - bool m_bIsVst2; + CModDoc *m_pModDoc; //rewbs.plugDocAware + CSoundFile *m_pSndFile; //rewbs.plugDocAware + + size_t m_nRefCount; + static const uint32 nInvalidSampleRate = UINT_MAX; + uint32 m_nSampleRate; SNDMIXPLUGINSTATE m_MixState; - UINT m_nInputs, m_nOutputs; - VSTInstrChannel m_MidiCh[16]; - int16 m_nMidiPitchBendPos[16]; // Current pitch wheel depth. Highest bit is used for indicating that vibrato was applied. Vibrato offset itself is not stored in this value. + uint32 m_nInputs, m_nOutputs; + int32 m_nEditorX, m_nEditorY; - CModDoc* m_pModDoc; //rewbs.plugDocAware - CSoundFile* m_pSndFile; //rewbs.plugDocAware -// PSNDMIXPLUGIN m_pSndMixPlugin; //rewbs.plugDocAware - static const UINT nInvalidMidiChan = UINT_MAX; - UINT m_nPreviousMidiChan; //rewbs.VSTCompliance + float m_fGain; + PLUGINDEX m_nSlot; bool m_bSongPlaying; //rewbs.VSTCompliance bool m_bPlugResumed; //rewbs.VSTCompliance - bool m_bModified; - PLUGINDEX m_nSlot; - float m_fGain; + bool m_bIsVst2; bool m_bIsInstrument; - int m_nEditorX, m_nEditorY; - + VSTInstrChannel m_MidiCh[16]; // MIDI channel state PluginMixBuffer<float, MIXBUFFERSIZE> mixBuffer; // Float buffers (input and output) for plugins - int m_MixBuffer[MIXBUFFERSIZE * 2 + 2]; // Stereo interleaved + int32 m_MixBuffer[MIXBUFFERSIZE * 2 + 2]; // Stereo interleaved PluginEventQueue<vstNumProcessEvents> vstEvents; // MIDI events that should be sent to the plugin public: @@ -187,7 +184,6 @@ VstInt32 GetVersion(); //rewbs.VSTpresets bool GetParams(float* param, VstInt32 min, VstInt32 max); //rewbs.VSTpresets bool RandomizeParams(PlugParamIndex minParam = 0, PlugParamIndex maxParam = 0); //rewbs.VSTpresets - bool isModified() {return m_bModified;} inline CModDoc* GetModDoc() {return m_pModDoc;} inline CSoundFile* GetSoundFile() {return m_pSndFile;} PLUGINDEX FindSlot(); @@ -214,12 +210,11 @@ BOOL GetDefaultEffectName(LPSTR pszName); BOOL GetCommandName(UINT index, LPSTR pszName); CAbstractVstEditor* GetEditor(); //rewbs.defaultPlugGUI - bool GetSpeakerArrangement(); //rewbs.VSTCompliance void Bypass(bool bypass = true); bool IsBypassed() const { return m_pMixStruct->IsBypassed(); }; - bool isInstrument(); // ericus 18/02/2005 + bool isInstrument(); bool CanRecieveMidiEvents(); size_t GetOutputPlugList(vector<CVstPlugin *> &list); @@ -228,8 +223,8 @@ size_t GetInputChannelList(vector<CHANNELINDEX> &list); public: - int AddRef() { return ++m_nRefCount; } - int Release(); + size_t AddRef() { return ++m_nRefCount; } + size_t Release(); void SaveAllParameters(); void RestoreAllParameters(long nProg=-1); //rewbs.plugDefaultProgram - added param void RecalculateGain(); @@ -237,8 +232,8 @@ void Init(unsigned long nFreq, int bReset); bool MidiSend(DWORD dwMidiCode); void MidiCC(uint8 nMidiCh, MIDIEvents::MidiCC nController, uint8 nParam, CHANNELINDEX trackChannel); - void MidiPitchBend(uint8 nMidiCh, int nParam, CHANNELINDEX trackChannel); - void MidiVibrato(uint8 nMidiCh, int16 depth); + void MidiPitchBend(uint8 nMidiCh, int32 increment, int8 pwd); + void MidiVibrato(uint8 nMidiCh, int32 depth, int8 pwd); void MidiCommand(uint8 nMidiCh, uint8 nMidiProg, uint16 wMidiBank, uint16 note, uint16 vol, CHANNELINDEX trackChannel); void HardAllNotesOff(); //rewbs.VSTiNoteHoldonStopFix bool isPlaying(UINT note, UINT midiChn, UINT trackerChn); //rewbs.instroVST @@ -260,10 +255,14 @@ void SetZxxParameter(UINT nParam, UINT nValue); UINT GetZxxParameter(UINT nParam); //rewbs.smoothVST - VstSpeakerArrangement speakerArrangement; //rewbs.VSTcompliance - private: - void MidiPitchBend(uint8 nMidiCh, int16 pitchBendPos); + void MidiPitchBend(uint8 nMidiCh, int32 pitchBendPos); + // Converts a 14-bit MIDI pitch bend position to a 16.11 fixed point pitch bend position + static int32 EncodePitchBendParam(int32 position) { return (position << vstPitchBendShift); } + // Converts a 16.11 fixed point pitch bend position to a 14-bit MIDI pitch bend position + static int16 DecodePitchBendParam(int32 position) { return static_cast<int16>(position >> vstPitchBendShift); } + // Apply Pitch Wheel Depth (PWD) to some MIDI pitch bend value. + static inline void ApplyPitchWheelDepth(int32 &value, int8 pwd); bool GetProgramNameIndexed(VstInt32 index, VstIntPtr category, char *text); //rewbs.VSTpresets Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2012-09-18 20:09:56 UTC (rev 1352) @@ -136,6 +136,7 @@ CheckDlgButton(IDC_CHK_COMPATPLAY, m_pSndFile->GetModFlag(MSF_COMPATIBLE_PLAY)); CheckDlgButton(IDC_CHK_MIDICCBUG, m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION)); CheckDlgButton(IDC_CHK_OLDRANDOM, m_pSndFile->GetModFlag(MSF_OLDVOLSWING)); + CheckDlgButton(IDC_CHK_OLDPITCH, m_pSndFile->GetModFlag(MSF_OLD_MIDI_PITCHBENDS)); // Time signature information @@ -239,11 +240,13 @@ GetDlgItem(IDC_CHK_COMPATPLAY)->ShowWindow(XMorITorMPT); GetDlgItem(IDC_CHK_MIDICCBUG)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_CHK_OLDRANDOM)->ShowWindow(ITorMPT); + GetDlgItem(IDC_CHK_OLDRANDOM)->ShowWindow(XMorITorMPT); + GetDlgItem(IDC_CHK_OLDPITCH)->ShowWindow(XMorITorMPT); // Deprecated flags are greyed out if they are not being used. GetDlgItem(IDC_CHK_MIDICCBUG)->EnableWindow(m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION) ? TRUE : FALSE); - GetDlgItem(IDC_CHK_OLDRANDOM)->EnableWindow(m_pSndFile->GetModFlag(MSF_OLDVOLSWING) ? TRUE : FALSE); + GetDlgItem(IDC_CHK_OLDRANDOM)->EnableWindow((ITorMPT && m_pSndFile->GetModFlag(MSF_OLDVOLSWING)) ? TRUE : FALSE); + GetDlgItem(IDC_CHK_OLDPITCH)->EnableWindow(m_pSndFile->GetModFlag(MSF_OLD_MIDI_PITCHBENDS) ? TRUE : FALSE); // Mixmode Box GetDlgItem(IDC_TEXT_MIXMODE)->ShowWindow(XMorITorMPT); @@ -369,6 +372,7 @@ if(IsDlgButtonChecked(IDC_CHK_COMPATPLAY)) m_pSndFile->SetModFlag(MSF_COMPATIBLE_PLAY, true); if(IsDlgButtonChecked(IDC_CHK_MIDICCBUG)) m_pSndFile->SetModFlag(MSF_MIDICC_BUGEMULATION, true); if(IsDlgButtonChecked(IDC_CHK_OLDRANDOM)) m_pSndFile->SetModFlag(MSF_OLDVOLSWING, true); + if(IsDlgButtonChecked(IDC_CHK_OLDPITCH)) m_pSndFile->SetModFlag(MSF_OLD_MIDI_PITCHBENDS, true); } m_pSndFile->m_nDefaultRowsPerBeat = GetDlgItemInt(IDC_ROWSPERBEAT); @@ -393,7 +397,7 @@ TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR; CStringA strTipText = ""; UINT_PTR nID = pNMHDR->idFrom; - if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) || + if(pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) || pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)) { // idFrom is actually the HWND of the tool @@ -435,16 +439,18 @@ case IDC_CHK_OLDRANDOM: strTipText = "Use old (buggy) random volume / panning variation algorithm (not recommended)"; break; + case IDC_CHK_OLDPITCH: + strTipText = "Use old (imprecise) portamento logic for instrument plugins (not recommended)"; + break; } - if (pNMHDR->code == TTN_NEEDTEXTA) + if(pNMHDR->code == TTN_NEEDTEXTA) { //strncpy_s(pTTTA->szText, sizeof(pTTTA->szText), strTipText, // strTipText.GetLength() + 1); // 80 chars max?! strncpy(pTTTA->szText, strTipText, min(strTipText.GetLength() + 1, CountOf(pTTTA->szText) - 1)); - } - else + } else { ::MultiByteToWideChar(CP_ACP , 0, strTipText, strTipText.GetLength() + 1, pTTTW->szText, CountOf(pTTTW->szText)); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/mptrack/mptrack.rc 2012-09-18 20:09:56 UTC (rev 1352) @@ -229,18 +229,18 @@ BEGIN CONTROL "Channel 1:",IDC_STATIC_CHANNEL_NAME,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,6,8,45,8 EDITTEXT IDC_EDIT3,60,6,126,12,ES_AUTOHSCROLL - PUSHBUTTON "<<",IDC_BUTTON1,192,6,18,12 - PUSHBUTTON ">>",IDC_BUTTON2,216,6,18,12 + PUSHBUTTON "&<<",IDC_BUTTON1,192,6,18,12 + PUSHBUTTON "&>>",IDC_BUTTON2,216,6,18,12 LTEXT "Initial Volume:",IDC_STATIC,6,30,45,8 CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,54,24,92,22 EDITTEXT IDC_EDIT1,150,30,36,12,ES_NUMBER CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY,174,30,11,14 - CONTROL "Mute",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,192,30,42,12 + CONTROL "&Mute",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,192,30,42,12 LTEXT "Initial Pan:",IDC_STATIC,6,54,34,8 CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,54,48,92,22 EDITTEXT IDC_EDIT2,150,54,36,12,ES_NUMBER CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY,174,54,11,14 - CONTROL "Surround",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,192,54,42,12 + CONTROL "&Surround",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,192,54,42,12 END @@ -758,7 +758,7 @@ LTEXT "Parameters",IDC_TEXT_STRETCHPARAMS,385,38,39,8 END -IDD_CONTROL_INSTRUMENTS DIALOGEX 0, 0, 558, 173 +IDD_CONTROL_INSTRUMENTS DIALOGEX 0, 0, 536, 170 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN @@ -766,81 +766,83 @@ CONTROL "Spin1",IDC_SPIN_INSTRUMENT,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS | WS_TABSTOP,111,8,11,11 EDITTEXT IDC_SAMPLE_NAME,131,6,151,12,ES_AUTOHSCROLL EDITTEXT IDC_SAMPLE_FILENAME,324,6,105,12,ES_AUTOHSCROLL + CTEXT "Global Volume",IDC_STATIC,8,36,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT8,84,36,37,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin1",IDC_SPIN8,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,112,40,8,10 + CTEXT "Fade Out",IDC_STATIC,8,53,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT7,84,53,37,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "",IDC_SPIN7,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,112,57,8,10 CONTROL "Set Pan",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,42,72,42,10 EDITTEXT IDC_EDIT9,84,70,37,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "",IDC_SPIN9,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,112,74,8,11 + CTEXT "Sep",IDC_STATIC,8,99,25,13,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT15,33,99,27,13,ES_AUTOHSCROLL - CONTROL "Spin1",IDC_SPIN12,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,61,103,7,11 + CONTROL "Spin1",IDC_SPIN12,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,54,102,11,11 + CTEXT "Centre",IDC_STATIC,69,99,26,13,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_COMBO4,95,99,27,91,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CTEXT "Ramping",IDC_STATIC,7,133,39,13,SS_CENTERIMAGE,WS_EX_STATICEDGE CONTROL "",IDC_SLIDER5,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS,47,135,36,10 EDITTEXT IDC_EDIT2,85,133,36,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,116,133,8,12 + CTEXT "Resampling",IDC_STATIC,7,151,39,13,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_COMBO9,50,151,71,81,CBS_DROPDOWNLIST | WS_TABSTOP CONTROL "Reso",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,136,37,33,10 CONTROL "Slider2",IDC_SLIDER4,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_DISABLED | WS_TABSTOP,168,37,64,10 CONTROL "Cutoff",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,136,52,35,10 CONTROL "Slider2",IDC_SLIDER3,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_DISABLED | WS_TABSTOP,168,53,64,10 + RTEXT "--",IDC_FILTERTEXT,166,62,65,8 + CTEXT "Mode",IDC_STATIC,135,70,23,13,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_FILTERMODE,163,70,69,42,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CTEXT "Volume",IDC_STATIC,136,99,33,13,SS_CENTERIMAGE,WS_EX_STATICEDGE CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,172,101,60,10 + CTEXT "Panning",IDC_STATIC,136,116,33,13,SS_CENTERIMAGE,WS_EX_STATICEDGE CONTROL "Slider1",IDC_SLIDER2,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,172,118,60,10 + CTEXT "Cutoff",IDC_STATIC,136,133,33,13,SS_CENTERIMAGE,WS_EX_STATICEDGE CONTROL "",IDC_SLIDER6,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,172,135,60,10 + CTEXT "Reso",IDC_STATIC,136,151,33,13,SS_CENTERIMAGE,WS_EX_STATICEDGE CONTROL "",IDC_SLIDER7,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS | WS_TABSTOP,172,152,60,10 + CTEXT "Action",IDC_STATIC,246,36,59,13,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_COMBO1,308,36,50,54,CBS_DROPDOWNLIST | WS_TABSTOP + CTEXT "Duplicate Check",IDC_STATIC,246,53,59,13,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_COMBO2,308,53,50,69,CBS_DROPDOWNLIST | WS_TABSTOP + CTEXT "Duplicate Action",IDC_STATIC,246,70,59,13,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_COMBO3,308,70,50,54,CBS_DROPDOWNLIST | WS_TABSTOP COMBOBOX IDC_COMBO6,246,99,72,127,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Editor",IDC_INSVIEWPLG,321,99,37,13,0,WS_EX_STATICEDGE + CTEXT "MIDI Channel",IDC_STATIC,246,116,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_COMBO5,321,116,37,169,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CTEXT "MIDI Program",IDC_STATIC,246,134,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT10,321,134,37,12,ES_AUTOHSCROLL CONTROL "Spin1",IDC_SPIN10,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,349,135,8,11 + CTEXT "MIDI Bank",IDC_STATIC,245,152,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT11,321,152,37,12,ES_AUTOHSCROLL CONTROL "",IDC_SPIN11,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,351,153,8,11 - COMBOBOX IDC_PLUGIN_VELOCITYSTYLE,367,115,83,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PLUGIN_VOLUMESTYLE,367,148,83,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBOTUNING,367,39,86,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Loop tempo:",IDC_CHECK_PITCHTEMPOLOCK,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,367,68,51,8 - EDITTEXT IDC_EDIT_PITCHTEMPOLOCK,425,67,24,12,ES_AUTOHSCROLL - CONTROL "",IDC_NOTEMAP,"Static",SS_GRAYRECT | SS_NOTIFY | WS_TABSTOP,461,37,62,131,WS_EX_CLIENTEDGE + LTEXT "P. Bend Range:",IDC_STATIC,366,101,54,8,SS_CENTERIMAGE + EDITTEXT IDC_PITCHWHEELDEPTH,420,99,36,12,ES_AUTOHSCROLL + CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS | WS_TABSTOP,444,102,11,11 + LTEXT "Volume Command Handling:",IDC_STATIC,366,114,90,8,SS_CENTERIMAGE + COMBOBOX IDC_PLUGIN_VOLUMESTYLE,366,126,90,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Volume commands with note are Velocities",IDC_PLUGIN_VELOCITYSTYLE, + "Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_MULTILINE | BS_FLAT | WS_TABSTOP,366,141,90,24 + COMBOBOX IDC_COMBOTUNING,368,38,88,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Loop tempo:",IDC_CHECK_PITCHTEMPOLOCK,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,369,70,51,8 + EDITTEXT IDC_EDIT_PITCHTEMPOLOCK,426,68,30,12,ES_AUTOHSCROLL + CONTROL "",IDC_NOTEMAP,"Static",SS_GRAYRECT | SS_NOTIFY | WS_TABSTOP,466,37,62,131,WS_EX_CLIENTEDGE CONTROL "Toolbar1",IDC_TOOLBAR1,"ToolbarWindow32",WS_GROUP | 0x4d,4,4,76,17 - CTEXT "MIDI / VSTi Channel",IDC_STATIC,246,116,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "MIDI Program",IDC_STATIC,246,134,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "MIDI Bank",IDC_STATIC,245,152,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Fade Out",IDC_STATIC,8,53,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Global Volume",IDC_STATIC,8,36,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE CTEXT "File",IDC_STATIC,289,6,35,12,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Sep",IDC_STATIC,8,99,25,13,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Centre",IDC_STATIC,69,99,26,13,SS_CENTERIMAGE,WS_EX_STATICEDGE GROUPBOX "Random Variation",IDC_STATIC,131,88,104,80 - CTEXT "Volume",IDC_STATIC,136,99,33,13,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Panning",IDC_STATIC,136,116,33,13,SS_CENTERIMAGE,WS_EX_STATICEDGE - EDITTEXT IDC_EDIT1,492,119,30,12,ES_RIGHT | ES_READONLY | NOT WS_VISIBLE | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RIGHT - CTEXT "Duplicate Action",IDC_STATIC,246,70,59,13,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Duplicate Check",IDC_STATIC,246,53,59,13,SS_CENTERIMAGE,WS_EX_STATICEDGE GROUPBOX "Filter",IDC_STATIC,131,27,104,141 GROUPBOX "General",IDC_STATIC,3,27,123,141 GROUPBOX "Pitch/Pan",IDC_STATIC,3,88,123,80 - CTEXT "Action",IDC_STATIC,246,36,59,13,SS_CENTERIMAGE,WS_EX_STATICEDGE - GROUPBOX "New Note Action",IDC_STATIC,240,27,122,59 + GROUPBOX "New Note Action",IDC_STATIC,240,27,122,60 GROUPBOX "Sample Quality",IDC_STATIC,3,118,123,50 - CTEXT "Ramping",IDC_STATIC,7,133,39,13,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Cutoff",IDC_STATIC,136,133,33,13,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Reso",IDC_STATIC,136,151,33,13,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Resampling",IDC_STATIC,7,151,39,13,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Mode",IDC_STATIC,135,70,23,13,SS_CENTERIMAGE,WS_EX_STATICEDGE - RTEXT "--",IDC_FILTERTEXT,166,62,65,8 - GROUPBOX "Pitch/Tempo Lock",IDC_STATIC,364,57,89,25 - GROUPBOX "Sample Map",IDC_STATIC,461,27,62,141 - CTEXT "Velocity handling",IDC_STATIC,367,102,83,10,SS_CENTERIMAGE,WS_EX_STATICEDGE - CTEXT "Volume handling",IDC_STATIC,367,133,83,10,SS_CENTERIMAGE,WS_EX_STATICEDGE - GROUPBOX "Tuning (experimental)",IDC_STATIC,364,28,92,28 - GROUPBOX "Plugin / MIDI",IDC_STATIC,240,88,216,80 + GROUPBOX "Pitch/Tempo Lock",IDC_STATIC,364,57,98,30 + GROUPBOX "Sample Map",IDC_STATIC,466,27,62,141 + GROUPBOX "Alternative Tuning",IDC_STATIC,364,27,98,28 + GROUPBOX "Plugin / MIDI",IDC_STATIC,240,88,222,80 END -IDD_MODDOC_MODTYPE DIALOGEX 0, 0, 262, 305 +IDD_MODDOC_MODTYPE DIALOGEX 0, 0, 262, 317 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Song Properties" FONT 8, "MS Shell Dlg", 0, 0, 0x0 @@ -849,7 +851,7 @@ PUSHBUTTON "Cancel",IDCANCEL,204,24,50,14 COMBOBOX IDC_COMBO1,12,18,108,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO2,126,18,66,77,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "&Embed instrument parameters in ITP",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,36,174,8 + CONTROL "&Embed Instrument Parameters in ITP",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,36,174,8 CONTROL "&Linear Frequency Slides",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,72,91,10 CONTROL "&Old Effects (IT)",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,72,66,10 CONTROL "Fast &Volume Slides (S3M)",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,84,96,10 @@ -863,21 +865,23 @@ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,162,222,12 CONTROL "Old &random variation behaviour for instruments",IDC_CHK_OLDRANDOM, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,174,222,12 - COMBOBOX IDC_COMBO_TEMPOMODE,12,222,108,77,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_ROWSPERBEAT,132,210,24,12,ES_AUTOHSCROLL | ES_NUMBER - EDITTEXT IDC_ROWSPERMEASURE,132,228,24,12,ES_AUTOHSCROLL | ES_NUMBER - EDITTEXT IDC_EDIT_CREATEDWITH,78,265,166,13,ES_AUTOHSCROLL | ES_READONLY,WS_EX_STATICEDGE - EDITTEXT IDC_EDIT_SAVEDWITH,78,283,166,13,ES_AUTOHSCROLL | ES_READONLY,WS_EX_STATICEDGE + CONTROL "Old P&itch Wheel behaviour for instrument plugins",IDC_CHK_OLDPITCH, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,186,222,12 + LTEXT "Mode:",IDC_TEXT_TEMPOMODE,12,222,21,8 + COMBOBOX IDC_COMBO_TEMPOMODE,12,234,108,77,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_ROWSPERBEAT,132,222,24,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Rows per beat",IDC_TEXT_ROWSPERBEAT,162,224,84,8 + EDITTEXT IDC_ROWSPERMEASURE,132,240,24,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Rows per measure",IDC_TEXT_ROWSPERMEASURE,162,242,84,8 + RTEXT "IDC_TEXT_CREATEDWITH",IDC_TEXT_CREATEDWITH,18,279,54,8 + EDITTEXT IDC_EDIT_CREATEDWITH,78,277,166,13,ES_AUTOHSCROLL | ES_READONLY,WS_EX_STATICEDGE + RTEXT "IDC_TEXT_SAVEDWITH",IDC_TEXT_SAVEDWITH,18,295,54,8 + EDITTEXT IDC_EDIT_SAVEDWITH,78,295,166,13,ES_AUTOHSCROLL | ES_READONLY,WS_EX_STATICEDGE GROUPBOX "Type",IDC_FRAME_MODTYPE,6,6,192,48 GROUPBOX "Playback",IDC_FRAME_MODFLAGS,6,60,246,54 - GROUPBOX "Extended Playback Options (OpenMPT only)",IDC_FRAME_MPTEXT,6,120,246,72 - GROUPBOX "Tempo",IDC_FRAME_TEMPOMODE,6,198,246,48 - LTEXT "Mode:",IDC_TEXT_TEMPOMODE,12,210,21,8 - LTEXT "Rows per beat",IDC_TEXT_ROWSPERBEAT,162,212,84,8 - LTEXT "Rows per measure",IDC_TEXT_ROWSPERMEASURE,162,230,84,8 - GROUPBOX "OpenMPT Version Info",IDC_FRAME_MPTVERSION,6,251,246,48 - RTEXT "IDC_TEXT_CREATEDWITH",IDC_TEXT_CREATEDWITH,18,267,54,8 - RTEXT "IDC_TEXT_SAVEDWITH",IDC_TEXT_SAVEDWITH,18,283,54,8 + GROUPBOX "Extended Playback Options (OpenMPT only)",IDC_FRAME_MPTEXT,6,120,246,84 + GROUPBOX "Tempo",IDC_FRAME_TEMPOMODE,6,210,246,48 + GROUPBOX "OpenMPT Version Info",IDC_FRAME_MPTVERSION,6,263,246,48 END IDD_SHOWLOG DIALOG 0, 0, 300, 106 @@ -1654,14 +1658,14 @@ IDD_CONTROL_INSTRUMENTS, DIALOG BEGIN - RIGHTMARGIN, 522 - BOTTOMMARGIN, 168 + RIGHTMARGIN, 500 + BOTTOMMARGIN, 165 END IDD_MODDOC_MODTYPE, DIALOG BEGIN RIGHTMARGIN, 248 - BOTTOMMARGIN, 298 + BOTTOMMARGIN, 310 END IDD_SHOWLOG, DIALOG Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/mptrack/resource.h 2012-09-18 20:09:56 UTC (rev 1352) @@ -819,6 +819,7 @@ #define IDC_CHK_MIDICCBUG 2322 #define IDC_CHK_OLDRANDOM 2323 #define IDC_CHECKCAPTURE 2324 +#define IDC_CHK_OLDPITCH 2324 #define IDC_SPINMOVEMAPPING 2325 #define IDC_BUTTON_HALF 2326 #define IDC_BUTTON_DOUBLE 2327 @@ -936,6 +937,7 @@ #define IDC_RESTORE_KEYMAP 2436 #define IDC_SAMPLE_AUTOTUNE 2437 #define IDC_FIND 2438 +#define IDC_PITCHWHEELDEPTH 2439 #define ID_FILE_NEWMOD 32771 #define ID_FILE_NEWXM 32772 #define ID_FILE_NEWS3M 32773 @@ -1213,7 +1215,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 535 #define _APS_NEXT_COMMAND_VALUE 44605 -#define _APS_NEXT_CONTROL_VALUE 2439 +#define _APS_NEXT_CONTROL_VALUE 2440 #define _APS_NEXT_SYMED_VALUE 901 #endif #endif Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/mptrack/version.h 2012-09-18 20:09:56 UTC (rev 1352) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 02 -#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/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2012-09-18 20:09:56 UTC (rev 1352) @@ -735,6 +735,7 @@ if(instrument != nullptr) { ITInstrToMPT(lpStream + inspos[nins], instrument, itHeader.cmwt, dwMemLength - inspos[nins]); + instrument->midiPWD = itHeader.pwd; } } } @@ -1175,6 +1176,16 @@ itHeader.speed = m_nDefaultSpeed; itHeader.tempo = min(m_nDefaultTempo, 255); //Limit this one to 255, we save the real one as an extension below. itHeader.sep = 128; // pan separation + // IT doesn't have a per-instrument Pitch Wheel Depth setting, so we just store the first non-zero PWD setting in the header. + for(INSTRUMENTINDEX ins = 1; ins < GetNumInstruments(); ins++) + { + if(Instruments[ins] != nullptr && Instruments[ins]->midiPWD != 0) + { + itHeader.pwd = abs(Instruments[ins]->midiPWD); + break; + } + } + dwHdrPos = sizeof(itHeader) + itHeader.ordnum; // Channel Pan and Volume memset(itHeader.chnpan, 0xA0, 64); @@ -2063,6 +2074,12 @@ WriteInstrumentPropertyForAllInstruments('PVEH', sizeof(ModInstrument().nPluginVelocityHandling), f, nInstruments); WriteInstrumentPropertyForAllInstruments('PVOH', sizeof(ModInstrument().nPluginVolumeHandling), f, nInstruments); + if(!(GetType() & MOD_TYPE_XM)) + { + // XM instrument headers already have support for this + WriteInstrumentPropertyForAllInstruments('MPWD', sizeof(ModInstrument().midiPWD), f, nInstruments); + } + if(GetType() & MOD_TYPE_MPT) { UINT maxNodes = 0; @@ -2324,7 +2341,7 @@ *pInterpretMptMade = true; // HACK: Reset mod flags to default values here, as they are not always written. - m_ModFlags = 0; + m_ModFlags.reset(); // Case macros. #define CASE(id, data) \ Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2012-09-18 20:09:56 UTC (rev 1352) @@ -99,7 +99,7 @@ } // New candidate slot is first unused sample slot. - candidateSlot = std::find(usedSamples.begin() + 1, usedSamples.end(), false) - usedSamples.begin(); + candidateSlot = static_cast<SAMPLEINDEX>(std::find(usedSamples.begin() + 1, usedSamples.end(), false) - usedSamples.begin()); } else { // No unused sampel slots: Give up :( @@ -376,7 +376,7 @@ if((insHeader.instrument.midiChannel | insHeader.instrument.midiEnabled | insHeader.instrument.midiProgram | insHeader.instrument.muteComputer | insHeader.instrument.pitchWheelRange) != 0) { // Definitely not MPT. (or any other tracker) - isFT2 = true; + //isFT2 = true; } // Read sample headers @@ -712,7 +712,7 @@ if ((note <= 12) || (note > 96+12)) note = 0; else note -= 12; uint8 vol = 0; - if (p->volcmd) + if (p->volcmd != VOLCMD_NONE) { switch(p->volcmd) { Modified: trunk/OpenMPT/soundlib/Loaders.h =================================================================== --- trunk/OpenMPT/soundlib/Loaders.h 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/soundlib/Loaders.h 2012-09-18 20:09:56 UTC (rev 1352) @@ -57,7 +57,7 @@ // Returns false if position is invalid. bool Seek(size_t position) { - if(position < streamLength) + if(position <= streamLength) { streamPos = position; return true; @@ -292,7 +292,8 @@ float target; if(Read(target)) { - uint32 temp = LittleEndian(*reinterpret_cast<uint32 *>(&target)); + uint32 temp = *reinterpret_cast<uint32 *>(&target); + SwapBytesLE(temp); return *reinterpret_cast<float *>(&temp); } else { @@ -307,7 +308,8 @@ float target; if(Read(target)) { - uint32 temp = BigEndian(*reinterpret_cast<uint32 *>(&target)); + uint32 temp = *reinterpret_cast<uint32 *>(&target); + SwapBytesBE(temp); return *reinterpret_cast<float *>(&temp); } else { Modified: trunk/OpenMPT/soundlib/ModInstrument.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModInstrument.cpp 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/soundlib/ModInstrument.cpp 2012-09-18 20:09:56 UTC (rev 1352) @@ -141,6 +141,7 @@ nMidiProgram = 0; nMidiChannel = 0; nMidiDrumKey = 0; + midiPWD = 2; nPPC = NOTE_MIDDLEC - 1; nPPS = 0; @@ -196,6 +197,10 @@ nMidiChannel = 1; } + // FT2 only has signed Pitch Wheel Depth, and it's limited to 0...36 (in the GUI, at least. As you would expect it from FT2, this value is actually not sanitized on load). + midiPWD = abs(midiPWD); + Limit(midiPWD, int8(0), int8(36)); + nGlobalVol = 64; nPan = 128; Modified: trunk/OpenMPT/soundlib/ModInstrument.h =================================================================== --- trunk/OpenMPT/soundlib/ModInstrument.h 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/soundlib/ModInstrument.h 2012-09-18 20:09:56 UTC (rev 1352) @@ -57,6 +57,7 @@ uint8 nMidiProgram; // MIDI Program (1...128). 0 = Don't send. uint8 nMidiChannel; // MIDI Channel (1...16). 0 = Don't send. 17 = Mapped (Send to tracker channel modulo 16). uint8 nMidiDrumKey; // Drum set note mapping (currently only used by the .MID loader) + int8 midiPWD; // MIDI Pitch Wheel Depth in semitones uint8 nNNA; // New note action uint8 nDCT; // Duplicate check type (i.e. which condition will trigger the duplicate note action) @@ -75,8 +76,8 @@ uint8 nFilterMode; // Default filter mode uint8 nPluginVelocityHandling; // How to deal with plugin velocity uint8 nPluginVolumeHandling; // How to deal with plugin volume + uint16 wPitchToTempoLock; // BPM at which the samples assigned to this instrument loop correctly uint32 nResampling; // Resampling mode - uint16 wPitchToTempoLock; // BPM at which the samples assigned to this instrument loop correctly CTuning *pTuning; // sample tuning assigned to this instrument static CTuning *s_DefaultTuning; Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-09-18 20:09:56 UTC (rev 1352) @@ -2667,7 +2667,13 @@ int actualParam = abs(param); int pitchBend = 0; - if(doFineSlides && actualParam >= 0xE0) + // Old MIDI Pitch Bends: + // - Applied on every tick + // - No fine pitch slides (they are interpreted as normal slides) + // New MIDI Pitch Bends: + // - Behaviour identical to sample pitch bends if the instrument's PWD parameter corresponds to the actual VSTi setting. + + if(doFineSlides && actualParam >= 0xE0 && !GetModFlag(MSF_OLD_MIDI_PITCHBENDS)) { if(m_SongFlags[SONG_FIRSTTICK]) { @@ -2679,7 +2685,7 @@ pitchBend *= 4; } } - } else + } else if(!m_SongFlags[SONG_FIRSTTICK] || GetModFlag(MSF_OLD_MIDI_PITCHBENDS)) { // Regular slide pitchBend = param * 4; @@ -2690,7 +2696,12 @@ IMixPlugin *plugin = GetChannelInstrumentPlugin(nChn); if(plugin != nullptr) { - plugin->MidiPitchBend(GetBestMidiChannel(nChn), pitchBend, 0); + int8 pwd = 13; // Early OpenMPT legacy... Actually it's not *exactly* 13, but close enough... + if(Chn[nChn].pModInstrument != nullptr) + { + pwd = Chn[nChn].pModInstrument->midiPWD; + } + plugin->MidiPitchBend(GetBestMidiChannel(nChn), pitchBend, pwd); } } } Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2012-09-18 19:52:29 UTC (rev 1351) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2012-09-18 20:09:56 UTC (rev 1352) @@ -10,17 +10,15 @@ #include "stdafx.h" -#include "../mptrack/mptrack.h" +#ifdef MODPLUG_TRACKER #include "../mptrack/mainfrm.h" #include "../mptrack/moddoc.h" +#endif // MODPLUG_TRACKER #include "../mptrack/version.h" #include "../mptrack/serialization_utils.h" #include "sndfile.h" #include "tuningcollection.h" #include "../common/StringFixer.h" -#include <vector> -#include <list> -#include <algorithm> #ifndef NO_COPYRIGHT #ifndef NO_MMCMP_SUPPORT @@ -192,6 +190,7 @@ PFLG PitchEnv.dwFlag AFLG PanEnv.dwFlags VFLG VolEnv.dwFlags +MPWD MIDI Pitch Wheel Depth ----------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------*/ @@ -314,6 +313,7 @@ WRITE_MPTHEADER_sized_member( PitchEnv.dwFlags , uint32 , PFLG ) WRITE_MPTHEADER_sized_member( PanEnv.dwFlags , uint32 , AFLG ) WRITE_MPTHEADER_sized_member( VolEnv.dwFlags , uint32 , VFLG ) +WRITE_MPTHEADER_sized_member( midiPWD , int8 , MPWD ) } // -------------------------------------------------------------------------------------------- @@ -396,6 +396,7 @@ GET_MPTHEADER_sized_member( PitchEnv.dwFlags , DWORD , PFLG ) GET_MPTHEADER_sized_member( PanEnv.dwFlags , DWORD , AFLG ) GET_MPTHEADER_sized_member( VolEnv.dwFlags , DWORD , VFLG ) +GET_MPTHEADER_sized_member( midiPWD , int8 , MPWD ) } return pointer; @@ -438,19 +439,23 @@ m_nRepeatCount = 0; m_nSeqOverride = ORDERINDEX_INVALID; m_bPatternTransitionOccurred = false; - m_nDefaultRowsPerBeat = m_nCurrentRowsPerBeat = (CMainFrame::GetSettings().m_nRowHighlightBeats) ? CMainFrame::GetSettings().m_nRowHighlightBeats : 4; - m_nDefaultRowsPerMeasure = m_nCurrentRowsPerMeasure = (CMainFrame::GetSettings().m_nRowHighlightMeasures >= m_nDefaultRowsPerBeat) ? CMainFrame::GetSettings().m_nRowHighlightMeasures : m_nDefaultRowsPerBeat * 4; m_nTempoMode = tempo_mode_classic; m_bIsRendering = false; #ifdef MODPLUG_TRACKER m_lockOrderStart = m_lockOrderEnd = ORDERINDEX_INVALID; + m_pModDoc = nullptr; + + m_nDefaultRowsPerBeat = m_nCurrentRowsPerBeat = (CMainFrame::GetSettings().m_nRowHighlightBeats) ? CMainFrame::GetSettings().m_nRowHighlightBeats : 4; + m_nDefaultRowsPerMeasure = m_nCurrentRowsPerMeasure = (CMainFrame::GetSettings().m_nRowHighlightMeasures >= m_nDefaultRowsPerBeat) ? CMainFrame::GetSettings().m_nRowHighlightMeasures : m_nDefaultRowsPerBeat * 4; +#else + m_nDefaultRowsPerBeat = m_nCurrentRowsPerBeat = 4; + m_nDefaultRowsPerMeasure = m_nCurrentRowsPerMeasure = 16; #endif // MODPLUG_TRACKER - m_ModFlags = 0; + m_ModFlags.reset(); m_bITBidiMode = false; - m_pModDoc = nullptr; m_dwLastSavedWithVersion=0; m_dwCreatedWithVersion=0; m_bChannelMuteTogglePending.reset(); @@ -487,10 +492,17 @@ } +#ifdef MODPLUG_TRACKER BOOL CSoundFile::Create(LPCBYTE lpStream, CModDoc *pModDoc, DWORD dwMemLength) //---------------------------------------------------------------------------- { m_pModDoc = pModDoc; +#else +BOOL CSoundFile::Create(LPCBYTE lpStream, void *pModDoc, DWORD dwMemLength) +//-------------------------------------------------------------------------- +{ +#endif // MODPLUG_TRACKER + m_nType = MOD_TYPE_NONE; m_SongFlags.reset(); m_nChannels = 0; @@ -738,6 +750,7 @@ string notFoundText; std::vector<PLUGINDEX> notFoundIDs; +#ifndef NO_VST // Load plugins only when m_pModDoc is valid. (can be invalid for example when examining module samples in treeview. if (gpMixPluginCreateProc && GetpModDoc() != nullptr) { @@ -797,12 +810,13 @@ CTrackApp::OpenURL(sUrl); } } +#endif // NO_VST // Set up mix levels m_pConfig->SetMixLevels(m_nMixLevels); RecalculateGainForAllPlugs(); - if(m_nType != MOD_TYPE_NONE) + if(GetType() != MOD_TYPE_NONE) { SetModSpecsPointer(m_pModSpecs, m_nType); const ORDERINDEX nMinLength = (std::min)(ModSequenceSet::s_nCacheSize, GetModSpecifications().ordersMax); @@ -1306,11 +1320,13 @@ Chn[nChn].Reset(ModChannel::resetTotal, *this, nChn); +#ifdef MODPLUG_TRACKER if(GetpModDoc() != nullptr) { GetpModDoc()->Record1Channel(nChn, false); GetpModDoc()->Record2Channel(nChn, false); } +#endif // MODPLUG_TRACK... [truncated message content] |
From: <sag...@us...> - 2012-09-21 19:35:43
|
Revision: 1356 http://modplug.svn.sourceforge.net/modplug/?rev=1356&view=rev Author: saga-games Date: 2012-09-21 19:35:36 +0000 (Fri, 21 Sep 2012) Log Message: ----------- [New] Wave Export: Added possibility to loop a song a given number of times during export (http://bugs.openmpt.org/view.php?id=221). Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/mod2wave.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2012-09-20 23:44:38 UTC (rev 1355) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2012-09-21 19:35:36 UTC (rev 1356) @@ -71,24 +71,26 @@ END_MESSAGE_MAP() -CWaveConvert::CWaveConvert(CWnd *parent, ORDERINDEX nMinOrder, ORDERINDEX nMaxOrder): - CDialog(IDD_WAVECONVERT, parent) -//----------------------------------------------------------------------------------- +CWaveConvert::CWaveConvert(CWnd *parent, ORDERINDEX minOrder, ORDERINDEX maxOrder, ORDERINDEX numOrders) : CDialog(IDD_WAVECONVERT, parent) +//----------------------------------------------------------------------------------------------------------------------------------------- { m_bGivePlugsIdleTime = false; m_bNormalize = false; m_bHighQuality = false; m_bSelectPlay = false; - if(nMinOrder != ORDERINDEX_INVALID && nMaxOrder != ORDERINDEX_INVALID) + if(minOrder != ORDERINDEX_INVALID && maxOrder != ORDERINDEX_INVALID) { // render selection - m_nMinOrder = nMinOrder; - m_nMaxOrder = nMaxOrder; + m_nMinOrder = minOrder; + m_nMaxOrder = maxOrder; m_bSelectPlay = true; } else { m_nMinOrder = m_nMaxOrder = 0; } + loopCount = 1; + m_nNumOrders = numOrders; + m_dwFileLimit = 0; m_dwSongLimit = 0; MemsetZero(WaveFormat); @@ -107,8 +109,9 @@ CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_COMBO1, m_CbnSampleRate); DDX_Control(pDX, IDC_COMBO2, m_CbnSampleFormat); - DDX_Control(pDX, IDC_EDIT3, m_EditMinOrder); - DDX_Control(pDX, IDC_EDIT4, m_EditMaxOrder); + DDX_Control(pDX, IDC_SPIN3, m_SpinMinOrder); + DDX_Control(pDX, IDC_SPIN4, m_SpinMaxOrder); + DDX_Control(pDX, IDC_SPIN5, m_SpinLoopCount); } @@ -130,9 +133,14 @@ // -! NEW_FEATURE#0024 SetDlgItemInt(IDC_EDIT3, m_nMinOrder); + m_SpinMinOrder.SetRange(0, m_nNumOrders); SetDlgItemInt(IDC_EDIT4, m_nMaxOrder); - + m_SpinMaxOrder.SetRange(0, m_nNumOrders); + SetDlgItemInt(IDC_EDIT5, loopCount, FALSE); + m_SpinLoopCount.SetRange(1, int16_max); + + for (size_t i = 0; i < CountOf(nMixingRates); i++) { UINT n = nMixingRates[i]; @@ -170,6 +178,7 @@ } } } + UpdateDialog(); return TRUE; } @@ -196,8 +205,10 @@ ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT1), (m_dwFileLimit) ? TRUE : FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT2), (m_dwSongLimit) ? TRUE : FALSE); BOOL bSel = IsDlgButtonChecked(IDC_RADIO2) ? TRUE : FALSE; - m_EditMinOrder.EnableWindow(bSel); - m_EditMaxOrder.EnableWindow(bSel); + GetDlgItem(IDC_EDIT3)->EnableWindow(bSel); + GetDlgItem(IDC_EDIT4)->EnableWindow(bSel); + GetDlgItem(IDC_EDIT5)->EnableWindow(!bSel); + m_SpinLoopCount.EnableWindow(!bSel); } @@ -263,8 +274,9 @@ if (m_dwFileLimit) m_dwFileLimit = GetDlgItemInt(IDC_EDIT1, NULL, FALSE); if (m_dwSongLimit) m_dwSongLimit = GetDlgItemInt(IDC_EDIT2, NULL, FALSE); m_bSelectPlay = IsDlgButtonChecked(IDC_RADIO2) != BST_UNCHECKED; - m_nMinOrder = (ORDERINDEX)GetDlgItemInt(IDC_EDIT3, NULL, FALSE); - m_nMaxOrder = (ORDERINDEX)GetDlgItemInt(IDC_EDIT4, NULL, FALSE); + m_nMinOrder = static_cast<ORDERINDEX>(GetDlgItemInt(IDC_EDIT3, NULL, FALSE)); + m_nMaxOrder = static_cast<ORDERINDEX>(GetDlgItemInt(IDC_EDIT4, NULL, FALSE)); + loopCount = static_cast<uint16>(GetDlgItemInt(IDC_EDIT5, NULL, FALSE)); if (m_nMaxOrder < m_nMinOrder) m_bSelectPlay = false; //m_bHighQuality = IsDlgButtonChecked(IDC_CHECK3) != BST_UNCHECKED; //rewbs.resamplerConf - we don't want this anymore. m_bNormalize = IsDlgButtonChecked(IDC_CHECK5) != BST_UNCHECKED; @@ -638,7 +650,6 @@ SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); int oldVol = m_pSndFile->GetMasterVolume(); - int nOldRepeat = m_pSndFile->GetRepeatCount(); CSoundFile::gdwSoundSetup |= SNDMIX_DIRECTTODISK; CSoundFile::gdwMixingFreq = m_pWaveFormat->nSamplesPerSec; CSoundFile::gnBitsPerSample = m_pWaveFormat->wBitsPerSample; @@ -657,9 +668,9 @@ { m_bNormalize = false; } + m_pSndFile->ResetChannels(); CSoundFile::InitPlayer(TRUE); - m_pSndFile->SetRepeatCount(0); if ((!m_dwFileLimit) || (m_dwFileLimit > 2047*1024)) m_dwFileLimit = 2047*1024; // 2GB m_dwFileLimit <<= 10; // File Header @@ -692,7 +703,7 @@ // calculate maximum samples ULONGLONG max = ullMaxSamples; - ULONGLONG l = ((ULONGLONG)m_pSndFile->GetSongTime()) * m_pWaveFormat->nSamplesPerSec; + ULONGLONG l = ((ULONGLONG)m_pSndFile->GetSongTime()) * m_pWaveFormat->nSamplesPerSec * (ULONGLONG)Util::Max(1, 1 + m_pSndFile->GetRepeatCount()); if (m_nMaxPatterns > 0) { DWORD dwOrds = m_pSndFile->Order.GetLengthFirstEmpty(); @@ -827,7 +838,9 @@ break; } } + CMainFrame::GetMainFrame()->StopRenderer(m_pSndFile); //rewbs.VSTTimeInfo + if (m_bNormalize) { DWORD dwLength = datahdr.length; @@ -901,7 +914,6 @@ fwrite(&datahdr, sizeof(datahdr), 1, f); fclose(f); CSoundFile::gdwSoundSetup &= ~SNDMIX_DIRECTTODISK; - m_pSndFile->SetRepeatCount(nOldRepeat); m_pSndFile->m_nMaxOrderPosition = 0; if (m_bNormalize) { @@ -1030,7 +1042,7 @@ wdh.id_data = IFFID_data; wdh.length = 0; data_ofs = 0; - if (bSaveWave) + if(bSaveWave) { fwrite(&wfh, 1, sizeof(wfh), f); chunk.id_data = IFFID_fmt; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2012-09-20 23:44:38 UTC (rev 1355) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2012-09-21 19:35:36 UTC (rev 1356) @@ -1532,7 +1532,7 @@ _splitpath(GetPathName(), NULL, NULL, fname, NULL); strcat_s(fname, CountOf(fname), ".wav"); - CWaveConvert wsdlg(pMainFrm, nMinOrder, nMaxOrder); + CWaveConvert wsdlg(pMainFrm, nMinOrder, nMaxOrder, m_SndFile.Order.GetLengthTailTrimmed() - 1); if (wsdlg.DoModal() != IDOK) return; FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "wav", fname, @@ -1610,6 +1610,7 @@ UINT pos = m_SndFile.GetCurrentPos(); pMainFrm->PauseMod(); + int oldRepeat = m_SndFile.GetRepeatCount(); for(int i = 0 ; i < nRenderPasses ; i++) { @@ -1675,12 +1676,16 @@ m_SndFile.visitedSongRows.Initialize(true); m_SndFile.SetCurrentPos(0); m_SndFile.m_SongFlags.reset(SONG_PATTERNLOOP); - if (wsdlg.m_bSelectPlay) + if(wsdlg.m_bSelectPlay) { m_SndFile.SetCurrentOrder(wsdlg.m_nMinOrder); m_SndFile.GetLength(eAdjust, wsdlg.m_nMinOrder, 0); // adjust playback variables / visited rows vector m_SndFile.m_nCurrentOrder = wsdlg.m_nMinOrder; m_SndFile.m_nMaxOrderPosition = wsdlg.m_nMaxOrder + 1; + m_SndFile.SetRepeatCount(0); + } else + { + m_SndFile.SetRepeatCount(Util::Max(0, wsdlg.loopCount - 1)); } if(dwcdlg.DoModal() != IDOK) break; } @@ -1711,6 +1716,7 @@ } } + m_SndFile.SetRepeatCount(oldRepeat); m_SndFile.SetCurrentPos(pos); CMainFrame::UpdateAudioParameters(TRUE); } Modified: trunk/OpenMPT/mptrack/mod2wave.h =================================================================== --- trunk/OpenMPT/mptrack/mod2wave.h 2012-09-20 23:44:38 UTC (rev 1355) +++ trunk/OpenMPT/mptrack/mod2wave.h 2012-09-21 19:35:36 UTC (rev 1356) @@ -24,9 +24,11 @@ ULONGLONG m_dwFileLimit; DWORD m_dwSongLimit; bool m_bSelectPlay, m_bNormalize, m_bHighQuality, m_bGivePlugsIdleTime; - ORDERINDEX m_nMinOrder, m_nMaxOrder; + ORDERINDEX m_nMinOrder, m_nMaxOrder, m_nNumOrders; + int loopCount; + CComboBox m_CbnSampleRate, m_CbnSampleFormat; - CEdit m_EditMinOrder, m_EditMaxOrder; + CSpinButtonCtrl m_SpinLoopCount, m_SpinMinOrder, m_SpinMaxOrder; // -> CODE#0024 // -> DESC="wav export update" @@ -35,7 +37,7 @@ bool m_bInstrumentMode; // Render by instrument public: - CWaveConvert(CWnd *parent, ORDERINDEX nMinOrder = ORDERINDEX_INVALID, ORDERINDEX nMaxOrder = ORDERINDEX_INVALID); + CWaveConvert(CWnd *parent, ORDERINDEX minOrder, ORDERINDEX maxOrder, ORDERINDEX numOrders); public: void UpdateDialog(); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2012-09-20 23:44:38 UTC (rev 1355) +++ trunk/OpenMPT/mptrack/mptrack.rc 2012-09-21 19:35:36 UTC (rev 1356) @@ -427,35 +427,40 @@ PUSHBUTTON "Default Settings",IDC_BUTTON_DEFAULT_RESAMPLING,186,180,66,12 END -IDD_WAVECONVERT DIALOGEX 0, 0, 262, 221 +IDD_WAVECONVERT DIALOGEX 0, 0, 262, 226 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Wave Convert" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,204,12,50,14 PUSHBUTTON "Cancel",IDCANCEL,204,30,50,14 - GROUPBOX "Render",IDC_STATIC,6,6,192,114 COMBOBOX IDC_COMBO1,18,18,54,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO2,78,18,73,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Change Player &Options",IDC_PLAYEROPTIONS,18,36,81,14,BS_CENTER + CONTROL "&High quality resampling",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,102,36,84,10 + CONTROL "&Channel mode (one file per channel)",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,54,168,12 + CONTROL "&Instrument mode (one file per instrument)",IDC_CHECK6, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,66,168,12 CONTROL "&Normalize Output (experimental)",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,84,168,12 - CONTROL "&High quality resampling",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,112,36,84,10 CONTROL "Slow &render (for Kontakt+DFD)",IDC_GIVEPLUGSIDLETIME, "Button",BS_AUTOCHECKBOX | BS_LEFT | BS_MULTILINE | WS_TABSTOP,18,97,168,12 - GROUPBOX "Limit",IDC_STATIC,6,126,192,90 CONTROL "Limit file &size to: (KBytes)",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,138,111,11 EDITTEXT IDC_EDIT1,138,138,50,12,ES_AUTOHSCROLL CONTROL "Limit song &length to: (seconds)",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,158,111,10 EDITTEXT IDC_EDIT2,138,157,50,12,ES_AUTOHSCROLL LTEXT "Play:",IDC_STATIC,18,174,37,8 - CONTROL "&Entire song",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,18,186,104,10 - CONTROL "From &position",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,18,199,58,10 - EDITTEXT IDC_EDIT3,78,198,24,12,ES_AUTOHSCROLL | ES_NUMBER - CTEXT "to",IDC_STATIC,105,200,8,8 - EDITTEXT IDC_EDIT4,117,198,24,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "&Channel mode (one file per channel)",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,54,168,12 - CONTROL "&Instrument mode (one file per instrument)",IDC_CHECK6, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,66,168,12 + CONTROL "&Entire song",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | BS_VCENTER,18,186,54,12 + CONTROL "From &position",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON | BS_VCENTER,18,204,58,12 + EDITTEXT IDC_EDIT5,78,186,36,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SPIN5,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,102,192,11,11 + LTEXT "times",IDC_STATIC,121,186,71,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT3,78,204,36,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SPIN3,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,102,210,11,11 + CTEXT "to",IDC_STATIC,120,204,8,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT4,132,204,36,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SPIN4,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,156,210,11,11 + GROUPBOX "Render",IDC_STATIC,6,6,192,114 + GROUPBOX "Limit",IDC_STATIC,6,126,192,96 END IDD_PROGRESS DIALOG 0, 0, 186, 55 @@ -690,12 +695,12 @@ EDITTEXT IDC_EDIT_SAMPLE,90,6,35,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin6",IDC_SPIN_SAMPLE,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,118,4,11,14 COMBOBOX IDC_COMBO_ZOOM,131,6,41,89,CBS_DROPDOWNLIST | WS_VSCROLL - EDITTEXT IDC_EDIT7,57,30,36,12,ES_NUMBER + EDITTEXT IDC_EDIT7,57,30,36,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin1",IDC_SPIN7,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,87,29,11,11 - EDITTEXT IDC_EDIT8,57,43,36,12,ES_NUMBER + EDITTEXT IDC_EDIT8,57,43,36,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin1",IDC_SPIN8,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,87,42,11,11 CONTROL "Set Pan",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,9,58,42,10 - EDITTEXT IDC_EDIT9,57,56,36,12,ES_NUMBER + EDITTEXT IDC_EDIT9,57,56,36,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin1",IDC_SPIN9,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,87,56,11,11 EDITTEXT IDC_EDIT5,48,70,45,12,ES_AUTOHSCROLL CONTROL "Spin1",IDC_SPIN5,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,87,69,11,11 @@ -713,11 +718,11 @@ EDITTEXT IDC_EDIT4,212,83,45,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin1",IDC_SPIN4,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,253,83,11,11 COMBOBOX IDC_COMBO3,275,59,47,70,CBS_DROPDOWNLIST | WS_TABSTOP - EDITTEXT IDC_EDIT15,327,59,32,12,ES_NUMBER + EDITTEXT IDC_EDIT15,327,59,32,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Depth",IDC_SPIN12,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,353,59,11,11 - EDITTEXT IDC_EDIT14,275,83,38,12,ES_NUMBER + EDITTEXT IDC_EDIT14,275,83,38,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Sweep",IDC_SPIN11,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,305,84,11,11 - EDITTEXT IDC_EDIT16,321,83,38,12,ES_NUMBER + EDITTEXT IDC_EDIT16,321,83,38,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Rate",IDC_SPIN13,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,353,83,11,11 CONTROL "Time stretching",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | BS_FLAT | NOT WS_VISIBLE | WS_TABSTOP,446,36,68,11 COMBOBOX IDC_COMBO4,400,35,39,61,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP @@ -817,11 +822,11 @@ CTEXT "MIDI Bank",IDC_STATIC,245,152,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT11,321,152,37,12,ES_AUTOHSCROLL CONTROL "",IDC_SPIN11,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,351,153,8,11 - LTEXT "P. Bend Range:",IDC_STATIC,366,101,54,8,SS_CENTERIMAGE + CTEXT "P. Bend Range",IDC_STATIC,366,99,52,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_PITCHWHEELDEPTH,420,99,36,12,ES_AUTOHSCROLL CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS | WS_TABSTOP,444,102,11,11 - LTEXT "Volume Command Handling:",IDC_STATIC,366,114,90,8,SS_CENTERIMAGE - COMBOBOX IDC_PLUGIN_VOLUMESTYLE,366,126,90,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CTEXT "Volume Command Handling",IDC_STATIC,366,116,90,10,SS_CENTERIMAGE,WS_EX_STATICEDGE + COMBOBOX IDC_PLUGIN_VOLUMESTYLE,366,128,90,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Volume commands with note are Velocities",IDC_PLUGIN_VELOCITYSTYLE, "Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_MULTILINE | BS_FLAT | WS_TABSTOP,366,141,90,24 COMBOBOX IDC_COMBOTUNING,368,38,88,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -1601,7 +1606,7 @@ IDD_WAVECONVERT, DIALOG BEGIN RIGHTMARGIN, 211 - BOTTOMMARGIN, 218 + BOTTOMMARGIN, 223 END IDD_OPTIONS_KEYBOARD, DIALOG Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2012-09-20 23:44:38 UTC (rev 1355) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2012-09-21 19:35:36 UTC (rev 1356) @@ -766,7 +766,7 @@ } //Handle Repeat position - if (m_nRepeatCount > 0) m_nRepeatCount--; + //if (m_nRepeatCount > 0) m_nRepeatCount--; m_nCurrentOrder = nRestartPosOverride; m_SongFlags.reset(SONG_BREAKTOROW); //If restart pos points to +++, move along @@ -818,7 +818,7 @@ if(m_nRepeatCount) { // repeat count == -1 means repeat infinitely. - if (m_nRepeatCount > 0) + if(m_nRepeatCount > 0) { m_nRepeatCount--; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-09-21 21:10:46
|
Revision: 1357 http://modplug.svn.sourceforge.net/modplug/?rev=1357&view=rev Author: saga-games Date: 2012-09-21 21:10:38 +0000 (Fri, 21 Sep 2012) Log Message: ----------- [Ref] Some oneliner refactorings. Modified Paths: -------------- trunk/OpenMPT/common/Reporting.cpp trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/MIDIMacroDialog.cpp trunk/OpenMPT/mptrack/Stdafx.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/test/test.cpp trunk/OpenMPT/soundlib/MIDIEvents.cpp trunk/OpenMPT/soundlib/MIDIEvents.h trunk/OpenMPT/soundlib/ModSample.cpp Modified: trunk/OpenMPT/common/Reporting.cpp =================================================================== --- trunk/OpenMPT/common/Reporting.cpp 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/common/Reporting.cpp 2012-09-21 21:10:38 UTC (rev 1357) @@ -10,12 +10,17 @@ #include "Stdafx.h" #include "Reporting.h" +#ifdef MODPLUG_TRACKER #include "../mptrack/Mainfrm.h" +#else +#include <iostream> +#endif // MODPLUG_TRACKER UINT Reporting::ShowNotification(const char *text, const char *caption, UINT flags, const CWnd *parent) //----------------------------------------------------------------------------------------------------- { +#ifdef MODPLUG_TRACKER CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); if(pMainFrm != nullptr && pMainFrm->GetInputHandler() != nullptr) @@ -35,6 +40,10 @@ } return result; +#else + std::cout << caption << std::endl << text << std::endl; + return 0; +#endif // MODPLUG_TRACKER } Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2012-09-21 21:10:38 UTC (rev 1357) @@ -659,13 +659,7 @@ // Command Manipulation //------------------------------------------------------- -CString CCommandSet::Add(KeyCombination kc, CommandID cmd, bool overwrite) -//------------------------------------------------------------------------ -{ - return Add(kc, cmd, overwrite, -1); -} - CString CCommandSet::Add(KeyCombination kc, CommandID cmd, bool overwrite, int pos) //--------------------------------------------------------------------------------- { @@ -704,13 +698,15 @@ } else { - if (crossContext) { + if (crossContext) + { report += "Warning! the following commands may conflict:\r\n >" + GetCommandText((CommandID)curCmd) + " in " + GetContextText(curKc.ctx) + "\r\n >" + GetCommandText((CommandID)cmd) + " in " + GetContextText(kc.ctx) + "\r\n\r\n"; - Log("%s",report); - } else { + Log("%s", report); + } else + { Remove(curKc, (CommandID)curCmd); report += "Removed due to conflict in same context:\r\n >" + GetCommandText((CommandID)curCmd) + " in " + GetContextText(curKc.ctx) + "\r\n\r\n"; - Log("%s",report); + Log("%s", report); } } } @@ -780,37 +776,35 @@ { //World's biggest, most confusing method. :) //Needs refactoring. Maybe make lots of Rule subclasses, each with their own Enforce() method? - //bool removing = !adding; //for attempt to salvage readability.. KeyCombination curKc; // for looping through key combinations KeyCombination newKc; // for adding new key combinations CString report=""; - if (enforceRule[krAllowNavigationWithSelection]) + if(enforceRule[krAllowNavigationWithSelection]) { // When we get a new navigation command key, we need to // make sure this navigation will work when any selection key is pressed - if (inCmd>=kcStartPatNavigation && inCmd<=kcEndPatNavigation) + if(inCmd >= kcStartPatNavigation && inCmd <= kcEndPatNavigation) {//Check that it is a nav cmd CommandID cmdNavSelection = (CommandID)(kcStartPatNavigationSelect + (inCmd-kcStartPatNavigation)); - for (int kSel=0; kSel<commands[kcSelect].kcList.GetSize(); kSel++) + for(int kSel=0; kSel<commands[kcSelect].kcList.GetSize(); kSel++) {//for all selection modifiers curKc=commands[kcSelect].kcList[kSel]; newKc=inKc; newKc.mod|=curKc.mod; //Add selection modifier's modifiers to this command - if (adding) + if(adding) { Log("Enforcing rule krAllowNavigationWithSelection - adding key:%d with modifier:%d to command: %d\n", kSel, newKc.mod, cmdNavSelection); Add(newKc, cmdNavSelection, false); - } - else - { + } else + { Log("Enforcing rule krAllowNavigationWithSelection - removing key:%d with modifier:%d to command: %d\n", kSel, newKc.mod, cmdNavSelection); Remove(newKc, cmdNavSelection); } } } // Same applies for orderlist navigation - else if (inCmd>=kcStartOrderlistNavigation && inCmd<=kcEndOrderlistNavigation) + else if(inCmd >= kcStartOrderlistNavigation && inCmd <= kcEndOrderlistNavigation) {//Check that it is a nav cmd CommandID cmdNavSelection = (CommandID)(kcStartOrderlistNavigationSelect+ (inCmd-kcStartOrderlistNavigation)); for (int kSel=0; kSel<commands[kcSelect].kcList.GetSize(); kSel++) @@ -818,13 +812,12 @@ curKc=commands[kcSelect].kcList[kSel]; newKc=inKc; newKc.mod|=curKc.mod; //Add selection modifier's modifiers to this command - if (adding) + if(adding) { Log("Enforcing rule krAllowNavigationWithSelection - adding key:%d with modifier:%d to command: %d\n", kSel, newKc.mod, cmdNavSelection); Add(newKc, cmdNavSelection, false); - } - else - { + } else + { Log("Enforcing rule krAllowNavigationWithSelection - removing key:%d with modifier:%d to command: %d\n", kSel, newKc.mod, cmdNavSelection); Remove(newKc, cmdNavSelection); } @@ -832,44 +825,42 @@ } // When we get a new selection key, we need to make sure that // all navigation commands will work with this selection key pressed - else if (inCmd==kcSelect) + else if(inCmd == kcSelect) { // check that is is a selection - for (int curCmd=kcStartPatNavigation; curCmd<=kcEndPatNavigation; curCmd++) + for(int curCmd=kcStartPatNavigation; curCmd<=kcEndPatNavigation; curCmd++) { // for all nav commands - for (int k=0; k<commands[curCmd].kcList.GetSize(); k++) + for(int k = 0; k < commands[curCmd].kcList.GetSize(); k++) { // for all keys for this command CommandID cmdNavSelection = (CommandID)(kcStartPatNavigationSelect + (curCmd-kcStartPatNavigation)); newKc=commands[curCmd].kcList[k]; // get all properties from the current nav cmd key newKc.mod|=inKc.mod; // and the new selection modifier - if (adding) + if(adding) { Log("Enforcing rule krAllowNavigationWithSelection - adding key:%d with modifier:%d to command: %d\n", curCmd, inKc.mod, cmdNavSelection); Add(newKc, cmdNavSelection, false); - } - else - { + } else + { Log("Enforcing rule krAllowNavigationWithSelection - removing key:%d with modifier:%d to command: %d\n", curCmd, inKc.mod, cmdNavSelection); Remove(newKc, cmdNavSelection); } } } // end all nav commands - for (int curCmd=kcStartOrderlistNavigation; curCmd<=kcEndOrderlistNavigation; curCmd++) + for(int curCmd = kcStartOrderlistNavigation; curCmd <= kcEndOrderlistNavigation; curCmd++) {// for all nav commands - for (int k=0; k<commands[curCmd].kcList.GetSize(); k++) + for(int k = 0; k < commands[curCmd].kcList.GetSize(); k++) {// for all keys for this command CommandID cmdNavSelection = (CommandID)(kcStartOrderlistNavigationSelect+ (curCmd-kcStartOrderlistNavigation)); newKc=commands[curCmd].kcList[k]; // get all properties from the current nav cmd key newKc.mod|=inKc.mod; // and the new selection modifier - if (adding) + if(adding) { Log("Enforcing rule krAllowNavigationWithSelection - adding key:%d with modifier:%d to command: %d\n", curCmd, inKc.mod, cmdNavSelection); Add(newKc, cmdNavSelection, false); - } - else - { + } else + { Log("Enforcing rule krAllowNavigationWithSelection - removing key:%d with modifier:%d to command: %d\n", curCmd, inKc.mod, cmdNavSelection); Remove(newKc, cmdNavSelection); } @@ -878,40 +869,42 @@ } } // end krAllowNavigationWithSelection - if (enforceRule[krAllowSelectionWithNavigation]) + if(enforceRule[krAllowSelectionWithNavigation]) { KeyCombination newKcSel; // When we get a new navigation command key, we need to ensure // all selection keys will work even when this new selection key is pressed - if (inCmd>=kcStartPatNavigation && inCmd<=kcEndPatNavigation) + if(inCmd >= kcStartPatNavigation && inCmd <= kcEndPatNavigation) {//if this is a navigation command - for (int kSel=0; kSel<commands[kcSelect].kcList.GetSize(); kSel++) + for(int kSel = 0; kSel < commands[kcSelect].kcList.GetSize(); kSel++) {//for all deselection modifiers - newKcSel=commands[kcSelect].kcList[kSel]; // get all properties from the selection key - newKcSel.mod|=inKc.mod; // add modifiers from the new nav command - if (adding) { + newKcSel = commands[kcSelect].kcList[kSel]; // get all properties from the selection key + newKcSel.mod |= inKc.mod; // add modifiers from the new nav command + if(adding) + { Log("Enforcing rule krAllowSelectionWithNavigation: adding removing kcSelectWithNav and kcSelectOffWithNav\n"); Add(newKcSel, kcSelectWithNav, false); - } - else { + } else + { Log("Enforcing rule krAllowSelectionWithNavigation: removing kcSelectWithNav and kcSelectOffWithNav\n"); Remove(newKcSel, kcSelectWithNav); } } } // Same for orderlist navigation - if (inCmd>=kcStartOrderlistNavigation&& inCmd<=kcEndOrderlistNavigation) + if(inCmd >= kcStartOrderlistNavigation && inCmd <= kcEndOrderlistNavigation) {//if this is a navigation command - for (int kSel=0; kSel<commands[kcSelect].kcList.GetSize(); kSel++) + for(int kSel = 0; kSel < commands[kcSelect].kcList.GetSize(); kSel++) {//for all deselection modifiers newKcSel=commands[kcSelect].kcList[kSel]; // get all properties from the selection key newKcSel.mod|=inKc.mod; // add modifiers from the new nav command - if (adding) { + if(adding) + { Log("Enforcing rule krAllowSelectionWithNavigation: adding removing kcSelectWithNav and kcSelectOffWithNav\n"); Add(newKcSel, kcSelectWithNav, false); - } - else { + } else + { Log("Enforcing rule krAllowSelectionWithNavigation: removing kcSelectWithNav and kcSelectOffWithNav\n"); Remove(newKcSel, kcSelectWithNav); } @@ -919,28 +912,29 @@ } // When we get a new selection key, we need to ensure it will work even when // any navigation key is pressed - else if (inCmd==kcSelect) + else if(inCmd == kcSelect) { - for (int curCmd=kcStartPatNavigation; curCmd<=kcEndPatNavigation; curCmd++) + for(int curCmd = kcStartPatNavigation; curCmd <= kcEndPatNavigation; curCmd++) {//for all nav commands - for (int k=0; k<commands[curCmd].kcList.GetSize(); k++) + for(int k = 0; k < commands[curCmd].kcList.GetSize(); k++) {// for all keys for this command newKcSel=inKc; // get all properties from the selection key newKcSel.mod|=commands[curCmd].kcList[k].mod; //add the nav keys' modifiers - if (adding) { + if(adding) + { Log("Enforcing rule krAllowSelectionWithNavigation - adding key:%d with modifier:%d to command: %d\n", curCmd, inKc.mod, kcSelectWithNav); Add(newKcSel, kcSelectWithNav, false); - } - else { + } else + { Log("Enforcing rule krAllowSelectionWithNavigation - removing key:%d with modifier:%d to command: %d\n", curCmd, inKc.mod, kcSelectWithNav); Remove(newKcSel, kcSelectWithNav); } } } // end all nav commands - for (int curCmd=kcStartOrderlistNavigation; curCmd<=kcEndOrderlistNavigation; curCmd++) + for(int curCmd = kcStartOrderlistNavigation; curCmd <= kcEndOrderlistNavigation; curCmd++) {//for all nav commands - for (int k=0; k<commands[curCmd].kcList.GetSize(); k++) + for(int k = 0; k <commands[curCmd].kcList.GetSize(); k++) {// for all keys for this command newKcSel=inKc; // get all properties from the selection key newKcSel.mod |= commands[curCmd].kcList[k].mod; //add the nav keys' modifiers @@ -948,8 +942,7 @@ { Log("Enforcing rule krAllowSelectionWithNavigation - adding key:%d with modifier:%d to command: %d\n", curCmd, inKc.mod, kcSelectWithNav); Add(newKcSel, kcSelectWithNav, false); - } - else + } else { Log("Enforcing rule krAllowSelectionWithNavigation - removing key:%d with modifier:%d to command: %d\n", curCmd, inKc.mod, kcSelectWithNav); Remove(newKcSel, kcSelectWithNav); @@ -1002,7 +995,7 @@ if(enforceRule[krAllowSelectCopySelectCombos]) { KeyCombination newKcSel, newKcCopySel; - if (inCmd==kcSelect) + if(inCmd==kcSelect) { // On getting a new selection key, make this selection key work with all copy selects' modifiers // On getting a new selection key, make all copyselects work with this key's modifiers @@ -1013,35 +1006,33 @@ newKcCopySel=commands[kcCopySelect].kcList[k]; newKcCopySel.mod|=inKc.mod; Log("Enforcing rule krAllowSelectCopySelectCombos\n"); - if (adding) + if(adding) { Add(newKcSel, kcSelectWithCopySelect, false); Add(newKcCopySel, kcCopySelectWithSelect, false); - } - else + } else { Remove(newKcSel, kcSelectWithCopySelect); Remove(newKcCopySel, kcCopySelectWithSelect); } } } - if (inCmd==kcCopySelect) + if(inCmd == kcCopySelect) { // On getting a new copyselection key, make this copyselection key work with all selects' modifiers // On getting a new copyselection key, make all selects work with this key's modifiers - for (int k=0; k<commands[kcSelect].kcList.GetSize(); k++) + for(int k = 0; k < commands[kcSelect].kcList.GetSize(); k++) { newKcSel=commands[kcSelect].kcList[k]; - newKcSel.mod|=inKc.mod; + newKcSel.mod |= inKc.mod; newKcCopySel=inKc; newKcCopySel.mod|=commands[kcSelect].kcList[k].mod; Log("Enforcing rule krAllowSelectCopySelectCombos\n"); - if (adding) + if(adding) { Add(newKcSel, kcSelectWithCopySelect, false); Add(newKcCopySel, kcCopySelectWithSelect, false); - } - else + } else { Remove(newKcSel, kcSelectWithCopySelect); Remove(newKcCopySel, kcCopySelectWithSelect); @@ -1757,56 +1748,28 @@ kc.code = VK_OEM_MINUS; pCommands->Add(kc, kcOrderlistPatMinus, false); - kc.code = '0'; - pCommands->Add(kc, kcOrderlistPat0, false); - kc.code = VK_NUMPAD0; - pCommands->Add(kc, kcOrderlistPat0, false); + STATIC_ASSERT(VK_NUMPAD0 + 9 == VK_NUMPAD9); + STATIC_ASSERT(kcOrderlistPat0 + 9 == kcOrderlistPat9); + for(int i = 0; i <= 9; i++) + { + kc.code = '0' + i; + pCommands->Add(kc, static_cast<CommandID>(kcOrderlistPat0 + i), false); + kc.code = VK_NUMPAD0 + i; + pCommands->Add(kc, static_cast<CommandID>(kcOrderlistPat0 + i), false); + } - kc.code = '1'; - pCommands->Add(kc, kcOrderlistPat1, false); - kc.code = VK_NUMPAD1; - pCommands->Add(kc, kcOrderlistPat1, false); + kc.code = 'I'; + pCommands->Add(kc, kcOrderlistPatIgnore, false); - kc.code = '2'; - pCommands->Add(kc, kcOrderlistPat2, false); - kc.code = VK_NUMPAD2; - pCommands->Add(kc, kcOrderlistPat2, false); + kc.code = VK_SPACE; + pCommands->Add(kc, kcOrderlistPatInvalid, false); - kc.code = '3'; - pCommands->Add(kc, kcOrderlistPat3, false); - kc.code = VK_NUMPAD3; - pCommands->Add(kc, kcOrderlistPat3, false); + kc.code = 'L'; + kc.mod = HOTKEYF_CONTROL; + pCommands->Add(kc, kcOrderlistLockPlayback, false); - kc.code = '4'; - pCommands->Add(kc, kcOrderlistPat4, false); - kc.code = VK_NUMPAD4; - pCommands->Add(kc, kcOrderlistPat4, false); - - kc.code = '5'; - pCommands->Add(kc, kcOrderlistPat5, false); - kc.code = VK_NUMPAD5; - pCommands->Add(kc, kcOrderlistPat5, false); - - kc.code = '6'; - pCommands->Add(kc, kcOrderlistPat6, false); - kc.code = VK_NUMPAD6; - pCommands->Add(kc, kcOrderlistPat6, false); - - kc.code = '7'; - pCommands->Add(kc, kcOrderlistPat7, false); - kc.code = VK_NUMPAD7; - pCommands->Add(kc, kcOrderlistPat7, false); - - kc.code = '8'; - pCommands->Add(kc, kcOrderlistPat8, false); - kc.code = VK_NUMPAD8; - pCommands->Add(kc, kcOrderlistPat8, false); - - kc.code = '9'; - pCommands->Add(kc, kcOrderlistPat9, false); - kc.code = VK_NUMPAD9; - pCommands->Add(kc, kcOrderlistPat9, false); - + kc.code = 'U'; + pCommands->Add(kc, kcOrderlistUnlockPlayback, false); } } Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/mptrack/CommandSet.h 2012-09-21 21:10:38 UTC (rev 1357) @@ -1213,8 +1213,7 @@ ~CCommandSet(void); //Population - CString Add(KeyCombination kc, CommandID cmd, bool overwrite); - CString Add(KeyCombination kc, CommandID cmd, bool overwrite, int pos); + CString Add(KeyCombination kc, CommandID cmd, bool overwrite, int pos = -1); CString Remove(KeyCombination kc, CommandID cmd); CString Remove(int pos, CommandID cmd); Modified: trunk/OpenMPT/mptrack/MIDIMacroDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMacroDialog.cpp 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/mptrack/MIDIMacroDialog.cpp 2012-09-21 21:10:38 UTC (rev 1357) @@ -59,14 +59,14 @@ BOOL CMidiMacroSetup::OnInitDialog() //---------------------------------- { - CHAR s[128]; + char s[128]; CDialog::OnInitDialog(); CheckDlgButton(IDC_CHECK1, m_bEmbed ? BST_CHECKED : BST_UNCHECKED); m_EditSFx.SetLimitText(MACRO_LENGTH - 1); m_EditZxx.SetLimitText(MACRO_LENGTH - 1); // Parametered macro selection - for (UINT isfx=0; isfx<16; isfx++) + for(int isfx = 0; isfx < 16; isfx++) { wsprintf(s, "%d (SF%X)", isfx, isfx); m_CbnSFx.AddString(s); @@ -88,7 +88,7 @@ } // Z80...ZFF box - for (int zxx = 0; zxx < 128; zxx++) + for(int zxx = 0; zxx < 128; zxx++) { wsprintf(s, "Z%02X", zxx | 0x80); m_CbnZxx.AddString(s); @@ -201,12 +201,12 @@ void CMidiMacroSetup::UpdateDialog() //---------------------------------- { - CHAR s[MACRO_LENGTH]; + char s[MACRO_LENGTH]; UINT sfx, sfx_preset, zxx; sfx = m_CbnSFx.GetCurSel(); sfx_preset = m_CbnSFxPreset.GetItemData(m_CbnSFxPreset.GetCurSel()); - if (sfx < 16) + if(sfx < 16) { ToggleBoxes(sfx_preset, sfx); memcpy(s, m_MidiCfg.szMidiSFXExt[sfx], MACRO_LENGTH); @@ -215,7 +215,7 @@ } zxx = m_CbnZxx.GetCurSel(); - if (zxx < 0x80) + if(zxx < 0x80) { memcpy(s, m_MidiCfg.szMidiZXXExt[zxx], MACRO_LENGTH); StringFixer::SetNullTerminator(s); @@ -319,7 +319,7 @@ { if(ValidateMacroString(m_EditSFx, m_MidiCfg.szMidiSFXExt[sfx], true)) { - CHAR s[MACRO_LENGTH]; + char s[MACRO_LENGTH]; MemsetZero(s); m_EditSFx.GetWindowText(s, MACRO_LENGTH); StringFixer::SetNullTerminator(s); @@ -342,7 +342,7 @@ { if(ValidateMacroString(m_EditZxx, m_MidiCfg.szMidiZXXExt[zxx], false)) { - CHAR s[MACRO_LENGTH]; + char s[MACRO_LENGTH]; MemsetZero(s); m_EditZxx.GetWindowText(s, MACRO_LENGTH); StringFixer::SetNullTerminator(s); @@ -510,8 +510,7 @@ wnd.SetSel(start - 1, end - 1, true); MessageBeep(MB_OK); return false; - } - else + } else { if(caseChange) { Modified: trunk/OpenMPT/mptrack/Stdafx.h =================================================================== --- trunk/OpenMPT/mptrack/Stdafx.h 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/mptrack/Stdafx.h 2012-09-21 21:10:38 UTC (rev 1357) @@ -40,7 +40,6 @@ #include <afxcmn.h> // MFC support for Windows Common Controls #include <afxcview.h> #include <afxole.h> -#include <winreg.h> #include <windowsx.h> #pragma warning(disable:4201) Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2012-09-21 21:10:38 UTC (rev 1357) @@ -2196,7 +2196,7 @@ plug->MidiSend(dwMidiData); // Sending midi may modify the plug. For now, if MIDI data // is not active sensing or aftertouch messages, set modified. - if(dwMidiData != MIDIEvents::BuildSystemEvent(MIDIEvents::sysActiveSense) && event != MIDIEvents::evPolyAftertouch && event != MIDIEvents::evChannelAftertouch) + if(dwMidiData != MIDIEvents::System(MIDIEvents::sysActiveSense) && event != MIDIEvents::evPolyAftertouch && event != MIDIEvents::evChannelAftertouch) { CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc); } Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2012-09-21 21:10:38 UTC (rev 1357) @@ -3723,7 +3723,7 @@ plug->MidiSend(dwMidiData); // Sending midi may modify the plug. For now, if MIDI data // is not active sensing, set modified. - if(dwMidiData != MIDIEvents::BuildSystemEvent(MIDIEvents::sysActiveSense)) + if(dwMidiData != MIDIEvents::System(MIDIEvents::sysActiveSense)) pMainFrm->ThreadSafeSetModified(pModDoc); } Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2012-09-21 21:10:38 UTC (rev 1357) @@ -2316,9 +2316,9 @@ VSTInstrChannel &channel = m_MidiCh[mc]; MidiPitchBend(mc, EncodePitchBendParam(MIDIEvents::pitchBendCentre)); // centre pitch bend - MidiSend(MIDIEvents::BuildCCEvent(MIDIEvents::MIDICC_AllControllersOff, mc, 0)); // reset all controllers - MidiSend(MIDIEvents::BuildCCEvent(MIDIEvents::MIDICC_AllNotesOff, mc, 0)); // all notes off - MidiSend(MIDIEvents::BuildCCEvent(MIDIEvents::MIDICC_AllSoundOff, mc, 0)); // all sounds off + MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_AllControllersOff, mc, 0)); // reset all controllers + MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_AllNotesOff, mc, 0)); // all notes off + MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_AllSoundOff, mc, 0)); // all sounds off for(size_t i = 0; i < CountOf(channel.uNoteOnMap); i++) //all notes { @@ -2326,7 +2326,7 @@ { while(channel.uNoteOnMap[i][c]) { - MidiSend(MIDIEvents::BuildNoteOffEvent(mc, static_cast<uint8>(i), 0)); + MidiSend(MIDIEvents::NoteOff(mc, static_cast<uint8>(i), 0)); channel.uNoteOnMap[i][c]--; } } @@ -2354,9 +2354,9 @@ LimitMax(nParam, uint8(127)); if(m_pSndFile && m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION)) - MidiSend(MIDIEvents::BuildEvent(MIDIEvents::evControllerChange, nMidiCh, nParam, static_cast<uint8>(nController))); // param and controller are swapped (old broken implementation) + MidiSend(MIDIEvents::Event(MIDIEvents::evControllerChange, nMidiCh, nParam, static_cast<uint8>(nController))); // param and controller are swapped (old broken implementation) else - MidiSend(MIDIEvents::BuildCCEvent(nController, nMidiCh, nParam)); + MidiSend(MIDIEvents::CC(nController, nMidiCh, nParam)); } @@ -2401,7 +2401,7 @@ { ASSERT(EncodePitchBendParam(MIDIEvents::pitchBendMin) <= newPitchBendPos && newPitchBendPos <= EncodePitchBendParam(MIDIEvents::pitchBendMax)); m_MidiCh[nMidiCh].midiPitchBendPos = newPitchBendPos; - MidiSend(MIDIEvents::BuildPitchBendEvent(nMidiCh, DecodePitchBendParam(newPitchBendPos))); + MidiSend(MIDIEvents::PitchBend(nMidiCh, DecodePitchBendParam(newPitchBendPos))); } @@ -2418,7 +2418,7 @@ int32 newPitchBendPos = (depth + m_MidiCh[nMidiCh].midiPitchBendPos) & vstPitchBendMask; Limit(newPitchBendPos, EncodePitchBendParam(MIDIEvents::pitchBendMin), EncodePitchBendParam(MIDIEvents::pitchBendMax)); - MidiSend(MIDIEvents::BuildPitchBendEvent(nMidiCh, DecodePitchBendParam(newPitchBendPos))); + MidiSend(MIDIEvents::PitchBend(nMidiCh, DecodePitchBendParam(newPitchBendPos))); } // Update vibrato status @@ -2452,11 +2452,11 @@ if((channel.currentBank >> 7) != high) { // High byte changed - MidiSend(MIDIEvents::BuildCCEvent(MIDIEvents::MIDICC_BankSelect_Coarse, nMidiCh, high)); + MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_BankSelect_Coarse, nMidiCh, high)); } // Low byte //GetSoundFile()->ProcessMIDIMacro(trackChannel, false, GetSoundFile()->m_MidiCfg.szMidiGlb[MIDIOUT_BANKSEL], 0); - MidiSend(MIDIEvents::BuildCCEvent(MIDIEvents::MIDICC_BankSelect_Fine, nMidiCh, low)); + MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_BankSelect_Fine, nMidiCh, low)); channel.currentBank = wMidiBank; } @@ -2468,7 +2468,7 @@ { channel.currentProgram = nMidiProg; //GetSoundFile()->ProcessMIDIMacro(trackChannel, false, GetSoundFile()->m_MidiCfg.szMidiGlb[MIDIOUT_PROGRAM], 0); - MidiSend(MIDIEvents::BuildProgramChangeEvent(nMidiCh, nMidiProg)); + MidiSend(MIDIEvents::ProgramChange(nMidiCh, nMidiProg)); } @@ -2480,7 +2480,7 @@ if(channel.uNoteOnMap[i][trackChannel]) { channel.uNoteOnMap[i][trackChannel]--; - MidiSend(MIDIEvents::BuildNoteOffEvent(nMidiCh, i, 0)); + MidiSend(MIDIEvents::NoteOff(nMidiCh, i, 0)); } } @@ -2489,14 +2489,14 @@ // Also less likely to cause a VST event buffer overflow. else if (note == NOTE_NOTECUT) // ^^ { - MidiSend(MIDIEvents::BuildCCEvent(MIDIEvents::MIDICC_AllNotesOff, nMidiCh, 0)); - MidiSend(MIDIEvents::BuildCCEvent(MIDIEvents::MIDICC_AllSoundOff, nMidiCh, 0)); + MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_AllNotesOff, nMidiCh, 0)); + MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_AllSoundOff, nMidiCh, 0)); // Turn off all notes for(uint8 i = 0; i < 128; i++) { channel.uNoteOnMap[i][trackChannel] = 0; - MidiSend(MIDIEvents::BuildNoteOffEvent(nMidiCh, i, volume)); + MidiSend(MIDIEvents::NoteOff(nMidiCh, i, volume)); } } @@ -2510,7 +2510,7 @@ // Some VSTis need a note off for each instance of a note on, e.g. fabfilter. while(channel.uNoteOnMap[i][trackChannel]) { - if(MidiSend(MIDIEvents::BuildNoteOffEvent(nMidiCh, i, volume))) + if(MidiSend(MIDIEvents::NoteOff(nMidiCh, i, volume))) { channel.uNoteOnMap[i][trackChannel]--; } else @@ -2543,7 +2543,7 @@ if(channel.uNoteOnMap[note][trackChannel] < 17) channel.uNoteOnMap[note][trackChannel]++; - MidiSend(MIDIEvents::BuildNoteOnEvent(nMidiCh, static_cast<uint8>(note), volume)); + MidiSend(MIDIEvents::NoteOn(nMidiCh, static_cast<uint8>(note), volume)); } } Modified: trunk/OpenMPT/mptrack/test/test.cpp =================================================================== --- trunk/OpenMPT/mptrack/test/test.cpp 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/mptrack/test/test.cpp 2012-09-21 21:10:38 UTC (rev 1357) @@ -281,37 +281,37 @@ { uint32 midiEvent; - midiEvent = MIDIEvents::BuildCCEvent(MIDIEvents::MIDICC_Balance_Coarse, 13, 40); + midiEvent = MIDIEvents::CC(MIDIEvents::MIDICC_Balance_Coarse, 13, 40); VERIFY_EQUAL_NONCONT(MIDIEvents::GetTypeFromEvent(midiEvent), MIDIEvents::evControllerChange); VERIFY_EQUAL_NONCONT(MIDIEvents::GetChannelFromEvent(midiEvent), 13); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte1FromEvent(midiEvent), MIDIEvents::MIDICC_Balance_Coarse); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte2FromEvent(midiEvent), 40); - midiEvent = MIDIEvents::BuildNoteOnEvent(10, 50, 120); + midiEvent = MIDIEvents::NoteOn(10, 50, 120); VERIFY_EQUAL_NONCONT(MIDIEvents::GetTypeFromEvent(midiEvent), MIDIEvents::evNoteOn); VERIFY_EQUAL_NONCONT(MIDIEvents::GetChannelFromEvent(midiEvent), 10); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte1FromEvent(midiEvent), 50); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte2FromEvent(midiEvent), 120); - midiEvent = MIDIEvents::BuildNoteOffEvent(15, 127, 42); + midiEvent = MIDIEvents::NoteOff(15, 127, 42); VERIFY_EQUAL_NONCONT(MIDIEvents::GetTypeFromEvent(midiEvent), MIDIEvents::evNoteOff); VERIFY_EQUAL_NONCONT(MIDIEvents::GetChannelFromEvent(midiEvent), 15); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte1FromEvent(midiEvent), 127); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte2FromEvent(midiEvent), 42); - midiEvent = MIDIEvents::BuildProgramChangeEvent(1, 127); + midiEvent = MIDIEvents::ProgramChange(1, 127); VERIFY_EQUAL_NONCONT(MIDIEvents::GetTypeFromEvent(midiEvent), MIDIEvents::evProgramChange); VERIFY_EQUAL_NONCONT(MIDIEvents::GetChannelFromEvent(midiEvent), 1); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte1FromEvent(midiEvent), 127); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte2FromEvent(midiEvent), 0); - midiEvent = MIDIEvents::BuildPitchBendEvent(2, MIDIEvents::pitchBendCentre); + midiEvent = MIDIEvents::PitchBend(2, MIDIEvents::pitchBendCentre); VERIFY_EQUAL_NONCONT(MIDIEvents::GetTypeFromEvent(midiEvent), MIDIEvents::evPitchBend); VERIFY_EQUAL_NONCONT(MIDIEvents::GetChannelFromEvent(midiEvent), 2); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte1FromEvent(midiEvent), 0x00); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte2FromEvent(midiEvent), 0x40); - midiEvent = MIDIEvents::BuildSystemEvent(MIDIEvents::sysStart); + midiEvent = MIDIEvents::System(MIDIEvents::sysStart); VERIFY_EQUAL_NONCONT(MIDIEvents::GetTypeFromEvent(midiEvent), MIDIEvents::evSystem); VERIFY_EQUAL_NONCONT(MIDIEvents::GetChannelFromEvent(midiEvent), MIDIEvents::sysStart); VERIFY_EQUAL_NONCONT(MIDIEvents::GetDataByte1FromEvent(midiEvent), 0); Modified: trunk/OpenMPT/soundlib/MIDIEvents.cpp =================================================================== --- trunk/OpenMPT/soundlib/MIDIEvents.cpp 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/soundlib/MIDIEvents.cpp 2012-09-21 21:10:38 UTC (rev 1357) @@ -15,56 +15,56 @@ { // Build a generic MIDI event -uint32 BuildEvent(EventType eventType, uint8 midiChannel, uint8 dataByte1, uint8 dataByte2) -//----------------------------------------------------------------------------------------- +uint32 Event(EventType eventType, uint8 midiChannel, uint8 dataByte1, uint8 dataByte2) +//------------------------------------------------------------------------------------ { return (eventType << 4) | (midiChannel & 0x0F) | (dataByte1 << 8) | (dataByte2 << 16); } // Build a MIDI CC event -uint32 BuildCCEvent(MidiCC midiCC, uint8 midiChannel, uint8 param) -//---------------------------------------------------------------- +uint32 CC(MidiCC midiCC, uint8 midiChannel, uint8 param) +//------------------------------------------------------ { - return BuildEvent(evControllerChange, midiChannel, static_cast<uint8>(midiCC), param); + return Event(evControllerChange, midiChannel, static_cast<uint8>(midiCC), param); } // Build a MIDI Pitchbend event -uint32 BuildPitchBendEvent(uint8 midiChannel, uint16 bendAmount) -//-------------------------------------------------------------- +uint32 PitchBend(uint8 midiChannel, uint16 bendAmount) +//---------------------------------------------------- { - return BuildEvent(evPitchBend, midiChannel, static_cast<uint8>(bendAmount & 0x7F), static_cast<uint8>(bendAmount >> 7)); + return Event(evPitchBend, midiChannel, static_cast<uint8>(bendAmount & 0x7F), static_cast<uint8>(bendAmount >> 7)); } // Build a MIDI Program Change event -uint32 BuildProgramChangeEvent(uint8 midiChannel, uint8 program) -//-------------------------------------------------------------- +uint32 ProgramChange(uint8 midiChannel, uint8 program) +//---------------------------------------------------- { - return BuildEvent(evProgramChange, midiChannel, program, 0); + return Event(evProgramChange, midiChannel, program, 0); } // Build a MIDI Note Off event -uint32 BuildNoteOffEvent(uint8 midiChannel, uint8 note, uint8 velocity) -//--------------------------------------------------------------------- +uint32 NoteOff(uint8 midiChannel, uint8 note, uint8 velocity) +//----------------------------------------------------------- { - return BuildEvent(evNoteOff, midiChannel, note, velocity); + return Event(evNoteOff, midiChannel, note, velocity); } // Build a MIDI Note On event -uint32 BuildNoteOnEvent(uint8 midiChannel, uint8 note, uint8 velocity) -//-------------------------------------------------------------------- +uint32 NoteOn(uint8 midiChannel, uint8 note, uint8 velocity) +//---------------------------------------------------------- { - return BuildEvent(evNoteOn, midiChannel, note, velocity); + return Event(evNoteOn, midiChannel, note, velocity); } // Build a MIDI System Event -uint8 BuildSystemEvent(SystemEvent eventType) -//------------------------------------------- +uint8 System(SystemEvent eventType) +//--------------------------------- { return static_cast<uint8>((evSystem << 4) | eventType); } Modified: trunk/OpenMPT/soundlib/MIDIEvents.h =================================================================== --- trunk/OpenMPT/soundlib/MIDIEvents.h 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/soundlib/MIDIEvents.h 2012-09-21 21:10:38 UTC (rev 1357) @@ -263,19 +263,19 @@ }; // Build a generic MIDI event - uint32 BuildEvent(EventType eventType, uint8 midiChannel, uint8 dataByte1, uint8 dataByte2); + uint32 Event(EventType eventType, uint8 midiChannel, uint8 dataByte1, uint8 dataByte2); // Build a MIDI CC event - uint32 BuildCCEvent(MidiCC midiCC, uint8 midiChannel, uint8 param); + uint32 CC(MidiCC midiCC, uint8 midiChannel, uint8 param); // Build a MIDI Pitchbend event - uint32 BuildPitchBendEvent(uint8 midiChannel, uint16 bendAmount); + uint32 PitchBend(uint8 midiChannel, uint16 bendAmount); // Build a MIDI Program Change event - uint32 BuildProgramChangeEvent(uint8 midiChannel, uint8 program); + uint32 ProgramChange(uint8 midiChannel, uint8 program); // Build a MIDI Note Off event - uint32 BuildNoteOffEvent(uint8 midiChannel, uint8 note, uint8 velocity); + uint32 NoteOff(uint8 midiChannel, uint8 note, uint8 velocity); // Build a MIDI Note On event - uint32 BuildNoteOnEvent(uint8 midiChannel, uint8 note, uint8 velocity); + uint32 NoteOn(uint8 midiChannel, uint8 note, uint8 velocity); // Build a MIDI System Event - uint8 BuildSystemEvent(SystemEvent eventType); + uint8 System(SystemEvent eventType); // Get MIDI channel from a MIDI event uint8 GetChannelFromEvent(uint32 midiMsg); Modified: trunk/OpenMPT/soundlib/ModSample.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSample.cpp 2012-09-21 19:35:36 UTC (rev 1356) +++ trunk/OpenMPT/soundlib/ModSample.cpp 2012-09-21 21:10:38 UTC (rev 1357) @@ -97,21 +97,21 @@ nLength = 0; nLoopStart = nLoopEnd = 0; nSustainStart = nSustainEnd = 0; + nC5Speed = 8363; + nPan = 128; nVolume = 256; nGlobalVol = 64; - nPan = 128; - nC5Speed = 8363; + uFlags.reset(CHN_PANNING | CHN_SUSTAINLOOP | CHN_LOOP); + if(type == MOD_TYPE_XM) + { + uFlags.set(CHN_PANNING); + } RelativeTone = 0; nFineTune = 0; nVibType = VIB_SINE; nVibSweep = 0; nVibDepth = 0; nVibRate = 0; - uFlags.reset(CHN_PANNING | CHN_SUSTAINLOOP | CHN_LOOP); - if(type == MOD_TYPE_XM) - { - uFlags.set(CHN_PANNING); - } filename[0] = '\0'; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-09-22 14:18:33
|
Revision: 1359 http://modplug.svn.sourceforge.net/modplug/?rev=1359&view=rev Author: saga-games Date: 2012-09-22 14:18:22 +0000 (Sat, 22 Sep 2012) Log Message: ----------- [Mod] Updated release documents [Mod] OpenMPT: Version is now 1.20.03.00 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/packageTemplate/History.txt trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html Added Paths: ----------- trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.20/instrument_settings.png Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-09-21 21:11:57 UTC (rev 1358) +++ trunk/OpenMPT/mptrack/version.h 2012-09-22 14:18:22 UTC (rev 1359) @@ -18,8 +18,8 @@ //Version definitions. The only thing that needs to be changed when changing version number. #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 -#define VER_MINOR 02 -#define VER_MINORMINOR 11 +#define VER_MINOR 03 +#define VER_MINORMINOR 00 //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 2012-09-21 21:11:57 UTC (rev 1358) +++ trunk/OpenMPT/packageTemplate/History.txt 2012-09-22 14:18:22 UTC (rev 1359) @@ -24,6 +24,73 @@ <ks> coda / Ken Snyder +v1.20.03.00 (22 September 2012, revision 1359) +---------------------------------------------- +Pattern tab + [New] <js> Playback can now be locked to an order range. The range can be specified from the context menu of an order selection. Locked orders are then shown with a different background colour. + [Imp] <js> For visual guidance during editing, non-existing pattern numbers are now greyed out. + [Imp] <js> Added a keyboard shortcut for opening the Quick Channel Settings dialog. + [Mod] <js> Entering note-offs via MIDI doesn't put an instrument number next to them anymore. + [Fix] <js> Cursor doesn't exceed the pattern anymore when moving it beyond the right border. + [Fix] <js> When opening the pattern tab for the first time, the order list should not be scrolled randomly anymore if not necessary. + +Pattern tab::Quick Channel Settings Dialog + [New] <js> Added freely assignable keyboard shortcuts for switching between channels and returning to the pattern editor. + [Imp] <js> The dialog is now always hidden when changing focus to another window, not only when switching back to the lower part of the pattern view. + [Fix] <js> Tab order is now correct. + +Sample tab + [Fix] <js> 8SVX Loader: Loops are now also loaded properly if the loop end is precisely at the sample end. + +Instrument tab + [New] <js> "Pitch Bend Range": For instrument plugins, enter the instrument's Pitch Wheel Depth into this box and OpenMPT will now automatically adjust portamento / vibrato commands for this instrument plugin so that they behave identical to sample portamento / vibrato. + [Imp] <js> Sustain / Loop points cannot be enabled anymore if there is no evelope. + [Mod] <js> Velocity handling option has been turned into a checkbox (should be easier to grasp). + [Fix] <js> Loading AIFF files as instruments (or previewing them from the tree view) works now. + +VST / DMO Plugins + [New] <js> Plugins can now also receive tracker portamento (Hxx / 4xx and the like). Vibrato is emulated through pitch wheel messages; the behaviour is identical to sample vibrato if the plugin's actual Pitch Wheel Depth is set up correctly in the instrument tab. + [Imp] <js> Portamento Up / Down effects are now implemented properly: Memory and fine slides do finally work. (Fine and extra fine slides are currently not supported in the XM format, but you should not use plugins in that format anyway!). The behaviour is now also identical to sample portamento if the plugin's actual Pitch Wheel Depth is set up correctly in the instrument tab. For existing songs, a new option has been added to the Song Properties to retain the old behaviour. + [Fix] <js> Randomize Parameters reset focus to main window instead of plugin window (http://bugs.openmpt.org/view.php?id=294) + [Fix] <js> Randomize Parameters doesn't ask the plugin if a parameter is automatable anymore, as some plugins do not seem to set this property at all. + [Fix] <js> OpenMPT didn't write more than 255 plugins to the settings file since version 1.20 (http://bugs.openmpt.org/view.php?id=267) + [Fix] <js> A memory leak that occoured when trying to register invalid or missing plugins (e.g. on startup) has been fixed. + +IT::Compatible Playback Mode + [Fix] <js> A channel's key-off status is kept with portamento notes if "Compatible Gxx" is disabled or there is no instrument number next to the new note. + +IT::Loading + [Fix] <js> Overly long (26 characters) sample / instrument name strings found in IT files made with older versions of MPT are now read correctly again. + [Fix] <js> Silent samples were sometimes loaded into sample slots that were actually supposed to be empty. + +XM + [Fix] <js> All fine slide commands (E1x, E2x, EAx, EBx, X1x, X2x) are supposed to have their own memory. Previously, it was shared between some of the commands. + +XM::Compatible Playback Mode + [Fix] <js> Notes next to note delays are now ignored if the delay is greater than the current speed (*ignoring* any pattern delays). Previously this was only ignored if the delay was greater than the speed *including* pattern delays. + +XM::Loading and Saving + [Imp] <js> When loading an XM file made with an older version of OpenMPT, gxx / 3xx combinations in the same pattern cell are now tried to be upgraded to fit the new behaviour of OpenMPT 1.20.02.00. + [Fix] <js> Compatibility export broke X1x and X2x (extra-fine portamento) commands. + +MOD + [Fix] <js> Dxx effects that are to the left of a Bxx effect are now ignored (like in the XM format). + [Fix] <js> Loading 15-sample MODs only worked under lucky circumstances (most likely since OpenMPT 1.20.01.00). + +Other formats + [Imp] <js> 669 Loader: Effects are now imported more accurately. + [Imp] <js> DMF Loader: Improved effect import to fit more effects into a pattern cell. + [Fix] <js> AMF (DSMI) Loader: Fixed pattern effects (normal volume slides were always loaded as volume slide + vibrato) and some other bugs; More AMF format revision (8-14) are supported now. + [Fix] <js> AMF (ASYLUM) Loader: Transposed samples will now play correctly, default speed / tempo are not ignored anymore. + +Misc + [New] <js> Wave Export: Added option to loop a song a given number of times during export (http://bugs.openmpt.org/view.php?id=221). + [Imp] <js> Keyboard Settings: Searching for shortcuts does now also work with MIDI CCs. + [Mod] <js> Since the DirectSound driver seems to be buggy (see various reports on the issue tracker), OpenMPT defaults to WaveOut now if there's no ASIO driver present. + [Fix] <ks> Save All / Save None buttons in the Unsaved Files dialog didn't work if there was only one unsaved file (http://bugs.openmpt.org/view.php?id=206). + [Fix] <js> A known file extension shouldn't suggest a wrong file extension in the WAV / MP3 export dialog anymore (http://bugs.openmpt.org/view.php?id=298). + + v1.20.02.00 (7 July 2012, revision 1318) ---------------------------------------- Pattern tab @@ -39,7 +106,7 @@ Sample tab [Imp] <js> Improved AIFF support (added support for loop points, up to 32-Bit sample resolution, AIFF-C files and little-endian sample data). - [Imp] <js> Added support for arbitrary bit resolutions between 1 and 32 bits in WAV files (f.e. 20-Bit sample data). + [Imp] <js> Added support for arbitrary bit resolutions between 1 and 32 bits in WAV files (e.g. 20-Bit sample data). [Imp] <js> If zooming the current selection is impossible, the zoom context menu item is greyed out. [Fix] <js> Shouldn't crash anymore when cleaning up Undo memory (http://bugs.openmpt.org/view.php?id=232). @@ -65,7 +132,7 @@ IT::Compatible Playback Mode [Fix] <js> Combinations of Qxy (retrigger) with a pattern delay at Speed y should now work as intended. - [Fix] <js> Combinations of SDx with x greater than the current spend and tick delay commands didn't work. + [Fix] <js> Combinations of SDx with x greater than the current speed combined with tick delay commands didn't work. IT::Loading [Fix] <js> Loading IT files made with older versions of OpenMPT replaces SC0 with ^^ instead of v00 now. @@ -90,7 +157,7 @@ [Imp] <js> STM Loader imports some effects more correctly now. [Imp] <js> UMX Loader checks for a few more contained module formats that are also supported by Galaxy Sound System (STM, 669, FAR). [Fix] <js> MDL Loader was severely broken in OpenMPT 1.20.01.00. - [Fix] <js> MED Loader: Sample transpose should work as intended (at least for MMD1 modules), MMD2 order list works again as well, Tempo vs Speed precence for value 32 should be correct now. + [Fix] <js> MED Loader: Sample transpose should work as intended (at least for MMD1 modules), MMD2 order list works again as well, Tempo vs Speed precedence for value 32 should be correct now. Misc [New] <js> Keyboard Settings: Shortcuts can now also be found by pressing the sought-after key combination. Click search field to reset filter. @@ -101,6 +168,7 @@ [Fix] <js> When using more than one instance of the MIDI Input / Output plugin at a time, killing one plugin instance killed all other instances as well. [Fix] <ks> The MIDI Input / Output plugin could sometimes send garbage data. + v1.20.01.00 (5 May 2012, revision 1263) --------------------------------------- General tab Modified: trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html =================================================================== --- trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html 2012-09-21 21:11:57 UTC (rev 1358) +++ trunk/OpenMPT/packageTemplate/OMPT_1.20_ReleaseNotes.html 2012-09-22 14:18:22 UTC (rev 1359) @@ -112,6 +112,7 @@ <ul> <li>OpenMPT 1.20 introduces a <strong>template system</strong> that can be used to quickly access often used plugin, pattern, sample and instrument combinations.</li> <li>When closing OpenMPT, a single dialog with a <strong>list of unsaved files</strong> is now shown instead of one message box for each modified file.</li> + <li>In the <strong>Wave Export</strong> dialog, you can now specifiy how often the exported tune should be looped.</li> <li><strong>Crash recovery</strong>: When a crash is encountered, OpenMPT will try to save modified documents to a temporary location and close the audio device. The latter can especially help with ASIO drivers that become unusable after a program crash.</li> <li><strong>MIDI CCs</strong> that are being received from an external MIDI device can now be mapped to pattern / sample / instrument editor shortcuts.</li> <li>The <strong>treeview</strong> can now handle more than 32 open modules.</li> @@ -144,7 +145,9 @@ </ul> <h3>VST Plugins</h3> - <ul> + <div class="screenshots"> + <a href="ReleaseNotesImages/1.20/instrument_settings.png"><img src="ReleaseNotesImages/1.20/instrument_settings.png" width="240" height="93" alt="Instrument Pitch Wheel Depth" title="Instrument Pitch Wheel Depth (click to view big screenshot)" /></a> + </div> <ul> <li>OpenMPT comes with its own <strong>MIDI Input / Output plugin</strong> that can be used to route MIDI event from external devices to other plugins or to send MIDI events to your MIDI gear. <li>Plugins can now <strong>route MIDI events</strong> to follow-up plugins. This can be useful for LFO, arpeggiator or groove plugins.</li> <li>Searching for multiple <strong>unknown plugins</strong> will now open only one browser window.</li> @@ -153,6 +156,7 @@ <li>Exception handling for crashed plugins does finally work again, so the <strong>overall stability</strong> of OpenMPT as a VST host has increased. Note that a few plugins don't seem to like exception handling and might crash now.</li> <li>The current <strong>playback position</strong> is now also reported correctly to plugins when jumping around in the order list. Previously, it was always reset to the song start. This enhances support for sequencer plugins like Maschine.</li> <li>Effect plugins are now sorted into <strong>plugin categories</strong> (as reported by the plugins) in the plugin selection dialog. Delete the <tt>plugin.cache</tt> file in OpenMPT's settings directory to rebuild the plugin cache with categories. Loading a plugin into a module will also update the cache.</li> + <li><strong>Vibrato effects</strong> are now also sent to instrument plugins! In fact, the whole MIDI portamento system has been overhauled and behaves exactly like sample portamentos and vibratos now - given that you set up the correct Pitch Wheel Depth of the plugin in the instrument settings tab.</li> </ul> <h3>There's more...</h3> Added: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.20/instrument_settings.png =================================================================== (Binary files differ) Property changes on: trunk/OpenMPT/packageTemplate/ReleaseNotesImages/1.20/instrument_settings.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-09-27 22:12:11
|
Revision: 1363 http://modplug.svn.sourceforge.net/modplug/?rev=1363&view=rev Author: saga-games Date: 2012-09-27 22:12:03 +0000 (Thu, 27 Sep 2012) Log Message: ----------- [Ref] Another mod loader rewrite that will probably break everything! Rewrote XM and XI loaders. [Mod] OpenMPT: Version is now 1.20.03.01 Modified Paths: -------------- trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Load_mo3.cpp trunk/OpenMPT/soundlib/Load_umx.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/XMTools.cpp trunk/OpenMPT/soundlib/XMTools.h Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-09-27 22:08:52 UTC (rev 1362) +++ trunk/OpenMPT/mptrack/version.h 2012-09-27 22:12:03 UTC (rev 1363) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 03 -#define VER_MINORMINOR 00 +#define VER_MINORMINOR 01 //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_mo3.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mo3.cpp 2012-09-27 22:08:52 UTC (rev 1362) +++ trunk/OpenMPT/soundlib/Load_mo3.cpp 2012-09-27 22:12:03 UTC (rev 1363) @@ -83,7 +83,7 @@ { FileReader unpackedFile(static_cast<const char *>(stream), length); - result = ReadXM(static_cast<const LPCBYTE>(stream), length) + result = ReadXM(unpackedFile) || ReadIT(static_cast<const LPCBYTE>(stream), length) || ReadS3M(unpackedFile) || ReadMTM(static_cast<const LPCBYTE>(stream), length) Modified: trunk/OpenMPT/soundlib/Load_umx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_umx.cpp 2012-09-27 22:08:52 UTC (rev 1362) +++ trunk/OpenMPT/soundlib/Load_umx.cpp 2012-09-27 22:12:03 UTC (rev 1363) @@ -271,7 +271,7 @@ { // Read as module if(ReadIT(data, fileChunk.GetLength()) - || ReadXM(data, fileChunk.GetLength()) + || ReadXM(fileChunk) || ReadS3M(fileChunk) || ReadWav(fileChunk) || ReadSTM(fileChunk) Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2012-09-27 22:08:52 UTC (rev 1362) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2012-09-27 22:12:03 UTC (rev 1363) @@ -20,12 +20,7 @@ //////////////////////////////////////////////////////// // FastTracker II XM file support -#pragma warning(disable:4244) //conversion from 'type1' to 'type2', possible loss of data -#define str_tooMuchPatternData (GetStrI18N((_TEXT("Warning: File format limit was reached. Some pattern data may not get written to file.")))) -#define str_pattern (GetStrI18N((_TEXT("pattern")))) - - // Allocate samples for an instrument vector<SAMPLEINDEX> AllocateXMSamples(CSoundFile &sndFile, SAMPLEINDEX numSamples) //-------------------------------------------------------------------------------- @@ -122,265 +117,249 @@ // Read .XM patterns -DWORD ReadXMPatterns(const BYTE *lpStream, DWORD dwMemLength, DWORD dwMemPos, XMFileHeader *xmheader, CSoundFile &sndFile) -//------------------------------------------------------------------------------------------------------------------------- +void ReadXMPatterns(FileReader &file, const XMFileHeader &fileHeader, CSoundFile &sndFile) +//---------------------------------------------------------------------------------------- { - vector<BYTE> patterns_used(256, 0); - vector<BYTE> pattern_map(256, 0); - - if(xmheader->patterns > MAX_PATTERNS) + // Reading patterns + for(PATTERNINDEX pat = 0; pat < fileHeader.patterns; pat++) { - UINT i, j; - for (i = 0; i < xmheader->orders; i++) + size_t curPos = file.GetPosition(); + uint32 headerSize = file.ReadUint32LE(); + file.Skip(1); // Pack method (= 0) + + ROWINDEX numRows = 64; + + if(fileHeader.version == 0x0102) { - if (sndFile.Order[i] < xmheader->patterns) patterns_used[sndFile.Order[i]] = true; - } - j = 0; - for (i = 0; i < 256; i++) + numRows = file.ReadUint8() + 1; + } else { - if (patterns_used[i]) pattern_map[i] = j++; + numRows = file.ReadUint16LE(); } - for (i = 0; i < 256; i++) + + // A packed size of 0 indicates a completely empty pattern. + const uint16 packedSize = file.ReadUint16LE(); + + if(numRows == 0 || numRows > MAX_PATTERN_ROWS) { - if (!patterns_used[i]) - { - pattern_map[i] = (j < MAX_PATTERNS) ? j : sndFile.Order.GetIgnoreIndex(); - j++; - } + numRows = 64; } - for (i = 0; i < xmheader->orders; i++) - { - sndFile.Order[i] = pattern_map[sndFile.Order[i]]; - } - } else - { - for (UINT i = 0; i < 256; i++) pattern_map[i] = i; - } - if(dwMemPos + 8 >= dwMemLength) return dwMemPos; - // Reading patterns - for(UINT ipat = 0; ipat < xmheader->patterns; ipat++) - { - UINT ipatmap = pattern_map[ipat]; - DWORD dwSize = 0; - WORD rows = 64, packsize = 0; - dwSize = LittleEndian(*((DWORD *)(lpStream + dwMemPos))); - if(xmheader->version == 0x0102) + file.Seek(curPos + headerSize); + FileReader patternChunk = file.GetChunk(packedSize); + + if(sndFile.Patterns.Insert(pat, numRows) || packedSize == 0) { - rows = *((BYTE *)(lpStream + dwMemPos + 5)) + 1; - packsize = LittleEndianW(*((WORD *)(lpStream + dwMemPos + 6))); + continue; } - else - { - rows = LittleEndianW(*((WORD *)(lpStream + dwMemPos + 5))); - packsize = LittleEndianW(*((WORD *)(lpStream + dwMemPos + 7))); - } - if ((!rows) || (rows > MAX_PATTERN_ROWS)) rows = 64; - if (dwMemPos + dwSize + 4 > dwMemLength) return 0; - dwMemPos += dwSize; - if (dwMemPos + packsize > dwMemLength) return 0; - ModCommand *p; - if (ipatmap < MAX_PATTERNS) + enum PatternFlags { - if(sndFile.Patterns.Insert(ipatmap, rows)) - return true; + isPackByte = 0x80, + allFlags = 0xFF, - if (!packsize) continue; - p = sndFile.Patterns[ipatmap]; - } else p = NULL; - const BYTE *src = lpStream+dwMemPos; - UINT j=0; - for (UINT row=0; row<rows; row++) + notePresent = 0x01, + instrPresent = 0x02, + volPresent = 0x04, + commandPresent = 0x08, + paramPresent = 0x10, + }; + + ModCommand *m = sndFile.Patterns[pat]; + for(size_t numCommands = numRows * fileHeader.channels; numCommands != 0; numCommands--, m++) { - for (UINT chn=0; chn < xmheader->channels; chn++) + uint8 info = patternChunk.ReadUint8(); + + uint8 vol = 0; + if(info & isPackByte) { - if ((p) && (j < packsize)) + // Interpret byte as flag set. + if(info & notePresent) m->note = patternChunk.ReadUint8(); + } else + { + // Interpret byte as note, read all other pattern fields as well. + m->note = info; + info = allFlags; + } + + if(info & instrPresent) m->instr = patternChunk.ReadUint8(); + if(info & volPresent) vol = patternChunk.ReadUint8(); + if(info & commandPresent) m->command = patternChunk.ReadUint8(); + if(info & paramPresent) m->param = patternChunk.ReadUint8(); + + if(m->note == 97) + { + m->note = NOTE_KEYOFF; + } else if(m->note > 0 && m->note < 97) + { + m->note += 12; + } else + { + m->note = NOTE_NONE; + } + + if(m->command | m->param) + { + sndFile.ConvertModCommand(*m); + } else + { + m->command = CMD_NONE; + } + + if(m->instr == 0xFF) + { + m->instr = 0; + } + + if(vol >= 0x10 && vol <= 0x50) + { + m->volcmd = VOLCMD_VOLUME; + m->vol = vol - 0x10; + } else if (vol >= 0x60) + { + // Volume commands 6-F translation. + static const ModCommand::VOLCMD volEffTrans[] = { - BYTE b = src[j++]; - UINT vol = 0; - if (b & 0x80) - { - if (b & 1) p->note = src[j++]; - if (b & 2) p->instr = src[j++]; - if (b & 4) vol = src[j++]; - if (b & 8) p->command = src[j++]; - if (b & 16) p->param = src[j++]; - } else - { - p->note = b; - p->instr = src[j++]; - vol = src[j++]; - p->command = src[j++]; - p->param = src[j++]; - } - if (p->note == 97) p->note = NOTE_KEYOFF; - else if ((p->note) && (p->note < 97)) p->note += 12; - if (p->command | p->param) sndFile.ConvertModCommand(*p); - if (p->instr == 0xff) p->instr = 0; - if ((vol >= 0x10) && (vol <= 0x50)) - { - p->volcmd = VOLCMD_VOLUME; - p->vol = vol - 0x10; - } else - if (vol >= 0x60) - { - UINT v = vol & 0xF0; - vol &= 0x0F; - p->vol = vol; - switch(v) - { - // 60-6F: Volume Slide Down - case 0x60: p->volcmd = VOLCMD_VOLSLIDEDOWN; break; - // 70-7F: Volume Slide Up: - case 0x70: p->volcmd = VOLCMD_VOLSLIDEUP; break; - // 80-8F: Fine Volume Slide Down - case 0x80: p->volcmd = VOLCMD_FINEVOLDOWN; break; - // 90-9F: Fine Volume Slide Up - case 0x90: p->volcmd = VOLCMD_FINEVOLUP; break; - // A0-AF: Set Vibrato Speed - case 0xA0: p->volcmd = VOLCMD_VIBRATOSPEED; break; - // B0-BF: Vibrato - case 0xB0: p->volcmd = VOLCMD_VIBRATODEPTH; break; - // C0-CF: Set Panning - case 0xC0: p->volcmd = VOLCMD_PANNING; p->vol = ((vol * 64 + 8) / 15); break; - // D0-DF: Panning Slide Left - case 0xD0: p->volcmd = VOLCMD_PANSLIDELEFT; break; - // E0-EF: Panning Slide Right - case 0xE0: p->volcmd = VOLCMD_PANSLIDERIGHT; break; - // F0-FF: Tone Portamento - case 0xF0: p->volcmd = VOLCMD_TONEPORTAMENTO; break; - } - } - p++; - } else - if (j < packsize) + VOLCMD_VOLSLIDEDOWN, VOLCMD_VOLSLIDEUP, VOLCMD_FINEVOLDOWN, VOLCMD_FINEVOLUP, + VOLCMD_VIBRATOSPEED, VOLCMD_VIBRATODEPTH, VOLCMD_PANNING, VOLCMD_PANSLIDELEFT, + VOLCMD_PANSLIDERIGHT, VOLCMD_TONEPORTAMENTO, + }; + + m->volcmd = volEffTrans[(vol - 0x60) >> 4]; + m->vol = vol & 0x0F; + + if(m->volcmd == VOLCMD_PANNING) { - BYTE b = src[j++]; - if (b & 0x80) - { - if (b & 1) j++; - if (b & 2) j++; - if (b & 4) j++; - if (b & 8) j++; - if (b & 16) j++; - } else j += 4; - } else break; + m->vol = ((m->vol * 64 + 8) / 15); + } } } - dwMemPos += packsize; } - return dwMemPos; } -bool CSoundFile::ReadXM(const BYTE *lpStream, const DWORD dwMemLength) -//-------------------------------------------------------------------- + +FLAGSET(TrackerVersions) { - if(lpStream == nullptr || dwMemLength < sizeof(XMFileHeader)) - { - return false; - } + verUnknown = 0x00, // Probably not made with MPT + verOldModPlug = 0x01, // Made with MPT Alpha / Beta + verNewModPlug = 0x02, // Made with MPT (not Alpha / Beta) + verModPlug1_09 = 0x04, // Made with MPT 1.09 or possibly other version + verConfirmed = 0x08, // We are very sure that we found the correct tracker version. +}; - XMFileHeader xmheader; - DWORD dwMemPos; - bool madeWithModPlug = false, probablyMadeWithModPlug = false, probablyMPT109 = false, isFT2 = false; - // Load and convert header - memcpy(&xmheader, lpStream, sizeof(XMFileHeader)); - xmheader.ConvertEndianness(); +bool CSoundFile::ReadXM(FileReader &file) +//--------------------------------------- +{ + file.Rewind(); - if(xmheader.channels == 0 - || xmheader.channels > MAX_BASECHANNELS - || _strnicmp(xmheader.signature, "Extended Module: ", 17)) + XMFileHeader fileHeader; + if(!file.ReadConvertEndianness(fileHeader) + || fileHeader.channels == 0 + || fileHeader.channels > MAX_BASECHANNELS + || _strnicmp(fileHeader.signature, "Extended Module: ", 17) + || !Order.ReadAsByte(file, Util::Min(ORDERINDEX(fileHeader.orders), MAX_ORDERS)) + || !file.Seek(fileHeader.size + 60)) { return false; } - if(xmheader.channels > 32) - { - // Not entirely true, some other trackers also allow more channels. - madeWithModPlug = true; - } + FlagSet<TrackerVersions> madeWith(verUnknown); - StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[0], xmheader.songName); - - // Look for null-terminated song name - that's most likely a tune made with modplug - if(memchr(xmheader.songName, '\0', sizeof(xmheader.songName)) != nullptr) + if(!memcmp(fileHeader.trackerName, "FastTracker v 2.00 ", 20)) { - probablyMadeWithModPlug = true; + madeWith = verOldModPlug; + } else if(fileHeader.size == 276 && fileHeader.version == 0x0104 && !memcmp(fileHeader.trackerName, "FastTracker v2.00 ", 20)) + { + madeWith = verNewModPlug; } + StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[0], fileHeader.songName); + m_nType = MOD_TYPE_XM; m_nMinPeriod = 27; m_nMaxPeriod = 54784; - m_nRestartPos = xmheader.restartpos; - m_nChannels = xmheader.channels; - m_nInstruments = min(xmheader.instruments, MAX_INSTRUMENTS - 1); + m_nRestartPos = fileHeader.restartPos; + m_nChannels = fileHeader.channels; + m_nInstruments = Util::Min(fileHeader.instruments, uint16(MAX_INSTRUMENTS - 1)); m_nSamples = 0; - m_nDefaultSpeed = CLAMP(xmheader.speed, 1, 31); - m_nDefaultTempo = CLAMP(xmheader.tempo, 32, 512); + m_nDefaultSpeed = Clamp(fileHeader.speed, uint16(1), uint16(31)); + m_nDefaultTempo = Clamp(fileHeader.tempo, uint16(32), uint16(512)); - m_SongFlags.set(SONG_LINEARSLIDES, (xmheader.flags & XMFileHeader::linearSlides) != 0); - m_SongFlags.set(SONG_EXFILTERRANGE, (xmheader.flags & XMFileHeader::extendedFilterRange) != 0); + m_SongFlags.reset(); + m_SongFlags.set(SONG_LINEARSLIDES, (fileHeader.flags & XMFileHeader::linearSlides) != 0); + m_SongFlags.set(SONG_EXFILTERRANGE, (fileHeader.flags & XMFileHeader::extendedFilterRange) != 0); - Order.ReadAsByte(lpStream + 80, min(xmheader.orders, MAX_ORDERS), dwMemLength - 80); - - dwMemPos = xmheader.size + 60; - // set this here already because XMs compressed with BoobieSqueezer will exit the function early SetModFlag(MSF_COMPATIBLE_PLAY, true); - if(xmheader.version >= 0x0104) + if(fileHeader.version >= 0x0104) { - if (dwMemPos + 8 >= dwMemLength) return true; - dwMemPos = ReadXMPatterns(lpStream, dwMemLength, dwMemPos, &xmheader, *this); - if(dwMemPos == 0) return true; + ReadXMPatterns(file, fileHeader, *this); } // In case of XM versions < 1.04, we need to memorize the sample flags for all samples, as they are not stored immediately after the sample headers. vector<SampleIO> sampleFlags; + uint8 sampleReserved = 0; // Reading instruments for(INSTRUMENTINDEX instr = 1; instr <= m_nInstruments; instr++) { - XMInstrumentHeader insHeader; - MemsetZero(insHeader); - // First, try to read instrument header length... - if(dwMemPos > dwMemLength || sizeof(uint32) > dwMemLength - dwMemPos) + XMInstrumentHeader instrHeader; + instrHeader.size = file.ReadUint32LE(); + if(instrHeader.size == 0) { - return true; + instrHeader.size = sizeof(XMInstrumentHeader); } - size_t insHeaderSize = LittleEndian(*reinterpret_cast<const uint32 *>(lpStream + dwMemPos)); - if(insHeaderSize == 0) + + // Now, read the complete struct. + file.SkipBack(4); + file.ReadStructPartial(instrHeader, instrHeader.size); + + // Time for some version detection stuff. + if(madeWith == verOldModPlug) { - insHeaderSize = sizeof(XMInstrumentHeader); + madeWith |= verConfirmed; + if(instrHeader.size == 245) + { + // ModPlug Tracker Alpha + m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 00, 00, A5); + } else if(instrHeader.size == 263) + { + // ModPlug Tracker Beta + m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 00, 00, B3); + } else + { + // WTF? + madeWith = (verUnknown | verConfirmed); + } + } else if(madeWith == verNewModPlug && instrHeader.numSamples == 0) + { + // Empty instruments make tracker identification pretty easy! + madeWith = ((instrHeader.size == 263 && instrHeader.sampleHeaderSize == 0) ? verNewModPlug : verUnknown) | verConfirmed; } - LimitMax(insHeaderSize, size_t(dwMemLength - dwMemPos)); - memcpy(&insHeader, lpStream + dwMemPos, min(sizeof(XMInstrumentHeader), insHeaderSize)); - dwMemPos += insHeaderSize; - if(AllocateInstrument(instr) == nullptr) { continue; } - insHeader.ConvertEndianness(); - insHeader.ConvertToMPT(*Instruments[instr]); + instrHeader.ConvertEndianness(); + instrHeader.ConvertToMPT(*Instruments[instr]); - if(insHeader.numSamples > 0) + if(instrHeader.numSamples > 0) { // Yep, there are some samples associated with this instrument. - if((insHeader.instrument.midiChannel | insHeader.instrument.midiEnabled | insHeader.instrument.midiProgram | insHeader.instrument.muteComputer | insHeader.instrument.pitchWheelRange) != 0) + if((instrHeader.instrument.midiEnabled | instrHeader.instrument.midiChannel | instrHeader.instrument.midiProgram | instrHeader.instrument.muteComputer) != 0) { - // Definitely not MPT. (or any other tracker) - //isFT2 = true; + // Definitely not an old MPT. + madeWith = verUnknown; } // Read sample headers - vector<SAMPLEINDEX> sampleSlots = AllocateXMSamples(*this, insHeader.numSamples); + vector<SAMPLEINDEX> sampleSlots = AllocateXMSamples(*this, instrHeader.numSamples); // Update sample assignment map for(size_t k = 0 + 12; k < 96 + 12; k++) @@ -391,200 +370,182 @@ } } - if(xmheader.version >= 0x0104) + if(fileHeader.version >= 0x0104) { sampleFlags.clear(); } // Need to memorize those if we're going to skip any samples... - vector<uint32> sampleSize(insHeader.numSamples); + vector<uint32> sampleSize(instrHeader.numSamples); - XMSample xmSample; - MemsetZero(xmSample); + // Early versions of Sk@le Tracker didn't set sampleHeaderSize (this fixes IFULOVE.XM) + const size_t copyBytes = (instrHeader.sampleHeaderSize > 0) ? instrHeader.sampleHeaderSize : sizeof(XMSample); - for(SAMPLEINDEX sample = 0; sample < insHeader.numSamples; sample++) + for(SAMPLEINDEX sample = 0; sample < instrHeader.numSamples; sample++) { - // Early versions of Sk@le Tracker didn't set sampleHeaderSize (this fixes IFULOVE.XM) - const size_t copyBytes = (insHeader.sampleHeaderSize > 0) ? insHeader.sampleHeaderSize : sizeof(XMSample); + XMSample sampleHeader; + file.ReadStructPartial(sampleHeader, copyBytes); - if(dwMemPos > dwMemLength || copyBytes > dwMemLength - dwMemPos) - { - return true; - } + sampleFlags.push_back(sampleHeader.GetSampleFormat()); + sampleSize[sample] = sampleHeader.length; + sampleReserved |= sampleHeader.reserved; - memcpy(&xmSample, lpStream + dwMemPos, min(copyBytes, sizeof(XMSample))); - dwMemPos += copyBytes; - - sampleFlags.push_back(xmSample.GetSampleFormat()); - sampleSize[sample] = xmSample.length; - if(sample < sampleSlots.size()) { SAMPLEINDEX mptSample = sampleSlots[sample]; - xmSample.ConvertToMPT(Samples[mptSample]); - insHeader.instrument.ApplyAutoVibratoToMPT(Samples[mptSample]); + sampleHeader.ConvertToMPT(Samples[mptSample]); + instrHeader.instrument.ApplyAutoVibratoToMPT(Samples[mptSample]); - StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[mptSample], xmSample.name); + StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[mptSample], sampleHeader.name); - if((xmSample.flags & 3) == 3) + if((sampleHeader.flags & 3) == 3 && madeWith[verNewModPlug]) { - // MPT 1.09 and maybe newer / older versions set both flags for bidi loops - probablyMPT109 = true; + // MPT 1.09 and maybe newer / older versions set both loop flags for bidi loops + madeWith = (verModPlug1_09 | verConfirmed); } } } // Read samples - if(xmheader.version >= 0x0104) + if(fileHeader.version >= 0x0104) { - for(SAMPLEINDEX sample = 0; sample < insHeader.numSamples; sample++) + for(SAMPLEINDEX sample = 0; sample < instrHeader.numSamples; sample++) { - if(sample < sampleSlots.size() && dwMemPos < dwMemLength) + if(sample < sampleSlots.size()) { - sampleFlags[sample].ReadSample(Samples[sampleSlots[sample]], (LPSTR)(lpStream + dwMemPos), dwMemLength - dwMemPos); + sampleFlags[sample].ReadSample(Samples[sampleSlots[sample]], file); } - dwMemPos += sampleSize[sample]; } } } } - if(xmheader.version < 0x0104) + if(sampleReserved == 0 && madeWith[verNewModPlug] && memchr(fileHeader.songName, '\0', sizeof(fileHeader.songName)) != nullptr) { + // Null-terminated song name: Quite possibly MPT. + madeWith |= verConfirmed; + } + + if(fileHeader.version < 0x0104) + { // Load Patterns and Samples (Version 1.02 and 1.03) - if (dwMemPos + 8 >= dwMemLength) return true; - dwMemPos = ReadXMPatterns(lpStream, dwMemLength, dwMemPos, &xmheader, *this); - if(dwMemPos == 0) return true; + ReadXMPatterns(file, fileHeader, *this); for(SAMPLEINDEX sample = 1; sample <= GetNumSamples(); sample++) { - if(dwMemPos < dwMemLength) - { - dwMemPos += sampleFlags[sample - 1].ReadSample(Samples[sample], (LPSTR)(lpStream + dwMemPos), dwMemLength - dwMemPos); - } + sampleFlags[sample - 1].ReadSample(Samples[sample], file); } } - // Read song comments: "TEXT" - if ((dwMemPos + 8 < dwMemLength) && (LittleEndian(*((DWORD *)(lpStream+dwMemPos))) == 0x74786574)) + // Read song comments: "text" + if(file.ReadMagic("text")) { - UINT len = *((DWORD *)(lpStream+dwMemPos+4)); - dwMemPos += 8; - if ((dwMemPos + len <= dwMemLength) && (len < 16384)) - { - ReadMessage(lpStream + dwMemPos, len, leCR); - dwMemPos += len; - } - madeWithModPlug = true; + ReadMessage(file, file.ReadUint32LE(), leCR); + madeWith |= verConfirmed; + } else + { + file.SkipBack(4); } + // Read midi config: "MIDI" - if ((dwMemPos + 8 < dwMemLength) && (LittleEndian(*((DWORD *)(lpStream + dwMemPos))) == 0x4944494D)) + if(file.ReadMagic("MIDI")) { - UINT len = *((DWORD *)(lpStream+dwMemPos+4)); - dwMemPos += 8; - if (len == sizeof(MIDIMacroConfig)) - { - memcpy(&m_MidiCfg, lpStream + dwMemPos, len); - m_MidiCfg.Sanitize(); - m_SongFlags.set(SONG_EMBEDMIDICFG); - dwMemPos += len; //rewbs.fix36946 - } - madeWithModPlug = true; + file.ReadStructPartial(m_MidiCfg, file.ReadUint32LE()); + m_MidiCfg.Sanitize(); + m_SongFlags |= SONG_EMBEDMIDICFG; + madeWith |= verConfirmed; + } else + { + file.SkipBack(4); } + // Read pattern names: "PNAM" - if ((dwMemPos + 8 < dwMemLength) && (LittleEndian(*((DWORD *)(lpStream + dwMemPos))) == 0x4d414e50)) + if(file.ReadMagic("PNAM")) { - UINT len = *((DWORD *)(lpStream + dwMemPos + 4)); - dwMemPos += 8; - if ((dwMemPos + len <= dwMemLength) && (len <= MAX_PATTERNS * MAX_PATTERNNAME) && (len >= MAX_PATTERNNAME)) + const PATTERNINDEX namedPats = Util::Min(static_cast<PATTERNINDEX>(file.ReadUint32LE() / MAX_PATTERNNAME), Patterns.Size()); + + for(PATTERNINDEX pat = 0; pat < namedPats; pat++) { - DWORD pos = 0; - PATTERNINDEX nPat = 0; - for(pos = 0; pos < len; pos += MAX_PATTERNNAME, nPat++) - { - Patterns[nPat].SetName((char *)(lpStream + dwMemPos + pos), min(MAX_PATTERNNAME, len - pos)); - } - dwMemPos += len; + char patName[MAX_PATTERNNAME]; + file.ReadString<StringFixer::maybeNullTerminated>(patName, MAX_PATTERNNAME); + Patterns[pat].SetName(patName); } - madeWithModPlug = true; + madeWith |= verConfirmed; + } else + { + file.SkipBack(4); } + // Read channel names: "CNAM" - if ((dwMemPos + 8 < dwMemLength) && (LittleEndian(*((DWORD *)(lpStream + dwMemPos))) == 0x4d414e43)) + if(file.ReadMagic("CNAM")) { - UINT len = *((DWORD *)(lpStream+dwMemPos+4)); - dwMemPos += 8; - if ((dwMemPos + len <= dwMemLength) && (len <= MAX_BASECHANNELS*MAX_CHANNELNAME)) + const CHANNELINDEX namedChans = Util::Min(static_cast<CHANNELINDEX>(file.ReadUint32LE() / MAX_CHANNELNAME), GetNumChannels()); + for(CHANNELINDEX chn = 0; chn < namedChans; chn++) { - UINT n = len / MAX_CHANNELNAME; - for (UINT i=0; i<n; i++) - { - memcpy(ChnSettings[i].szName, (lpStream+dwMemPos + i * MAX_CHANNELNAME), MAX_CHANNELNAME); - StringFixer::SetNullTerminator(ChnSettings[i].szName); - } - dwMemPos += len; + file.ReadString<StringFixer::maybeNullTerminated>(ChnSettings[chn].szName, MAX_CHANNELNAME); } - madeWithModPlug = true; + madeWith |= verConfirmed; + } else + { + file.SkipBack(4); } + // Read mix plugins information - if (dwMemPos + 8 < dwMemLength) + if(file.BytesLeft() >= 8) { - DWORD dwOldPos = dwMemPos; - dwMemPos += LoadMixPlugins(lpStream+dwMemPos, dwMemLength-dwMemPos); - if(dwMemPos != dwOldPos) - madeWithModPlug = true; + size_t oldPos = file.GetPosition(); + file.Skip(LoadMixPlugins(file.GetRawData(), file.BytesLeft())); + if(file.GetPosition() != oldPos) + { + madeWith |= verConfirmed; + } } - // Check various things to find out whether this has been made with MPT. - // Null chars in names -> most likely made with MPT, which disguises as FT2 - if (!memcmp((LPCSTR)lpStream + 0x26, "FastTracker v2.00 ", 20) && probablyMadeWithModPlug && !isFT2) madeWithModPlug = true; - if (memcmp((LPCSTR)lpStream + 0x26, "FastTracker v2.00 ", 20)) madeWithModPlug = false; // this could happen e.g. with (early?) versions of Sk@le - if (!memcmp((LPCSTR)lpStream + 0x26, "FastTracker v 2.00 ", 20)) + if(madeWith[verConfirmed]) { - // Early MPT 1.0 alpha/beta versions - madeWithModPlug = true; - m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 00, 00, 00); + if(madeWith[verModPlug1_09]) + { + m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 09, 00, 00); + } else if(madeWith[verNewModPlug]) + { + m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 16, 00, 00); + } } - - if (!memcmp((LPCSTR)lpStream + 0x26, "OpenMPT ", 8)) + if(!memcmp(fileHeader.trackerName, "OpenMPT ", 8)) { - CHAR sVersion[13]; - memcpy(sVersion, lpStream + 0x26 + 8, 12); - StringFixer::SetNullTerminator(sVersion); - m_dwLastSavedWithVersion = MptVersion::ToNum(sVersion); + // Hey, I know this tracker! + char mptVersion[13]; + memcpy(mptVersion, fileHeader.trackerName + 8, 12); + StringFixer::SetNullTerminator(mptVersion); + m_dwLastSavedWithVersion = MptVersion::ToNum(mptVersion); } - if(madeWithModPlug) + if(m_dwLastSavedWithVersion != 0) { m_nMixLevels = mixLevels_original; SetModFlag(MSF_COMPATIBLE_PLAY, false); - if(!m_dwLastSavedWithVersion) - { - if(probablyMPT109) - m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 09, 00, 00); - else - m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 16, 00, 00); - } } // -> CODE#0027 // -> DESC="per-instrument volume ramping setup (refered as attack)" // Leave if no extra instrument settings are available (end of file reached) - if(dwMemPos >= dwMemLength) return true; + if(!file.BytesLeft()) return true; - bool bInterpretOpenMPTMade = false; // specific for OpenMPT 1.17+ (bMadeWithModPlug is also for MPT 1.16) - LPCBYTE ptr = lpStream + dwMemPos; + bool interpretOpenMPTMade = false; // specific for OpenMPT 1.17+ (bMadeWithModPlug is also for MPT 1.16) if(m_nInstruments) - ptr = LoadExtendedInstrumentProperties(ptr, lpStream+dwMemLength, &bInterpretOpenMPTMade); + { + file.Skip(reinterpret_cast<const char *>(LoadExtendedInstrumentProperties(reinterpret_cast<LPCBYTE>(file.GetRawData()), reinterpret_cast<LPCBYTE>(file.GetRawData()) + file.BytesLeft(), &interpretOpenMPTMade)) - file.GetRawData()); + } - LoadExtendedSongProperties(GetType(), ptr, lpStream, dwMemLength, &bInterpretOpenMPTMade); + LoadExtendedSongProperties(GetType(), reinterpret_cast<LPCBYTE>(file.GetRawData()), reinterpret_cast<LPCBYTE>(file.GetRawData()), file.BytesLeft(), &interpretOpenMPTMade); - if(bInterpretOpenMPTMade) + if(interpretOpenMPTMade) { UpgradeModFlags(); } - if(bInterpretOpenMPTMade && m_dwLastSavedWithVersion == 0) + if(interpretOpenMPTMade && m_dwLastSavedWithVersion == 0) m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 17, 01, 00); // early versions of OpenMPT had no version indication. return true; @@ -594,6 +555,10 @@ #ifndef MODPLUG_NO_FILESAVE #include "../mptrack/Moddoc.h" // for logging errors +#define str_tooMuchPatternData (GetStrI18N((_TEXT("Warning: File format limit was reached. Some pattern data may not get written to file.")))) +#define str_pattern (GetStrI18N((_TEXT("pattern")))) + + bool CSoundFile::SaveXM(LPCSTR lpszFileName, bool compatibilityExport) //-------------------------------------------------------------------- { @@ -630,7 +595,7 @@ // Writing song header xmheader.version = 0x0104; // XM Format v1.04 xmheader.size = sizeof(XMFileHeader) - 60; // minus everything before this field - xmheader.restartpos = m_nRestartPos; + xmheader.restartPos = m_nRestartPos; xmheader.channels = (m_nChannels + 1) & 0xFFFE; // avoid odd channel count for FT2 compatibility if((m_nChannels & 1) && m_nChannels < MAX_BASECHANNELS) addChannel = true; @@ -643,12 +608,12 @@ // +++ and --- patterns are not taken into consideration as FastTracker does not support them. ORDERINDEX nMaxOrds = 0; PATTERNINDEX nPatterns = 0; - for(ORDERINDEX nOrd = 0; nOrd < Order.GetLengthTailTrimmed(); nOrd++) + for(ORDERINDEX ord = 0; ord < Order.GetLengthTailTrimmed(); ord++) { - if(Patterns.IsValidIndex(Order[nOrd])) + if(Patterns.IsValidIndex(Order[ord])) { nMaxOrds++; - if(Order[nOrd] >= nPatterns) nPatterns = Order[nOrd] + 1; + if(Order[ord] >= nPatterns) nPatterns = Order[ord] + 1; } } if(!compatibilityExport) nMaxOrds = Order.GetLengthTailTrimmed(); // should really be removed at some point @@ -667,22 +632,23 @@ if(m_SongFlags[SONG_EXFILTERRANGE] && !compatibilityExport) xmheader.flags |= XMFileHeader::extendedFilterRange; xmheader.flags = xmheader.flags; - if(compatibilityExport) - xmheader.tempo = CLAMP(m_nDefaultTempo, 32, 255); - else - xmheader.tempo = CLAMP(m_nDefaultTempo, 32, 512); - xmheader.speed = CLAMP(m_nDefaultSpeed, 1, 31); +// if(compatibilityExport) +// xmheader.tempo = static_cast<uint16>(Clamp(m_nDefaultTempo, 32u, 255u)); +// else + // Fasttracker 2 will happily accept any tempo faster than 255 BPM. XMPlay does also support this, great! + xmheader.tempo = static_cast<uint16>(Clamp(m_nDefaultTempo, 32u, 512u)); + xmheader.speed = static_cast<uint16>(Clamp(m_nDefaultSpeed, 1u, 31u)); xmheader.ConvertEndianness(); - fwrite(&xmheader, 1, sizeof(xmheader), f); + // write order list (wihout +++ and ---, explained above) - for(ORDERINDEX nOrd = 0; nOrd < Order.GetLengthTailTrimmed(); nOrd++) + for(ORDERINDEX ord = 0; ord < Order.GetLengthTailTrimmed(); ord++) { - if(Patterns.IsValidIndex(Order[nOrd]) || !compatibilityExport) + if(Patterns.IsValidIndex(Order[ord]) || !compatibilityExport) { - BYTE nOrdval = static_cast<BYTE>(Order[nOrd]); - fwrite(&nOrdval, 1, sizeof(BYTE), f); + uint8 ordItem = static_cast<uint8>(Order[ord]); + fwrite(&ordItem, 1, 1, f); } } @@ -692,7 +658,7 @@ ModCommand *p = Patterns[pat]; UINT len = 0; // Empty patterns are always loaded as 64-row patterns in FT2, regardless of their real size... - bool emptyPatNeedsFixing = (Patterns[pat].GetNumRows() != 64); + bool emptyPattern = true; MemsetZero(xmph); xmph[0] = 9; @@ -737,6 +703,7 @@ case VOLCMD_PANNING: case VOLCMD_VIBRATODEPTH: case VOLCMD_TONEPORTAMENTO: + case VOLCMD_PANSLIDELEFT: // Doesn't have memory, but does weird things with zero param. break; default: // no memory here. @@ -747,11 +714,11 @@ // no need to fix non-empty patterns if(!p->IsEmpty()) - emptyPatNeedsFixing = false; + emptyPattern = false; - // apparently, completely empty patterns are loaded as empty 64-row patterns in FT2, regardless of their original size. + // Apparently, completely empty patterns are loaded as empty 64-row patterns in FT2, regardless of their original size. // We have to avoid this, so we add a "break to row 0" command in the last row. - if(j == 1 && emptyPatNeedsFixing) + if(j == 1 && emptyPattern && Patterns[pat].GetNumRows() != 64) { command = 0x0D; param = 0; @@ -787,12 +754,18 @@ } ASSERT_CAN_WRITE(5); + } + if(emptyPattern && Patterns[pat].GetNumRows() == 64) + { + // Be smart when saving empty patterns! + len = 0; } + xmph[7] = (BYTE)(len & 0xFF); xmph[8] = (BYTE)(len >> 8); fwrite(xmph, 1, 9, f); - fwrite(&s[0], 1, len, f); + if(len) fwrite(&s[0], 1, len, f); } else { MemsetZero(xmph); Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2012-09-27 22:08:52 UTC (rev 1362) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2012-09-27 22:12:03 UTC (rev 1363) @@ -30,7 +30,7 @@ FileReader file(reinterpret_cast<const char *>(lpMemFile), dwFileLength); if(!nSample || nSample >= MAX_SAMPLES) return false; if(!ReadWAVSample(nSample, file) - && !ReadXISample(nSample, lpMemFile, dwFileLength) + && !ReadXISample(nSample, file) && !ReadAIFFSample(nSample, file) && !ReadITSSample(nSample, lpMemFile, dwFileLength) && !ReadPATSample(nSample, lpMemFile, dwFileLength) @@ -46,8 +46,9 @@ bool CSoundFile::ReadInstrumentFromFile(INSTRUMENTINDEX nInstr, const LPBYTE lpMemFile, DWORD dwFileLength) //--------------------------------------------------------------------------------------------------------- { + FileReader file(reinterpret_cast<const char *>(lpMemFile), dwFileLength); if ((!nInstr) || (nInstr >= MAX_INSTRUMENTS)) return false; - if ((!ReadXIInstrument(nInstr, lpMemFile, dwFileLength)) + if ((!ReadXIInstrument(nInstr, file)) && (!ReadPATInstrument(nInstr, lpMemFile, dwFileLength)) && (!ReadITIInstrument(nInstr, lpMemFile, dwFileLength)) // Generic read @@ -900,23 +901,16 @@ // XI Instruments -bool CSoundFile::ReadXIInstrument(INSTRUMENTINDEX nInstr, const LPBYTE lpMemFile, DWORD dwFileLength) -//--------------------------------------------------------------------------------------------------- +bool CSoundFile::ReadXIInstrument(INSTRUMENTINDEX nInstr, FileReader &file) +//------------------------------------------------------------------------- { - if(dwFileLength < sizeof(XIInstrumentHeader)) - { - return false; - } + file.Rewind(); - XIInstrumentHeader header = *reinterpret_cast<const XIInstrumentHeader *>(lpMemFile); - header.ConvertEndianness(); - - DWORD dwMemPos = sizeof(XIInstrumentHeader); - - if(memcmp(header.signature, "Extended Instrument: ", 21) - || header.version != 0x102 - || header.eof != 0x1A - || header.numSamples > 32) + XIInstrumentHeader fileHeader; + if(!file.ReadConvertEndianness(fileHeader) + || memcmp(fileHeader.signature, "Extended Instrument: ", 21) + || fileHeader.version != XIInstrumentHeader::fileVersion + || fileHeader.eof != 0x1A) { return false; } @@ -932,18 +926,21 @@ } DestroyInstrument(nInstr, deleteAssociatedSamples); - if(nInstr > m_nInstruments) m_nInstruments = nInstr; + if(nInstr > m_nInstruments) + { + m_nInstruments = nInstr; + } Instruments[nInstr] = pIns; - header.ConvertToMPT(*pIns); + fileHeader.ConvertToMPT(*pIns); // Translate sample map and find available sample slots - vector<SAMPLEINDEX> sampleMap(header.numSamples); + vector<SAMPLEINDEX> sampleMap(fileHeader.numSamples); SAMPLEINDEX maxSmp = 0; for(size_t i = 0 + 12; i < 96 + 12; i++) { - if(pIns->Keyboard[i] >= header.numSamples) + if(pIns->Keyboard[i] >= fileHeader.numSamples) { continue; } @@ -965,41 +962,35 @@ m_nSamples = maxSmp; } - vector<SampleIO> sampleFlags(header.numSamples); + vector<SampleIO> sampleFlags(fileHeader.numSamples); // Read sample headers - for(SAMPLEINDEX i = 0; i < header.numSamples; i++) + for(SAMPLEINDEX i = 0; i < fileHeader.numSamples; i++) { - if (dwMemPos + sizeof(XMSample) > dwFileLength) + XMSample sampleHeader; + if(!file.Read(sampleHeader) + || !sampleMap[i]) { - break; - } - - const XMSample *xmSample= reinterpret_cast<const XMSample *>(lpMemFile + dwMemPos); - dwMemPos += sizeof(XMSample); - - if(!sampleMap[i]) - { continue; } ModSample &mptSample = Samples[sampleMap[i]]; - xmSample->ConvertToMPT(mptSample); - header.instrument.ApplyAutoVibratoToMPT(mptSample); + sampleHeader.ConvertToMPT(mptSample); + fileHeader.instrument.ApplyAutoVibratoToMPT(mptSample); mptSample.Convert(MOD_TYPE_XM, GetType()); - StringFixer::ReadString<StringFixer::spacePadded>(mptSample.filename, xmSample->name); - StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[sampleMap[i]], xmSample->name); + StringFixer::ReadString<StringFixer::spacePadded>(mptSample.filename, sampleHeader.name); + StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[sampleMap[i]], sampleHeader.name); - sampleFlags[i] = xmSample->GetSampleFormat(); + sampleFlags[i] = sampleHeader.GetSampleFormat(); } // Read sample data - for(SAMPLEINDEX i = 0; i < header.numSamples; i++) + for(SAMPLEINDEX i = 0; i < fileHeader.numSamples; i++) { - if(dwMemPos < dwFileLength && sampleMap[i]) + if(sampleMap[i]) { - dwMemPos += sampleFlags[i].ReadSample(Samples[sampleMap[i]], (LPSTR)(lpMemFile + dwMemPos), dwFileLength - dwMemPos); + sampleFlags[i].ReadSample(Samples[sampleMap[i]], file); } } @@ -1009,9 +1000,9 @@ // -> DESC="per-instrument volume ramping setup (refered as attack)" // Leave if no extra instrument settings are available (end of file reached) - if(dwMemPos < dwFileLength) + if(file.BytesLeft()) { - ReadExtendedInstrumentProperties(pIns, lpMemFile + dwMemPos, dwFileLength - dwMemPos); + ReadExtendedInstrumentProperties(pIns, file.GetRawData(), file.BytesLeft()); } // -! NEW_FEATURE#0027 @@ -1086,23 +1077,18 @@ // Read first sample from XI file into a sample slot -bool CSoundFile::ReadXISample(SAMPLEINDEX nSample, const LPBYTE lpMemFile, DWORD dwFileLength) -//-------------------------------------------------------------------------------------------- +bool CSoundFile::ReadXISample(SAMPLEINDEX nSample, FileReader &file) +//------------------------------------------------------------------ { - if(dwFileLength < sizeof(XIInstrumentHeader)) - { - return false; - } + file.Rewind(); - XIInstrumentHeader header = *reinterpret_cast<const XIInstrumentHeader *>(lpMemFile); - header.ConvertEndianness(); - - DWORD dwMemPos = sizeof(XIInstrumentHeader); - - if(memcmp(header.signature, "Extended Instrument: ", 21) - || header.version != 0x102 - || header.eof != 0x1A - || header.numSamples > 32) + XIInstrumentHeader fileHeader; + if(!file.ReadConvertEndianness(fileHeader) + || !file.CanRead(sizeof(XMSample)) + || memcmp(fileHeader.signature, "Extended Instrument: ", 21) + || fileHeader.version != XIInstrumentHeader::fileVersion + || fileHeader.eof != 0x1A + || fileHeader.numSamples == 0) { return false; } @@ -1112,34 +1098,27 @@ m_nSamples = nSample; } - // Read sample header - if (dwMemPos + sizeof(XMSample) > dwFileLength) - { - return false; - } - - const XMSample *xmSample= reinterpret_cast<const XMSample *>(lpMemFile + dwMemPos); + // Read first sample header + XMSample sampleHeader; + file.Read(sampleHeader); // Gotta skip 'em all! - dwMemPos += sizeof(XMSample) * header.numSamples; + file.Skip(sizeof(XMSample) * (fileHeader.numSamples - 1)); ModSample &mptSample = Samples[nSample]; - xmSample->ConvertToMPT(mptSample); + sampleHeader.ConvertToMPT(mptSample); if(GetType() != MOD_TYPE_XM) { // No need to pan that single sample, thank you... mptSample.uFlags &= ~CHN_PANNING; } - header.instrument.ApplyAutoVibratoToMPT(mptSample); + fileHeader.instrument.ApplyAutoVibratoToMPT(mptSample); mptSample.Convert(MOD_TYPE_XM, GetType()); - StringFixer::ReadString<StringFixer::spacePadded>(mptSample.filename, xmSample->name); - StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[nSample], xmSample->name); + StringFixer::ReadString<StringFixer::spacePadded>(mptSample.filename, sampleHeader.name); + StringFixer::ReadString<StringFixer::spacePadded>(m_szNames[nSample], sampleHeader.name); // Read sample data - if(dwMemPos < dwFileLength) - { - xmSample->GetSampleFormat().ReadSample(Samples[nSample], (LPSTR)(lpMemFile + dwMemPos), dwFileLength - dwMemPos); - } + sampleHeader.GetSampleFormat().ReadSample(Samples[nSample], file); return true; } @@ -1714,24 +1693,25 @@ } -void ReadExtendedInstrumentProperties(ModInstrument* pIns, const LPCBYTE pDataStart, const size_t nMemLength) -//----------------------------------------------------------------------------------------------------------- +void ReadExtendedInstrumentProperties(ModInstrument* pIns, const void *pDataStart, const size_t nMemLength) +//--------------------------------------------------------------------------------------------------------- { if(pIns == nullptr || pDataStart == nullptr || nMemLength < 4) return; - LPCBYTE pData = pDataStart; - const LPCBYTE pEnd = pDataStart + nMemLength; + const uint8 *pStart = static_cast<const uint8 *>(pDataStart); + const uint8 *pData = pStart; + const uint8 *pEnd = pStart + nMemLength; int32 code; memcpy(&code, pData, sizeof(code)); // Seek for supported extended settings header - if( code == 'MPTX' ) + if(code == 'MPTX') { pData += sizeof(code); // jump extension header code - while( (uintptr_t)(pData - pDataStart) <= nMemLength - 4) + while(static_cast<size_t>(pData - pStart) <= nMemLength - 4u) { memcpy(&code, pData, sizeof(code)); // read field code pData += sizeof(code); // jump field code Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2012-09-27 22:08:52 UTC (rev 1362) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2012-09-27 22:12:03 UTC (rev 1363) @@ -597,7 +597,7 @@ FileReader file(reinterpret_cast<const char*>(lpStream), dwMemLength); - if(!ReadXM(lpStream, dwMemLength) + if(!ReadXM(file) // -> CODE#0023 // -> DESC="IT project files (.itp)" && !ReadITProject(file) Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2012-09-27 22:08:52 UTC (rev 1362) +++ trunk/OpenMPT/soundlib/Sndfile.h 2012-09-27 22:12:03 UTC (rev 1363) @@ -384,7 +384,7 @@ bool InitChannel(CHANNELINDEX nChn); // Module Loaders - bool ReadXM(const LPCBYTE lpStream, const DWORD dwMemLength); + bool ReadXM(FileReader &file); bool ReadS3M(FileReader &file); bool ReadMod(FileReader &file); bool ReadMed(const LPCBYTE lpStream, const DWORD dwMemLength); @@ -631,7 +631,7 @@ bool ReadPATSample(SAMPLEINDEX nSample, const LPBYTE lpMemFile, DWORD dwFileLength); bool ReadS3ISample(SAMPLEINDEX nSample, const LPBYTE lpMemFile, DWORD dwFileLength); bool ReadAIFFSample(SAMPLEINDEX nSample, FileReader &file); - bool ReadXISample(SAMPLEINDEX nSample, const LPBYTE lpMemFile, DWORD dwFileLength); + bool ReadXISample(SAMPLEINDEX nSample, FileReader &file); UINT ReadITSSample(SAMPLEINDEX nSample, const LPBYTE lpMemFile, DWORD dwFileLength, DWORD dwOffset=0); bool Read8SVXSample(SAMPLEINDEX nInstr, const LPBYTE lpMemFile, DWORD dwFileLength); bool SaveWAVSample(SAMPLEINDEX nSample, const LPCSTR lpszFileName) const; @@ -639,7 +639,7 @@ // Instrument file I/O bool ReadInstrumentFromFile(INSTRUMENTINDEX nInstr, const LPBYTE lpMemFile, DWORD dwFileLength); - bool ReadXIInstrument(INSTRUMENTINDEX nInstr, const LPBYTE lpMemFile, DWORD dwFileLength); + bool ReadXIInstrument(INSTRUMENTINDEX nInstr, FileReader &file); bool ReadITIInstrument(INSTRUMENTINDEX nInstr, const LPBYTE lpMemFile, DWORD dwFileLength); bool ReadPATInstrument(INSTRUMENTINDEX nInstr, const LPBYTE lpMemFile, DWORD dwFileLength); bool ReadSampleAsInstrument(INSTRUMENTINDEX nInstr, const LPBYTE lpMemFile, DWORD dwFileLength); @@ -808,7 +808,7 @@ void ReadExtendedInstrumentProperty(ModInstrument* pIns, const int32 code, LPCBYTE& pData, const LPCBYTE pEnd); // Read extended instrument properties from 'pDataStart' to instrument 'pIns'. -void ReadExtendedInstrumentProperties(ModInstrument* pIns, const LPCBYTE pDataStart, const size_t nMemLength); +void ReadExtendedInstrumentProperties(ModInstrument* pIns, const void *pDataStart, const size_t nMemLength); // Convert instrument flags which were read from 'dF..' extension to proper internal representation. void ConvertReadExtendedFlags(ModInstrument* pIns); \ No newline at end of file Modified: trunk/OpenMPT/soundlib/XMTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/XMTools.cpp 2012-09-27 22:08:52 UTC (rev 1362) +++ trunk/OpenMPT/soundlib/XMTools.cpp 2012-09-27 22:12:03 UTC (rev 1363) @@ -22,7 +22,7 @@ SwapBytesLE(version); SwapBytesLE(size); SwapBytesLE(orders); - SwapBytesLE(restartpos); + SwapBytesLE(restartPos); SwapBytesLE(channels); SwapBytesLE(patterns); SwapBytesLE(instruments); Modified: trunk/OpenMPT/soundlib/XMTools.h =================================================================== --- trunk/OpenMPT/soundlib/XMTools.h 2012-09-27 22:08:52 UTC (rev 1362) +++ trunk/OpenMPT/soundlib/XMTools.h 2012-09-27 22:12:03 UTC (rev 1363) @@ -28,7 +28,7 @@ uint16 version; // File version (1.02 - 1.04 are supported) uint32 size; // Header Size uint16 orders; // Number of Orders - uint16 restartpos; // Restart Position + uint16 restartPos; // Restart Position uint16 channels; // Number of Channels uint16 patterns; // Number of Patterns uint16 instruments; // Number of Unstruments @@ -128,6 +128,11 @@ // XI Instrument Header struct XIInstrumentHeader { + enum + { + fileVersion = 0x102, + }; + char signature[21]; // "Extended Instrument: " char name[22]; // Instrument Name, not null-terminated (any nulls are treated as spaces) uint8 eof; // DOS EOF Character (0x1A) @@ -169,7 +174,7 @@ uint8 flags; // Sample Flags uint8 pan; // Sample Panning int8 relnote; // Sample Transpose - uint8 reserved; // Reserved (used for ModPlug's ADPCM compression) + uint8 reserved; // Reserved (abused for ModPlug's ADPCM compression) char name[22]; // Sample Name, not null-terminated (any nulls are treated as spaces) // Convert OpenMPT's internal sample representation to an XMSample. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-09-27 22:27:31
|
Revision: 1364 http://modplug.svn.sourceforge.net/modplug/?rev=1364&view=rev Author: saga-games Date: 2012-09-27 22:27:24 +0000 (Thu, 27 Sep 2012) Log Message: ----------- [Ref] Moved FileReader class to FileReader.h Modified Paths: -------------- trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/soundlib/ChunkReader.h trunk/OpenMPT/soundlib/Loaders.h trunk/OpenMPT/soundlib/WAVTools.h Added Paths: ----------- trunk/OpenMPT/soundlib/FileReader.h Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2012-09-27 22:12:03 UTC (rev 1363) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2012-09-27 22:27:24 UTC (rev 1364) @@ -1223,6 +1223,10 @@ > </File> <File + RelativePath="..\soundlib\FileReader.h" + > + </File> + <File RelativePath="..\soundlib\ITTools.cpp" > </File> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2012-09-27 22:12:03 UTC (rev 1363) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2012-09-27 22:27:24 UTC (rev 1364) @@ -322,6 +322,7 @@ <ClInclude Include="..\common\StringFixer.h" /> <ClInclude Include="..\common\typedefs.h" /> <ClInclude Include="..\soundlib\ChunkReader.h" /> + <ClInclude Include="..\soundlib\FileReader.h" /> <ClInclude Include="..\soundlib\ITTools.h" /> <ClInclude Include="..\soundlib\MIDIEvents.h" /> <ClInclude Include="..\soundlib\MIDIMacros.h" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2012-09-27 22:12:03 UTC (rev 1363) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2012-09-27 22:27:24 UTC (rev 1364) @@ -738,6 +738,9 @@ <ClInclude Include="..\common\FlagSet.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\soundlib\FileReader.h"> + <Filter>Module Loaders</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> Modified: trunk/OpenMPT/soundlib/ChunkReader.h =================================================================== --- trunk/OpenMPT/soundlib/ChunkReader.h 2012-09-27 22:12:03 UTC (rev 1363) +++ trunk/OpenMPT/soundlib/ChunkReader.h 2012-09-27 22:27:24 UTC (rev 1364) @@ -10,8 +10,7 @@ #pragma once -#include "Loaders.h" -#include <vector> +#include "FileReader.h" //=================================== Added: trunk/OpenMPT/soundlib/FileReader.h =================================================================== --- trunk/OpenMPT/soundlib/FileReader.h (rev 0) +++ trunk/OpenMPT/soundlib/FileReader.h 2012-09-27 22:27:24 UTC (rev 1364) @@ -0,0 +1,480 @@ +/* + * FileReader.h + * ------------ + * Purpose: A basic class for transparent reading of memory-based files. + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#pragma once + +#include "../common/typedefs.h" +#include "../common/StringFixer.h" +#include "Endianness.h" +#include <vector> +#include <algorithm> + + +//============== +class FileReader +//============== +{ +private: + const char *streamData; // Pointer to memory-mapped file + size_t streamLength; // Size of memory-mapped file in bytes + size_t streamPos; // Cursor location in the file + +public: + // Initialize invalid file reader object. + FileReader() : streamData(nullptr), streamLength(0), streamPos(0) { } + // Initialize file reader object with pointer to data and data length. + FileReader(const char *data, size_t length) : streamData(data), streamLength(length), streamPos(0) { } + // Initialize file reader object based on an existing file reader object. The other object's stream position is copied. + FileReader(const FileReader &other) : streamData(other.streamData), streamLength(other.streamLength), streamPos(other.streamPos) { } + + // Returns true if the object points to a valid stream. + bool IsValid() const + { + return streamData != nullptr; + } + + // Reset cursor to first byte in file. + void Rewind() + { + streamPos = 0; + } + + // Seek to a position in the mapped file. + // Returns false if position is invalid. + bool Seek(size_t position) + { + if(position <= streamLength) + { + streamPos = position; + return true; + } else + { + return false; + } + } + + // Increases position by skipBytes. + // Returns true if skipBytes could be skipped or false if the file end was reached earlier. + bool Skip(size_t skipBytes) + { + if(BytesLeft() >= skipBytes) + { + streamPos += skipBytes; + return true; + } else + { + streamPos = streamLength; + return false; + } + } + + // Decreases position by skipBytes. + // Returns true if skipBytes could be skipped or false if the file start was reached earlier. + bool SkipBack(size_t skipBytes) + { + if(streamPos >= skipBytes) + { + streamPos -= skipBytes; + return true; + } else + { + streamPos = 0; + return false; + } + } + + // Returns cursor position in the mapped file. + size_t GetPosition() const + { + return streamPos; + } + + // Returns size of the mapped file in bytes. + size_t GetLength() const + { + return streamLength; + } + + // Return byte count between cursor position and end of file, i.e. how many bytes can still be read. + size_t BytesLeft() const + { + ASSERT(streamPos <= streamLength); + return streamLength - streamPos; + } + + // Check if "amount" bytes can be read from the current position in the stream. + bool CanRead(size_t amount) const + { + return (amount <= BytesLeft()); + } + + // Create a new FileReader object for parsing a sub chunk at a given position with a given length. + // The file cursor is not modified. + FileReader GetChunk(size_t position, size_t length) const + { + if(position < streamLength) + { + return FileReader(streamData + position, (std::min)(length, streamLength - position)); + } else + { + return FileReader(); + } + } + + // Create a new FileReader object for parsing a sub chunk at the current position with a given length. + // The file cursor is advanced by "length" bytes. + FileReader GetChunk(size_t length) + { + size_t position = streamPos; + Skip(length); + return GetChunk(position, length); + } + + // Returns raw stream data at cursor position. + // Should only be used if absolutely necessary, for example for sample reading. + const char *GetRawData() const + { + return streamData + streamPos; + } + + // Read a "T" object from the stream. + // If not enough bytes can be read, false is returned. + // If successful, the file cursor is advanced by the size of "T". + template <typename T> + bool Read(T &target) + { + if(CanRead(sizeof(T))) + { + target = *reinterpret_cast<const T *>(streamData + streamPos); + streamPos += sizeof(T); + return true; + } else + { + return false; + } + } + +protected: + // Read some kind of integer in little-endian format. + // If successful, the file cursor is advanced by the size of the integer. + template <typename T> + T ReadIntLE() + { + static_assert(std::numeric_limits<T>::is_integer == true, "Target type is a not an integer"); + T target; + if(Read(target)) + { + return SwapBytesLE(target); + } else + { + return 0; + } + } + + // Read some kind of integer in big-endian format. + // If successful, the file cursor is advanced by the size of the integer. + template <typename T> + T ReadIntBE() + { + static_assert(std::numeric_limits<T>::is_integer == true, "Target type is a not an integer"); + T target; + if(Read(target)) + { + return SwapBytesBE(target); + } else + { + return 0; + } + } + +public: + // Read unsigned 32-Bit integer in little-endian format. + // If successful, the file cursor is advanced by the size of the integer. + uint32 ReadUint32LE() + { + return ReadIntLE<uint32>(); + } + + // Read unsigned 32-Bit integer in big-endian format. + // If successful, the file cursor is advanced by the size of the integer. + uint32 ReadUint32BE() + { + return ReadIntBE<uint32>(); + } + + // Read signed 32-Bit integer in little-endian format. + // If successful, the file cursor is advanced by the size of the integer. + int32 ReadInt32LE() + { + return ReadIntLE<int32>(); + } + + // Read signed 32-Bit integer in big-endian format. + // If successful, the file cursor is advanced by the size of the integer. + int32 ReadInt32BE() + { + return ReadIntBE<int32>(); + } + + // Read unsigned 16-Bit integer in little-endian format. + // If successful, the file cursor is advanced by the size of the integer. + uint16 ReadUint16LE() + { + return ReadIntLE<uint16>(); + } + + // Read unsigned 16-Bit integer in big-endian format. + // If successful, the file cursor is advanced by the size of the integer. + uint16 ReadUint16BE() + { + return ReadIntBE<uint16>(); + } + + // Read signed 16-Bit integer in little-endian format. + // If successful, the file cursor is advanced by the size of the integer. + int16 ReadInt16LE() + { + return ReadIntLE<int16>(); + } + + // Read signed 16-Bit integer in big-endian format. + // If successful, the file cursor is advanced by the size of the integer. + int16 ReadInt16BE() + { + return ReadIntBE<int16>(); + } + + // Read unsigned 8-Bit integer. + // If successful, the file cursor is advanced by the size of the integer. + uint8 ReadUint8() + { + uint8 target; + if(Read(target)) + { + return target; + } else + { + return 0; + } + } + + // Read signed 8-Bit integer. If successful, the file cursor is advanced by the size of the integer. + int8 ReadInt8() + { + int8 target; + if(Read(target)) + { + return target; + } else + { + return 0; + } + } + + // Read 32-Bit float in little-endian format. + // If successful, the file cursor is advanced by the size of the float. + float ReadFloatLE() + { + float target; + if(Read(target)) + { + uint32 temp = *reinterpret_cast<uint32 *>(&target); + SwapBytesLE(temp); + return *reinterpret_cast<float *>(&temp); + } else + { + return 0.0f; + } + } + + // Read 32-Bit float in big-endian format. + // If successful, the file cursor is advanced by the size of the float. + float ReadFloatBE() + { + float target; + if(Read(target)) + { + uint32 temp = *reinterpret_cast<uint32 *>(&target); + SwapBytesBE(temp); + return *reinterpret_cast<float *>(&temp); + } else + { + return 0.0f; + } + } + + // Read a struct. + // If successful, the file cursor is advanced by the size of the struct. Otherwise, the target is zeroed. + template <typename T> + bool ReadStruct(T &target) + { + if(Read(target)) + { + return true; + } else + { + MemsetZero(target); + return false; + } + } + + // Allow to read a struct partially (if there's less memory available than the struct's size, fill it up with zeros). + // The file cursor is advanced by "partialSize" bytes. + template <typename T> + bool ReadStructPartial(T &target, size_t partialSize = sizeof(T)) + { + const size_t copyBytes = Util::Min(partialSize, sizeof(target), BytesLeft()); + + memcpy(&target, streamData + streamPos, copyBytes); + memset(reinterpret_cast<char *>(&target) + copyBytes, 0, sizeof(target) - copyBytes); + Skip(partialSize); + + return true; + } + + // Read a "T" object from the stream. + // If not enough bytes can be read, false is returned. + // If successful, the file cursor is advanced by the size of "T" and the object's "ConvertEndianness()" method is called. + template <typename T> + bool ReadConvertEndianness(T &target) + { + if(Read(target)) + { + target.ConvertEndianness(); + return true; + } else + { + return false; + } + } + + // Read a string of length srcSize into fixed-length char array destBuffer using a given read mode. + // The file cursor is advanced by "srcSize" bytes. + template<StringFixer::ReadWriteMode mode, size_t destSize> + bool ReadString(char (&destBuffer)[destSize], const size_t srcSize) + { + if(CanRead(srcSize)) + { + StringFixer::ReadString<mode, destSize>(destBuffer, streamData + streamPos, srcSize); + streamPos += srcSize; + return true; + } else + { + return false; + } + } + + // Read an array. + // If successful, the file cursor is advanced by the size of the array. + // Otherwise, the target is zeroed. + template<typename T, size_t destSize> + bool ReadArray(T (&destArray)[destSize]) + { + if(CanRead(sizeof(destArray))) + { + memcpy(destArray, streamData + streamPos, sizeof(destArray)); + streamPos += sizeof(destArray); + return true; + } else + { + MemsetZero(destArray); + return false; + } + } + + // Read destSize elements of type T into a vector. + // If successful, the file cursor is advanced by the size of the vector. + // Otherwise, the vector is cleared. + template<typename T> + bool ReadVector(std::vector<T> &destVector, size_t destSize) + { + const size_t readSize = sizeof(T) * destSize; + if(CanRead(readSize)) + { + destVector.resize(destSize); + memcpy(&destVector[0], streamData + streamPos, readSize); + streamPos += readSize; + return true; + } else + { + destVector.clear(); + return false; + } + } + + // Compare a magic string with the current stream position. + // Returns true if they are identical. + // The file cursor is advanced by the the length of the "magic" string. + bool ReadMagic(const char *magic) + { + const size_t magicLength = strlen(magic); + if(CanRead(magicLength)) + { + bool result = !memcmp(streamData + streamPos, magic, magicLength); + streamPos += magicLength; + return result; + } else + { + return false; + } + } + + // Read variable-length integer (as found in MIDI files). + // If successful, the file cursor is advanced by the size of the integer and true is returned. + // False is returned if not enough bytes were left to finish reading of the integer or if an overflow happened (source doesn't fit into target integer). + // In case of an overflow, the target is also set to the maximum value supported by its data type. + template<typename T> + bool ReadVarInt(T &target) + { + static_assert(std::numeric_limits<T>::is_integer == true + && std::numeric_limits<T>::is_signed == false, + "Target type is a not an unsigned integer"); + + if(!BytesLeft()) + { + target = 0; + return false; + } + + size_t writtenBits = 0; + uint8 b = ReadUint8(); + target = (b & 0x7F); + + // Count actual bits used in most significant byte (i.e. this one) + for(size_t bit = 0; bit < 7; bit++) + { + if((b & (1 << bit)) != 0) + { + writtenBits = bit + 1; + } + } + + while(BytesLeft() && (b & 0x80) != 0) + { + b = ReadUint8(); + target <<= 7; + target |= (b & 0x7F); + writtenBits += 7; + }; + + if(writtenBits > sizeof(target) * 8) + { + // Overflow + target = Util::MaxValueOfType<T>(target); + return false; + } else if((b & 0x80) != 0) + { + // Reached EOF + return false; + } + return true; + } + +}; Modified: trunk/OpenMPT/soundlib/Loaders.h =================================================================== --- trunk/OpenMPT/soundlib/Loaders.h 2012-09-27 22:12:03 UTC (rev 1363) +++ trunk/OpenMPT/soundlib/Loaders.h 2012-09-27 22:27:24 UTC (rev 1364) @@ -9,10 +9,10 @@ #pragma once -#include "Endianness.h" #include "../common/misc_util.h" -#include "../common/StringFixer.h" -#include <vector> +#include "FileReader.h" +#include "Sndfile.h" +#include "SampleIO.h" // Execute "action" if "request_bytes" bytes cannot be read from stream at position "position" // DEPRECATED. Use FileReader instead. @@ -22,469 +22,3 @@ // "Default" macro for checking if x bytes can be read from stream. // DEPRECATED. Use FileReader instead. #define ASSERT_CAN_READ(x) ASSERT_CAN_READ_PROTOTYPE(dwMemPos, dwMemLength, x, return false); - - -//============== -class FileReader -//============== -{ -private: - const char *streamData; // Pointer to memory-mapped file - size_t streamLength; // Size of memory-mapped file in bytes - size_t streamPos; // Cursor location in the file - -public: - // Initialize invalid file reader object. - FileReader() : streamData(nullptr), streamLength(0), streamPos(0) { } - // Initialize file reader object with pointer to data and data length. - FileReader(const char *data, size_t length) : streamData(data), streamLength(length), streamPos(0) { } - // Initialize file reader object based on an existing file reader object. The other object's stream position is copied. - FileReader(const FileReader &other) : streamData(other.streamData), streamLength(other.streamLength), streamPos(other.streamPos) { } - - // Returns true if the object points to a valid stream. - bool IsValid() const - { - return streamData != nullptr; - } - - // Reset cursor to first byte in file. - void Rewind() - { - streamPos = 0; - } - - // Seek to a position in the mapped file. - // Returns false if position is invalid. - bool Seek(size_t position) - { - if(position <= streamLength) - { - streamPos = position; - return true; - } else - { - return false; - } - } - - // Increases position by skipBytes. - // Returns true if skipBytes could be skipped or false if the file end was reached earlier. - bool Skip(size_t skipBytes) - { - if(BytesLeft() >= skipBytes) - { - streamPos += skipBytes; - return true; - } else - { - streamPos = streamLength; - return false; - } - } - - // Decreases position by skipBytes. - // Returns true if skipBytes could be skipped or false if the file start was reached earlier. - bool SkipBack(size_t skipBytes) - { - if(streamPos >= skipBytes) - { - streamPos -= skipBytes; - return true; - } else - { - streamPos = 0; - return false; - } - } - - // Returns cursor position in the mapped file. - size_t GetPosition() const - { - return streamPos; - } - - // Returns size of the mapped file in bytes. - size_t GetLength() const - { - return streamLength; - } - - // Return byte count between cursor position and end of file, i.e. how many bytes can still be read. - size_t BytesLeft() const - { - ASSERT(streamPos <= streamLength); - return streamLength - streamPos; - } - - // Check if "amount" bytes can be read from the current position in the stream. - bool CanRead(size_t amount) const - { - return (amount <= BytesLeft()); - } - - // Create a new FileReader object for parsing a sub chunk at a given position with a given length. - // The file cursor is not modified. - FileReader GetChunk(size_t position, size_t length) const - { - if(position < streamLength) - { - return FileReader(streamData + position, Util::Min(length, streamLength - position)); - } else - { - return FileReader(); - } - } - - // Create a new FileReader object for parsing a sub chunk at the current position with a given length. - // The file cursor is advanced by "length" bytes. - FileReader GetChunk(size_t length) - { - size_t position = streamPos; - Skip(length); - return GetChunk(position, length); - } - - // Returns raw stream data at cursor position. - // Should only be used if absolutely necessary, for example for sample reading. - const char *GetRawData() const - { - return streamData + streamPos; - } - - // Read a "T" object from the stream. - // If not enough bytes can be read, false is returned. - // If successful, the file cursor is advanced by the size of "T". - template <typename T> - bool Read(T &target) - { - if(CanRead(sizeof(T))) - { - target = *reinterpret_cast<const T *>(streamData + streamPos); - streamPos += sizeof(T); - return true; - } else - { - return false; - } - } - -protected: - // Read some kind of integer in little-endian format. - // If successful, the file cursor is advanced by the size of the integer. - template <typename T> - T ReadIntLE() - { - static_assert(std::numeric_limits<T>::is_integer == true, "Target type is a not an integer"); - T target; - if(Read(target)) - { - return SwapBytesLE(target); - } else - { - return 0; - } - } - - // Read some kind of integer in big-endian format. - // If successful, the file cursor is advanced by the size of the integer. - template <typename T> - T ReadIntBE() - { - static_assert(std::numeric_limits<T>::is_integer == true, "Target type is a not an integer"); - T target; - if(Read(target)) - { - return SwapBytesBE(target); - } else - { - return 0; - } - } - -public: - // Read unsigned 32-Bit integer in little-endian format. - // If successful, the file cursor is advanced by the size of the integer. - uint32 ReadUint32LE() - { - return ReadIntLE<uint32>(); - } - - // Read unsigned 32-Bit integer in big-endian format. - // If successful, the file cursor is advanced by the size of the integer. - uint32 ReadUint32BE() - { - return ReadIntBE<uint32>(); - } - - // Read signed 32-Bit integer in little-endian format. - // If successful, the file cursor is advanced by the size of the integer. - int32 ReadInt32LE() - { - return ReadIntLE<int32>(); - } - - // Read signed 32-Bit integer in big-endian format. - // If successful, the file cursor is advanced by the size of the integer. - int32 ReadInt32BE() - { - return ReadIntBE<int32>(); - } - - // Read unsigned 16-Bit integer in little-endian format. - // If successful, the file cursor is advanced by the size of the integer. - uint16 ReadUint16LE() - { - return ReadIntLE<uint16>(); - } - - // Read unsigned 16-Bit integer in big-endian format. - // If successful, the file cursor is advanced by the size of the integer. - uint16 ReadUint16BE() - { - return ReadIntBE<uint16>(); - } - - // Read signed 16-Bit integer in little-endian format. - // If successful, the file cursor is advanced by the size of the integer. - int16 ReadInt16LE() - { - return ReadIntLE<int16>(); - } - - // Read signed 16-Bit integer in big-endian format. - // If successful, the file cursor is advanced by the size of the integer. - int16 ReadInt16BE() - { - return ReadIntBE<int16>(); - } - - // Read unsigned 8-Bit integer. - // If successful, the file cursor is advanced by the size of the integer. - uint8 ReadUint8() - { - uint8 target; - if(Read(target)) - { - return target; - } else - { - return 0; - } - } - - // Read signed 8-Bit integer. If successful, the file cursor is advanced by the size of the integer. - int8 ReadInt8() - { - int8 target; - if(Read(target)) - { - return target; - } else - { - return 0; - } - } - - // Read 32-Bit float in little-endian format. - // If successful, the file cursor is advanced by the size of the float. - float ReadFloatLE() - { - float target; - if(Read(target)) - { - uint32 temp = *reinterpret_cast<uint32 *>(&target); - SwapBytesLE(temp); - return *reinterpret_cast<float *>(&temp); - } else - { - return 0.0f; - } - } - - // Read 32-Bit float in big-endian format. - // If successful, the file cursor is advanced by the size of the float. - float ReadFloatBE() - { - float target; - if(Read(target)) - { - uint32 temp = *reinterpret_cast<uint32 *>(&target); - SwapBytesBE(temp); - return *reinterpret_cast<float *>(&temp); - } else - { - return 0.0f; - } - } - - // Read a struct. - // If successful, the file cursor is advanced by the size of the struct. Otherwise, the target is zeroed. - template <typename T> - bool ReadStruct(T &target) - { - if(Read(target)) - { - return true; - } else - { - MemsetZero(target); - return false; - } - } - - // Allow to read a struct partially (if there's less memory available than the struct's size, fill it up with zeros). - // The file cursor is advanced by "partialSize" bytes. - template <typename T> - bool ReadStructPartial(T &target, size_t partialSize = sizeof(T)) - { - const size_t copyBytes = Util::Min(partialSize, sizeof(target), BytesLeft()); - - memcpy(&target, streamData + streamPos, copyBytes); - memset(reinterpret_cast<char *>(&target) + copyBytes, 0, sizeof(target) - copyBytes); - Skip(partialSize); - - return true; - } - - // Read a "T" object from the stream. - // If not enough bytes can be read, false is returned. - // If successful, the file cursor is advanced by the size of "T" and the object's "ConvertEndianness()" method is called. - template <typename T> - bool ReadConvertEndianness(T &target) - { - if(Read(target)) - { - target.ConvertEndianness(); - return true; - } else - { - return false; - } - } - - // Read a string of length srcSize into fixed-length char array destBuffer using a given read mode. - // The file cursor is advanced by "srcSize" bytes. - template<StringFixer::ReadWriteMode mode, size_t destSize> - bool ReadString(char (&destBuffer)[destSize], const size_t srcSize) - { - if(CanRead(srcSize)) - { - StringFixer::ReadString<mode, destSize>(destBuffer, streamData + streamPos, srcSize); - streamPos += srcSize; - return true; - } else - { - return false; - } - } - - // Read an array. - // If successful, the file cursor is advanced by the size of the array. - // Otherwise, the target is zeroed. - template<typename T, size_t destSize> - bool ReadArray(T (&destArray)[destSize]) - { - if(CanRead(sizeof(destArray))) - { - memcpy(destArray, streamData + streamPos, sizeof(destArray)); - streamPos += sizeof(destArray); - return true; - } else - { - MemsetZero(destArray); - return false; - } - } - - // Read destSize elements of type T into a vector. - // If successful, the file cursor is advanced by the size of the vector. - // Otherwise, the vector is cleared. - template<typename T> - bool ReadVector(std::vector<T> &destVector, size_t destSize) - { - const size_t readSize = sizeof(T) * destSize; - if(CanRead(readSize)) - { - destVector.resize(destSize); - memcpy(&destVector[0], streamData + streamPos, readSize); - streamPos += readSize; - return true; - } else - { - destVector.clear(); - return false; - } - } - - // Compare a magic string with the current stream position. - // Returns true if they are identical. - // The file cursor is advanced by the the length of the "magic" string. - bool ReadMagic(const char *magic) - { - const size_t magicLength = strlen(magic); - if(CanRead(magicLength)) - { - bool result = !memcmp(streamData + streamPos, magic, magicLength); - streamPos += magicLength; - return result; - } else - { - return false; - } - } - - // Read variable-length integer (as found in MIDI files). - // If successful, the file cursor is advanced by the size of the integer and true is returned. - // False is returned if not enough bytes were left to finish reading of the integer or if an overflow happened (source doesn't fit into target integer). - // In case of an overflow, the target is also set to the maximum value supported by its data type. - template<typename T> - bool ReadVarInt(T &target) - { - static_assert(std::numeric_limits<T>::is_integer == true - && std::numeric_limits<T>::is_signed == false, - "Target type is a not an unsigned integer"); - - if(!BytesLeft()) - { - target = 0; - return false; - } - - size_t writtenBits = 0; - uint8 b = ReadUint8(); - target = (b & 0x7F); - - // Count actual bits used in most significant byte (i.e. this one) - for(size_t bit = 0; bit < 7; bit++) - { - if((b & (1 << bit)) != 0) - { - writtenBits = bit + 1; - } - } - - while(BytesLeft() && (b & 0x80) != 0) - { - b = ReadUint8(); - target <<= 7; - target |= (b & 0x7F); - writtenBits += 7; - }; - - if(writtenBits > sizeof(target) * 8) - { - // Overflow - target = Util::MaxValueOfType<T>(target); - return false; - } else if((b & 0x80) != 0) - { - // Reached EOF - return false; - } - return true; - } - -}; - -#include "Sndfile.h" -#include "SampleIO.h" Modified: trunk/OpenMPT/soundlib/WAVTools.h =================================================================== --- trunk/OpenMPT/soundlib/WAVTools.h 2012-09-27 22:12:03 UTC (rev 1363) +++ trunk/OpenMPT/soundlib/WAVTools.h 2012-09-27 22:27:24 UTC (rev 1364) @@ -10,6 +10,7 @@ #pragma once +#include "Loaders.h" #include "ChunkReader.h" #pragma pack(push, 1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-09-28 14:08:50
|
Revision: 1365 http://modplug.svn.sourceforge.net/modplug/?rev=1365&view=rev Author: saga-games Date: 2012-09-28 14:08:40 +0000 (Fri, 28 Sep 2012) Log Message: ----------- [Imp] Mouse wheel works with more spin controls now (http://bugs.openmpt.org/view.php?id=99) [Ref] Removed some dead code Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Ctrl_gen.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Tables.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2012-09-27 22:27:24 UTC (rev 1364) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2012-09-28 14:08:40 UTC (rev 1365) @@ -32,11 +32,6 @@ ON_COMMAND(IDC_BUTTON_MODTYPE, OnSongProperties) ON_COMMAND(IDC_BUTTON_PLAYERPROPS, OnPlayerProperties) ON_COMMAND(IDC_CHECK_LOOPSONG, OnLoopSongChanged) - ON_COMMAND(IDC_CHECK_BASS, OnXBassChanged) - ON_COMMAND(IDC_CHECK_SURROUND, OnSurroundChanged) - ON_COMMAND(IDC_CHECK_REVERB, OnReverbChanged) - ON_COMMAND(IDC_CHECK_EQ, OnEqualizerChanged) - ON_COMMAND(IDC_CHECK_AGC, OnAGCChanged) ON_EN_CHANGE(IDC_EDIT_SONGTITLE, OnTitleChanged) ON_EN_CHANGE(IDC_EDIT_TEMPO, OnTempoChanged) ON_EN_CHANGE(IDC_EDIT_SPEED, OnSpeedChanged) @@ -44,7 +39,6 @@ ON_EN_CHANGE(IDC_EDIT_RESTARTPOS, OnRestartPosChanged) ON_EN_CHANGE(IDC_EDIT_VSTIVOL, OnVSTiVolChanged) ON_EN_CHANGE(IDC_EDIT_SAMPLEPA, OnSamplePAChanged) - ON_CBN_SELCHANGE(IDC_COMBO_RESAMPLING, OnResamplingChanged) ON_MESSAGE(WM_MOD_UPDATEPOSITION, OnUpdatePosition) ON_EN_SETFOCUS(IDC_EDIT_SONGTITLE, OnEnSetfocusEditSongtitle) //}}AFX_MSG_MAP @@ -76,7 +70,6 @@ DDX_Control(pDX, IDC_SLIDER_SAMPLEPREAMP, m_SliderSamplePreAmp); DDX_Control(pDX, IDC_EDIT_MODTYPE, m_EditModType); - DDX_Control(pDX, IDC_COMBO_RESAMPLING, m_ComboResampling); DDX_Control(pDX, IDC_VUMETER_LEFT, m_VuMeterLeft); DDX_Control(pDX, IDC_VUMETER_RIGHT, m_VuMeterRight); //}}AFX_DATA_MAP @@ -126,15 +119,6 @@ m_SliderVSTiVol.SetRange(0, MAX_SLIDER_VSTI_VOL); m_SliderSamplePreAmp.SetRange(0, MAX_SLIDER_SAMPLE_VOL); - - // -! BEHAVIOUR_CHANGE#0016 - m_ComboResampling.AddString("None"); - m_ComboResampling.AddString("Linear"); - m_ComboResampling.AddString("Cubic spline"); - //rewbs.resamplerConf - m_ComboResampling.AddString("Polyphase"); - m_ComboResampling.AddString("XMMS-ModPlug"); - //end rewbs.resamplerConf m_bEditsLocked=false; UpdateView(HINT_MODGENERAL|HINT_MODTYPE|HINT_MODSEQUENCE|HINT_MPTSETUP, NULL); OnActivatePage(0); @@ -188,10 +172,8 @@ if ((pHint == this) || (!m_pSndFile)) return; if (dwHint & HINT_MODSEQUENCE) { - // Detecting max valid restart position - ORDERINDEX i = 0; - for (i=0; i<m_pSndFile->Order.size(); i++) if (m_pSndFile->Order[i] == m_pSndFile->Order.GetInvalidPatIndex()) break; - m_SpinRestartPos.SetRange32(0, i); + // Set max valid restart position + m_SpinRestartPos.SetRange32(0, m_pSndFile->Order.GetLengthTailTrimmed() - 1); } if (dwHint & HINT_MODGENERAL) { @@ -218,10 +200,8 @@ m_SliderVSTiVol.SetPos(MAX_SLIDER_VSTI_VOL-m_pSndFile->m_nVSTiVolume); m_SliderSamplePreAmp.SetPos(MAX_SLIDER_SAMPLE_VOL-m_pSndFile->m_nSamplePreAmp); m_SliderTempo.SetPos(m_pSndFile->GetModSpecifications().tempoMax - m_pSndFile->m_nDefaultTempo); - - - } + if (dwHint & HINT_MODTYPE) { CModSpecifications specs = m_pSndFile->GetModSpecifications(); @@ -245,7 +225,7 @@ m_SliderVSTiVol.EnableWindow(bIsNotMOD_S3M); m_EditVSTiVol.EnableWindow(bIsNotMOD_S3M); m_SpinVSTiVol.EnableWindow(bIsNotMOD_S3M); - m_EditRestartPos.EnableWindow((specs.hasRestartPos || m_pSndFile->m_nRestartPos != 0) ? TRUE : FALSE); + m_EditRestartPos.EnableWindow((specs.hasRestartPos || m_pSndFile->m_nRestartPos != 0)); m_SpinRestartPos.EnableWindow(m_EditRestartPos.IsWindowEnabled()); //Note: Sample volume slider is not disabled for MOD @@ -270,14 +250,7 @@ } if (dwHint & HINT_MPTSETUP) { - DWORD dwSetup = CMainFrame::GetSettings().m_dwQuality; - m_ComboResampling.SetCurSel(CMainFrame::GetSettings().m_nSrcMode); CheckDlgButton(IDC_CHECK_LOOPSONG, (CMainFrame::GetSettings().gbLoopSong) ? TRUE : FALSE); - CheckDlgButton(IDC_CHECK_AGC, (dwSetup & QUALITY_AGC) ? TRUE : FALSE); - CheckDlgButton(IDC_CHECK_BASS, (dwSetup & QUALITY_MEGABASS) ? TRUE : FALSE); - CheckDlgButton(IDC_CHECK_REVERB, (dwSetup & QUALITY_REVERB) ? TRUE : FALSE); - CheckDlgButton(IDC_CHECK_SURROUND, (dwSetup & QUALITY_SURROUND) ? TRUE : FALSE); - CheckDlgButton(IDC_CHECK_EQ, (dwSetup & QUALITY_EQ) ? TRUE : FALSE); } if (dwHint & HINT_MPTOPTIONS) { @@ -536,18 +509,6 @@ } -void CCtrlGeneral::OnResamplingChanged() -//-------------------------------------- -{ - DWORD n = m_ComboResampling.GetCurSel(); - if ((n < NUM_SRC_MODES) && (n != CMainFrame::GetSettings().m_nSrcMode)) - { - CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (pMainFrm) pMainFrm->SetupPlayer(CMainFrame::GetSettings().m_dwQuality, n); - } -} - - void CCtrlGeneral::OnLoopSongChanged() //------------------------------------ { @@ -561,76 +522,6 @@ } -void CCtrlGeneral::OnAGCChanged() -//------------------------------- -{ - BOOL b = IsDlgButtonChecked(IDC_CHECK_AGC); - DWORD dwQuality = CMainFrame::GetSettings().m_dwQuality & ~QUALITY_AGC; - if (b) dwQuality |= QUALITY_AGC; - if (dwQuality != CMainFrame::GetSettings().m_dwQuality) - { - CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (pMainFrm) pMainFrm->SetupPlayer(dwQuality, CMainFrame::GetSettings().m_nSrcMode); - } -} - - -void CCtrlGeneral::OnXBassChanged() -//--------------------------------- -{ - BOOL b = IsDlgButtonChecked(IDC_CHECK_BASS); - DWORD dwQuality = CMainFrame::GetSettings().m_dwQuality & ~QUALITY_MEGABASS; - if (b) dwQuality |= QUALITY_MEGABASS; - if (dwQuality != CMainFrame::GetSettings().m_dwQuality) - { - CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (pMainFrm) pMainFrm->SetupPlayer(dwQuality, CMainFrame::GetSettings().m_nSrcMode); - } -} - - -void CCtrlGeneral::OnReverbChanged() -//---------------------------------- -{ - BOOL b = IsDlgButtonChecked(IDC_CHECK_REVERB); - DWORD dwQuality = CMainFrame::GetSettings().m_dwQuality & ~QUALITY_REVERB; - if (b) dwQuality |= QUALITY_REVERB; - if (dwQuality != CMainFrame::GetSettings().m_dwQuality) - { - CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (pMainFrm) pMainFrm->SetupPlayer(dwQuality, CMainFrame::GetSettings().m_nSrcMode); - } -} - - -void CCtrlGeneral::OnSurroundChanged() -//------------------------------------ -{ - BOOL b = IsDlgButtonChecked(IDC_CHECK_SURROUND); - DWORD dwQuality = CMainFrame::GetSettings().m_dwQuality & ~QUALITY_SURROUND; - if (b) dwQuality |= QUALITY_SURROUND; - if (dwQuality != CMainFrame::GetSettings().m_dwQuality) - { - CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (pMainFrm) pMainFrm->SetupPlayer(dwQuality, CMainFrame::GetSettings().m_nSrcMode); - } -} - - -void CCtrlGeneral::OnEqualizerChanged() -//------------------------------------- -{ - BOOL b = IsDlgButtonChecked(IDC_CHECK_EQ); - DWORD dwQuality = CMainFrame::GetSettings().m_dwQuality & ~QUALITY_EQ; - if (b) dwQuality |= QUALITY_EQ; - if (dwQuality != CMainFrame::GetSettings().m_dwQuality) - { - CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (pMainFrm) pMainFrm->SetupPlayer(dwQuality, CMainFrame::GetSettings().m_nSrcMode); - } -} - - LRESULT CCtrlGeneral::OnUpdatePosition(WPARAM, LPARAM lParam) //----------------------------------------------------------- { @@ -689,7 +580,7 @@ } double changeFactor = value / valueAtZeroDB; - double dB = 10 * log(changeFactor); + double dB = 10 * log(changeFactor); char sign = (dB>=0) ? '+' : ' '; sprintf(stringToSet, "%c%.2f dB", sign, dB); @@ -759,7 +650,7 @@ for (int ry=rect.bottom-1; ry>rect.top; ry-=2) { int y0 = rect.bottom - ry; - int n = CLAMP((y0 * NUM_VUMETER_PENS) / cy, 0, NUM_VUMETER_PENS - 1); + int n = Clamp((y0 * NUM_VUMETER_PENS) / cy, 0, NUM_VUMETER_PENS - 1); if (vu < y0) n += NUM_VUMETER_PENS; Modified: trunk/OpenMPT/mptrack/Ctrl_gen.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.h 2012-09-27 22:27:24 UTC (rev 1364) +++ trunk/OpenMPT/mptrack/Ctrl_gen.h 2012-09-28 14:08:40 UTC (rev 1365) @@ -66,7 +66,6 @@ m_SpinSamplePA, m_SpinVSTiVol; CSliderCtrl m_SliderTempo, m_SliderSamplePreAmp, m_SliderGlobalVol, m_SliderVSTiVol; - CComboBox m_ComboResampling; CVuMeter m_VuMeterLeft, m_VuMeterRight; //}}AFX_DATA //{{AFX_VIRTUAL(CCtrlGeneral) @@ -92,13 +91,7 @@ afx_msg void OnRestartPosChanged(); afx_msg void OnSongProperties(); afx_msg void OnPlayerProperties(); - afx_msg void OnResamplingChanged(); afx_msg void OnLoopSongChanged(); - afx_msg void OnAGCChanged(); - afx_msg void OnXBassChanged(); - afx_msg void OnReverbChanged(); - afx_msg void OnSurroundChanged(); - afx_msg void OnEqualizerChanged(); afx_msg void OnEnSetfocusEditSongtitle(); //}}AFX_MSG DECLARE_MESSAGE_MAP() Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2012-09-27 22:27:24 UTC (rev 1364) +++ trunk/OpenMPT/mptrack/mptrack.rc 2012-09-28 14:08:40 UTC (rev 1365) @@ -234,12 +234,12 @@ LTEXT "Initial Volume:",IDC_STATIC,6,30,45,8 CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,54,24,92,22 EDITTEXT IDC_EDIT1,150,30,36,12,ES_NUMBER - CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY,174,30,11,14 + CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,174,30,11,14 CONTROL "&Mute",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,192,30,42,12 LTEXT "Initial Pan:",IDC_STATIC,6,54,34,8 CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,54,48,92,22 EDITTEXT IDC_EDIT2,150,54,36,12,ES_NUMBER - CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY,174,54,11,14 + CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,174,54,11,14 CONTROL "&Surround",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,192,54,42,12 END @@ -345,7 +345,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 237 TOPMARGIN, 7 - BOTTOMMARGIN, 69 + BOTTOMMARGIN, 70 END END #endif // APSTUDIO_INVOKED @@ -605,50 +605,42 @@ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,54,168,12 END -IDD_CONTROL_GLOBALS DIALOGEX 0, 0, 561, 94 -STYLE DS_SETFONT | WS_CHILD +IDD_CONTROL_GLOBALS DIALOGEX 0, 0, 374, 98 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN EDITTEXT IDC_EDIT_SONGTITLE,2,3,167,12,ES_AUTOHSCROLL - CTEXT "Type EXT, ## channels",IDC_EDIT_MODTYPE,173,3,149,12,SS_CENTERIMAGE,WS_EX_STATICEDGE - GROUPBOX "",IDC_STATIC,1,14,83,78 - LTEXT "Initial tempo:",IDC_STATIC,4,20,44,8 + CTEXT "Type EXT, ## channels",IDC_EDIT_MODTYPE,174,3,156,12,SS_CENTERIMAGE,WS_EX_STATICEDGE + GROUPBOX "",IDC_STATIC,1,14,83,82 + LTEXT "Initial tempo:",IDC_STATIC,5,20,44,8 CONTROL "",IDC_SLIDER_SONGTEMPO,"msctls_trackbar32",TBS_VERT | TBS_BOTH | TBS_NOTICKS,11,28,15,50 EDITTEXT IDC_EDIT_TEMPO,5,78,29,12,ES_NUMBER - CONTROL "",IDC_SPIN_TEMPO,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,27,76,11,14 + CONTROL "",IDC_SPIN_TEMPO,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,27,76,11,14 LTEXT "Ticks/row:",IDC_STATIC,44,40,35,8 EDITTEXT IDC_EDIT_SPEED,44,51,30,12,ES_NUMBER - CONTROL "Spin1",IDC_SPIN_SPEED,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,67,50,11,14 - LTEXT "Restart:",IDC_STATIC,44,70,26,8 + CONTROL "Spin1",IDC_SPIN_SPEED,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,67,50,11,14 + LTEXT "Restart:",IDC_STATIC,44,68,26,8 EDITTEXT IDC_EDIT_RESTARTPOS,44,78,30,12,ES_NUMBER - CONTROL "Spin1",IDC_SPIN_RESTARTPOS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,65,77,11,14 - GROUPBOX "",IDC_STATIC,83,14,175,78 + CONTROL "Spin1",IDC_SPIN_RESTARTPOS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,65,77,11,14 + GROUPBOX "",IDC_STATIC,83,14,175,82 LTEXT "Initial global vol:",IDC_STATIC,90,20,52,8 CONTROL "",IDC_SLIDER_GLOBALVOL,"msctls_trackbar32",TBS_VERT | TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS,105,28,15,50 EDITTEXT IDC_EDIT_GLOBALVOL,95,78,36,12,ES_NUMBER - CONTROL "",IDC_SPIN_GLOBALVOL,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,120,76,11,14 + CONTROL "",IDC_SPIN_GLOBALVOL,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,124,76,11,14 LTEXT "VSTi vol:",IDC_STATIC,159,20,33,8 CONTROL "",IDC_SLIDER_VSTIVOL,"msctls_trackbar32",TBS_VERT | TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS,164,28,15,50 EDITTEXT IDC_EDIT_VSTIVOL,156,78,36,12,ES_NUMBER - CONTROL "",IDC_SPIN_VSTIVOL,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,180,76,11,14 + CONTROL "",IDC_SPIN_VSTIVOL,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,184,76,11,14 LTEXT "Sample vol:",IDC_STATIC,212,20,38,8 CONTROL "Slider1",IDC_SLIDER_SAMPLEPREAMP,"msctls_trackbar32",TBS_VERT | TBS_BOTH | TBS_NOTICKS | TBS_TOOLTIPS,221,28,15,50 EDITTEXT IDC_EDIT_SAMPLEPA,212,78,36,12,ES_NUMBER - CONTROL "",IDC_SPIN_SAMPLEPA,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,238,75,11,14 - PUSHBUTTON "Song Properties...",IDC_BUTTON_MODTYPE,262,18,60,12,NOT WS_TABSTOP - CONTROL "Loop Song",IDC_CHECK_LOOPSONG,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,263,48,50,10 - PUSHBUTTON "Player Settings...",IDC_BUTTON_PLAYERPROPS,262,59,60,12,NOT WS_TABSTOP - CTEXT "Not saved with song!",IDC_STATIC,262,73,60,17 - CONTROL "",IDC_VUMETER_LEFT,"Static",SS_BLACKRECT | SS_SUNKEN,325,1,15,91 - CONTROL "",IDC_VUMETER_RIGHT,"Static",SS_BLACKRECT | SS_SUNKEN,343,1,15,91 - GROUPBOX "Player Settings (not saved in song!)",IDC_STATIC,366,6,150,66,NOT WS_VISIBLE - CONTROL "Bass Expansion",IDC_CHECK_BASS,"Button",BS_AUTOCHECKBOX | BS_FLAT | NOT WS_VISIBLE | WS_TABSTOP,372,18,65,10 - CONTROL "Reverb",IDC_CHECK_REVERB,"Button",BS_AUTOCHECKBOX | BS_FLAT | NOT WS_VISIBLE | WS_TABSTOP,372,30,46,10 - CONTROL "Surround",IDC_CHECK_SURROUND,"Button",BS_AUTOCHECKBOX | BS_FLAT | NOT WS_VISIBLE | WS_TABSTOP,372,42,48,10 - COMBOBOX IDC_COMBO_RESAMPLING,444,54,67,74,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_TABSTOP - LTEXT "Resampling:",IDC_STATIC,444,42,43,8,NOT WS_VISIBLE - CONTROL "Graphic EQ",IDC_CHECK_EQ,"Button",BS_AUTOCHECKBOX | BS_FLAT | NOT WS_VISIBLE | WS_TABSTOP,372,54,58,10 - CONTROL "AGC",IDC_CHECK_AGC,"Button",BS_AUTOCHECKBOX | BS_FLAT | NOT WS_VISIBLE | WS_TABSTOP,444,18,31,10 + CONTROL "",IDC_SPIN_SAMPLEPA,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,238,75,11,14 + PUSHBUTTON "Song Properties...",IDC_BUTTON_MODTYPE,264,18,66,12,NOT WS_TABSTOP + CONTROL "Loop Song",IDC_CHECK_LOOPSONG,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,263,48,67,10 + PUSHBUTTON "Player Settings...",IDC_BUTTON_PLAYERPROPS,264,60,66,12,NOT WS_TABSTOP + CTEXT "Not saved with song!",IDC_STATIC,264,73,68,17 + CONTROL "",IDC_VUMETER_LEFT,"Static",SS_BLACKRECT | SS_SUNKEN,336,1,15,91 + CONTROL "",IDC_VUMETER_RIGHT,"Static",SS_BLACKRECT | SS_SUNKEN,354,1,15,91 END IDD_CONTROL_COMMENTS DIALOGEX 0, 0, 435, 119 @@ -667,7 +659,7 @@ COMBOBOX IDC_COMBO_INSTRUMENT,18,31,102,137,CBS_DROPDOWNLIST | WS_VSCROLL CTEXT "Row Spacing",IDC_STATIC,168,33,42,8,SS_CENTERIMAGE EDITTEXT IDC_EDIT_SPACING,216,31,28,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_TABSTOP - CONTROL "Spin1",IDC_SPIN_SPACING,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,236,31,11,11 + CONTROL "Spin1",IDC_SPIN_SPACING,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,236,31,11,11 PUSHBUTTON "<<",IDC_BUTTON2,3,51,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE PUSHBUTTON ">>",IDC_BUTTON1,15,51,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE LTEXT "Pattern Name",IDC_STATIC_PATTERNNAME,384,33,48,8,SS_CENTERIMAGE @@ -684,7 +676,7 @@ GROUPBOX "",IDC_STATIC_SEQUENCE_NAME_FRAME,378,0,174,24 GROUPBOX "",IDC_STATIC,378,23,174,24 EDITTEXT IDC_EDIT_SEQNUM,420,8,28,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_TABSTOP - CONTROL "",IDC_SPIN_SEQNUM,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,438,6,11,11 + CONTROL "",IDC_SPIN_SEQNUM,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,438,6,11,11 END IDD_CONTROL_SAMPLES DIALOGEX 0, 0, 544, 106 @@ -693,37 +685,37 @@ BEGIN CONTROL "Toolbar1",IDC_TOOLBAR1,"ToolbarWindow32",WS_GROUP | 0x4d,4,4,55,17 EDITTEXT IDC_EDIT_SAMPLE,90,6,35,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin6",IDC_SPIN_SAMPLE,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,118,4,11,14 + CONTROL "Spin6",IDC_SPIN_SAMPLE,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,118,4,11,14 COMBOBOX IDC_COMBO_ZOOM,131,6,41,89,CBS_DROPDOWNLIST | WS_VSCROLL EDITTEXT IDC_EDIT7,57,30,36,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin1",IDC_SPIN7,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,87,29,11,11 + CONTROL "Spin1",IDC_SPIN7,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,87,29,11,11 EDITTEXT IDC_EDIT8,57,43,36,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin1",IDC_SPIN8,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,87,42,11,11 + CONTROL "Spin1",IDC_SPIN8,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,87,42,11,11 CONTROL "Set Pan",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,9,58,42,10 EDITTEXT IDC_EDIT9,57,56,36,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin1",IDC_SPIN9,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,87,56,11,11 + CONTROL "Spin1",IDC_SPIN9,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,87,56,11,11 EDITTEXT IDC_EDIT5,48,70,45,12,ES_AUTOHSCROLL - CONTROL "Spin1",IDC_SPIN5,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,87,69,11,11 + CONTROL "Spin1",IDC_SPIN5,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,87,69,11,11 COMBOBOX IDC_COMBO_BASENOTE,48,83,45,89,CBS_DROPDOWNLIST | WS_VSCROLL EDITTEXT IDC_SAMPLE_NAME,129,26,135,12,ES_AUTOHSCROLL EDITTEXT IDC_SAMPLE_FILENAME,292,26,72,13,ES_AUTOHSCROLL COMBOBOX IDC_COMBO1,130,54,45,46,CBS_DROPDOWNLIST | WS_TABSTOP EDITTEXT IDC_EDIT1,130,70,45,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,169,69,11,11 + CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,169,69,11,11 EDITTEXT IDC_EDIT2,130,83,45,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin1",IDC_SPIN2,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,169,84,11,11 + CONTROL "Spin1",IDC_SPIN2,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,169,84,11,11 COMBOBOX IDC_COMBO2,212,54,45,46,CBS_DROPDOWNLIST | WS_TABSTOP EDITTEXT IDC_EDIT3,212,70,45,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin1",IDC_SPIN3,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,253,70,11,11 + CONTROL "Spin1",IDC_SPIN3,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,253,70,11,11 EDITTEXT IDC_EDIT4,212,83,45,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin1",IDC_SPIN4,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,253,83,11,11 + CONTROL "Spin1",IDC_SPIN4,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,253,83,11,11 COMBOBOX IDC_COMBO3,275,59,47,70,CBS_DROPDOWNLIST | WS_TABSTOP EDITTEXT IDC_EDIT15,327,59,32,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Depth",IDC_SPIN12,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,353,59,11,11 + CONTROL "Depth",IDC_SPIN12,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,353,59,11,11 EDITTEXT IDC_EDIT14,275,83,38,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Sweep",IDC_SPIN11,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,305,84,11,11 + CONTROL "Sweep",IDC_SPIN11,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,305,84,11,11 EDITTEXT IDC_EDIT16,321,83,38,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Rate",IDC_SPIN13,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,353,83,11,11 + CONTROL "Rate",IDC_SPIN13,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,353,83,11,11 CONTROL "Time stretching",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | BS_FLAT | NOT WS_VISIBLE | WS_TABSTOP,446,36,68,11 COMBOBOX IDC_COMBO4,400,35,39,61,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP COMBOBOX IDC_COMBO5,400,51,39,86,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP @@ -768,21 +760,21 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_EDIT_INSTRUMENT,87,7,33,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin1",IDC_SPIN_INSTRUMENT,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS | WS_TABSTOP,111,8,11,11 + CONTROL "Spin1",IDC_SPIN_INSTRUMENT,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_TABSTOP,111,8,11,11 EDITTEXT IDC_SAMPLE_NAME,131,6,151,12,ES_AUTOHSCROLL EDITTEXT IDC_SAMPLE_FILENAME,324,6,105,12,ES_AUTOHSCROLL CTEXT "Global Volume",IDC_STATIC,8,36,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT8,84,36,37,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Spin1",IDC_SPIN8,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,112,40,8,10 + CONTROL "Spin1",IDC_SPIN8,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,112,40,8,10 CTEXT "Fade Out",IDC_STATIC,8,53,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT7,84,53,37,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN7,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,112,57,8,10 + CONTROL "",IDC_SPIN7,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,112,57,8,10 CONTROL "Set Pan",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,42,72,42,10 EDITTEXT IDC_EDIT9,84,70,37,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SPIN9,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,112,74,8,11 + CONTROL "",IDC_SPIN9,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,112,74,8,11 CTEXT "Sep",IDC_STATIC,8,99,25,13,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT15,33,99,27,13,ES_AUTOHSCROLL - CONTROL "Spin1",IDC_SPIN12,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,54,102,11,11 + CONTROL "Spin1",IDC_SPIN12,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,54,102,11,11 CTEXT "Centre",IDC_STATIC,69,99,26,13,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_COMBO4,95,99,27,91,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CTEXT "Ramping",IDC_STATIC,7,133,39,13,SS_CENTERIMAGE,WS_EX_STATICEDGE @@ -818,13 +810,13 @@ COMBOBOX IDC_COMBO5,321,116,37,169,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CTEXT "MIDI Program",IDC_STATIC,246,134,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT10,321,134,37,12,ES_AUTOHSCROLL - CONTROL "Spin1",IDC_SPIN10,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,349,135,8,11 + CONTROL "Spin1",IDC_SPIN10,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,352,135,8,11 CTEXT "MIDI Bank",IDC_STATIC,245,152,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_EDIT11,321,152,37,12,ES_AUTOHSCROLL - CONTROL "",IDC_SPIN11,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,351,153,8,11 + CONTROL "",IDC_SPIN11,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,351,153,8,11 CTEXT "P. Bend Range",IDC_STATIC,366,99,52,12,SS_CENTERIMAGE,WS_EX_STATICEDGE EDITTEXT IDC_PITCHWHEELDEPTH,420,99,36,12,ES_AUTOHSCROLL - CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS | WS_TABSTOP,444,102,11,11 + CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_TABSTOP,444,102,11,11 CTEXT "Volume Command Handling",IDC_STATIC,366,116,90,10,SS_CENTERIMAGE,WS_EX_STATICEDGE COMBOBOX IDC_PLUGIN_VOLUMESTYLE,366,128,90,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Volume commands with note are Velocities",IDC_PLUGIN_VELOCITYSTYLE, @@ -1636,6 +1628,7 @@ IDD_CONTROL_GLOBALS, DIALOG BEGIN + BOTTOMMARGIN, 94 END IDD_CONTROL_COMMENTS, DIALOG Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2012-09-27 22:27:24 UTC (rev 1364) +++ trunk/OpenMPT/soundlib/Sndfile.h 2012-09-28 14:08:40 UTC (rev 1365) @@ -792,8 +792,6 @@ DWORD dwPadding; } MODFORMATINFO; -extern MODFORMATINFO gModFormatInfo[]; - #endif Modified: trunk/OpenMPT/soundlib/Tables.cpp =================================================================== --- trunk/OpenMPT/soundlib/Tables.cpp 2012-09-27 22:27:24 UTC (rev 1364) +++ trunk/OpenMPT/soundlib/Tables.cpp 2012-09-28 14:08:40 UTC (rev 1365) @@ -23,7 +23,7 @@ /////////////////////////////////////////////////////////////////////// #ifndef FASTSOUNDLIB -MODFORMATINFO gModFormatInfo[] = +/*MODFORMATINFO gModFormatInfo[] = { { MOD_TYPE_MOD, "ProTracker", ".mod", 0 }, { MOD_TYPE_S3M, "ScreamTracker III", ".s3m", 0 }, @@ -52,7 +52,7 @@ { MOD_TYPE_MPT, "OpenMPT", ".mptm", 0 }, { MOD_TYPE_J2B, "Galaxy Sound System", ".j2b", 0 }, { MOD_TYPE_IMF, "Imago Orpheus", ".imf", 0 }, -}; +};*/ #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-09-28 15:36:40
|
Revision: 1366 http://modplug.svn.sourceforge.net/modplug/?rev=1366&view=rev Author: saga-games Date: 2012-09-28 15:36:28 +0000 (Fri, 28 Sep 2012) Log Message: ----------- [Fix] Scroll wheel should now also work correctly on spin buttons in sample tab [Fix] WAV Export / Mass sample export file names were sometimes not sanitized correctly (http://bugs.openmpt.org/view.php?id=300). Modified Paths: -------------- trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Moddoc.cpp Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2012-09-28 14:08:40 UTC (rev 1365) +++ trunk/OpenMPT/common/misc_util.h 2012-09-28 15:36:28 UTC (rev 1366) @@ -165,11 +165,7 @@ buffer[i] == '>' || buffer[i] == '*') { - for(size_t j = i + 1; j < size; j++) - { - buffer[j - 1] = buffer[j]; - } - buffer[size - 1] = 0; + buffer[i] = '_'; } } } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2012-09-28 14:08:40 UTC (rev 1365) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2012-09-28 15:36:28 UTC (rev 1366) @@ -2810,7 +2810,7 @@ ModSample &sample = m_pSndFile->GetSample(m_nSample); LPSTR pSample = sample.pSample; short int pos; - bool bRedraw = false; + bool redraw = false; LockControls(); if ((!sample.nLength) || (!pSample)) goto NoSample; @@ -2860,7 +2860,7 @@ wsprintf(s, "%u", sample.nLoopStart); m_EditLoopStart.SetWindowText(s); m_pModDoc->AdjustEndOfSample(m_nSample); - bRedraw = true; + redraw = true; } m_SpinLoopStart.SetPos(0); } @@ -2904,7 +2904,7 @@ wsprintf(s, "%u", sample.nLoopEnd); m_EditLoopEnd.SetWindowText(s); m_pModDoc->AdjustEndOfSample(m_nSample); - bRedraw = true; + redraw = true; } m_SpinLoopEnd.SetPos(0); } @@ -2948,7 +2948,7 @@ { wsprintf(s, "%u", sample.nSustainStart); m_EditSustainStart.SetWindowText(s); - bRedraw = true; + redraw = true; } m_SpinSustainStart.SetPos(0); } @@ -2991,7 +2991,7 @@ { wsprintf(s, "%u", sample.nSustainEnd); m_EditSustainEnd.SetWindowText(s); - bRedraw = true; + redraw = true; } m_SpinSustainEnd.SetPos(0); } @@ -3030,11 +3030,11 @@ } SetDlgItemInt(IDC_EDIT5, ftune, TRUE); } - bRedraw = true; + redraw = true; m_SpinFineTune.SetPos(0); } - if ((nCode == SB_ENDSCROLL) || (nCode == SB_THUMBPOSITION)) SwitchToView(); - if (bRedraw) + if(nCode == SB_ENDSCROLL) SwitchToView(); + if(redraw) { m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); m_pModDoc->SetModified(); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2012-09-28 14:08:40 UTC (rev 1365) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2012-09-28 15:36:28 UTC (rev 1366) @@ -1543,15 +1543,16 @@ // will set default dir here because there's no setup option for export dir yet (feel free to add one...) CMainFrame::GetSettings().SetDefaultDirectory(files.workingDirectory.c_str(), DIR_EXPORT, true); - TCHAR sFilename[_MAX_PATH]; - strcpy(sFilename, files.first_file.c_str()); + CString fileName, fileExt; + { + char drive[_MAX_DRIVE], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT]; + _splitpath(files.first_file.c_str(), drive, dir, name, ext); + fileName = CString(drive) + CString(dir) + CString(name); + fileExt = CString(ext); + } // Saving as wave file - // Keep position of the character just before ".wav" in path string - size_t p = strlen(sFilename) - 4; - TCHAR sFilenameAdd[_MAX_PATH] = _T(""); - int nRenderPasses = 1; // Channel mode vector<bool> usedChannels; @@ -1601,19 +1602,14 @@ } } - CDoWaveConvert dwcdlg(&m_SndFile, sFilename, &wsdlg.WaveFormat.Format, wsdlg.m_bNormalize, pMainFrm); - dwcdlg.m_dwFileLimit = static_cast<DWORD>(wsdlg.m_dwFileLimit); - dwcdlg.m_bGivePlugsIdleTime = wsdlg.m_bGivePlugsIdleTime; - dwcdlg.m_dwSongLimit = wsdlg.m_dwSongLimit; - dwcdlg.m_nMaxPatterns = (wsdlg.m_bSelectPlay) ? wsdlg.m_nMaxOrder - wsdlg.m_nMinOrder + 1 : 0; - //if(wsdlg.m_bHighQuality) CSoundFile::SetResamplingMode(SRCMODE_POLYPHASE); - UINT pos = m_SndFile.GetCurrentPos(); pMainFrm->PauseMod(); int oldRepeat = m_SndFile.GetRepeatCount(); for(int i = 0 ; i < nRenderPasses ; i++) { + CString thisName = fileName; + char fileNameAdd[_MAX_FNAME]; // Channel mode if(wsdlg.m_bChannelMode) @@ -1625,10 +1621,10 @@ if(usedChannels[i] == false) continue; // Add channel number & name (if available) to path string - if(strlen(m_SndFile.ChnSettings[i].szName) > 0) - wsprintf(sFilenameAdd, "-%03d_%s.wav", i + 1, m_SndFile.ChnSettings[i].szName); + if(strcmp(m_SndFile.ChnSettings[i].szName, "")) + sprintf(fileNameAdd, "-%03d_%s", i + 1, m_SndFile.ChnSettings[i].szName); else - wsprintf(sFilenameAdd, "-%03d.wav", i + 1); + sprintf(fileNameAdd, "-%03d", i + 1); // Unmute channel to process m_SndFile.ChnSettings[i].dwFlags.reset(CHN_MUTE); } @@ -1643,10 +1639,10 @@ if(m_SndFile.GetSample((SAMPLEINDEX)(i + 1)).pSample == nullptr || !m_SndFile.IsSampleUsed((SAMPLEINDEX)(i + 1))) continue; // Add sample number & name (if available) to path string - if(strlen(m_SndFile.m_szNames[i + 1]) > 0) - wsprintf(sFilenameAdd, "-%03d_%s.wav", i + 1, m_SndFile.m_szNames[i + 1]); + if(strcmp(m_SndFile.m_szNames[i + 1], "")) + sprintf(fileNameAdd, "-%03d_%s", i + 1, m_SndFile.m_szNames[i + 1]); else - wsprintf(sFilenameAdd, "-%03d.wav", i + 1); + sprintf(fileNameAdd, "-%03d", i + 1); // Unmute sample to process MuteSample((SAMPLEINDEX)(i + 1), false); } else @@ -1656,21 +1652,21 @@ if(m_SndFile.Instruments[i + 1] == nullptr || !m_SndFile.IsInstrumentUsed((INSTRUMENTINDEX)(i + 1))) continue; - if(strlen(m_SndFile.Instruments[i + 1]->name) > 0) - wsprintf(sFilenameAdd, "-%03d_%s.wav", i + 1, m_SndFile.Instruments[i + 1]->name); + if(strcmp(m_SndFile.Instruments[i + 1]->name, "")) + sprintf(fileNameAdd, "-%03d_%s", i + 1, m_SndFile.Instruments[i + 1]->name); else - wsprintf(sFilenameAdd, "-%03d.wav", i + 1); + sprintf(fileNameAdd, "-%03d", i + 1); // Unmute instrument to process MuteInstrument((INSTRUMENTINDEX)(i + 1), false); } } - if(_tcslen(sFilenameAdd) > 0) + + if(strcmp(fileNameAdd, "")) { - SanitizeFilename(sFilenameAdd); - sFilename[p] = 0; - _tcscat(sFilename, sFilenameAdd); - _tcscpy(sFilenameAdd, _T("")); + SanitizeFilename(fileNameAdd); + thisName += CString(fileNameAdd); } + thisName += fileExt; // Render song (or current channel, or current sample/instrument) m_SndFile.visitedSongRows.Initialize(true); @@ -1687,6 +1683,14 @@ { m_SndFile.SetRepeatCount(Util::Max(0, wsdlg.loopCount - 1)); } + + CDoWaveConvert dwcdlg(&m_SndFile, thisName, &wsdlg.WaveFormat.Format, wsdlg.m_bNormalize, pMainFrm); + dwcdlg.m_dwFileLimit = static_cast<DWORD>(wsdlg.m_dwFileLimit); + dwcdlg.m_bGivePlugsIdleTime = wsdlg.m_bGivePlugsIdleTime; + dwcdlg.m_dwSongLimit = wsdlg.m_dwSongLimit; + dwcdlg.m_nMaxPatterns = (wsdlg.m_bSelectPlay) ? wsdlg.m_nMaxOrder - wsdlg.m_nMinOrder + 1 : 0; + //if(wsdlg.m_bHighQuality) CSoundFile::SetResamplingMode(SRCMODE_POLYPHASE); + if(dwcdlg.DoModal() != IDOK) break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |