From: <man...@us...> - 2014-11-11 15:39:05
|
Revision: 4593 http://sourceforge.net/p/modplug/code/4593 Author: manxorist Date: 2014-11-11 15:38:51 +0000 (Tue, 11 Nov 2014) Log Message: ----------- [Ref] Rewrite ApplyStereoSeparation in mid/side form. Makes the code a tiny bit easier to follow for separation > 100%. [Mod] Allow stereo separation values > 100% again. Support [0..200] in the mixer settings dialog. [Doc] libopenmpt: Document the useful range for stereo separation as 0%..200%. [Fix] foo_openmpt: Correct description of allowed samplerates in advanced settings. [Mod] foo_openmpt Limit stereo separation to [0..200]. [Mod] xmp-openmpt / in_openmpt: Limit stereo separation to [0..200]. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/foo_openmpt.cpp trunk/OpenMPT/libopenmpt/libopenmpt.hpp trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/soundlib/MixerSettings.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/libopenmpt/foo_openmpt.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/foo_openmpt.cpp 2014-11-11 11:26:37 UTC (rev 4592) +++ trunk/OpenMPT/libopenmpt/foo_openmpt.cpp 2014-11-11 15:38:51 UTC (rev 4593) @@ -63,10 +63,10 @@ static advconfig_branch_factory g_advconfigBranch("OpenMPT Component", guid_openmpt_root, advconfig_branch::guid_branch_decoding, 0); -static advconfig_integer_factory cfg_samplerate("Samplerate [6000..48000] (Hz)" , guid_openmpt_samplerate, guid_openmpt_root, 0, 48000, 6000, 96000); +static advconfig_integer_factory cfg_samplerate("Samplerate [6000..96000] (Hz)" , guid_openmpt_samplerate, guid_openmpt_root, 0, 48000, 6000, 96000); static advconfig_integer_factory cfg_channels ("Channels [1=mono, 2=stereo, 4=quad]" , guid_openmpt_channels , guid_openmpt_root, 0, 2, 1, 4); static advconfig_string_factory_MT cfg_gain ("Gain [-12...12] (dB)" , guid_openmpt_gain , guid_openmpt_root, 0, "0.0"); -static advconfig_integer_factory cfg_stereo ("Stereo separation [0...400] (%)" , guid_openmpt_stereo , guid_openmpt_root, 0, 100, 0, 400); +static advconfig_integer_factory cfg_stereo ("Stereo separation [0...200] (%)" , guid_openmpt_stereo , guid_openmpt_root, 0, 100, 0, 200); static advconfig_string_factory_MT cfg_repeat ("Repeat [0=never, -1=forever, 1..] (#)" , guid_openmpt_repeat , guid_openmpt_root, 0, "0"); static advconfig_integer_factory cfg_filter ("Interpolation filter length [1=nearest, 2=linear, 4=cubic, 8=sinc]", guid_openmpt_filter , guid_openmpt_root, 0, 8, 1, 8); static advconfig_string_factory_MT cfg_ramping ("Volume ramping [-1=default, 0=off, 1..10] (ms)" , guid_openmpt_ramping , guid_openmpt_root, 0, "-1"); Modified: trunk/OpenMPT/libopenmpt/libopenmpt.hpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.hpp 2014-11-11 11:26:37 UTC (rev 4592) +++ trunk/OpenMPT/libopenmpt/libopenmpt.hpp 2014-11-11 15:38:51 UTC (rev 4593) @@ -169,7 +169,7 @@ /*! The related value represents the stereo separation generated by the libopenmpt mixer in percent.\n The default value is 100.\n - The supported value range is [0,400].\n + The supported value range is [0,200].\n */ RENDER_STEREOSEPARATION_PERCENT = 2, //! Interpolation Filter Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2014-11-11 11:26:37 UTC (rev 4592) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2014-11-11 15:38:51 UTC (rev 4593) @@ -574,7 +574,7 @@ return static_cast<std::int32_t>( 1000.0f * 2.0f * std::log10( m_Gain ) ); } break; case module::RENDER_STEREOSEPARATION_PERCENT: { - return m_sndFile->m_MixerSettings.m_nStereoSeparation * 100 / 128; + return m_sndFile->m_MixerSettings.m_nStereoSeparation * 100 / MixerSettings::StereoSeparationScale; } break; case module::RENDER_INTERPOLATIONFILTER_LENGTH: { return resamplingmode_to_filterlength( m_sndFile->m_Resampler.m_Settings.SrcMode ); @@ -594,7 +594,7 @@ m_Gain = static_cast<float>( std::pow( 10.0f, value * 0.001f * 0.5f ) ); } break; case module::RENDER_STEREOSEPARATION_PERCENT: { - std::int32_t newvalue = value * 128 / 100; + std::int32_t newvalue = value * MixerSettings::StereoSeparationScale / 100; if ( newvalue != static_cast<std::int32_t>( m_sndFile->m_MixerSettings.m_nStereoSeparation ) ) { MixerSettings settings = m_sndFile->m_MixerSettings; settings.m_nStereoSeparation = newvalue; Modified: trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp 2014-11-11 11:26:37 UTC (rev 4592) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp 2014-11-11 15:38:51 UTC (rev 4593) @@ -190,7 +190,7 @@ m_ComboBoxRepeat.SelectString( 0, L"never" ); } - m_SliderCtrlStereoSeparation.SetRange( 0, 100 ); + m_SliderCtrlStereoSeparation.SetRange( 0, 200 ); m_SliderCtrlStereoSeparation.SetTicFreq( 100 ); m_SliderCtrlStereoSeparation.SetPageSize( 25 ); m_SliderCtrlStereoSeparation.SetLineSize( 5 ); Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-11-11 11:26:37 UTC (rev 4592) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-11-11 15:38:51 UTC (rev 4593) @@ -1010,9 +1010,9 @@ // Stereo Separation { - m_SliderStereoSep.SetRange(0, 16); + m_SliderStereoSep.SetRange(0, 32); m_SliderStereoSep.SetPos(16); - for (int n = 0; n <= 16; n++) + for (int n = 0; n <= 32; n++) { if ((int)TrackerSettings::Instance().MixerStereoSeparation <= 8 * n) { Modified: trunk/OpenMPT/soundlib/MixerSettings.h =================================================================== --- trunk/OpenMPT/soundlib/MixerSettings.h 2014-11-11 11:26:37 UTC (rev 4592) +++ trunk/OpenMPT/soundlib/MixerSettings.h 2014-11-11 15:38:51 UTC (rev 4593) @@ -17,6 +17,8 @@ { int32 m_nStereoSeparation; + static const int32 StereoSeparationScale = 128; + UINT m_nMaxMixChannels; DWORD DSPMask; DWORD MixerFlags; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2014-11-11 11:26:37 UTC (rev 4592) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2014-11-11 15:38:51 UTC (rev 4593) @@ -129,21 +129,40 @@ // Apply stereo separation factor on an interleaved stereo/quad stream. // count = Number of stereo sample pairs to process -// separation = -128...128 (negative values = swap L/R, 0 = mono) +// separation = -256...256 (negative values = swap L/R, 0 = mono, 128 = normal) static void ApplyStereoSeparation(mixsample_t *mixBuf, CSoundFile::samplecount_t count, int32 separation) //------------------------------------------------------------------------------------------------------- { - const mixsample_t fac1 = static_cast<mixsample_t>(64 + separation / 2), fac2 = static_cast<mixsample_t>(64 - separation / 2); +#ifdef MPT_INTMIXER + const mixsample_t factor_num = separation; // 128 =^= 1.0f + const mixsample_t factor_den = MixerSettings::StereoSeparationScale; // 128 + const mixsample_t normalize_den = 2; // mid/side pre/post normalization + const mixsample_t mid_den = normalize_den; + const mixsample_t side_num = factor_num; + const mixsample_t side_den = factor_den * normalize_den; +#else + const float normalize_factor = 0.5f; // cumulative mid/side normalization factor (1/sqrt(2))*(1/sqrt(2)) + const float factor = static_cast<float>(separation) / static_cast<float>(MixerSettings::StereoSeparationScale); // sep / 128 + const float mid_factor = normalize_factor; + const float side_factor = factor * normalize_factor; +#endif for(CSoundFile::samplecount_t i = 0; i < count; i++) { - const mixsample_t l = mixBuf[0], r = mixBuf[1]; + mixsample_t l = mixBuf[0]; + mixsample_t r = mixBuf[1]; + mixsample_t m = l + r; + mixsample_t s = l - r; #ifdef MPT_INTMIXER - mixBuf[0] = static_cast<mixsample_t>((Util::mul32to64(l, fac1) + Util::mul32to64(r, fac2)) >> 7); - mixBuf[1] = static_cast<mixsample_t>((Util::mul32to64(l, fac2) + Util::mul32to64(r, fac1)) >> 7); + m /= mid_den; + s = Util::muldiv(s, side_num, side_den); #else - mixBuf[0] = (l * fac1 + r * fac2) / mixsample_t(128); - mixBuf[1] = (l * fac2 + r * fac1) / mixsample_t(128); + m *= mid_factor; + s *= side_factor; #endif + l = m + s; + r = m - s; + mixBuf[0] = l; + mixBuf[1] = r; mixBuf += 2; } } @@ -152,7 +171,7 @@ static void ApplyStereoSeparation(mixsample_t *SoundFrontBuffer, mixsample_t *SoundRearBuffer, std::size_t channels, std::size_t countChunk, int32 separation) //------------------------------------------------------------------------------------------------------------------------------------------------------------ { - if(separation == 128) + if(separation == MixerSettings::StereoSeparationScale) { // identity return; } @@ -260,7 +279,7 @@ ApplyGlobalVolume(MixSoundBuffer, MixRearBuffer, countChunk); } - if(m_MixerSettings.m_nStereoSeparation >= -128 && m_MixerSettings.m_nStereoSeparation < 128 && m_MixerSettings.gnChannels >= 2) + if(m_MixerSettings.m_nStereoSeparation != MixerSettings::StereoSeparationScale) { ApplyStereoSeparation(MixSoundBuffer, MixRearBuffer, m_MixerSettings.gnChannels, countChunk, m_MixerSettings.m_nStereoSeparation); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-11 20:57:51
|
Revision: 4595 http://sourceforge.net/p/modplug/code/4595 Author: saga-games Date: 2014-11-11 20:57:42 +0000 (Tue, 11 Nov 2014) Log Message: ----------- [Imp] xmp-openmpt: Add heuristic for extracting release date from sample texts ?\195?\160 la XMPlay. [Imp] GDM Loader: Ignore artist name if it's "Unknown" (which is the case for probably 99% of all GDMs) Modified Paths: -------------- trunk/OpenMPT/libopenmpt/xmp-openmpt.cpp trunk/OpenMPT/soundlib/Load_gdm.cpp Modified: trunk/OpenMPT/libopenmpt/xmp-openmpt.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/xmp-openmpt.cpp 2014-11-11 17:24:33 UTC (rev 4594) +++ trunk/OpenMPT/libopenmpt/xmp-openmpt.cpp 2014-11-11 20:57:42 UTC (rev 4595) @@ -23,6 +23,7 @@ #define NOMINMAX #include <windows.h> +#include <WindowsX.h> #include "libopenmpt.hpp" #include "libopenmpt_ext.hpp" @@ -503,6 +504,61 @@ std::strcpy( dst, src.c_str() ); } +static std::string extract_date( const openmpt::module & mod ) { + std::string result = mod.get_metadata("date"); + if ( result.empty() ) { + // Search the sample, instrument and message texts for possible release years. + // We'll look for things that may vaguely resemble a release year, such as 4-digit numbers + // or 2-digit numbers with a leading apostrophe. Generally, only years between + // 1988 (release of Ultimate SoundTracker) and the current year + 1 (saftey margin) will + // be considered. + std::string s = " " + mod.get_metadata("message"); + std::vector<std::string> names = mod.get_sample_names(); + for ( std::vector<std::string>::const_iterator i = names.begin(); i != names.end(); ++i ) { + s += " " + *i; + } + names = mod.get_instrument_names(); + for ( std::vector<std::string>::const_iterator i = names.begin(); i != names.end(); ++i ) { + s += " " + *i; + } + s += " "; + + int32_t best_year = 0; + + SYSTEMTIME time; + GetSystemTime( &time ); + const int32_t current_year = time.wYear + 1; + +#define MPT_NUMERIC( x ) ( ( x >= '0' ) && ( x <= '9' ) ) + for ( std::string::const_iterator i = s.begin(); i != s.end(); ++i ) { + if ( !MPT_NUMERIC( i[0] ) && MPT_NUMERIC( i[1] ) && MPT_NUMERIC( i[2] ) && MPT_NUMERIC( i[3] ) && MPT_NUMERIC( i[4] ) && !MPT_NUMERIC( i[5] ) ) { + // Four-digit year + const int32_t year = ( i[1] - '0' ) * 1000 + ( i[2] - '0' ) * 100 + ( i[3] - '0' ) * 10 + ( i[4] - '0' ); + if ( year >= 1988 && year <= current_year ) { + best_year = std::max( year, best_year ); + } + } else if ( i[0] == '\'' && MPT_NUMERIC( i[1] ) && MPT_NUMERIC( i[2] ) && !MPT_NUMERIC( i[3] ) ) { + // Apostrophe + two-digit year + const int32_t year = ( i[1] - '0' ) * 10 + ( i[2] - '0' ); + if ( year >= 88 && year <= 99 ) { + best_year = std::max( 1900 + year, best_year ); + } else if ( year >= 00 && ( 2000 + year ) <= current_year ) { + best_year = std::max( 2000 + year, best_year ); + } + } + } +#undef MPT_NUMERIC + + if ( best_year != 0 ) { + std::ostringstream os; + os << best_year; + result = os.str(); + } + } + + return result; +} + #if XMPIN_FACE >= 4 static void append_xmplay_tag( std::string & tags, const std::string & tag, const std::string & val ) { @@ -524,7 +580,7 @@ append_xmplay_tag( tags, "title", convert_to_native( mod.get_metadata("title") ) ); append_xmplay_tag( tags, "artist", convert_to_native( mod.get_metadata("artist") ) ); append_xmplay_tag( tags, "album", convert_to_native( mod.get_metadata("xmplay-album") ) ); // todo, libopenmpt does not support that - append_xmplay_tag( tags, "date", convert_to_native( mod.get_metadata("date") ) ); + append_xmplay_tag( tags, "date", convert_to_native( extract_date( mod ) ) ); append_xmplay_tag( tags, "track", convert_to_native( mod.get_metadata("xmplay-tracknumber") ) ); // todo, libopenmpt does not support that append_xmplay_tag( tags, "genre", convert_to_native( mod.get_metadata("xmplay-genre") ) ); // todo, libopenmpt does not support that append_xmplay_tag( tags, "comment", convert_to_native( mod.get_metadata("message") ) ); @@ -584,7 +640,7 @@ write_xmplay_tag( &tags[0], convert_to_native( mod.get_metadata("title") ) ); write_xmplay_tag( &tags[1], convert_to_native( mod.get_metadata("artist") ) ); write_xmplay_tag( &tags[2], convert_to_native( mod.get_metadata("xmplay-album") ) ); // todo, libopenmpt does not support that - write_xmplay_tag( &tags[3], convert_to_native( mod.get_metadata("date") ) ); + write_xmplay_tag( &tags[3], convert_to_native( extract_date( mod ) ) ); write_xmplay_tag( &tags[4], convert_to_native( mod.get_metadata("xmplay-tracknumber") ) ); // todo, libopenmpt does not support that write_xmplay_tag( &tags[5], convert_to_native( mod.get_metadata("xmplay-genre") ) ); // todo, libopenmpt does not support that write_xmplay_tag( &tags[6], convert_to_native( mod.get_metadata("message") ) ); @@ -968,9 +1024,10 @@ metadatainfo = true; str << "Artist" << "\t" << sanitize_xmplay_info_string( self->mod->get_metadata("artist") ) << "\r"; } - if ( !self->mod->get_metadata("date").empty() ) { + const std::string date = extract_date( *self->mod ); + if ( !date.empty() ) { metadatainfo = true; - str << "Date" << "\t" << sanitize_xmplay_info_string( self->mod->get_metadata("date") ) << "\r"; + str << "Date" << "\t" << sanitize_xmplay_info_string( date ) << "\r"; } if ( metadatainfo ) { str << "\r"; @@ -1298,7 +1355,7 @@ visfont = CreateFontIndirect( &logfont ); } SIZE text_size; - SelectObject( dc, visfont ); + SelectFont( dc, visfont ); if ( GetTextExtentPoint32( dc, TEXT("W"), 1, &text_size ) == FALSE ) { return FALSE; } @@ -1361,17 +1418,17 @@ int pattern_height = rows * text_size.cy; if ( visDC == nullptr || last_pattern != pattern ) { - DeleteObject( visbitmap ); + DeleteBitmap( visbitmap ); DeleteDC( visDC ); visDC = CreateCompatibleDC( dc ); visbitmap = CreateCompatibleBitmap( dc, pattern_width, pattern_height ); - SelectObject( visDC, visbitmap ); + SelectBitmap( visDC, visbitmap ); - SelectObject( visDC, vispens[col_unknown] ); - SelectObject( visDC, visbrushs[col_background] ); + SelectBrush( visDC, vispens[col_unknown] ); + SelectBrush( visDC, visbrushs[col_background] ); - SelectObject( visDC, visfont ); + SelectFont( visDC, visfont ); rect.top = 0; rect.left = 0; @@ -1522,8 +1579,9 @@ return TRUE; } + static void WINAPI VisButton(DWORD x, DWORD y) { - xmpopenmpt_lock guard; + //xmpopenmpt_lock guard; } #endif Modified: trunk/OpenMPT/soundlib/Load_gdm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_gdm.cpp 2014-11-11 17:24:33 UTC (rev 4594) +++ trunk/OpenMPT/soundlib/Load_gdm.cpp 2014-11-11 20:57:42 UTC (rev 4595) @@ -161,6 +161,7 @@ // Artist name mpt::String::Read<mpt::String::maybeNullTerminated>(songArtist, fileHeader.songMusician); + if(songArtist == "Unknown") songArtist.clear(); // Read channel pan map... 0...15 = channel panning, 16 = surround channel, 255 = channel does not exist m_nChannels = 32; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-15 15:44:41
|
Revision: 4598 http://sourceforge.net/p/modplug/code/4598 Author: saga-games Date: 2014-11-15 15:44:29 +0000 (Sat, 15 Nov 2014) Log Message: ----------- [New/Mod] Added a compatible playback mode for S3M files: When enabled, OpenMPT emulates certain ST3 quirks as it did until now (linked pattern effect memory and ignored effects on muted channels). For files made with less ST3-compatible trackers, this flag is disabled automatically, so that the original (non-compatible) handling is used instead. S3M files made with OpenMPT always have this enabled, the flag is not saved in S3M files. Modified Paths: -------------- trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2014-11-13 15:07:12 UTC (rev 4597) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2014-11-15 15:44:29 UTC (rev 4598) @@ -51,11 +51,11 @@ // Trim envelopes and remove release nodes. -void UpdateEnvelopes(InstrumentEnvelope &mptEnv, CSoundFile &sndFile, std::bitset<wNumWarnings> &warnings) -//-------------------------------------------------------------------------------------------------------- +static void UpdateEnvelopes(InstrumentEnvelope &mptEnv, const CModSpecifications &specs, std::bitset<wNumWarnings> &warnings) +//--------------------------------------------------------------------------------------------------------------------------- { // shorten instrument envelope if necessary (for mod conversion) - const uint8 envMax = sndFile.GetModSpecifications().envelopePointsMax; + const uint8 envMax = specs.envelopePointsMax; #define TRIMENV(envLen) if(envLen > envMax) { envLen = envMax; CHANGEMODTYPE_WARNING(wTrimmedEnvelopes); } @@ -66,7 +66,7 @@ TRIMENV(mptEnv.nSustainEnd); if(mptEnv.nReleaseNode != ENV_RELEASE_NODE_UNSET) { - if(sndFile.GetModSpecifications().hasReleaseNode) + if(specs.hasReleaseNode) { TRIMENV(mptEnv.nReleaseNode); } else @@ -76,7 +76,7 @@ } } - #undef TRIMENV +#undef TRIMENV } @@ -462,7 +462,7 @@ } // Is the "restart position" value allowed in this format? - if(m_SndFile.m_nRestartPos > 0 && !CSoundFile::GetModSpecifications(nNewType).hasRestartPos) + if(m_SndFile.m_nRestartPos > 0 && !specs.hasRestartPos) { // Try to fix it by placing a pattern jump command in the pattern. if(!RestartPosToPattern()) @@ -495,7 +495,7 @@ } // Check for patterns with custom time signatures (fixing will be applied in the pattern container) - if(!CSoundFile::GetModSpecifications(nNewType).hasPatternSignatures) + if(!specs.hasPatternSignatures) { for(PATTERNINDEX nPat = 0; nPat < m_SndFile.Patterns.Size(); nPat++) { @@ -525,12 +525,12 @@ m_SndFile.PrecomputeSampleLoops(false); // Song flags - if(!(CSoundFile::GetModSpecifications(nNewType).songFlags & SONG_LINEARSLIDES) && m_SndFile.m_SongFlags[SONG_LINEARSLIDES]) + if(!(specs.songFlags & SONG_LINEARSLIDES) && m_SndFile.m_SongFlags[SONG_LINEARSLIDES]) { CHANGEMODTYPE_WARNING(wLinearSlides); } if(oldTypeIsXM && newTypeIsIT_MPT) m_SndFile.m_SongFlags.set(SONG_ITCOMPATGXX); - m_SndFile.m_SongFlags &= (CSoundFile::GetModSpecifications(nNewType).songFlags | SONG_PLAY_FLAGS); + m_SndFile.m_SongFlags &= (specs.songFlags | SONG_PLAY_FLAGS); // Adjust mix levels if(newTypeIsMOD || newTypeIsS3M) @@ -542,8 +542,8 @@ CHANGEMODTYPE_WARNING(wMixmode); } - // Automatically enable compatible mode when converting from MOD and S3M, since it's automatically enabled in those formats. - if((nOldType & (MOD_TYPE_MOD | MOD_TYPE_S3M)) && (nNewType & (MOD_TYPE_XM | MOD_TYPE_IT))) + // Automatically enable compatible mode when converting from MOD, since it's automatically enabled there and should be used in the other formats as well. + if((nOldType & MOD_TYPE_MOD) && (nNewType & (MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_S3M))) { m_SndFile.SetModFlag(MSF_COMPATIBLE_PLAY, true); } @@ -561,9 +561,9 @@ for(INSTRUMENTINDEX i = 1; i <= m_SndFile.GetNumInstruments(); i++) if(m_SndFile.Instruments[i] != nullptr) { - UpdateEnvelopes(m_SndFile.Instruments[i]->VolEnv, m_SndFile, warnings); - UpdateEnvelopes(m_SndFile.Instruments[i]->PanEnv, m_SndFile, warnings); - UpdateEnvelopes(m_SndFile.Instruments[i]->PitchEnv, m_SndFile, warnings); + UpdateEnvelopes(m_SndFile.Instruments[i]->VolEnv, specs, warnings); + UpdateEnvelopes(m_SndFile.Instruments[i]->PanEnv, specs, warnings); + UpdateEnvelopes(m_SndFile.Instruments[i]->PitchEnv, specs, warnings); } // XM requires instruments, so we create them right away. Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-11-13 15:07:12 UTC (rev 4597) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-11-15 15:44:29 UTC (rev 4598) @@ -713,7 +713,7 @@ m_SndFile.m_nSamplePreAmp = m_SndFile.m_nVSTiVolume = 128; }*/ - if(m_SndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_XM)) + if(m_SndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_XM | MOD_TYPE_S3M)) { m_SndFile.SetModFlag(MSF_COMPATIBLE_PLAY, true); } Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2014-11-13 15:07:12 UTC (rev 4597) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2014-11-15 15:44:29 UTC (rev 4598) @@ -182,18 +182,19 @@ if(ITorMPT) { GetDlgItem(IDC_CHK_COMPATPLAY)->SetWindowText(_T("More Impulse Tracker &compatible playback")); + } else if(XM) + { + GetDlgItem(IDC_CHK_COMPATPLAY)->SetWindowText(_T("More Fasttracker 2 &compatible playback")); } else { - GetDlgItem(IDC_CHK_COMPATPLAY)->SetWindowText(_T("More Fasttracker 2 &compatible playback")); + GetDlgItem(IDC_CHK_COMPATPLAY)->SetWindowText(_T("More ScreamTracker 3 &compatible playback")); } - GetDlgItem(IDC_CHK_COMPATPLAY)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_CHK_MIDICCBUG)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_CHK_OLDRANDOM)->ShowWindow(ITorMPT); - GetDlgItem(IDC_CHK_OLDPITCH)->ShowWindow(XMorITorMPT); + GetDlgItem(IDC_CHK_OLDRANDOM)->ShowWindow(!XM); GetDlgItem(IDC_CHK_FT2VOLRAMP)->ShowWindow(XM); // Deprecated flags are greyed out if they are not being used. + GetDlgItem(IDC_CHK_COMPATPLAY)->EnableWindow(type != MOD_TYPE_MOD ? TRUE : FALSE); GetDlgItem(IDC_CHK_MIDICCBUG)->EnableWindow(sndFile.GetModFlag(MSF_MIDICC_BUGEMULATION) ? TRUE : FALSE); GetDlgItem(IDC_CHK_OLDRANDOM)->EnableWindow((ITorMPT && sndFile.GetModFlag(MSF_OLDVOLSWING)) ? TRUE : FALSE); GetDlgItem(IDC_CHK_OLDPITCH)->EnableWindow(sndFile.GetModFlag(MSF_OLD_MIDI_PITCHBENDS) ? TRUE : FALSE); @@ -242,36 +243,17 @@ } // Mixmode Box - GetDlgItem(IDC_TEXT_MIXMODE)->ShowWindow(XMorITorMPT); - m_PlugMixBox.ShowWindow(XMorITorMPT); + GetDlgItem(IDC_TEXT_MIXMODE)->EnableWindow(XMorITorMPT); + m_PlugMixBox.EnableWindow(XMorITorMPT); // Tempo mode box - m_TempoModeBox.ShowWindow(XMorITorMPT); - GetDlgItem(IDC_ROWSPERBEAT)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_ROWSPERMEASURE)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_TEXT_ROWSPERBEAT)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_TEXT_ROWSPERMEASURE)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_TEXT_TEMPOMODE)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_FRAME_TEMPOMODE)->ShowWindow(XMorITorMPT); - - // Version info - GetDlgItem(IDC_FRAME_MPTVERSION)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_TEXT_CREATEDWITH)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_TEXT_SAVEDWITH)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_EDIT_CREATEDWITH)->ShowWindow(XMorITorMPT); - GetDlgItem(IDC_EDIT_SAVEDWITH)->ShowWindow(XMorITorMPT); - - // Window height - some parts of the dialog won't be visible for all formats - RECT rWindow; - GetWindowRect(&rWindow); - - UINT iHeight; - int nItemID = (XMorITorMPT) ? IDC_FRAME_MPTVERSION : IDC_FRAME_MODFLAGS; - RECT rFrame; - GetDlgItem(nItemID)->GetWindowRect(&rFrame); - iHeight = rFrame.bottom - rWindow.top + 12; - MoveWindow(rWindow.left, rWindow.top, rWindow.right - rWindow.left, iHeight); - + m_TempoModeBox.EnableWindow(XMorITorMPT); + GetDlgItem(IDC_ROWSPERBEAT)->EnableWindow(XMorITorMPT); + GetDlgItem(IDC_ROWSPERMEASURE)->EnableWindow(XMorITorMPT); + GetDlgItem(IDC_TEXT_ROWSPERBEAT)->EnableWindow(XMorITorMPT); + GetDlgItem(IDC_TEXT_ROWSPERMEASURE)->EnableWindow(XMorITorMPT); + GetDlgItem(IDC_TEXT_TEMPOMODE)->EnableWindow(XMorITorMPT); + GetDlgItem(IDC_FRAME_TEMPOMODE)->EnableWindow(XMorITorMPT); } @@ -298,7 +280,7 @@ CString error; error.Format("Error: Maximum number of channels for this module type is %d.", maxChans); Reporting::Warning(error); - return FALSE; + return false; } if(maxChans < sndFile.GetNumChannels()) @@ -348,10 +330,10 @@ sndFile.SetMixLevels(static_cast<mixLevels>(m_PlugMixBox.GetItemData(sel))); } + sndFile.SetModFlags(0); + if(IsDlgButtonChecked(IDC_CHK_COMPATPLAY)) sndFile.SetModFlag(MSF_COMPATIBLE_PLAY, true); if(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM)) { - sndFile.SetModFlags(0); - if(IsDlgButtonChecked(IDC_CHK_COMPATPLAY)) sndFile.SetModFlag(MSF_COMPATIBLE_PLAY, true); if(IsDlgButtonChecked(IDC_CHK_MIDICCBUG)) sndFile.SetModFlag(MSF_MIDICC_BUGEMULATION, true); if(IsDlgButtonChecked(IDC_CHK_OLDRANDOM)) sndFile.SetModFlag(MSF_OLDVOLSWING, true); if(IsDlgButtonChecked(IDC_CHK_OLDPITCH)) sndFile.SetModFlag(MSF_OLD_MIDI_PITCHBENDS, true); Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2014-11-13 15:07:12 UTC (rev 4597) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2014-11-15 15:44:29 UTC (rev 4598) @@ -223,6 +223,7 @@ } else { trackerStr = "Scream Tracker"; + SetModFlag(MSF_COMPATIBLE_PLAY, true); } break; case S3MFileHeader::trkImagoOrpheus: @@ -243,12 +244,15 @@ case S3MFileHeader::trkOpenMPT: trackerStr = "OpenMPT"; m_dwLastSavedWithVersion = (fileHeader.cwtv & S3MFileHeader::versionMask) << 16; + SetModFlag(MSF_COMPATIBLE_PLAY, true); break; case S3MFileHeader::trkBeRoTracker: madeWithTracker = "BeRoTracker"; + SetModFlag(MSF_COMPATIBLE_PLAY, true); break; case S3MFileHeader::trkCreamTracker: madeWithTracker = "CreamTracker"; + SetModFlag(MSF_COMPATIBLE_PLAY, true); break; } if(!trackerStr.empty()) @@ -562,6 +566,11 @@ fileHeader.dosEof = S3MFileHeader::idEOF; fileHeader.fileType = S3MFileHeader::idS3MType; + if(!IsCompatibleMode(TRK_SCREAMTRACKER)) + { + AddToLog("Compatible playback mode is currently disabled. This setting is not saved in S3M files and will be enabled automatically once the file is reloaded."); + } + // Orders ORDERINDEX writeOrders = Order.GetLengthTailTrimmed(); if(writeOrders < 2) Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-11-13 15:07:12 UTC (rev 4597) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-11-15 15:44:29 UTC (rev 4598) @@ -292,7 +292,7 @@ ModCommand *nextRow = nullptr; for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, pChn++, nChn++) if(!p->IsEmpty()) { - if((GetType() == MOD_TYPE_S3M) && ChnSettings[nChn].dwFlags[CHN_MUTE]) // not even effects are processed on muted S3M channels + if(IsCompatibleMode(TRK_SCREAMTRACKER) && ChnSettings[nChn].dwFlags[CHN_MUTE]) // not even effects are processed on muted S3M channels continue; ModCommand::COMMAND command = p->command; ModCommand::PARAM param = p->param; @@ -1939,7 +1939,7 @@ //:xy --> note delay until tick x, note cut at tick x+y nStartTick = (param & 0xF0) >> 4; const UINT cutAtTick = nStartTick + (param & 0x0F); - NoteCut(nChn, cutAtTick, IsCompatibleMode(TRK_IMPULSETRACKER | TRK_SCREAMTRACKER)); + NoteCut(nChn, cutAtTick, IsCompatibleMode(TRK_IMPULSETRACKER) || GetType() == MOD_TYPE_S3M); } else if ((cmd == CMD_MODCMDEX) || (cmd == CMD_S3MCMDEX)) { if ((!param) && (GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))) param = pChn->nOldCmdEx; else pChn->nOldCmdEx = param; @@ -1978,7 +1978,7 @@ // Pattern Loop ? if((((param & 0xF0) == 0x60 && cmd == CMD_MODCMDEX) || ((param & 0xF0) == 0xB0 && cmd == CMD_S3MCMDEX)) - && !(GetType() == MOD_TYPE_S3M && ChnSettings[nChn].dwFlags[CHN_MUTE])) // not even effects are processed on muted S3M channels + && !(IsCompatibleMode(TRK_SCREAMTRACKER) && ChnSettings[nChn].dwFlags[CHN_MUTE])) // not even effects are processed on muted S3M channels { ROWINDEX nloop = PatternLoop(pChn, param & 0x0F); if (nloop != ROWINDEX_INVALID) @@ -2352,7 +2352,7 @@ #endif // MODPLUG_TRACKER } - if((GetType() == MOD_TYPE_S3M) && ChnSettings[nChn].dwFlags[CHN_MUTE]) // not even effects are processed on muted S3M channels + if(IsCompatibleMode(TRK_SCREAMTRACKER) && ChnSettings[nChn].dwFlags[CHN_MUTE]) // not even effects are processed on muted S3M channels continue; // Volume Column Effect (except volume & panning) @@ -2613,7 +2613,7 @@ if(m_PlayState.m_nTickCount) break; if((!pChn->nPeriod || !pChn->nNote) && (pChn->pModInstrument == nullptr || !pChn->pModInstrument->HasValidMIDIChannel()) // Plugin arpeggio - && !IsCompatibleMode(TRK_IMPULSETRACKER | TRK_SCREAMTRACKER)) break; + && !IsCompatibleMode(TRK_IMPULSETRACKER) && GetType() != MOD_TYPE_S3M) break; if (!param && (GetType() & (MOD_TYPE_XM | MOD_TYPE_MOD))) break; // Only important when editing MOD/XM files (000 effects are removed when loading files where this means "no effect") pChn->nCommand = CMD_ARPEGGIO; if (param) pChn->nArpeggio = param; @@ -2746,7 +2746,7 @@ // S3M/IT Sxx Extended Commands case CMD_S3MCMDEX: - if(GetType() == MOD_TYPE_S3M && param == 0) + if(IsCompatibleMode(TRK_SCREAMTRACKER) && param == 0) { param = pChn->nArpeggio; // S00 uses the last non-zero effect parameter as memory, like other effects including Arpeggio, so we "borrow" our memory there. } @@ -2913,7 +2913,7 @@ break; } - if(GetType() == MOD_TYPE_S3M && param != 0) + if(IsCompatibleMode(TRK_SCREAMTRACKER) && param != 0) { UpdateS3MEffectMemory(pChn, param); } @@ -3971,7 +3971,7 @@ } // S3M/IT compatibility: Note Cut really cuts notes and does not just mute them (so that following volume commands could restore the sample) // Test case: scx.it - NoteCut(nChn, param, IsCompatibleMode(TRK_IMPULSETRACKER | TRK_SCREAMTRACKER)); + NoteCut(nChn, param, IsCompatibleMode(TRK_IMPULSETRACKER) || GetType() == MOD_TYPE_S3M); break; // SDx: Note Delay // SEx: Pattern Delay for x rows @@ -4879,7 +4879,7 @@ { // IT compatibility 10. Pattern loops (+ same fix for MOD / S3M files) // When finishing a pattern loop, the next loop without a dedicated SB0 starts on the first row after the previous loop. - if(IsCompatibleMode(TRK_IMPULSETRACKER | TRK_PROTRACKER | TRK_SCREAMTRACKER)) + if(IsCompatibleMode(TRK_IMPULSETRACKER) || (GetType() & (MOD_TYPE_MOD | MOD_TYPE_S3M))) { pChn->nPatternLoop = m_PlayState.m_nRow + 1; } @@ -4891,7 +4891,7 @@ // First time we get into the loop => Set loop count. // IT compatibility 10. Pattern loops (+ same fix for XM / MOD / S3M files) - if(!IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2 | TRK_PROTRACKER | TRK_SCREAMTRACKER)) + if(!IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2) && !(GetType() & (MOD_TYPE_MOD | MOD_TYPE_S3M))) { ModChannel *p = m_PlayState.Chn; for(CHANNELINDEX i = 0; i < GetNumChannels(); i++, p++) if (p != pChn) Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2014-11-13 15:07:12 UTC (rev 4597) +++ trunk/OpenMPT/soundlib/Sndfile.h 2014-11-15 15:44:29 UTC (rev 4598) @@ -295,8 +295,8 @@ // Hint 2: Always returns true for MOD / S3M format (if that is the format of the current file) bool IsCompatibleMode(MODTYPE type) const { - if(GetType() & type & (MOD_TYPE_MOD | MOD_TYPE_S3M)) - return true; // S3M and MOD format don't have compatibility flags, so we will always return true + if(GetType() & type & MOD_TYPE_MOD) + return true; // MOD format doesn't have compatibility flags, so we will always return true return ((GetType() & type) && GetModFlag(MSF_COMPATIBLE_PLAY)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-11-19 17:45:13
|
Revision: 4600 http://sourceforge.net/p/modplug/code/4600 Author: manxorist Date: 2014-11-19 17:44:55 +0000 (Wed, 19 Nov 2014) Log Message: ----------- [Ref] xmp-openmpt: Split pugixml into a separate project. Modified Paths: -------------- trunk/OpenMPT/build/premake4.lua trunk/OpenMPT/libopenmpt/libopenmpt.sln trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj.filters Added Paths: ----------- trunk/OpenMPT/build/gen/pugixml.vcproj trunk/OpenMPT/build/gen/pugixml.vcxproj trunk/OpenMPT/build/gen/pugixml.vcxproj.filters trunk/OpenMPT/include/pugixml.premake4.lua Added: trunk/OpenMPT/build/gen/pugixml.vcproj =================================================================== --- trunk/OpenMPT/build/gen/pugixml.vcproj (rev 0) +++ trunk/OpenMPT/build/gen/pugixml.vcproj 2014-11-19 17:44:55 UTC (rev 4600) @@ -0,0 +1,506 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="pugixml" + ProjectGUID="{07B89124-7C71-42CC-81AB-62B09BB61F9B}" + RootNamespace="pugixml" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="..\lib\x32\Debug" + IntermediateDirectory="..\obj\pugixml\x32\Debug" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\pugixml.pdb" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\pugixml.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="..\lib\x64\Debug" + IntermediateDirectory="..\obj\pugixml\x64\Debug" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\pugixml.pdb" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\pugixml.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="..\lib\x32\Release" + IntermediateDirectory="..\obj\pugixml\x32\Release" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/MP" + Optimization="3" + PreprocessorDefinitions="NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + FloatingPointModel="2" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\pugixml.pdb" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\pugixml.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="..\lib\x64\Release" + IntermediateDirectory="..\obj\pugixml\x64\Release" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/MP" + Optimization="3" + PreprocessorDefinitions="NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + FloatingPointModel="2" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\pugixml.pdb" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\pugixml.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="ReleaseNoLTCG|Win32" + OutputDirectory="..\lib\x32\ReleaseNoLTCG" + IntermediateDirectory="..\obj\pugixml\x32\ReleaseNoLTCG" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/GL- /MP" + Optimization="3" + PreprocessorDefinitions="NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + FloatingPointModel="2" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\pugixml.pdb" + DebugInformationFormat="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\pugixml.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="ReleaseNoLTCG|x64" + OutputDirectory="..\lib\x64\ReleaseNoLTCG" + IntermediateDirectory="..\obj\pugixml\x64\ReleaseNoLTCG" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/GL- /MP" + Optimization="3" + PreprocessorDefinitions="NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + FloatingPointModel="2" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\pugixml.pdb" + DebugInformationFormat="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\pugixml.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="include" + Filter="" + > + <Filter + Name="pugixml" + Filter="" + > + <Filter + Name="src" + Filter="" + > + <File + RelativePath="..\..\include\pugixml\src\pugixml.cpp" + > + </File> + <File + RelativePath="..\..\include\pugixml\src\pugiconfig.hpp" + > + </File> + <File + RelativePath="..\..\include\pugixml\src\pugixml.hpp" + > + </File> + </Filter> + </Filter> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Property changes on: trunk/OpenMPT/build/gen/pugixml.vcproj ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-ms-vcproj \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +CRLF \ No newline at end of property Added: trunk/OpenMPT/build/gen/pugixml.vcxproj =================================================================== --- trunk/OpenMPT/build/gen/pugixml.vcxproj (rev 0) +++ trunk/OpenMPT/build/gen/pugixml.vcxproj 2014-11-19 17:44:55 UTC (rev 4600) @@ -0,0 +1,281 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="ReleaseNoLTCG|Win32"> + <Configuration>ReleaseNoLTCG</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="ReleaseNoLTCG|x64"> + <Configuration>ReleaseNoLTCG</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{07B89124-7C71-42CC-81AB-62B09BB61F9B}</ProjectGuid> + <RootNamespace>pugixml</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <UseDebugLibraries>true</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <UseDebugLibraries>true</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\lib\x32\Debug\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\obj\pugixml\x32\Debug\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">pugixml</TargetName> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\lib\x64\Debug\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\obj\pugixml\x64\Debug\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pugixml</TargetName> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\lib\x32\Release\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\obj\pugixml\x32\Release\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pugixml</TargetName> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\lib\x64\Release\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\obj\pugixml\x64\Release\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">pugixml</TargetName> + <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'">..\lib\x32\ReleaseNoLTCG\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'">..\obj\pugixml\x32\ReleaseNoLTCG\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'">pugixml</TargetName> + <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'">..\lib\x64\ReleaseNoLTCG\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'">..\obj\pugixml\x64\ReleaseNoLTCG\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'">pugixml</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)pugixml.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>OldStyle</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)pugixml.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <PreprocessorDefinitions>NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <FloatingPointModel>Fast</FloatingPointModel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)pugixml.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <PreprocessorDefinitions>NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <FloatingPointModel>Fast</FloatingPointModel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)pugixml.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'"> + <ClCompile> + <AdditionalOptions>/GL- /MP %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <PreprocessorDefinitions>NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <FloatingPointModel>Fast</FloatingPointModel> + <DebugInformationFormat></DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)pugixml.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>false</GenerateDebugInformation> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'"> + <ClCompile> + <AdditionalOptions>/GL- /MP %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <PreprocessorDefinitions>NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <FloatingPointModel>Fast</FloatingPointModel> + <DebugInformationFormat></DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)pugixml.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>false</GenerateDebugInformation> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\include\pugixml\src\pugiconfig.hpp" /> + <ClInclude Include="..\..\include\pugixml\src\pugixml.hpp" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\include\pugixml\src\pugixml.cpp"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> Property changes on: trunk/OpenMPT/build/gen/pugixml.vcxproj ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-ms-vcproj \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +CRLF \ No newline at end of property Added: trunk/OpenMPT/build/gen/pugixml.vcxproj.filters =================================================================== --- trunk/OpenMPT/build/gen/pugixml.vcxproj.filters (rev 0) +++ trunk/OpenMPT/build/gen/pugixml.vcxproj.filters 2014-11-19 17:44:55 UTC (rev 4600) @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{54E9DEE4-5EFB-A046-A9A1-658A92A98DD1}</UniqueIdentifier> + </Filter> + <Filter Include="include\pugixml"> + <UniqueIdentifier>{CE9EA013-C061-3B4E-92E0-5A6BFAECC13F}</UniqueIdentifier> + </Filter> + <Filter Include="include\pugixml\src"> + <UniqueIdentifier>{8ACD3917-0E40-CD47-95F6-4837494A3357}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\pugixml\src\pugiconfig.hpp"> + <Filter>include\pugixml\src</Filter> + </ClInclude> + <ClInclude Include="..\..\include\pugixml\src\pugixml.hpp"> + <Filter>include\pugixml\src</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\include\pugixml\src\pugixml.cpp"> + <Filter>include\pugixml\src</Filter> + </ClCompile> + </ItemGroup> +</Project> Property changes on: trunk/OpenMPT/build/gen/pugixml.vcxproj.filters ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-ms-vcproj \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +CRLF \ No newline at end of property Modified: trunk/OpenMPT/build/premake4.lua =================================================================== --- trunk/OpenMPT/build/premake4.lua 2014-11-19 17:26:56 UTC (rev 4599) +++ trunk/OpenMPT/build/premake4.lua 2014-11-19 17:44:55 UTC (rev 4600) @@ -9,6 +9,7 @@ dofile "../include/minizip.premake4.lua" dofile "../include/portaudio.premake4.lua" dofile "../include/portmidi.premake4.lua" + dofile "../include/pugixml.premake4.lua" dofile "../include/r8brain.premake4.lua" dofile "../include/smbPitchShift.premake4.lua" dofile "../include/soundtouch.premake4.lua" Added: trunk/OpenMPT/include/pugixml.premake4.lua =================================================================== --- trunk/OpenMPT/include/pugixml.premake4.lua (rev 0) +++ trunk/OpenMPT/include/pugixml.premake4.lua 2014-11-19 17:44:55 UTC (rev 4600) @@ -0,0 +1,16 @@ + + project "pugixml" + uuid "07B89124-7C71-42cc-81AB-62B09BB61F9B" + language "C++" + location "../build/gen" + objdir "../build/obj/pugixml" + includedirs { } + files { + "../include/pugixml/src/pugixml.cpp", + } + files { + "../include/pugixml/src/pugiconfig.hpp", + "../include/pugixml/src/pugixml.hpp", + } + dofile "../build/premake4-defaults-LIB.lua" + dofile "../build/premake4-defaults-static.lua" Property changes on: trunk/OpenMPT/include/pugixml.premake4.lua ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/x-lua \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/OpenMPT/libopenmpt/libopenmpt.sln =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.sln 2014-11-19 17:26:56 UTC (rev 4599) +++ trunk/OpenMPT/libopenmpt/libopenmpt.sln 2014-11-19 17:44:55 UTC (rev 4600) @@ -26,6 +26,8 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foo_openmpt", "foo_openmpt.vcxproj", "{3F14BF17-016A-44C3-9B8D-C875C2EC8A18}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pugixml", "..\build\gen\pugixml.vcxproj", "{07B89124-7C71-42CC-81AB-62B09BB61F9B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -106,6 +108,12 @@ {3F14BF17-016A-44C3-9B8D-C875C2EC8A18}.Release|Win32.ActiveCfg = Release|Win32 {3F14BF17-016A-44C3-9B8D-C875C2EC8A18}.Release|Win32.Build.0 = Release|Win32 {3F14BF17-016A-44C3-9B8D-C875C2EC8A18}.Release|x64.ActiveCfg = Release|Win32 + {07B89124-7C71-42CC-81AB-62B09BB61F9B}.Debug|Win32.ActiveCfg = Debug|Win32 + {07B89124-7C71-42CC-81AB-62B09BB61F9B}.Debug|Win32.Build.0 = Debug|Win32 + {07B89124-7C71-42CC-81AB-62B09BB61F9B}.Debug|x64.ActiveCfg = Debug|x64 + {07B89124-7C71-42CC-81AB-62B09BB61F9B}.Release|Win32.ActiveCfg = Release|Win32 + {07B89124-7C71-42CC-81AB-62B09BB61F9B}.Release|Win32.Build.0 = Release|Win32 + {07B89124-7C71-42CC-81AB-62B09BB61F9B}.Release|x64.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj 2014-11-19 17:26:56 UTC (rev 4599) +++ trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj 2014-11-19 17:44:55 UTC (rev 4600) @@ -81,17 +81,17 @@ </PreBuildEvent> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\include\pugixml\src\pugixml.cpp" /> <ClCompile Include="xmp-openmpt.cpp" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\build\gen\pugixml.vcxproj"> + <Project>{07b89124-7c71-42cc-81ab-62b09bb61f9b}</Project> + </ProjectReference> <ProjectReference Include="libopenmpt.vcxproj"> <Project>{812a654d-99be-4d13-b97f-86332ad3e363}</Project> </ProjectReference> </ItemGroup> <ItemGroup> - <ClInclude Include="..\include\pugixml\src\pugiconfig.hpp" /> - <ClInclude Include="..\include\pugixml\src\pugixml.hpp" /> <ClInclude Include="libopenmpt_settings.hpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> Modified: trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj.filters 2014-11-19 17:26:56 UTC (rev 4599) +++ trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj.filters 2014-11-19 17:44:55 UTC (rev 4600) @@ -13,28 +13,13 @@ <UniqueIdentifier>{F4138DCF-90EE-41BF-BDDB-E13FF5BDDD2C}</UniqueIdentifier> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> </Filter> - <Filter Include="Source Files\pugixml"> - <UniqueIdentifier>{2cf6ac76-86c7-45f3-856b-7d9f3b71096b}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files\pugixml"> - <UniqueIdentifier>{32038de6-25cb-4ed5-848d-b4319ea01a9b}</UniqueIdentifier> - </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="xmp-openmpt.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\include\pugixml\src\pugixml.cpp"> - <Filter>Source Files\pugixml</Filter> - </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\include\pugixml\src\pugiconfig.hpp"> - <Filter>Header Files\pugixml</Filter> - </ClInclude> - <ClInclude Include="..\include\pugixml\src\pugixml.hpp"> - <Filter>Header Files\pugixml</Filter> - </ClInclude> <ClInclude Include="libopenmpt_settings.hpp"> <Filter>Header Files</Filter> </ClInclude> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-11-19 18:10:02
|
Revision: 4602 http://sourceforge.net/p/modplug/code/4602 Author: manxorist Date: 2014-11-19 18:09:53 +0000 (Wed, 19 Nov 2014) Log Message: ----------- [Imp] in_openmpt: Kill libopenmpt_settings.dll . [Imp] xmp-popenmpt: Kill libopenmpt_settings.dll . Modified Paths: -------------- trunk/OpenMPT/build/auto/package_libopenmpt_win32.cmd trunk/OpenMPT/libopenmpt/dox/changelog.md trunk/OpenMPT/libopenmpt/in_openmpt.cpp trunk/OpenMPT/libopenmpt/in_openmpt.vcxproj trunk/OpenMPT/libopenmpt/in_openmpt.vcxproj.filters trunk/OpenMPT/libopenmpt/libopenmpt.sln trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp trunk/OpenMPT/libopenmpt/libopenmpt_settings.hpp trunk/OpenMPT/libopenmpt/xmp-openmpt.cpp trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj.filters Removed Paths: ------------- trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj.filters Modified: trunk/OpenMPT/build/auto/package_libopenmpt_win32.cmd =================================================================== --- trunk/OpenMPT/build/auto/package_libopenmpt_win32.cmd 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/build/auto/package_libopenmpt_win32.cmd 2014-11-19 18:09:53 UTC (rev 4602) @@ -26,7 +26,7 @@ copy /y ..\..\libopenmpt\doc\foo_openmpt.txt .\ || goto error copy /y ..\..\LICENSE .\ || goto error copy /y ..\..\libopenmpt\dox\changelog.md .\ || goto error -"C:\Program Files\7-Zip\7z.exe" a -t7z -mx=9 libopenmpt-win32-r%GOT_REVISION%.7z libopenmpt.dll libmodplug.dll in_openmpt.dll xmp-openmpt.dll foo_openmpt.dll libopenmpt_settings.dll openmpt123.exe inc\libopenmpt\libopenmpt.h inc\libopenmpt\libopenmpt.hpp inc\libopenmpt\libopenmpt_config.h inc\libopenmpt\libopenmpt_version.h lib\Win32\libopenmpt.lib bin\Win32\libopenmpt.dll in_openmpt.txt xmp-openmpt.txt foo_openmpt.txt LICENSE changelog.md || goto error +"C:\Program Files\7-Zip\7z.exe" a -t7z -mx=9 libopenmpt-win32-r%GOT_REVISION%.7z libopenmpt.dll libmodplug.dll in_openmpt.dll xmp-openmpt.dll foo_openmpt.dll openmpt123.exe inc\libopenmpt\libopenmpt.h inc\libopenmpt\libopenmpt.hpp inc\libopenmpt\libopenmpt_config.h inc\libopenmpt\libopenmpt_version.h lib\Win32\libopenmpt.lib bin\Win32\libopenmpt.dll in_openmpt.txt xmp-openmpt.txt foo_openmpt.txt LICENSE changelog.md || goto error "C:\Program Files\7-Zip\7z.exe" a -ttar libopenmpt-win32.tar libopenmpt-win32-r%GOT_REVISION%.7z || goto error del /f /q libopenmpt-win32-r%GOT_REVISION%.7z cd ..\.. || goto error Modified: trunk/OpenMPT/libopenmpt/dox/changelog.md =================================================================== --- trunk/OpenMPT/libopenmpt/dox/changelog.md 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/dox/changelog.md 2014-11-19 18:09:53 UTC (rev 4602) @@ -7,8 +7,6 @@ ### libopenmpt svn - * xmp-openmpt / in_openmpt: libopenmpt_settings.dll no longer requires - .NET 4 to be installed. * foo_openmpt: Settings are now accessable via foobar2000 advanced settings. * Autotools based build now supports libunmo3. Specify --enable-unmo3. * Support for dynamic loading of libunmo3 on MacOS X. @@ -18,6 +16,8 @@ (see `build/vs2008`) * libopenmpt_ext.hpp is now distributed by default. The API is still considered experimental and not guaranteed to stay API or ABI compatible. + * xmp-openmpt / in_openmpt: No more libopenmpt_settings.dll. + The settings dialog now uses a statically linked copy of MFC. * [Bug] The -autotools tarballs were not working at all. Modified: trunk/OpenMPT/libopenmpt/in_openmpt.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/in_openmpt.cpp 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/in_openmpt.cpp 2014-11-19 18:09:53 UTC (rev 4602) @@ -9,6 +9,19 @@ #ifndef NO_WINAMP +#if defined(_MFC_VER) || 1 +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 // _WIN32_WINNT_WIN2000 +#endif +#define NOMINMAX +#include <afxwin.h> +#include <afxcmn.h> +#include <windows.h> +#endif // _MFC_VER + #ifdef LIBOPENMPT_BUILD_DLL #undef LIBOPENMPT_BUILD_DLL #endif @@ -30,7 +43,9 @@ static char * in_openmpt_string = "in_openmpt " OPENMPT_API_VERSION_STRING; #endif +#ifndef NOMINMAX #define NOMINMAX +#endif #include <windows.h> #define UNICODE_INPUT_PLUGIN @@ -446,4 +461,22 @@ return &inmod; } + +#ifdef _MFC_VER + +void PluginDllMainAttach() { + // nothing +} + +void PluginDllMainDetach() { + // nothing +} + +#else + +// nothing + +#endif + + #endif // NO_WINAMP Modified: trunk/OpenMPT/libopenmpt/in_openmpt.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/in_openmpt.vcxproj 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/in_openmpt.vcxproj 2014-11-19 18:09:53 UTC (rev 4602) @@ -19,12 +19,14 @@ <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <CharacterSet>Unicode</CharacterSet> + <UseOfMfc>Static</UseOfMfc> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>Unicode</CharacterSet> + <UseOfMfc>Static</UseOfMfc> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -82,6 +84,7 @@ </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="in_openmpt.cpp" /> + <ClCompile Include="libopenmpt_settings.cpp" /> </ItemGroup> <ItemGroup> <ProjectReference Include="libopenmpt.vcxproj"> @@ -90,7 +93,11 @@ </ItemGroup> <ItemGroup> <ClInclude Include="libopenmpt_settings.hpp" /> + <ClInclude Include="resource.h" /> </ItemGroup> + <ItemGroup> + <ResourceCompile Include="libopenmpt_settings.rc" /> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> Modified: trunk/OpenMPT/libopenmpt/in_openmpt.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/in_openmpt.vcxproj.filters 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/in_openmpt.vcxproj.filters 2014-11-19 18:09:53 UTC (rev 4602) @@ -18,10 +18,21 @@ <ClCompile Include="in_openmpt.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="libopenmpt_settings.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="libopenmpt_settings.hpp"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="resource.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> + <ItemGroup> + <ResourceCompile Include="libopenmpt_settings.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> </Project> \ No newline at end of file Modified: trunk/OpenMPT/libopenmpt/libopenmpt.sln =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.sln 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/libopenmpt.sln 2014-11-19 18:09:53 UTC (rev 4602) @@ -2,12 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenmpt", "libopenmpt.vcxproj", "{812A654D-99BE-4D13-B97F-86332AD3E363}" - ProjectSection(ProjectDependencies) = postProject - {B2B6EE07-F662-496D-980C-FCA7CA144DBC} = {B2B6EE07-F662-496D-980C-FCA7CA144DBC} - EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenmpt_settings", "libopenmpt_settings.vcxproj", "{B2B6EE07-F662-496D-980C-FCA7CA144DBC}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenmptDLL", "libopenmptDLL.vcxproj", "{A1C5B6FA-F333-4999-8DF0-BE2F5FD4B882}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "in_openmpt", "in_openmpt.vcxproj", "{268A016B-2468-4849-8444-782752F555FC}" @@ -44,12 +39,6 @@ {812A654D-99BE-4D13-B97F-86332AD3E363}.Release|Win32.Build.0 = Release|Win32 {812A654D-99BE-4D13-B97F-86332AD3E363}.Release|x64.ActiveCfg = Release|x64 {812A654D-99BE-4D13-B97F-86332AD3E363}.Release|x64.Build.0 = Release|x64 - {B2B6EE07-F662-496D-980C-FCA7CA144DBC}.Debug|Win32.ActiveCfg = Debug|Win32 - {B2B6EE07-F662-496D-980C-FCA7CA144DBC}.Debug|Win32.Build.0 = Debug|Win32 - {B2B6EE07-F662-496D-980C-FCA7CA144DBC}.Debug|x64.ActiveCfg = Debug|Win32 - {B2B6EE07-F662-496D-980C-FCA7CA144DBC}.Release|Win32.ActiveCfg = Release|Win32 - {B2B6EE07-F662-496D-980C-FCA7CA144DBC}.Release|Win32.Build.0 = Release|Win32 - {B2B6EE07-F662-496D-980C-FCA7CA144DBC}.Release|x64.ActiveCfg = Release|Win32 {A1C5B6FA-F333-4999-8DF0-BE2F5FD4B882}.Debug|Win32.ActiveCfg = Debug|Win32 {A1C5B6FA-F333-4999-8DF0-BE2F5FD4B882}.Debug|Win32.Build.0 = Debug|Win32 {A1C5B6FA-F333-4999-8DF0-BE2F5FD4B882}.Debug|x64.ActiveCfg = Debug|x64 Modified: trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp 2014-11-19 18:09:53 UTC (rev 4602) @@ -38,10 +38,12 @@ { return FALSE; } + PluginDllMainAttach(); return TRUE; } virtual int ExitInstance() { + PluginDllMainDetach(); return CWinApp::ExitInstance(); } Modified: trunk/OpenMPT/libopenmpt/libopenmpt_settings.hpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings.hpp 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings.hpp 2014-11-19 18:09:53 UTC (rev 4602) @@ -46,6 +46,11 @@ +void PluginDllMainAttach(); +void PluginDllMainDetach(); + + + namespace openmpt { namespace settings { class settings : public libopenmpt_settings { @@ -124,37 +129,26 @@ #define LIBOPENMPT_SETTINGS_DECLARE() \ - static HMODULE settings_dll = NULL; + #define LIBOPENMPT_SETTINGS_IS_AVAILABLE() \ - settings_dll + true #define LIBOPENMPT_SETTINGS_EDIT( settings, parent, title ) \ do { \ - if ( (libopenmpt_settings_edit_func)GetProcAddress( settings_dll , "libopenmpt_settings_edit" ) ) { \ - ((libopenmpt_settings_edit_func)GetProcAddress( settings_dll, "libopenmpt_settings_edit" ))( settings , parent , title ); \ - } \ + libopenmpt_settings_edit( settings , parent , title ); \ } while(0) #define LIBOPENMPT_SETTINGS_UNAVAILABLE( parent, dll, title ) \ - MessageBox( parent , TEXT("libopenmpt_settings.dll failed to load. Please check if it is in the same folder as ") dll TEXT("."), title , MB_ICONERROR ) + do { \ + } while(0) #define LIBOPENMPT_SETTINGS_LOAD() \ do { \ - if ( !settings_dll ) { \ - settings_dll = LoadLibrary( TEXT("libopenmpt_settings.dll") ); \ - } \ - if ( !settings_dll ) { \ - settings_dll = LoadLibrary( TEXT("Plugins\\libopenmpt_settings.dll") ); \ - } \ } while(0) #define LIBOPENMPT_SETTINGS_UNLOAD() \ do { \ - if ( settings_dll ) { \ - FreeLibrary( settings_dll ); \ - settings_dll = NULL; \ - } \ } while(0) Deleted: trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj 2014-11-19 18:09:53 UTC (rev 4602) @@ -1,98 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{B2B6EE07-F662-496D-980C-FCA7CA144DBC}</ProjectGuid> - <RootNamespace>libopenmpt_settings</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>Unicode</CharacterSet> - <UseOfMfc>Static</UseOfMfc> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <CharacterSet>Unicode</CharacterSet> - <UseOfMfc>Static</UseOfMfc> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <IntDir>..\build\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir> - <OutDir>..\bin\$(Platform)-Debug\</OutDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <IntDir>..\build\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir> - <OutDir>..\bin\$(Platform)\</OutDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <AdditionalOptions>/wd4945 %(AdditionalOptions)</AdditionalOptions> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalOptions>/wd4945 %(AdditionalOptions)</AdditionalOptions> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="libopenmpt_settings.cpp"> - <ExceptionHandling Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Async</ExceptionHandling> - <ExceptionHandling Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Async</ExceptionHandling> - <DebugInformationFormat Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OldStyle</DebugInformationFormat> - <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Default</BasicRuntimeChecks> - <MinimalRebuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</MinimalRebuild> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="libopenmpt_settings.hpp" /> - <ClInclude Include="resource.h" /> - </ItemGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Data" /> - <Reference Include="System.Drawing" /> - <Reference Include="System.Windows.Forms" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="libopenmpt_settings.rc" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file Deleted: trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj.filters 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj.filters 2014-11-19 18:09:53 UTC (rev 4602) @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="Resource Files"> - <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="libopenmpt_settings.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="resource.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="libopenmpt_settings.hpp"> - <Filter>Header Files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="libopenmpt_settings.rc"> - <Filter>Resource Files</Filter> - </ResourceCompile> - </ItemGroup> -</Project> \ No newline at end of file Modified: trunk/OpenMPT/libopenmpt/xmp-openmpt.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/xmp-openmpt.cpp 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/xmp-openmpt.cpp 2014-11-19 18:09:53 UTC (rev 4602) @@ -9,6 +9,19 @@ #ifndef NO_XMPLAY +#if defined(_MFC_VER) || 1 +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 // _WIN32_WINNT_WIN2000 +#endif +#define NOMINMAX +#include <afxwin.h> +#include <afxcmn.h> +#include <windows.h> +#endif // _MFC_VER + #ifdef LIBOPENMPT_BUILD_DLL #undef LIBOPENMPT_BUILD_DLL #endif @@ -21,7 +34,9 @@ #define LIBOPENMPT_EXT_IS_EXPERIMENTAL +#ifndef NOMINMAX #define NOMINMAX +#endif #include <windows.h> #include <WindowsX.h> @@ -1723,6 +1738,19 @@ }; // extern "C" + +#ifdef _MFC_VER + +void PluginDllMainAttach() { + xmp_openmpt_on_dll_load(); +} + +void PluginDllMainDetach() { + xmp_openmpt_on_dll_unload(); +} + +#else + BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { switch ( fdwReason ) { case DLL_PROCESS_ATTACH: @@ -1735,4 +1763,7 @@ return TRUE; } +#endif + + #endif // NO_XMPLAY Modified: trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj 2014-11-19 18:09:53 UTC (rev 4602) @@ -19,12 +19,14 @@ <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <CharacterSet>Unicode</CharacterSet> + <UseOfMfc>Static</UseOfMfc> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>Unicode</CharacterSet> + <UseOfMfc>Static</UseOfMfc> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -81,6 +83,7 @@ </PreBuildEvent> </ItemDefinitionGroup> <ItemGroup> + <ClCompile Include="libopenmpt_settings.cpp" /> <ClCompile Include="xmp-openmpt.cpp" /> </ItemGroup> <ItemGroup> @@ -93,7 +96,11 @@ </ItemGroup> <ItemGroup> <ClInclude Include="libopenmpt_settings.hpp" /> + <ClInclude Include="resource.h" /> </ItemGroup> + <ItemGroup> + <ResourceCompile Include="libopenmpt_settings.rc" /> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> Modified: trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj.filters 2014-11-19 17:48:59 UTC (rev 4601) +++ trunk/OpenMPT/libopenmpt/xmp-openmpt.vcxproj.filters 2014-11-19 18:09:53 UTC (rev 4602) @@ -18,10 +18,21 @@ <ClCompile Include="xmp-openmpt.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="libopenmpt_settings.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="libopenmpt_settings.hpp"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="resource.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> + <ItemGroup> + <ResourceCompile Include="libopenmpt_settings.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> </Project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-21 15:38:43
|
Revision: 4607 http://sourceforge.net/p/modplug/code/4607 Author: saga-games Date: 2014-11-21 15:38:31 +0000 (Fri, 21 Nov 2014) Log Message: ----------- [Imp] Amiga limits can now also be enforced for MOD files separately from PT1/2 mode. [Mod] MOD Loader: M.K. and M!K! files that only have Amiga-compatible notes in their patterns automatically enforce Amiga limits now (http://bugs.openmpt.org/view.php?id=563) Modified Paths: -------------- trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/dlg_misc.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/mod_specifications.cpp Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2014-11-20 19:30:23 UTC (rev 4606) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2014-11-21 15:38:31 UTC (rev 4607) @@ -30,7 +30,8 @@ BEGIN_MESSAGE_MAP(CModTypeDlg, CDialog) //{{AFX_MSG_MAP(CModTypeDlg) - ON_CBN_SELCHANGE(IDC_COMBO1,UpdateDialog) + ON_CBN_SELCHANGE(IDC_COMBO1, UpdateDialog) + ON_COMMAND(IDC_CHECK_PT1X, OnPTModeChanged) ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, &CModTypeDlg::OnToolTipNotify) ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, &CModTypeDlg::OnToolTipNotify) @@ -171,8 +172,10 @@ m_CheckBoxPT1x.EnableWindow(allowedFlags[SONG_PT1XMODE]); m_CheckBoxAmigaLimits.EnableWindow(allowedFlags[SONG_AMIGALIMITS]); - m_CheckBoxPT1x.ShowWindow(type != MOD_TYPE_S3M ? SW_SHOW : SW_HIDE); - m_CheckBoxAmigaLimits.ShowWindow(type == MOD_TYPE_S3M ? SW_SHOW : SW_HIDE); + // These two checkboxes are mutually exclusive and share the same screen space + m_CheckBoxPT1x.ShowWindow(type == MOD_TYPE_MOD ? SW_SHOW : SW_HIDE); + m_CheckBox5.ShowWindow(type != MOD_TYPE_MOD ? SW_SHOW : SW_HIDE); + OnPTModeChanged(); const bool XMorITorMPT = (type & (MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT)) != 0; const bool ITorMPT = (type & (MOD_TYPE_IT | MOD_TYPE_MPT)) != 0; @@ -257,6 +260,16 @@ } +void CModTypeDlg::OnPTModeChanged() +//--------------------------------- +{ + // PT1/2 mode enforces Amiga limits + const bool ptMode = IsDlgButtonChecked(IDC_CHECK_PT1X) != BST_UNCHECKED; + m_CheckBoxAmigaLimits.EnableWindow(!ptMode); + if(ptMode) m_CheckBoxAmigaLimits.SetCheck(BST_CHECKED); +} + + bool CModTypeDlg::VerifyData() //---------------------------- { @@ -292,6 +305,7 @@ return true; } + void CModTypeDlg::OnOK() //---------------------- { Modified: trunk/OpenMPT/mptrack/dlg_misc.h =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.h 2014-11-20 19:30:23 UTC (rev 4606) +++ trunk/OpenMPT/mptrack/dlg_misc.h 2014-11-21 15:38:31 UTC (rev 4607) @@ -32,6 +32,7 @@ CModTypeDlg(CSoundFile &sf, CWnd *parent) : CDialog(IDD_MODDOC_MODTYPE, parent), sndFile(sf) { m_nType = MOD_TYPE_NONE; m_nChannels = 0; } bool VerifyData(); void UpdateDialog(); + void OnPTModeChanged(); protected: void UpdateChannelCBox(); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-11-20 19:30:23 UTC (rev 4606) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-11-21 15:38:31 UTC (rev 4607) @@ -1029,12 +1029,13 @@ 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 GROUPBOX "Playback",IDC_FRAME_MODFLAGS,6,42,246,54 - CONTROL "&Linear Frequency Slides",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,54,91,10 - CONTROL "&Old Effects (IT)",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,54,66,10 - CONTROL "Fast &Volume Slides (S3M)",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,66,96,10 - CONTROL "Compatible &Gxx (IT)",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,66,84,10 - CONTROL "Extended &filter range",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,81,10 - CONTROL "&ProTracker 1/2 Mode (MOD)",IDC_CHECK_PT1X,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,78,108,10 + CONTROL "&Linear Frequency Slides",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,54,108,10 + CONTROL "&Old Effects (IT)",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,54,108,10 + CONTROL "Fast &Volume Slides (S3M)",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,66,108,10 + CONTROL "Compatible &Gxx (IT)",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,66,108,10 + CONTROL "&ProTracker 1/2 Mode (MOD)",IDC_CHECK_PT1X,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,108,10 + CONTROL "Extended &filter range",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,108,10 + CONTROL "&Amiga Frequency Limits",IDC_CHECK_AMIGALIMITS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,78,108,10 GROUPBOX "Extended Playback Options (OpenMPT only)",IDC_FRAME_MPTEXT,6,102,246,84 LTEXT "&Mix Levels:",IDC_TEXT_MIXMODE,18,116,42,8 COMBOBOX IDC_COMBO_MIXLEVELS,60,114,108,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -1059,8 +1060,6 @@ EDITTEXT IDC_EDIT_CREATEDWITH,78,258,166,13,ES_AUTOHSCROLL | ES_READONLY,WS_EX_STATICEDGE RTEXT "Last saved with:",IDC_TEXT_SAVEDWITH,12,276,60,8 EDITTEXT IDC_EDIT_SAVEDWITH,78,276,166,13,ES_AUTOHSCROLL | ES_READONLY,WS_EX_STATICEDGE - CONTROL "&Amiga Frequency Limits (S3M)",IDC_CHECK_AMIGALIMITS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,78,108,10 END IDD_SHOWLOG DIALOGEX 0, 0, 300, 149 Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2014-11-20 19:30:23 UTC (rev 4606) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2014-11-21 15:38:31 UTC (rev 4607) @@ -649,6 +649,7 @@ if(isFLT8) numPatterns++; // as one logical pattern consists of two real patterns in FLT8 format, the highest pattern number has to be increased by one. bool hasTempoCommands = false; // for detecting VBlank MODs bool leftPanning = false, extendedPanning = false; // for detecting 800-880 panning + bool onlyAmigaNotes = true; // Reading patterns for(PATTERNINDEX pat = 0; pat < numPatterns; pat++) @@ -718,6 +719,10 @@ { instrWithoutNoteCount[chn] = 0; } + if(m.note != NOTE_NONE && m.note < NOTE_MIDDLEC - 12 || m.note > NOTE_MIDDLEC + 23) + { + onlyAmigaNotes = false; + } if(m.instr != 0) { lastInstrument[chn] = m.instr; @@ -727,6 +732,12 @@ } } + if(onlyAmigaNotes && (!memcmp(magic, "M.K.", 4) || !memcmp(magic, "M!K!", 4))) + { + // M.K. files that don't exceed the Amiga note limit (fixes mod.mothergoose) + m_SongFlags.set(SONG_AMIGALIMITS); + } + // Reading samples if(loadFlags & loadSampleData) { Modified: trunk/OpenMPT/soundlib/mod_specifications.cpp =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.cpp 2014-11-20 19:30:23 UTC (rev 4606) +++ trunk/OpenMPT/soundlib/mod_specifications.cpp 2014-11-21 15:38:31 UTC (rev 4607) @@ -109,7 +109,7 @@ false, // Doesn't support plugins false, // No custom pattern time signatures false, // No pattern names - SONG_PT1XMODE, // Supported song flags + SONG_PT1XMODE | SONG_AMIGALIMITS, // Supported song flags }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-11-28 17:19:57
|
Revision: 4610 http://sourceforge.net/p/modplug/code/4610 Author: manxorist Date: 2014-11-28 17:19:35 +0000 (Fri, 28 Nov 2014) Log Message: ----------- [Var] Update FLAC to v1.3.1 . Modified Paths: -------------- trunk/OpenMPT/build/gen/flac.vcproj trunk/OpenMPT/build/gen/flac.vcxproj trunk/OpenMPT/build/gen/flac.vcxproj.filters trunk/OpenMPT/include/flac/AUTHORS trunk/OpenMPT/include/flac/COPYING.Xiph trunk/OpenMPT/include/flac/README trunk/OpenMPT/include/flac/include/FLAC/all.h trunk/OpenMPT/include/flac/include/FLAC/assert.h trunk/OpenMPT/include/flac/include/FLAC/callback.h trunk/OpenMPT/include/flac/include/FLAC/export.h trunk/OpenMPT/include/flac/include/FLAC/format.h trunk/OpenMPT/include/flac/include/FLAC/metadata.h trunk/OpenMPT/include/flac/include/FLAC/ordinals.h trunk/OpenMPT/include/flac/include/FLAC/stream_decoder.h trunk/OpenMPT/include/flac/include/FLAC/stream_encoder.h trunk/OpenMPT/include/flac/include/share/alloc.h trunk/OpenMPT/include/flac/include/share/compat.h trunk/OpenMPT/include/flac/include/share/endswap.h trunk/OpenMPT/include/flac/include/share/macros.h trunk/OpenMPT/include/flac/include/share/private.h trunk/OpenMPT/include/flac/include/share/safe_str.h trunk/OpenMPT/include/flac/include/share/win_utf8_io.h trunk/OpenMPT/include/flac/src/libFLAC/bitmath.c trunk/OpenMPT/include/flac/src/libFLAC/bitreader.c trunk/OpenMPT/include/flac/src/libFLAC/bitwriter.c trunk/OpenMPT/include/flac/src/libFLAC/cpu.c trunk/OpenMPT/include/flac/src/libFLAC/crc.c trunk/OpenMPT/include/flac/src/libFLAC/fixed.c trunk/OpenMPT/include/flac/src/libFLAC/float.c trunk/OpenMPT/include/flac/src/libFLAC/format.c trunk/OpenMPT/include/flac/src/libFLAC/include/private/all.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/bitmath.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/bitreader.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/bitwriter.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/cpu.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/crc.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/fixed.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/float.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/format.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/lpc.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/macros.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/md5.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/memory.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/metadata.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/ogg_decoder_aspect.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/ogg_encoder_aspect.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/ogg_helper.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/ogg_mapping.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/stream_encoder_framing.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/window.h trunk/OpenMPT/include/flac/src/libFLAC/include/protected/all.h trunk/OpenMPT/include/flac/src/libFLAC/include/protected/stream_decoder.h trunk/OpenMPT/include/flac/src/libFLAC/include/protected/stream_encoder.h trunk/OpenMPT/include/flac/src/libFLAC/lpc.c trunk/OpenMPT/include/flac/src/libFLAC/md5.c trunk/OpenMPT/include/flac/src/libFLAC/memory.c trunk/OpenMPT/include/flac/src/libFLAC/metadata_iterators.c trunk/OpenMPT/include/flac/src/libFLAC/metadata_object.c trunk/OpenMPT/include/flac/src/libFLAC/ogg_decoder_aspect.c trunk/OpenMPT/include/flac/src/libFLAC/ogg_encoder_aspect.c trunk/OpenMPT/include/flac/src/libFLAC/ogg_helper.c trunk/OpenMPT/include/flac/src/libFLAC/ogg_mapping.c trunk/OpenMPT/include/flac/src/libFLAC/stream_decoder.c trunk/OpenMPT/include/flac/src/libFLAC/stream_encoder.c trunk/OpenMPT/include/flac/src/libFLAC/stream_encoder_framing.c trunk/OpenMPT/include/flac/src/libFLAC/window.c trunk/OpenMPT/include/flac/src/share/win_utf8_io/win_utf8_io.c trunk/OpenMPT/include/flac.premake4.lua Added Paths: ----------- trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_sse2.c trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_ssse3.c trunk/OpenMPT/include/flac/src/libFLAC/ia32/ trunk/OpenMPT/include/flac/src/libFLAC/ia32/cpu_asm.nasm trunk/OpenMPT/include/flac/src/libFLAC/ia32/fixed_asm.nasm trunk/OpenMPT/include/flac/src/libFLAC/ia32/lpc_asm.nasm trunk/OpenMPT/include/flac/src/libFLAC/ia32/nasm.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/stream_encoder.h trunk/OpenMPT/include/flac/src/libFLAC/lpc_intrin_avx2.c trunk/OpenMPT/include/flac/src/libFLAC/lpc_intrin_sse.c trunk/OpenMPT/include/flac/src/libFLAC/lpc_intrin_sse2.c trunk/OpenMPT/include/flac/src/libFLAC/lpc_intrin_sse41.c trunk/OpenMPT/include/flac/src/libFLAC/stream_encoder_intrin_avx2.c trunk/OpenMPT/include/flac/src/libFLAC/stream_encoder_intrin_sse2.c trunk/OpenMPT/include/flac/src/libFLAC/stream_encoder_intrin_ssse3.c Modified: trunk/OpenMPT/build/gen/flac.vcproj =================================================================== --- trunk/OpenMPT/build/gen/flac.vcproj 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/build/gen/flac.vcproj 2014-11-28 17:19:35 UTC (rev 4610) @@ -45,7 +45,7 @@ AdditionalOptions="/wd4244 /wd4267 /wd4334" Optimization="0" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -61,7 +61,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" /> <Tool @@ -124,7 +124,7 @@ AdditionalOptions="/wd4244 /wd4267 /wd4334" Optimization="0" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -140,7 +140,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" /> <Tool @@ -202,7 +202,7 @@ AdditionalOptions="/wd4244 /wd4267 /wd4334 /MP" Optimization="3" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -218,7 +218,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" /> <Tool @@ -281,7 +281,7 @@ AdditionalOptions="/wd4244 /wd4267 /wd4334 /MP" Optimization="3" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -297,7 +297,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" /> <Tool @@ -359,7 +359,7 @@ AdditionalOptions="/wd4244 /wd4267 /wd4334 /GL- /MP" Optimization="3" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -375,7 +375,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" /> <Tool @@ -438,7 +438,7 @@ AdditionalOptions="/wd4244 /wd4267 /wd4334 /GL- /MP" Optimization="3" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -454,7 +454,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.0\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.3.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="..\..\include\flac\include;..\..\include\flac\src\libFLAC\include" /> <Tool @@ -570,6 +570,10 @@ > </File> <File + RelativePath="..\..\include\flac\src\libFLAC\include\private\stream_encoder.h" + > + </File> + <File RelativePath="..\..\include\flac\src\libFLAC\include\private\stream_encoder_framing.h" > </File> @@ -621,6 +625,14 @@ > </File> <File + RelativePath="..\..\include\flac\src\libFLAC\fixed_intrin_sse2.c" + > + </File> + <File + RelativePath="..\..\include\flac\src\libFLAC\fixed_intrin_ssse3.c" + > + </File> + <File RelativePath="..\..\include\flac\src\libFLAC\float.c" > </File> @@ -633,6 +645,22 @@ > </File> <File + RelativePath="..\..\include\flac\src\libFLAC\lpc_intrin_avx2.c" + > + </File> + <File + RelativePath="..\..\include\flac\src\libFLAC\lpc_intrin_sse2.c" + > + </File> + <File + RelativePath="..\..\include\flac\src\libFLAC\lpc_intrin_sse41.c" + > + </File> + <File + RelativePath="..\..\include\flac\src\libFLAC\lpc_intrin_sse.c" + > + </File> + <File RelativePath="..\..\include\flac\src\libFLAC\md5.c" > </File> @@ -657,6 +685,18 @@ > </File> <File + RelativePath="..\..\include\flac\src\libFLAC\stream_encoder_intrin_avx2.c" + > + </File> + <File + RelativePath="..\..\include\flac\src\libFLAC\stream_encoder_intrin_sse2.c" + > + </File> + <File + RelativePath="..\..\include\flac\src\libFLAC\stream_encoder_intrin_ssse3.c" + > + </File> + <File RelativePath="..\..\include\flac\src\libFLAC\stream_encoder_framing.c" > </File> Modified: trunk/OpenMPT/build/gen/flac.vcxproj =================================================================== --- trunk/OpenMPT/build/gen/flac.vcxproj 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/build/gen/flac.vcxproj 2014-11-28 17:19:35 UTC (rev 4610) @@ -114,7 +114,7 @@ <AdditionalOptions>/wd4244 /wd4267 /wd4334 %(AdditionalOptions)</AdditionalOptions> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> @@ -125,7 +125,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -142,7 +142,7 @@ <AdditionalOptions>/wd4244 /wd4267 /wd4334 %(AdditionalOptions)</AdditionalOptions> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> @@ -153,7 +153,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -170,7 +170,7 @@ <AdditionalOptions>/wd4244 /wd4267 /wd4334 /MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -182,7 +182,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -201,7 +201,7 @@ <AdditionalOptions>/wd4244 /wd4267 /wd4334 /MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -213,7 +213,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -232,7 +232,7 @@ <AdditionalOptions>/wd4244 /wd4267 /wd4334 /GL- /MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -244,7 +244,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -262,7 +262,7 @@ <AdditionalOptions>/wd4244 /wd4267 /wd4334 /GL- /MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -274,7 +274,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.0";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.3.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>..\..\include\flac\include;..\..\include\flac\src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -301,6 +301,7 @@ <ClInclude Include="..\..\include\flac\src\libFLAC\include\private\md5.h" /> <ClInclude Include="..\..\include\flac\src\libFLAC\include\private\memory.h" /> <ClInclude Include="..\..\include\flac\src\libFLAC\include\private\metadata.h" /> + <ClInclude Include="..\..\include\flac\src\libFLAC\include\private\stream_encoder.h" /> <ClInclude Include="..\..\include\flac\src\libFLAC\include\private\stream_encoder_framing.h" /> <ClInclude Include="..\..\include\flac\src\libFLAC\include\private\window.h" /> <ClInclude Include="..\..\include\flac\src\libFLAC\include\protected\all.h" /> @@ -329,12 +330,24 @@ </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\fixed.c"> </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\fixed_intrin_sse2.c"> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\fixed_intrin_ssse3.c"> + </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\float.c"> </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\format.c"> </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\lpc.c"> </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\lpc_intrin_avx2.c"> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\lpc_intrin_sse2.c"> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\lpc_intrin_sse41.c"> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\lpc_intrin_sse.c"> + </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\md5.c"> </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\memory.c"> @@ -347,6 +360,12 @@ </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\stream_encoder.c"> </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\stream_encoder_intrin_avx2.c"> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\stream_encoder_intrin_sse2.c"> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\stream_encoder_intrin_ssse3.c"> + </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\stream_encoder_framing.c"> </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\window.c"> Modified: trunk/OpenMPT/build/gen/flac.vcxproj.filters =================================================================== --- trunk/OpenMPT/build/gen/flac.vcxproj.filters 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/build/gen/flac.vcxproj.filters 2014-11-28 17:19:35 UTC (rev 4610) @@ -2,37 +2,37 @@ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="include"> - <UniqueIdentifier>{B7001649-E6CA-EC40-B7E5-19B0A790498D}</UniqueIdentifier> + <UniqueIdentifier>{DBBF01E4-2752-914D-B523-37BC4141C557}</UniqueIdentifier> </Filter> <Filter Include="include\flac"> - <UniqueIdentifier>{2D5C8B77-DA1B-8641-9D6A-0694FBBAFAE0}</UniqueIdentifier> + <UniqueIdentifier>{12618FA6-0897-9443-87A7-B1FCF5E3CFDB}</UniqueIdentifier> </Filter> <Filter Include="include\flac\src"> - <UniqueIdentifier>{0E1A5C5B-57D3-8C41-8897-1A81CA416761}</UniqueIdentifier> + <UniqueIdentifier>{A3029C73-04B7-BC4F-884F-C49387619902}</UniqueIdentifier> </Filter> <Filter Include="include\flac\src\libFLAC"> - <UniqueIdentifier>{AA84FF48-7868-9C4C-A69B-BD8F82907385}</UniqueIdentifier> + <UniqueIdentifier>{E7CCF378-9A55-064D-8944-ECA731C1A85D}</UniqueIdentifier> </Filter> <Filter Include="include\flac\src\libFLAC\include"> - <UniqueIdentifier>{3233DEE2-52D3-8849-BCD1-71F195EA353B}</UniqueIdentifier> + <UniqueIdentifier>{3BEE864C-0550-4742-BFE2-455AF29F7508}</UniqueIdentifier> </Filter> <Filter Include="include\flac\src\libFLAC\include\private"> - <UniqueIdentifier>{018C5592-1164-ED4E-B88F-D84B74F76032}</UniqueIdentifier> + <UniqueIdentifier>{250AEE6E-8367-244B-AD10-53AA7E28A0DF}</UniqueIdentifier> </Filter> <Filter Include="include\flac\src\libFLAC\include\protected"> - <UniqueIdentifier>{BF28CD32-4AEA-5A44-8459-0121F306AD4A}</UniqueIdentifier> + <UniqueIdentifier>{EBB59549-AC23-594F-A7EC-67FB1DEE6F18}</UniqueIdentifier> </Filter> <Filter Include="include\flac\include"> - <UniqueIdentifier>{C3075182-D8D9-6D4A-AC86-765B62BFF004}</UniqueIdentifier> + <UniqueIdentifier>{5AE8ED7A-8516-3E43-89BF-7EBAA82D8DF3}</UniqueIdentifier> </Filter> <Filter Include="include\flac\include\FLAC"> - <UniqueIdentifier>{1A8CED26-238F-DB42-9890-043B71968D33}</UniqueIdentifier> + <UniqueIdentifier>{986FEA12-4E26-6545-BEF2-5D113998E167}</UniqueIdentifier> </Filter> <Filter Include="include\flac\src\share"> - <UniqueIdentifier>{3F8A36E1-642E-8441-A1C4-97D268C871CB}</UniqueIdentifier> + <UniqueIdentifier>{7896B2AA-F5A0-964F-B58D-C7239691BEF8}</UniqueIdentifier> </Filter> <Filter Include="include\flac\src\share\win_utf8_io"> - <UniqueIdentifier>{2D0A81D5-142A-A64A-861F-3E01CF7ADFC1}</UniqueIdentifier> + <UniqueIdentifier>{C9E9DF11-E837-8141-BF5D-18C634F0241A}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> @@ -75,6 +75,9 @@ <ClInclude Include="..\..\include\flac\src\libFLAC\include\private\metadata.h"> <Filter>include\flac\src\libFLAC\include\private</Filter> </ClInclude> + <ClInclude Include="..\..\include\flac\src\libFLAC\include\private\stream_encoder.h"> + <Filter>include\flac\src\libFLAC\include\private</Filter> + </ClInclude> <ClInclude Include="..\..\include\flac\src\libFLAC\include\private\stream_encoder_framing.h"> <Filter>include\flac\src\libFLAC\include\private</Filter> </ClInclude> @@ -137,6 +140,12 @@ <ClCompile Include="..\..\include\flac\src\libFLAC\fixed.c"> <Filter>include\flac\src\libFLAC</Filter> </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\fixed_intrin_sse2.c"> + <Filter>include\flac\src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\fixed_intrin_ssse3.c"> + <Filter>include\flac\src\libFLAC</Filter> + </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\float.c"> <Filter>include\flac\src\libFLAC</Filter> </ClCompile> @@ -146,6 +155,18 @@ <ClCompile Include="..\..\include\flac\src\libFLAC\lpc.c"> <Filter>include\flac\src\libFLAC</Filter> </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\lpc_intrin_avx2.c"> + <Filter>include\flac\src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\lpc_intrin_sse2.c"> + <Filter>include\flac\src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\lpc_intrin_sse41.c"> + <Filter>include\flac\src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\lpc_intrin_sse.c"> + <Filter>include\flac\src\libFLAC</Filter> + </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\md5.c"> <Filter>include\flac\src\libFLAC</Filter> </ClCompile> @@ -164,6 +185,15 @@ <ClCompile Include="..\..\include\flac\src\libFLAC\stream_encoder.c"> <Filter>include\flac\src\libFLAC</Filter> </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\stream_encoder_intrin_avx2.c"> + <Filter>include\flac\src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\stream_encoder_intrin_sse2.c"> + <Filter>include\flac\src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="..\..\include\flac\src\libFLAC\stream_encoder_intrin_ssse3.c"> + <Filter>include\flac\src\libFLAC</Filter> + </ClCompile> <ClCompile Include="..\..\include\flac\src\libFLAC\stream_encoder_framing.c"> <Filter>include\flac\src\libFLAC</Filter> </ClCompile> Modified: trunk/OpenMPT/include/flac/AUTHORS =================================================================== --- trunk/OpenMPT/include/flac/AUTHORS 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/AUTHORS 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* FLAC - Free Lossless Audio Codec * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * This file is part the FLAC project. FLAC is comprised of several * components distributed under different licenses. The codec libraries @@ -17,11 +17,27 @@ * distribution. */ +Current FLAC maintainer: Erik de Castro Lopo <er...@me...> -FLAC (http://flac.sourceforge.net/) is an Open Source lossless audio -codec developed by Josh Coalson <jco...@us...>. +Original author: Josh Coalson <jco...@us...> +Website : https://www.xiph.org/flac/ + +FLAC is an Open Source lossless audio codec originally developed by Josh Coalson +between 2001 and 2009. From 2009 to 2012 FLAC was basically unmaintained. In +2012 the Erik de Castro Lopo became the chief maintainer as part of the +Xiph.Org Foundation. + Other major contributors and their contributions: + +"lvqcl" <lv...@us...> +* Visual Studio build system. +* Optimisations in the encoder and decoder. + +"Janne Hyvärinen" <cs...@sc...> +* Visual Studio build system. +* Unicode handling on Windows. + "Andrey Astafiev" <an...@tv...> * Russian translation of the HTML documentation Modified: trunk/OpenMPT/include/flac/COPYING.Xiph =================================================================== --- trunk/OpenMPT/include/flac/COPYING.Xiph 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/COPYING.Xiph 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,5 +1,5 @@ Copyright (C) 2000-2009 Josh Coalson -Copyright (C) 2011-2013 Xiph.Org Foundation +Copyright (C) 2011-2014 Xiph.Org Foundation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/README =================================================================== --- trunk/OpenMPT/include/flac/README 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/README 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* FLAC - Free Lossless Audio Codec * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * This file is part the FLAC project. FLAC is comprised of several * components distributed under different licenses. The codec libraries @@ -31,7 +31,7 @@ * `flac', a command-line program for encoding and decoding files * `metaflac', a command-line program for viewing and editing FLAC metadata - * player plugins for XMMS and Winamp + * player plugin for XMMS * user and API documentation The libraries (libFLAC, libFLAC++) are @@ -42,7 +42,7 @@ =============================================================================== -FLAC - 1.3.0 - Contents +FLAC - 1.3.1 - Contents =============================================================================== - Introduction @@ -67,12 +67,18 @@ A brief description of the directory tree: doc/ the HTML documentation + examples/ example programs demonstrating the use of libFLAC and libFLAC++ include/ public include files for libFLAC and libFLAC++ - man/ the man page for `flac' + man/ the man pages for `flac' and `metaflac' src/ the source code and private headers test/ the test scripts +If you have questions about building FLAC that this document does not answer, +please submit them at the following tracker so this document can be improved: + https://sourceforge.net/p/flac/support-requests/ + + =============================================================================== Prerequisites =============================================================================== @@ -152,7 +158,7 @@ assembly routines. Many routines have assembly versions for speed and `configure' is pretty good about knowing what is supported, but you can use this option to build only from the -C sources. May be necessary for building on OS X (Intel) +C sources. May be necessary for building on OS X (Intel). --enable-sse : If you are building for an x86 CPU that supports SSE instructions, you can enable some of the faster routines @@ -214,10 +220,9 @@ your PATH, or the path to nasm.exe must be added to the list of directories for executable files in the MSVC global options. -VC++ 2005: To build everything, run Visual Studio, do File|Open and open FLAC.sln. From the dropdown in the toolbar, select "Release" instead of "Debug", -then hit F7 to build. +then do Build|Build Solution. This will build all libraries both statically (e.g. objs\release\lib\libFLAC_static.lib) and as DLLs (e.g. Modified: trunk/OpenMPT/include/flac/include/FLAC/all.h =================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/all.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/FLAC/all.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/FLAC/assert.h =================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/assert.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/FLAC/assert.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/FLAC/callback.h =================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/callback.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/FLAC/callback.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2004-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/FLAC/export.h =================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/export.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/FLAC/export.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -61,9 +61,9 @@ #elif defined(_MSC_VER) #ifdef FLAC_API_EXPORTS -#define FLAC_API _declspec(dllexport) +#define FLAC_API __declspec(dllexport) #else -#define FLAC_API _declspec(dllimport) +#define FLAC_API __declspec(dllimport) #endif #elif defined(FLAC__USE_VISIBILITY_ATTR) Modified: trunk/OpenMPT/include/flac/include/FLAC/format.h =================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/format.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/FLAC/format.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -509,9 +509,11 @@ FLAC__METADATA_TYPE_PICTURE = 6, /**< <A HREF="../format.html#metadata_block_picture">PICTURE</A> block */ - FLAC__METADATA_TYPE_UNDEFINED = 7 + FLAC__METADATA_TYPE_UNDEFINED = 7, /**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */ + FLAC__MAX_METADATA_TYPE = FLAC__MAX_METADATA_TYPE_CODE, + /**< No type will ever be greater than this. There is not enough room in the protocol block. */ } FLAC__MetadataType; /** Maps a FLAC__MetadataType to a C string. Modified: trunk/OpenMPT/include/flac/include/FLAC/metadata.h =================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/metadata.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/FLAC/metadata.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -500,7 +500,7 @@ * \retval unsigned * The length of the metadata block at the current iterator position. * The is same length as that in the - * <a href="http://flac.sourceforge.net/format.html#metadata_block_header">metadata block header</a>, + * <a href="http://xiph.org/flac/format.html#metadata_block_header">metadata block header</a>, * i.e. the length of the metadata body that follows the header. */ FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator); Modified: trunk/OpenMPT/include/flac/include/FLAC/ordinals.h =================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/ordinals.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/FLAC/ordinals.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/FLAC/stream_decoder.h =================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/stream_decoder.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/FLAC/stream_decoder.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/FLAC/stream_encoder.h =================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/stream_encoder.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/FLAC/stream_encoder.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -830,28 +830,28 @@ * The actual values set for each level are: * <table> * <tr> - * <td><b>level</b><td> - * <td>do mid-side stereo<td> - * <td>loose mid-side stereo<td> - * <td>apodization<td> - * <td>max lpc order<td> - * <td>qlp coeff precision<td> - * <td>qlp coeff prec search<td> - * <td>escape coding<td> - * <td>exhaustive model search<td> - * <td>min residual partition order<td> - * <td>max residual partition order<td> - * <td>rice parameter search dist<td> + * <td><b>level</b></td> + * <td>do mid-side stereo</td> + * <td>loose mid-side stereo</td> + * <td>apodization</td> + * <td>max lpc order</td> + * <td>qlp coeff precision</td> + * <td>qlp coeff prec search</td> + * <td>escape coding</td> + * <td>exhaustive model search</td> + * <td>min residual partition order</td> + * <td>max residual partition order</td> + * <td>rice parameter search dist</td> * </tr> - * <tr> <td><b>0</b><td> <td>false<td> <td>false<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr> - * <tr> <td><b>1</b><td> <td>true<td> <td>true<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr> - * <tr> <td><b>2</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr> - * <tr> <td><b>3</b><td> <td>false<td> <td>false<td> <td>tukey(0.5)<td> <td>6<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>4<td> <td>0<td> </tr> - * <tr> <td><b>4</b><td> <td>true<td> <td>true<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>4<td> <td>0<td> </tr> - * <tr> <td><b>5</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>5<td> <td>0<td> </tr> - * <tr> <td><b>6</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>6<td> <td>0<td> </tr> - * <tr> <td><b>7</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>true<td> <td>0<td> <td>6<td> <td>0<td> </tr> - * <tr> <td><b>8</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>12<td> <td>0<td> <td>false<td> <td>false<td> <td>true<td> <td>0<td> <td>6<td> <td>0<td> </tr> + * <tr> <td><b>0</b></td> <td>false</td> <td>false</td> <td>tukey(0.5)<td> <td>0</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr> + * <tr> <td><b>1</b></td> <td>true</td> <td>true</td> <td>tukey(0.5)<td> <td>0</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr> + * <tr> <td><b>2</b></td> <td>true</td> <td>false</td> <td>tukey(0.5)<td> <td>0</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr> + * <tr> <td><b>3</b></td> <td>false</td> <td>false</td> <td>tukey(0.5)<td> <td>6</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>4</td> <td>0</td> </tr> + * <tr> <td><b>4</b></td> <td>true</td> <td>true</td> <td>tukey(0.5)<td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>4</td> <td>0</td> </tr> + * <tr> <td><b>5</b></td> <td>true</td> <td>false</td> <td>tukey(0.5)<td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>5</td> <td>0</td> </tr> + * <tr> <td><b>6</b></td> <td>true</td> <td>false</td> <td>tukey(0.5);partial_tukey(2)<td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr> + * <tr> <td><b>7</b></td> <td>true</td> <td>false</td> <td>tukey(0.5);partial_tukey(2)<td> <td>12</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr> + * <tr> <td><b>8</b></td> <td>true</td> <td>false</td> <td>tukey(0.5);partial_tukey(2);punchout_tukey(3)</td> <td>12</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr> * </table> * * \default \c 5 @@ -920,7 +920,8 @@ * The available functions are \c bartlett, \c bartlett_hann, * \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop, * \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall, - * \c rectangle, \c triangle, \c tukey(P), \c welch. + * \c rectangle, \c triangle, \c tukey(P), \c partial_tukey(n[/ov[/P]]), + * \c punchout_tukey(n[/ov[/P]]), \c welch. * * For \c gauss(STDDEV), STDDEV specifies the standard deviation * (0<STDDEV<=0.5). @@ -929,6 +930,24 @@ * tapered (0<=P<=1). P=0 corresponds to \c rectangle and P=1 * corresponds to \c hann. * + * Specifying \c partial_tukey or \c punchout_tukey works a little + * different. These do not specify a single apodization function, but + * a series of them with some overlap. partial_tukey specifies a series + * of small windows (all treated separately) while punchout_tukey + * specifies a series of windows that have a hole in them. In this way, + * the predictor is constructed with only a part of the block, which + * helps in case a block consists of dissimilar parts. + * + * The three parameters that can be specified for the functions are + * n, ov and P. n is the number of functions to add, ov is the overlap + * of the windows in case of partial_tukey and the overlap in the gaps + * in case of punchout_tukey. P is the fraction of the window that is + * tapered, like with a regular tukey window. The function can be + * specified with only a number, a number and an overlap, or a number + * an overlap and a P, for example, partial_tukey(3), partial_tukey(3/0.3) + * and partial_tukey(3/0.3/0.5) are all valid. ov should be smaller than 1 + * and can be negative. + * * Example specifications are \c "blackman" or * \c "hann;triangle;tukey(0.5);tukey(0.25);tukey(0.125)" * @@ -941,7 +960,9 @@ * results in the smallest compressed subframe. * * Note that each function specified causes the encoder to occupy a - * floating point array in which to store the window. + * floating point array in which to store the window. Also note that the + * values of P, STDDEV and ov are locale-specific, so if the comma + * separator specified by the locale is a comma, a comma should be used. * * \default \c "tukey(0.5)" * \param encoder An encoder instance to set. Modified: trunk/OpenMPT/include/flac/include/share/alloc.h =================================================================== --- trunk/OpenMPT/include/flac/include/share/alloc.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/share/alloc.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* alloc - Convenience routines for safely allocating memory * Copyright (C) 2007-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,7 +33,7 @@ #ifndef FLAC__SHARE__ALLOC_H #define FLAC__SHARE__ALLOC_H -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif Modified: trunk/OpenMPT/include/flac/include/share/compat.h =================================================================== --- trunk/OpenMPT/include/flac/include/share/compat.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/share/compat.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2012 Xiph.org Foundation + * Copyright (C) 2012-2014 Xiph.org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -73,23 +73,25 @@ #endif #if defined(_MSC_VER) -#if _MSC_VER < 1500 -/* Visual Studio 2008 has restrict. */ -#define restrict __restrict -#endif #define inline __inline #endif -/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ -#ifdef _MSC_VER -#define FLAC__U64L(x) x +#if defined __INTEL_COMPILER || (defined _MSC_VER && defined _WIN64) +/* MSVS generates VERY slow 32-bit code with __restrict */ +#define flac_restrict __restrict +#elif defined __GNUC__ +#define flac_restrict __restrict__ #else -#define FLAC__U64L(x) x##LLU +#define flac_restrict #endif +#define FLAC__U64L(x) x##ULL + #if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ +#define FLAC__STRCASECMP stricmp #define FLAC__STRNCASECMP strnicmp #else +#define FLAC__STRCASECMP strcasecmp #define FLAC__STRNCASECMP strncasecmp #endif @@ -161,12 +163,7 @@ #define flac_utime utime #define flac_unlink unlink #define flac_rename rename - -#ifdef _WIN32 -#define flac_stat _stat64 -#else #define flac_stat stat -#endif #endif @@ -178,17 +175,25 @@ #define flac_fstat fstat #endif +#ifndef M_LN2 +#define M_LN2 0.69314718055994530942 +#endif +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif -/* FLAC needs to compile and work correctly on systems with a norrmal ISO C99 +/* FLAC needs to compile and work correctly on systems with a normal ISO C99 * snprintf as well as Microsoft Visual Studio which has an non-standards * conformant snprint_s function. * * This function wraps the MS version to behave more like the the ISO version. */ +#include <stdarg.h> #ifdef __cplusplus extern "C" { #endif int flac_snprintf(char *str, size_t size, const char *fmt, ...); +int flac_vsnprintf(char *str, size_t size, const char *fmt, va_list va); #ifdef __cplusplus }; #endif Modified: trunk/OpenMPT/include/flac/include/share/endswap.h =================================================================== --- trunk/OpenMPT/include/flac/include/share/endswap.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/share/endswap.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2012 Xiph.org Foundation + * Copyright (C) 2012-2014 Xiph.org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,21 +33,46 @@ #if HAVE_BSWAP32 /* GCC and Clang */ +/* GCC prior to 4.8 didn't provide bswap16 on x86_64 */ +#if ! HAVE_BSWAP16 +static inline unsigned short __builtin_bswap16(unsigned short a) +{ + return (a<<8)|(a>>8); +} +#endif + +#define ENDSWAP_16(x) (__builtin_bswap16 (x)) #define ENDSWAP_32(x) (__builtin_bswap32 (x)) #elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */ +#define ENDSWAP_16(x) (_byteswap_ushort (x)) #define ENDSWAP_32(x) (_byteswap_ulong (x)) #elif defined HAVE_BYTESWAP_H /* Linux */ #include <byteswap.h> +#define ENDSWAP_16(x) (bswap_16 (x)) #define ENDSWAP_32(x) (bswap_32 (x)) #else -#define ENDSWAP_32(x) ((((x) >> 24) & 0xFF) + (((x) >> 8) & 0xFF00) + (((x) & 0xFF00) << 8) + (((x) & 0xFF) << 24)) +#define ENDSWAP_16(x) ((((x) >> 8) & 0xFF) | (((x) & 0xFF) << 8)) +#define ENDSWAP_32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) & 0xFF00) << 8) | (((x) & 0xFF) << 24)) #endif + +/* Host to little-endian byte swapping. */ +#if CPU_IS_BIG_ENDIAN + +#define H2LE_16(x) ENDSWAP_16 (x) +#define H2LE_32(x) ENDSWAP_32 (x) + +#else + +#define H2LE_16(x) (x) +#define H2LE_32(x) (x) + +#endif Modified: trunk/OpenMPT/include/flac/include/share/macros.h =================================================================== --- trunk/OpenMPT/include/flac/include/share/macros.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/share/macros.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2013 Xiph.org Foundation + * Copyright (C) 2013-2014 Xiph.org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/share/private.h =================================================================== --- trunk/OpenMPT/include/flac/include/share/private.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/share/private.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2013 Xiph.org Foundation + * Copyright (C) 2013-2014 Xiph.org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/share/safe_str.h =================================================================== --- trunk/OpenMPT/include/flac/include/share/safe_str.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/share/safe_str.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2013 Xiph.org Foundation + * Copyright (C) 2013-2014 Xiph.org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/share/win_utf8_io.h =================================================================== --- trunk/OpenMPT/include/flac/include/share/win_utf8_io.h 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/include/share/win_utf8_io.h 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2013 Xiph.Org Foundation + * Copyright (C) 2013-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -58,7 +58,7 @@ int rename_utf8(const char *oldname, const char *newname); size_t strlen_utf8(const char *str); int win_get_console_width(void); -int print_console(FILE *stream, const wchar_t *text, uint32_t len); +int print_console(FILE *stream, const wchar_t *text, size_t len); HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); #ifdef __cplusplus Modified: trunk/OpenMPT/include/flac/src/libFLAC/bitmath.c =================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/bitmath.c 2014-11-21 16:02:10 UTC (rev 4609) +++ trunk/OpenMPT/include/flac/src/libFLAC/bitmath.c 2014-11-28 17:19:35 UTC (rev 4610) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2013 Xiph.Org Foundation + * Copyright (C) 2011-2014 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following condi... [truncated message content] |
From: <sag...@us...> - 2014-11-29 00:15:36
|
Revision: 4613 http://sourceforge.net/p/modplug/code/4613 Author: saga-games Date: 2014-11-29 00:15:19 +0000 (Sat, 29 Nov 2014) Log Message: ----------- [Ref] Change the confusing CSoundFile::SetCurrentPos method into CSoundFile::ResetPlayPos, which is the same as SetCurrentPos(0) -- apart from a single call site, this was the only usage of this function. [Mod] OpenMPT: Version is now 1.24.00.18 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-11-29 00:07:22 UTC (rev 4612) +++ trunk/OpenMPT/common/versionNumber.h 2014-11-29 00:15:19 UTC (rev 4613) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 24 #define VER_MINOR 00 -#define VER_MINORMINOR 17 +#define VER_MINORMINOR 18 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-11-29 00:07:22 UTC (rev 4612) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-11-29 00:15:19 UTC (rev 4613) @@ -1379,7 +1379,7 @@ PausePlayback(); GenerateStopNotification(); - m_pSndFile->SetCurrentPos(0); + m_pSndFile->ResetPlayPos(); m_pSndFile->ResetChannels(); UnsetPlaybackSoundFile(); @@ -1600,7 +1600,7 @@ { m_WaveFile.m_SongFlags.reset(SONG_PAUSED); m_WaveFile.SetRepeatCount(-1); - m_WaveFile.SetCurrentPos(0); + m_WaveFile.ResetPlayPos(); ModCommand *m = m_WaveFile.Patterns[0]; if(m) Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2014-11-29 00:07:22 UTC (rev 4612) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2014-11-29 00:15:19 UTC (rev 4613) @@ -1010,8 +1010,7 @@ uint64 l = static_cast<uint64>(m_SndFile.GetSongTime() + 0.5) * samplerate * std::max<uint64>(1, 1 + m_SndFile.GetRepeatCount()); // Reset song position tracking - m_SndFile.InitializeVisitedRows(); - m_SndFile.SetCurrentPos(0); + m_SndFile.ResetPlayPos(); m_SndFile.m_SongFlags.reset(SONG_PATTERNLOOP); ORDERINDEX startOrder = 0; if(m_Settings.minOrder != ORDERINDEX_INVALID && m_Settings.maxOrder != ORDERINDEX_INVALID) Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-11-29 00:07:22 UTC (rev 4612) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-11-29 00:15:19 UTC (rev 4613) @@ -758,7 +758,7 @@ m_SndFile.m_SongFlags.set(SONG_LINEARSLIDES); } } - m_SndFile.SetCurrentPos(0); + m_SndFile.ResetPlayPos(); return TRUE; } @@ -1689,7 +1689,8 @@ const mpt::PathString fileName = drive + dir + name; const mpt::PathString fileExt = ext; - // Saving as wave file + const ORDERINDEX currentOrd = m_SndFile.m_PlayState.m_nCurrentOrder; + const ROWINDEX currentRow = m_SndFile.m_PlayState.m_nRow; int nRenderPasses = 1; // Channel mode @@ -1740,7 +1741,6 @@ } } - UINT pos = m_SndFile.GetCurrentPos(); pMainFrm->PauseMod(); int oldRepeat = m_SndFile.GetRepeatCount(); @@ -1756,7 +1756,7 @@ if(i > 0) m_SndFile.ChnSettings[i - 1].dwFlags.set(CHN_MUTE); // Was this channel actually muted? Don't process it then. - if(usedChannels[i] == false) + if(!usedChannels[i]) continue; // Add channel number & name (if available) to path string if(strcmp(m_SndFile.ChnSettings[i].szName, "")) @@ -1842,7 +1842,9 @@ } m_SndFile.SetRepeatCount(oldRepeat); - m_SndFile.SetCurrentPos(pos); + m_SndFile.GetLength(eAdjust, GetLengthTarget(currentOrd, currentRow)); + m_SndFile.m_PlayState.m_nNextOrder = currentOrd; + m_SndFile.m_PlayState.m_nNextRow = currentRow; CMainFrame::UpdateAudioParameters(m_SndFile, true); } @@ -2092,7 +2094,7 @@ pMainFrm->PauseMod(); CriticalSection cs; m_SndFile.m_SongFlags.reset(SONG_STEP | SONG_PATTERNLOOP); - m_SndFile.SetCurrentPos(0); + m_SndFile.ResetPlayPos(); //m_SndFile.visitedSongRows.Initialize(true); m_SndFile.m_PlayState.m_lTotalSampleCount = 0; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2014-11-29 00:07:22 UTC (rev 4612) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2014-11-29 00:15:19 UTC (rev 4613) @@ -897,36 +897,30 @@ if ((m_nRestartPos >= Order.size()) || (Order[m_nRestartPos] >= Patterns.Size())) m_nRestartPos = 0; - // When reading a file made with an older version of MPT, it might be necessary to upgrade some settings automatically. - if(m_dwLastSavedWithVersion) - { - UpgradeModule(); - } - +#ifndef NO_VST // plugin loader std::string notFoundText; - std::vector<PLUGINDEX> notFoundIDs; + std::vector<SNDMIXPLUGININFO *> notFoundIDs; -#ifndef NO_VST if (gpMixPluginCreateProc && (loadFlags & loadPluginData)) { - for(PLUGINDEX iPlug = 0; iPlug < MAX_MIXPLUGINS; iPlug++) + for(PLUGINDEX plug = 0; plug < MAX_MIXPLUGINS; plug++) { - if(m_MixPlugins[iPlug].IsValidPlugin()) + if(m_MixPlugins[plug].IsValidPlugin()) { - gpMixPluginCreateProc(m_MixPlugins[iPlug], *this); - if (m_MixPlugins[iPlug].pMixPlugin) + gpMixPluginCreateProc(m_MixPlugins[plug], *this); + if (m_MixPlugins[plug].pMixPlugin) { // plugin has been found - m_MixPlugins[iPlug].pMixPlugin->RestoreAllParameters(m_MixPlugins[iPlug].defaultProgram); + m_MixPlugins[plug].pMixPlugin->RestoreAllParameters(m_MixPlugins[plug].defaultProgram); } else { // plugin not found - add to list bool found = false; - for(std::vector<PLUGINDEX>::iterator i = notFoundIDs.begin(); i != notFoundIDs.end(); ++i) + for(std::vector<SNDMIXPLUGININFO *>::const_iterator i = notFoundIDs.begin(); i != notFoundIDs.end(); ++i) { - if(m_MixPlugins[*i].Info.dwPluginId2 == m_MixPlugins[iPlug].Info.dwPluginId2 - && m_MixPlugins[*i].Info.dwPluginId1 == m_MixPlugins[iPlug].Info.dwPluginId1) + if((**i).dwPluginId2 == (**i).dwPluginId2 + && (**i).dwPluginId1 == (**i).dwPluginId1) { found = true; break; @@ -935,9 +929,9 @@ if(!found) { - notFoundText.append(m_MixPlugins[iPlug].GetLibraryName()); + notFoundText.append(m_MixPlugins[plug].GetLibraryName()); notFoundText.append("\n"); - notFoundIDs.push_back(iPlug); // add this to the list of missing IDs so we will find the needed plugins later when calling KVRAudio + notFoundIDs.push_back(&m_MixPlugins[plug].Info); // add this to the list of missing IDs so we will find the needed plugins later when calling KVRAudio } } } @@ -951,21 +945,20 @@ if(notFoundIDs.size() == 1) { notFoundText = "The following plugin has not been found:\n\n" + notFoundText + "\nDo you want to search for it online?"; - } - else + } else { - notFoundText = "The following plugins have not been found:\n\n" + notFoundText + "\nDo you want to search for them online?"; + notFoundText = "The following plugins have not been found:\n\n" + notFoundText + "\nDo you want to search for them online?"; } if (Reporting::Confirm(mpt::ToWide(mpt::CharsetUTF8, notFoundText.c_str()), L"OpenMPT - Plugins missing", false, true) == cnfYes) { - std::string sUrl = "http://resources.openmpt.org/plugins/search.php?p="; - for(std::vector<PLUGINDEX>::iterator i = notFoundIDs.begin(); i != notFoundIDs.end(); ++i) + std::string url = "http://resources.openmpt.org/plugins/search.php?p="; + for(std::vector<SNDMIXPLUGININFO *>::const_iterator i = notFoundIDs.begin(); i != notFoundIDs.end(); ++i) { - sUrl += mpt::fmt::HEX0<8>(LittleEndian(m_MixPlugins[*i].Info.dwPluginId2)); - sUrl += m_MixPlugins[*i].GetLibraryName(); - sUrl += "%0a"; + url += mpt::fmt::HEX0<8>(LittleEndian((**i).dwPluginId2)); + url += (**i).szLibraryName; + url += "%0a"; } - CTrackApp::OpenURL(mpt::PathString::FromUTF8(sUrl)); + CTrackApp::OpenURL(mpt::PathString::FromUTF8(url)); } } #endif // NO_VST @@ -973,17 +966,23 @@ // Set up mix levels SetMixLevels(m_nMixLevels); - if(GetType() != MOD_TYPE_NONE) + if(GetType() == MOD_TYPE_NONE) { - SetModSpecsPointer(m_pModSpecs, GetBestSaveFormat()); - const ORDERINDEX CacheSize = ModSequenceSet::s_nCacheSize; // workaround reference to static const member problem - const ORDERINDEX nMinLength = std::min(CacheSize, GetModSpecifications().ordersMax); - if (Order.GetLength() < nMinLength) - Order.resize(nMinLength); - return true; + return false; } - return false; + SetModSpecsPointer(m_pModSpecs, GetBestSaveFormat()); + const ORDERINDEX CacheSize = ModSequenceSet::s_nCacheSize; // workaround reference to static const member problem + const ORDERINDEX nMinLength = std::min(CacheSize, GetModSpecifications().ordersMax); + if (Order.GetLength() < nMinLength) + Order.resize(nMinLength); + + // When reading a file made with an older version of MPT, it might be necessary to upgrade some settings automatically. + if(m_dwLastSavedWithVersion) + { + UpgradeModule(); + } + return true; } @@ -1059,27 +1058,19 @@ } -UINT CSoundFile::GetCurrentPos() const -//------------------------------------ -{ - UINT pos = 0; - - for (UINT i=0; i<m_PlayState.m_nCurrentOrder; i++) if (Order[i] < Patterns.Size()) - pos += Patterns[Order[i]].GetNumRows(); - return pos + m_PlayState.m_nRow; -} - double CSoundFile::GetCurrentBPM() const //-------------------------------------- { double bpm; - if (m_nTempoMode == tempo_mode_modern) // With modern mode, we trust that true bpm - { // is close enough to what user chose. + if (m_nTempoMode == tempo_mode_modern) + { + // With modern mode, we trust that true bpm is close enough to what user chose. bpm = static_cast<double>(m_PlayState.m_nMusicTempo); // This avoids oscillation due to tick-to-tick corrections. } else - { //with other modes, we calculate it: - double ticksPerBeat = m_PlayState.m_nMusicSpeed * m_PlayState.m_nCurrentRowsPerBeat; //ticks/beat = ticks/row * rows/beat + { + //with other modes, we calculate it: + double ticksPerBeat = m_PlayState.m_nMusicSpeed * m_PlayState.m_nCurrentRowsPerBeat; //ticks/beat = ticks/row * rows/beat double samplesPerBeat = m_PlayState.m_nSamplesPerTick * ticksPerBeat; //samps/beat = samps/tick * ticks/beat bpm = m_MixerSettings.gdwMixingFreq/samplesPerBeat * 60; //beats/sec = samps/sec / samps/beat } //beats/min = beats/sec * 60 @@ -1087,73 +1078,28 @@ return bpm; } -void CSoundFile::SetCurrentPos(UINT nPos) -//--------------------------------------- + +void CSoundFile::ResetPlayPos() +//----------------------------- { - ORDERINDEX nPattern; - ModChannel::ResetFlags resetMask = (!nPos) ? ModChannel::resetSetPosFull : ModChannel::resetSetPosBasic; + for(CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) + m_PlayState.Chn[i].Reset(ModChannel::resetSetPosFull, *this, i); - for (CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) - m_PlayState.Chn[i].Reset(resetMask, *this, i); + InitializeVisitedRows(); + m_SongFlags.reset(SONG_FADINGSONG | SONG_ENDREACHED); - if(nPos == 0) - { - m_PlayState.m_nGlobalVolume = m_nDefaultGlobalVolume; - m_PlayState.m_nMusicSpeed = m_nDefaultSpeed; - m_PlayState.m_nMusicTempo = m_nDefaultTempo; + m_PlayState.m_nGlobalVolume = m_nDefaultGlobalVolume; + m_PlayState.m_nMusicSpeed = m_nDefaultSpeed; + m_PlayState.m_nMusicTempo = m_nDefaultTempo; - // do not ramp global volume when starting playback - m_PlayState.m_lHighResRampingGlobalVolume = m_PlayState.m_nGlobalVolume<<VOLUMERAMPPRECISION; - m_PlayState.m_nGlobalVolumeDestination = m_PlayState.m_nGlobalVolume; - m_PlayState.m_nSamplesToGlobalVolRampDest = 0; - m_PlayState.m_nGlobalVolumeRampAmount = 0; + // do not ramp global volume when starting playback + m_PlayState.m_lHighResRampingGlobalVolume = m_PlayState.m_nGlobalVolume<<VOLUMERAMPPRECISION; + m_PlayState.m_nGlobalVolumeDestination = m_PlayState.m_nGlobalVolume; + m_PlayState.m_nSamplesToGlobalVolRampDest = 0; + m_PlayState.m_nGlobalVolumeRampAmount = 0; - visitedSongRows.Initialize(true); - } - m_SongFlags.reset(SONG_FADINGSONG | SONG_ENDREACHED); - for (nPattern = 0; nPattern < Order.size(); nPattern++) - { - ORDERINDEX ord = Order[nPattern]; - if(ord == Order.GetIgnoreIndex()) continue; - if (ord == Order.GetInvalidPatIndex()) break; - if (ord < Patterns.Size()) - { - if (nPos < (UINT)Patterns[ord].GetNumRows()) break; - nPos -= Patterns[ord].GetNumRows(); - } - } - // Buggy position ? - if ((nPattern >= Order.size()) - || (Order[nPattern] >= Patterns.Size()) - || (nPos >= Patterns[Order[nPattern]].GetNumRows())) - { - nPos = 0; - nPattern = 0; - } - UINT nRow = nPos; - if ((nRow) && (Order[nPattern] < Patterns.Size())) - { - ModCommand *p = Patterns[Order[nPattern]]; - if ((p) && (nRow < Patterns[Order[nPattern]].GetNumRows())) - { - bool bOk = false; - while ((!bOk) && (nRow > 0)) - { - UINT n = nRow * m_nChannels; - for (UINT k=0; k<m_nChannels; k++, n++) - { - if (p[n].note) - { - bOk = true; - break; - } - } - if (!bOk) nRow--; - } - } - } - m_PlayState.m_nNextOrder = nPattern; - m_PlayState.m_nNextRow = nRow; + m_PlayState.m_nNextOrder = 0; + m_PlayState.m_nNextRow = 0; m_PlayState.m_nTickCount = m_PlayState.m_nMusicSpeed; m_PlayState.m_nBufferCount = 0; m_PlayState.m_nPatternDelay = 0; @@ -1194,7 +1140,7 @@ if (!nOrder) { - SetCurrentPos(0); + ResetPlayPos(); } else { m_PlayState.m_nNextOrder = nOrder; @@ -1276,7 +1222,7 @@ void CSoundFile::RecalculateGainForAllPlugs() //------------------------------------------- { - for (UINT iPlug=0; iPlug<MAX_MIXPLUGINS; iPlug++) + for (PLUGINDEX iPlug = 0; iPlug < MAX_MIXPLUGINS; iPlug++) { if (!m_MixPlugins[iPlug].pMixPlugin) continue; //most common branch @@ -1289,6 +1235,7 @@ } } + //end rewbs.VSTCompliance void CSoundFile::ResetChannels() Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2014-11-29 00:07:22 UTC (rev 4612) +++ trunk/OpenMPT/soundlib/Sndfile.h 2014-11-29 00:15:19 UTC (rev 4613) @@ -97,13 +97,13 @@ struct GetLengthType { double duration; // total time in seconds - ROWINDEX lastRow; // last parsed row (see lastOrder remark) - ROWINDEX endRow; // last row before module loops (see endOrder remark) + ROWINDEX lastRow; // last parsed row (if no target is specified, this is the first row that is parsed twice, i.e. not the *last* played order) + ROWINDEX endRow; // last row before module loops (UNDEFINED if a target is specified) ROWINDEX startRow; // first row of parsed subsong - ORDERINDEX lastOrder; // last parsed order (if no target is specified, this is the first order that is parsed twice, i.e. not the *last* played order) + ORDERINDEX lastOrder; // last parsed order (see lastRow remark) ORDERINDEX endOrder; // last order before module loops (UNDEFINED if a target is specified) ORDERINDEX startOrder; // first order of parsed subsong - bool targetReached; // true if the specified order/row combination has been reached while going through the module + bool targetReached; // true if the specified order/row combination or duration has been reached while going through the module GetLengthType() : duration(0.0) @@ -601,7 +601,6 @@ INSTRUMENTINDEX GetNumInstruments() const { return m_nInstruments; } SAMPLEINDEX GetNumSamples() const { return m_nSamples; } - UINT GetCurrentPos() const; PATTERNINDEX GetCurrentPattern() const { return m_PlayState.m_nPattern; } ORDERINDEX GetCurrentOrder() const { return m_PlayState.m_nCurrentOrder; } CHANNELINDEX GetNumChannels() const { return m_nChannels; } @@ -619,7 +618,7 @@ void DontLoopPattern(PATTERNINDEX nPat, ROWINDEX nRow = 0); //rewbs.playSongFromCursor CHANNELINDEX GetMixStat() const { return m_nMixStat; } void ResetMixStat() { m_nMixStat = 0; } - void SetCurrentPos(UINT nPos); + void ResetPlayPos(); void SetCurrentOrder(ORDERINDEX nOrder); std::string GetTitle() const { return songName; } bool SetTitle(const std::string &newTitle); // Return true if title was changed. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-02 19:54:32
|
Revision: 4625 http://sourceforge.net/p/modplug/code/4625 Author: saga-games Date: 2014-12-02 19:53:57 +0000 (Tue, 02 Dec 2014) Log Message: ----------- [New] Pattern tab: Ctrl+Scrollwheel can now be used as a replacement for the data entry shortcuts. Holding Ctrl+Shift+Scrollwheel acts as coarse data entry (http://bugs.openmpt.org/view.php?id=613) Modified Paths: -------------- trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/soundlib/plugins/PlugInterface.h Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-12-01 21:42:54 UTC (rev 4624) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-12-02 19:53:57 UTC (rev 4625) @@ -2,7 +2,7 @@ * view_pat.cpp * ------------ * Purpose: Pattern tab, lower panel. - * Notes : (currently none) + * Notes : Welcome to about 7000 lines of, err, very beautiful code. * Authors: Olivier Lapicque * OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. @@ -16,10 +16,9 @@ #include "Childfrm.h" #include "Moddoc.h" #include "SampleEditorDialogs.h" // For amplification dialog (which is re-used from sample editor) -#include "globals.h" -#include "view_pat.h" -#include "ctrl_pat.h" -#include "vstplug.h" // for writing plug params to pattern +#include "Globals.h" +#include "View_pat.h" +#include "Ctrl_pat.h" #include "EffectVis.h" //rewbs.fxvis #include "PatternGotoDialog.h" @@ -56,6 +55,7 @@ ON_WM_ERASEBKGND() ON_WM_VSCROLL() ON_WM_SIZE() + ON_WM_MOUSEWHEEL() ON_WM_MOUSEMOVE() ON_WM_LBUTTONDOWN() ON_WM_LBUTTONDBLCLK() @@ -1522,6 +1522,19 @@ } +BOOL CViewPattern::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +//------------------------------------------------------------------- +{ + // Ctrl + mouse wheel: Increment / decrement values + if(nFlags & MK_CONTROL) + { + DataEntry(zDelta > 0, (nFlags & MK_SHIFT) == MK_SHIFT); + return TRUE; + } + return CModScrollView::OnMouseWheel(nFlags, zDelta, pt); +} + + void CViewPattern::OnMouseMove(UINT nFlags, CPoint point) //------------------------------------------------------- { @@ -2946,7 +2959,7 @@ // Don't allow notes outside our supported note range. const ModCommand::NOTE noteMin = pSndFile->GetModSpecifications().noteMin; const ModCommand::NOTE noteMax = pSndFile->GetModSpecifications().noteMax; - const int instrMax = std::min(static_cast<int>(Util::MaxValueOfType(ModCommand::INSTR())), static_cast<int>(pSndFile->GetNumInstruments() ? pSndFile->GetModSpecifications().instrumentsMax : pSndFile->GetModSpecifications().samplesMax)); + const int instrMax = std::min<int>(Util::MaxValueOfType(ModCommand::INSTR()), pSndFile->GetNumInstruments() ? pSndFile->GetNumInstruments() : pSndFile->GetNumSamples()); const EffectInfo effectInfo(*pSndFile); const int offset = up ? 1 : -1; @@ -3688,7 +3701,7 @@ // TODO: Is the right plugin active? Move to a chan with the right plug // Probably won't do this - finish fluctuator implementation instead. - CVstPlugin *pPlug = (CVstPlugin*)pSndFile->m_MixPlugins[plugSlot].pMixPlugin; + IMixPlugin *pPlug = pSndFile->m_MixPlugins[plugSlot].pMixPlugin; if (pPlug == nullptr) return 0; if(pSndFile->GetType() == MOD_TYPE_MPT) @@ -6376,20 +6389,19 @@ if(selStart.instr >= 1 && selStart.instr <= MAX_MIXPLUGINS) { - CVstPlugin *plug = (CVstPlugin *)(sndFile->m_MixPlugins[selStart.instr - 1].pMixPlugin); - - if(plug != nullptr) + const SNDMIXPLUGIN &plug = sndFile->m_MixPlugins[selStart.instr - 1]; + if(plug.pMixPlugin != nullptr) { // Create sub menu for "change plugin param" HMENU paramChangeMenu = ::CreatePopupMenu(); AppendMenu(hMenu, MF_POPUP, reinterpret_cast<UINT_PTR>(paramChangeMenu), "Change Plugin Parameter\t"); - const PlugParamIndex curParam = selStart.GetValueVolCol(), nParams = plug->GetNumParameters(); + const PlugParamIndex curParam = selStart.GetValueVolCol(), nParams = plug.pMixPlugin->GetNumParameters(); for(PlugParamIndex i = 0; i < nParams; i++) { - AppendMenu(paramChangeMenu, MF_STRING | (i == curParam) ? MF_CHECKED : 0, ID_CHANGE_PCNOTE_PARAM + i, plug->GetFormattedParamName(i)); + AppendMenu(paramChangeMenu, MF_STRING | (i == curParam) ? MF_CHECKED : 0, ID_CHANGE_PCNOTE_PARAM + i, plug.GetParamName(i).c_str()); } } } Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2014-12-01 21:42:54 UTC (rev 4624) +++ trunk/OpenMPT/mptrack/View_pat.h 2014-12-02 19:53:57 UTC (rev 4625) @@ -352,6 +352,7 @@ afx_msg BOOL OnEraseBkgnd(CDC *) { return TRUE; } afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnDestroy(); + afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); afx_msg void OnMouseMove(UINT, CPoint); afx_msg void OnLButtonUp(UINT, CPoint); afx_msg void OnLButtonDown(UINT, CPoint); Modified: trunk/OpenMPT/soundlib/plugins/PlugInterface.h =================================================================== --- trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2014-12-01 21:42:54 UTC (rev 4624) +++ trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2014-12-02 19:53:57 UTC (rev 4625) @@ -52,6 +52,7 @@ virtual void HardAllNotesOff() = 0; //rewbs.VSTCompliance virtual void RecalculateGain() = 0; virtual bool isPlaying(UINT note, UINT midiChn, UINT trackerChn) = 0; //rewbs.VSTiNNA + virtual PlugParamIndex GetNumParameters() = 0; virtual void SetParameter(PlugParamIndex paramindex, PlugParamValue paramvalue) = 0; virtual void SetZxxParameter(UINT nParam, UINT nValue) = 0; virtual PlugParamValue GetParameter(PlugParamIndex nIndex) = 0; @@ -102,7 +103,7 @@ float *pOutBufferR; uint32 dwFlags; // PluginStateFlags uint32 inputSilenceCount; // How much silence has been processed? (for plugin auto-turnoff) - mixsample_t nVolDecayL, nVolDecayR; // Buffer click removal - I think these are *always* 0. + mixsample_t nVolDecayL, nVolDecayR; // End of sample click removal SNDMIXPLUGINSTATE() { memset(this, 0, sizeof(*this)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-03 00:50:31
|
Revision: 4628 http://sourceforge.net/p/modplug/code/4628 Author: saga-games Date: 2014-12-03 00:50:20 +0000 (Wed, 03 Dec 2014) Log Message: ----------- [Var] Correct spelling of "ditto" in various places. Modified Paths: -------------- trunk/OpenMPT/mptrack/Notification.h trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/Undo.h trunk/OpenMPT/soundlib/Load_dmf.cpp trunk/OpenMPT/soundlib/Load_gdm.cpp trunk/OpenMPT/soundlib/Load_okt.cpp trunk/OpenMPT/soundlib/Load_psm.cpp trunk/OpenMPT/soundlib/ModChannel.h trunk/OpenMPT/soundlib/ModSample.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/mod_specifications.h trunk/OpenMPT/soundlib/modcommand.cpp trunk/OpenMPT/soundlib/pattern.h Modified: trunk/OpenMPT/mptrack/Notification.h =================================================================== --- trunk/OpenMPT/mptrack/Notification.h 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/mptrack/Notification.h 2014-12-03 00:50:20 UTC (rev 4628) @@ -39,12 +39,12 @@ FlagSet<Type, uint16> type; Item item; // Sample or instrument number, depending on type ROWINDEX row; // Always valid - uint32 tick; // dito - ORDERINDEX order; // dito - PATTERNINDEX pattern; // dito - uint32 mixedChannels; // dito - uint32 masterVU[4]; // dito - uint8 masterVUchannels; // dito + uint32 tick; // ditto + ORDERINDEX order; // ditto + PATTERNINDEX pattern; // ditto + uint32 mixedChannels; // ditto + uint32 masterVU[4]; // ditto + uint8 masterVUchannels; // ditto SmpLength pos[MAX_CHANNELS]; // Sample / envelope pos for each channel if != PosInvalid, or pattern channel VUs Notification(Type t = Default, Item i = 0, int64 s = 0, ROWINDEX r = 0, uint32 ti = 0, ORDERINDEX o = 0, PATTERNINDEX p = 0, uint32 x = 0, uint8 outChannels = 0) : timestampSamples(s), type(t), item(i), row(r), tick(ti), order(o), pattern(p), mixedChannels(x), masterVUchannels(outChannels) Modified: trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp 2014-12-03 00:50:20 UTC (rev 4628) @@ -178,7 +178,7 @@ tHeader.signature[1] = 'D'; tHeader.signature[2] = '3'; tHeader.version[0] = 0x04; // Version 2.4.0 - tHeader.version[1] = 0x00; // Dito + tHeader.version[1] = 0x00; // Ditto tHeader.flags = 0x00; // No flags s.write(reinterpret_cast<const char*>(&tHeader), sizeof(tHeader)); Modified: trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp 2014-12-03 00:50:20 UTC (rev 4628) @@ -143,7 +143,7 @@ cuePoint.position = static_cast<uint32>(*iter); cuePoint.riffChunkID = static_cast<uint32>(RIFFChunk::iddata); cuePoint.chunkStart = 0; // we use no Wave List Chunk (wavl) as we have only one data block, so this should be 0. - cuePoint.blockStart = 0; // dito + cuePoint.blockStart = 0; // ditto cuePoint.offset = cuePoint.position; cuePoint.ConvertEndianness(); fileWAV->Write(cuePoint); Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/mptrack/Undo.cpp 2014-12-03 00:50:20 UTC (rev 4628) @@ -365,8 +365,8 @@ { case sundo_none: // we are done, no sample changes here. case sundo_invert: // no action necessary, since those effects can be applied again to be undone. - case sundo_reverse: // dito - case sundo_unsign: // dito + case sundo_reverse: // ditto + case sundo_unsign: // ditto case sundo_insert: // no action necessary, we already have stored the variables that are necessary. break; Modified: trunk/OpenMPT/mptrack/Undo.h =================================================================== --- trunk/OpenMPT/mptrack/Undo.h 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/mptrack/Undo.h 2014-12-03 00:50:20 UTC (rev 4628) @@ -113,8 +113,8 @@ sundo_update, // silence, amplify, normalize, dc offset - update complete sample section sundo_delete, // delete part of the sample sundo_invert, // invert sample phase, apply again to undo - sundo_reverse, // reverse sample, dito - sundo_unsign, // unsign sample, dito + sundo_reverse, // reverse sample, ditto + sundo_unsign, // unsign sample, ditto sundo_insert, // insert data, delete inserted data to undo sundo_replace, // replace complete sample (16->8Bit, up/downsample, downmix to mono, pitch shifting / time stretching, trimming, pasting) }; Modified: trunk/OpenMPT/soundlib/Load_dmf.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_dmf.cpp 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/soundlib/Load_dmf.cpp 2014-12-03 00:50:20 UTC (rev 4628) @@ -133,7 +133,7 @@ smpCompMask = 0x0C, smpComp1 = 0x04, // Compression type 1 smpComp2 = 0x08, // Compression type 2 (unused) - smpComp3 = 0x0C, // Compression type 3 (dito) + smpComp3 = 0x0C, // Compression type 3 (ditto) smpLibrary = 0x80, // Sample is stored in a library }; Modified: trunk/OpenMPT/soundlib/Load_gdm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_gdm.cpp 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/soundlib/Load_gdm.cpp 2014-12-03 00:50:20 UTC (rev 4628) @@ -227,7 +227,7 @@ } sample.nLoopStart = std::min<SmpLength>(gdmSample.loopBegin, sample.nLength); // in samples - sample.nLoopEnd = std::min<SmpLength>(gdmSample.loopEnd - 1, sample.nLength); // dito + sample.nLoopEnd = std::min<SmpLength>(gdmSample.loopEnd - 1, sample.nLength); // ditto sample.FrequencyToTranspose(); // set transpose + finetune for mod files // Fix transpose + finetune for some rare cases where transpose is not C-5 (e.g. sample 4 in wander2.gdm) @@ -249,7 +249,7 @@ if(gdmSample.flags & GDMSampleHeader::smpVolume) { // Default volume is used... 0...64, 255 = no default volume - sample.nVolume = MIN(gdmSample.volume, 64) * 4; + sample.nVolume = std::min(gdmSample.volume, uint8(64)) * 4; } else { sample.nVolume = 256; @@ -260,7 +260,7 @@ // Default panning is used sample.uFlags.set(CHN_PANNING); // 0...15, 16 = surround (not supported), 255 = no default panning - sample.nPan = (gdmSample.panning > 15) ? 128 : MIN((gdmSample.panning * 16) + 8, 256); + sample.nPan = static_cast<uint16>((gdmSample.panning > 15) ? 128 : std::min((gdmSample.panning * 16) + 8, 256)); sample.uFlags.set(CHN_SURROUND, gdmSample.panning == 16); } else { @@ -274,7 +274,7 @@ for(SAMPLEINDEX smp = 1; smp <= GetNumSamples(); smp++) { SampleIO( - (Samples[smp].uFlags & CHN_16BIT) ? SampleIO::_16bit : SampleIO::_8bit, + Samples[smp].uFlags[CHN_16BIT] ? SampleIO::_16bit : SampleIO::_8bit, SampleIO::mono, SampleIO::littleEndian, SampleIO::unsignedPCM) Modified: trunk/OpenMPT/soundlib/Load_okt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_okt.cpp 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/soundlib/Load_okt.cpp 2014-12-03 00:50:20 UTC (rev 4628) @@ -51,7 +51,7 @@ char name[20]; uint32 length; // length in bytes uint16 loopStart; // *2 for real value - uint16 loopLength; // dito + uint16 loopLength; // ditto uint16 volume; // default volume uint16 type; // 7-/8-bit sample Modified: trunk/OpenMPT/soundlib/Load_psm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_psm.cpp 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/soundlib/Load_psm.cpp 2014-12-03 00:50:20 UTC (rev 4628) @@ -683,7 +683,7 @@ { PatternRow rowBase = Patterns[pat].GetRow(row); uint16 rowSize = patternChunk.ReadUint16LE(); - if(rowSize < 2) + if(rowSize <= 2) { continue; } @@ -1024,7 +1024,7 @@ }; char filename[13]; // null-terminated - char name[24]; // dito + char name[24]; // ditto uint32 offset; // in file uint32 memoffset; // not used uint16 sampleNumber; // 1 ... 255 @@ -1249,7 +1249,7 @@ continue; } - ModCommand &m = *Patterns[pat].GetpModCommand(curRow, MIN(chnFlag & channelMask, m_nChannels - 1)); + ModCommand &m = *Patterns[pat].GetpModCommand(curRow, std::min<CHANNELINDEX>(chnFlag & channelMask, m_nChannels - 1)); if(chnFlag & noteFlag) { Modified: trunk/OpenMPT/soundlib/ModChannel.h =================================================================== --- trunk/OpenMPT/soundlib/ModChannel.h 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/soundlib/ModChannel.h 2014-12-03 00:50:20 UTC (rev 4628) @@ -38,12 +38,12 @@ uint32 nPosLo; // 16-bit fractional part of play position int32 nInc; // 16.16 fixed point sample speed relative to mixing frequency (0x10000 = one sample per output sample, 0x20000 = two samples per output sample, etc...) int32 leftVol; // 0...4096 (12 bits, since 16 bits + 12 bits = 28 bits = 0dB in integer mixer, see MIXING_ATTENUATION) - int32 rightVol; // dito + int32 rightVol; // Ditto int32 leftRamp; // Ramping delta, 20.12 fixed point (see VOLUMERAMPPRECISION) - int32 rightRamp; // dito + int32 rightRamp; // Ditto // Up to here: 32 bytes int32 rampLeftVol; // Current ramping volume, 20.12 fixed point (see VOLUMERAMPPRECISION) - int32 rampRightVol; // dito + int32 rampRightVol; // Ditto mixsample_t nFilter_Y[2][2]; // Filter memory - two history items per sample channel mixsample_t nFilter_A0, nFilter_B0, nFilter_B1; // Filter coeffs mixsample_t nFilter_HP; Modified: trunk/OpenMPT/soundlib/ModSample.h =================================================================== --- trunk/OpenMPT/soundlib/ModSample.h 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/soundlib/ModSample.h 2014-12-03 00:50:20 UTC (rev 4628) @@ -18,8 +18,8 @@ struct ModSample { SmpLength nLength; // In samples, not bytes - SmpLength nLoopStart, nLoopEnd; // Dito - SmpLength nSustainStart, nSustainEnd; // Dito + SmpLength nLoopStart, nLoopEnd; // Ditto + SmpLength nSustainStart, nSustainEnd; // Ditto union { void *pSample; // Pointer to sample data Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-12-03 00:50:20 UTC (rev 4628) @@ -102,9 +102,9 @@ // [out] duration: total time in seconds // [out] targetReached: true if the specified target has been reached while going through the module. // [out] lastOrder: last parsed order (if no target is specified, this is the first order that is parsed twice, i.e. not the *last* played order) -// [out] lastRow: last parsed row (dito) +// [out] lastRow: last parsed row (ditto) // [out] endOrder: last order before module loops (UNDEFINED if a target is specified) -// [out] endRow: last row before module loops (dito) +// [out] endRow: last row before module loops (ditto) std::vector<GetLengthType> CSoundFile::GetLength(enmGetLengthResetMode adjustMode, GetLengthTarget target) //-------------------------------------------------------------------------------------------------------- { Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2014-12-03 00:50:20 UTC (rev 4628) @@ -52,10 +52,10 @@ ROWINDEX patternRowsMin; ROWINDEX patternRowsMax; uint16 modNameLengthMax; // Meaning 'usable letters', possible null character is not included. - uint16 sampleNameLengthMax; // Dito - uint16 sampleFilenameLengthMax; // Dito - uint16 instrNameLengthMax; // Dito - uint16 instrFilenameLengthMax; // Dito + uint16 sampleNameLengthMax; // Ditto + uint16 sampleFilenameLengthMax; // Ditto + uint16 instrNameLengthMax; // Ditto + uint16 instrFilenameLengthMax; // Ditto SAMPLEINDEX samplesMax; // Max number of samples == Highest possible sample index INSTRUMENTINDEX instrumentsMax; // Max number of instruments == Highest possible instrument index mixLevels defaultMixLevels; // Default mix levels that are used when creating a new file in this format @@ -66,7 +66,7 @@ uint8 envelopePointsMax; // Maximum number of points of each envelope bool hasReleaseNode; // Envelope release node char commands[MAX_EFFECTS + 1]; // An array holding all commands this format supports; commands that are not supported are marked with "?" - char volcommands[MAX_VOLCMDS + 1]; // dito, but for volume column + char volcommands[MAX_VOLCMDS + 1]; // Ditto, but for volume column bool hasIgnoreIndex; // Does "+++" pattern exist? bool hasStopIndex; // Does "---" pattern exist? bool hasRestartPos; // Format has an automatic restart order position Modified: trunk/OpenMPT/soundlib/modcommand.cpp =================================================================== --- trunk/OpenMPT/soundlib/modcommand.cpp 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/soundlib/modcommand.cpp 2014-12-03 00:50:20 UTC (rev 4628) @@ -91,7 +91,7 @@ case 0xA0: if(param & 0x0F) { command = CMD_VOLUMESLIDE; param = (param << 4) | 0x0F; } else command = 0; break; case 0xB0: if(param & 0x0F) { command = CMD_VOLUMESLIDE; param |= 0xF0; } else command = 0; break; case 0xC0: if(param == 0xC0) { command = CMD_NONE; note = NOTE_NOTECUT; } // this does different things in IT and ST3 - case 0xD0: if(param == 0xD0) { command = CMD_NONE; } // dito + case 0xD0: if(param == 0xD0) { command = CMD_NONE; } // ditto // rest are the same } } Modified: trunk/OpenMPT/soundlib/pattern.h =================================================================== --- trunk/OpenMPT/soundlib/pattern.h 2014-12-02 23:07:06 UTC (rev 4627) +++ trunk/OpenMPT/soundlib/pattern.h 2014-12-03 00:50:20 UTC (rev 4628) @@ -150,7 +150,7 @@ ModCommand* m_ModCommands; ROWINDEX m_Rows; ROWINDEX m_RowsPerBeat; // patterns-specific time signature. if != 0, this is implicitely set. - ROWINDEX m_RowsPerMeasure; // dito + ROWINDEX m_RowsPerMeasure; // ditto std::string m_PatternName; CPatternContainer& m_rPatternContainer; //END: DATA This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-12-03 16:36:43
|
Revision: 4630 http://sourceforge.net/p/modplug/code/4630 Author: manxorist Date: 2014-12-03 16:36:24 +0000 (Wed, 03 Dec 2014) Log Message: ----------- [Fix] Fix undefined behaviour. Rewrite FlagSet to be standard-conforming and more type-safe. Storing bitwise compositions of enum values into a variable of enum type is undefined behaviour if the resulting value lies outside the enum value range. Clang ubsan complains loudly. Additionally, explicitely stating the FlagSet type makes the code intent more obvious. [Ref] Add Enum<enum_t>, a stricter version that allows only storing a single enum value and no compositions (without using casts anyway). [Ref] The type returned from FlagSet values bitwise combined with enum values is no longer comparable or convertible to an integer value. Specifically this means ((FlagSet<MODTYPE>(a) & MODTYPE_IT) != 0) no longer compiles. The bitwise combined expression, however, is convertible to bool, so this is a trivial replacement on all usage sites. [Ref] Convert FlagSet<MODTYPE> to Enum<MODTYPE>. [Ref] Avoid dynamic initialization of some static tables which had been caused by combining enum values using custom bitwise operators. Modified Paths: -------------- trunk/OpenMPT/common/FlagSet.h trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/mptrack/Autotune.cpp trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/EffectInfo.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Notification.h trunk/OpenMPT/mptrack/PatternClipboard.cpp trunk/OpenMPT/mptrack/UpdateHints.h trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/view_com.cpp trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/mod_specifications.cpp trunk/OpenMPT/soundlib/mod_specifications.h trunk/OpenMPT/soundlib/pattern.cpp trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/common/FlagSet.h =================================================================== --- trunk/OpenMPT/common/FlagSet.h 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/common/FlagSet.h 2014-12-03 16:36:24 UTC (rev 4630) @@ -2,7 +2,8 @@ * FlagSet.h * --------- * Purpose: A flexible and typesafe flag set class. - * Notes : Mostly taken from http://stackoverflow.com/questions/4226960/type-safer-bitflags-in-c + * Notes : Originally based on http://stackoverflow.com/questions/4226960/type-safer-bitflags-in-c . + * Rewritten to be standard-conforming. * Authors: OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ @@ -14,165 +15,407 @@ OPENMPT_NAMESPACE_BEGIN -template <typename enum_t, typename store_t = enum_t> + +// Be aware of the required size when specializing this. +// We cannot assert the minimum size because some compilers always allocate an 'int', +// even for enums that would fit in smaller integral types. +template <typename Tenum> +struct enum_traits +{ + typedef typename mpt::make_unsigned<Tenum>::type store_type; +}; + + +// Type-safe wrapper around an enum, that can represent all enum values and bitwise compositions thereof. +// Conversions to and from plain integers as well as conversions to the base enum are always explicit. +template <typename enum_t> +class enum_value_type +{ +public: + typedef enum_t enum_type; + typedef enum_value_type value_type; + typedef typename enum_traits<enum_t>::store_type store_type; +private: + store_type bits; +public: + forceinline enum_value_type() : bits(0) { } + forceinline enum_value_type(const enum_value_type &x) : bits(x.bits) { } + forceinline enum_value_type(enum_type x) : bits(static_cast<store_type>(x)) { } +private: + explicit forceinline enum_value_type(store_type x) : bits(x) { } // private in order to prevent accidental conversions. use from_bits. + forceinline operator store_type () const { return bits; } // private in order to prevent accidental conversions. use as_bits. +public: + static forceinline enum_value_type from_bits(store_type bits) { return value_type(bits); } + forceinline enum_type as_enum() const { return static_cast<enum_t>(bits); } + forceinline store_type as_bits() const { return bits; } +public: + forceinline operator bool () const { return bits != store_type(); } + forceinline bool operator ! () const { return bits == store_type(); } + + forceinline const enum_value_type operator ~ () const { return enum_value_type(~bits); } + + friend forceinline bool operator == (enum_value_type a, enum_value_type b) { return a.bits == b.bits; } + friend forceinline bool operator != (enum_value_type a, enum_value_type b) { return a.bits != b.bits; } + + friend forceinline bool operator == (enum_value_type a, enum_t b) { return a == enum_value_type(b); } + friend forceinline bool operator != (enum_value_type a, enum_t b) { return a != enum_value_type(b); } + + friend forceinline bool operator == (enum_t a, enum_value_type b) { return enum_value_type(a) == b; } + friend forceinline bool operator != (enum_t a, enum_value_type b) { return enum_value_type(a) != b; } + + friend forceinline const enum_value_type operator | (enum_value_type a, enum_value_type b) { return enum_value_type(a.bits | b.bits); } + friend forceinline const enum_value_type operator & (enum_value_type a, enum_value_type b) { return enum_value_type(a.bits & b.bits); } + friend forceinline const enum_value_type operator ^ (enum_value_type a, enum_value_type b) { return enum_value_type(a.bits ^ b.bits); } + + friend forceinline const enum_value_type operator | (enum_value_type a, enum_t b) { return a | enum_value_type(b); } + friend forceinline const enum_value_type operator & (enum_value_type a, enum_t b) { return a & enum_value_type(b); } + friend forceinline const enum_value_type operator ^ (enum_value_type a, enum_t b) { return a ^ enum_value_type(b); } + + friend forceinline const enum_value_type operator | (enum_t a, enum_value_type b) { return enum_value_type(a) | b; } + friend forceinline const enum_value_type operator & (enum_t a, enum_value_type b) { return enum_value_type(a) & b; } + friend forceinline const enum_value_type operator ^ (enum_t a, enum_value_type b) { return enum_value_type(a) ^ b; } + + forceinline enum_value_type &operator |= (enum_value_type b) { *this = *this | b; return *this; } + forceinline enum_value_type &operator &= (enum_value_type b) { *this = *this & b; return *this; } + forceinline enum_value_type &operator ^= (enum_value_type b) { *this = *this ^ b; return *this; } + + forceinline enum_value_type &operator |= (enum_t b) { *this = *this | b; return *this; } + forceinline enum_value_type &operator &= (enum_t b) { *this = *this & b; return *this; } + forceinline enum_value_type &operator ^= (enum_t b) { *this = *this ^ b; return *this; } + +}; + + +// Type-safe enum wrapper that allows type-safe bitwise testing. +template <typename enum_t> +class Enum +{ +public: + typedef Enum self_type; + typedef enum_t enum_type; + typedef enum_value_type<enum_t> value_type; + typedef typename value_type::store_type store_type; +private: + enum_type value; +public: + explicit forceinline Enum(enum_type val) : value(val) { } + forceinline operator enum_type () const { return value; } + forceinline Enum &operator = (enum_type val) { value = val; return *this; } +public: + forceinline const value_type operator ~ () const { return ~value_type(value); } + + friend forceinline bool operator == (self_type a, self_type b) { return value_type(a) == value_type(b); } + friend forceinline bool operator != (self_type a, self_type b) { return value_type(a) != value_type(b); } + + friend forceinline bool operator == (self_type a, value_type b) { return value_type(a) == value_type(b); } + friend forceinline bool operator != (self_type a, value_type b) { return value_type(a) != value_type(b); } + + friend forceinline bool operator == (value_type a, self_type b) { return value_type(a) == value_type(b); } + friend forceinline bool operator != (value_type a, self_type b) { return value_type(a) != value_type(b); } + + friend forceinline bool operator == (self_type a, enum_type b) { return value_type(a) == value_type(b); } + friend forceinline bool operator != (self_type a, enum_type b) { return value_type(a) != value_type(b); } + + friend forceinline bool operator == (enum_type a, self_type b) { return value_type(a) == value_type(b); } + friend forceinline bool operator != (enum_type a, self_type b) { return value_type(a) != value_type(b); } + + friend forceinline const value_type operator | (self_type a, self_type b) { return value_type(a) | value_type(b); } + friend forceinline const value_type operator & (self_type a, self_type b) { return value_type(a) & value_type(b); } + friend forceinline const value_type operator ^ (self_type a, self_type b) { return value_type(a) ^ value_type(b); } + + friend forceinline const value_type operator | (self_type a, value_type b) { return value_type(a) | value_type(b); } + friend forceinline const value_type operator & (self_type a, value_type b) { return value_type(a) & value_type(b); } + friend forceinline const value_type operator ^ (self_type a, value_type b) { return value_type(a) ^ value_type(b); } + + friend forceinline const value_type operator | (value_type a, self_type b) { return value_type(a) | value_type(b); } + friend forceinline const value_type operator & (value_type a, self_type b) { return value_type(a) & value_type(b); } + friend forceinline const value_type operator ^ (value_type a, self_type b) { return value_type(a) ^ value_type(b); } + + friend forceinline const value_type operator | (self_type a, enum_type b) { return value_type(a) | value_type(b); } + friend forceinline const value_type operator & (self_type a, enum_type b) { return value_type(a) & value_type(b); } + friend forceinline const value_type operator ^ (self_type a, enum_type b) { return value_type(a) ^ value_type(b); } + + friend forceinline const value_type operator | (enum_type a, self_type b) { return value_type(a) | value_type(b); } + friend forceinline const value_type operator & (enum_type a, self_type b) { return value_type(a) & value_type(b); } + friend forceinline const value_type operator ^ (enum_type a, self_type b) { return value_type(a) ^ value_type(b); } + +}; + + +template <typename enum_t, typename store_t = typename enum_value_type<enum_t>::store_type > class FlagSet { public: + typedef FlagSet self_type; + typedef enum_t enum_type; + typedef enum_value_type<enum_t> value_type; + typedef store_t store_type; + +private: + + // support truncated store_type ... : + store_type bits_; + static forceinline store_type store_from_value(value_type bits) { return static_cast<store_type>(bits.as_bits()); } + static forceinline value_type value_from_store(store_type bits) { return value_type::from_bits(static_cast<typename value_type::store_type>(bits)); } + + forceinline void store(value_type bits) { bits_ = store_from_value(bits); } + forceinline value_type load() const { return value_from_store(bits_); } + +public: + // Default constructor (no flags set) - FlagSet() : flags(store_t(0)) + forceinline FlagSet() : bits_(store_from_value(value_type())) { - + return; } // Value constructor - explicit FlagSet(enum_t value) : flags(static_cast<store_t>(value)) + forceinline FlagSet(value_type flags) : bits_(store_from_value(value_type(flags))) { - + return; } - // Explicit conversion operator - operator enum_t() const + forceinline FlagSet(enum_type flag) : bits_(store_from_value(value_type(flag))) { - return static_cast<enum_t>(flags); + return; } - operator std::string() const + explicit forceinline FlagSet(store_type flags) : bits_(store_from_value(value_type::from_bits(flags))) { - return to_string(); + return; } + + forceinline operator bool () const + { + return load(); + } + // In order to catch undesired conversions to bool in integer contexts, + // add a deprecated conversion operator to store_type. + // C++11 explicit conversion cast operators ('explicit operator bool ();') + // would solve this in a better way and always fail at compile-time instead of this + // solution which just warns in some cases. + // The macro-based extended instrument fields writer in Sndfile.cpp currently needs this conversion, + // so it is not marked deprecated (for now). + /*MPT_DEPRECATED*/ forceinline operator store_type () const + { + return load().as_bits(); + } + + forceinline value_type value() const + { + return load(); + } + + forceinline operator value_type () const + { + return load(); + } // Test if one or more flags are set. Returns true if at least one of the given flags is set. - bool operator[] (enum_t flag) const + forceinline bool operator[] (value_type flags) const { - return test(flag); + return test(flags); } // String representation of flag set std::string to_string() const { - std::string str(size(), '0'); + std::string str(size_bits(), '0'); - for(size_t x = 0; x < size(); ++x) + for(size_t x = 0; x < size_bits(); ++x) { - str[size() - x - 1] = (flags & (1 << x) ? '1' : '0'); + str[size_bits() - x - 1] = (load() & (1 << x) ? '1' : '0'); } return str; } // Set one or more flags. - FlagSet &set(enum_t flag) + forceinline FlagSet &set(value_type flags) { - flags = static_cast<store_t>(flags | flag); + store(load() | flags); return *this; } // Set or clear one or more flags. - FlagSet &set(enum_t flag, bool val) + forceinline FlagSet &set(value_type flags, bool val) { - flags = static_cast<store_t>(val ? (flags | flag) : (flags & ~flag)); + store((val ? (load() | flags) : (load() & ~flags))); return *this; } // Clear or flags. - FlagSet &reset() + forceinline FlagSet &reset() { - flags = store_t(0); + store(value_type()); return *this; } // Clear one or more flags. - FlagSet &reset(enum_t flag) + forceinline FlagSet &reset(value_type flags) { - flags = static_cast<store_t>(flags & ~flag); + store(load() & ~flags); return *this; } // Toggle all flags. - FlagSet &flip() + forceinline FlagSet &flip() { - flags = ~flags; + store(~load()); return *this; } // Toggle one or more flags. - FlagSet &flip(enum_t flag) + forceinline FlagSet &flip(value_type flags) { - flags = static_cast<store_t>(flags ^ flag); + store(load() ^ flags); return *this; } + // Returns the size of the flag set in bytes + forceinline std::size_t size() const + { + return sizeof(store_type); + } + // Returns the size of the flag set in bits - size_t size() const + forceinline std::size_t size_bits() const { - return sizeof(enum_t) * 8; + return size() * 8; } - + // 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 + forceinline bool test(value_type flags) const { - return (flags & static_cast<store_t>(flag)) > 0; + return (load() & flags); } // Test if all specified flags are set. - bool test_all(enum_t flag) const + forceinline bool test_all(value_type flags) const { - return (flags & static_cast<store_t>(flag)) == static_cast<store_t>(flag); + return (load() & flags) == flags; } // Test if any flag is set. - bool any() const + forceinline bool any() const { - return flags > 0; + return load(); } // Test if no flags are set. - bool none() const + forceinline bool none() const { - return flags == 0; + return !load(); } + + forceinline store_type GetRaw() const + { + return bits_; + } - FlagSet<enum_t, store_t> &operator = (const enum_t other) + forceinline void SetRaw(store_type flags) { - flags = static_cast<store_t>(other); + bits_ = flags; + } + + forceinline FlagSet &operator = (value_type flags) + { + store(flags); return *this; } + + forceinline FlagSet &operator = (enum_type flag) + { + store(flag); + return *this; + } - FlagSet<enum_t, store_t> &operator &= (const enum_t other) + forceinline FlagSet &operator = (FlagSet flags) { - flags &= static_cast<store_t>(other); + store(flags.load()); return *this; } - FlagSet<enum_t, store_t> &operator |= (const enum_t other) + forceinline FlagSet &operator &= (value_type flags) { - flags |= static_cast<store_t>(other); + store(load() & flags); return *this; } - store_t GetRaw() const + forceinline FlagSet &operator |= (value_type flags) { - return flags; + store(load() | flags); + return *this; } - void SetRaw(store_t flags_) + forceinline FlagSet &operator ^= (value_type flags) { - flags = flags_; + store(load() ^ flags); + return *this; } + + friend forceinline bool operator == (self_type a, self_type b) { return a.load() == b.load(); } + friend forceinline bool operator != (self_type a, self_type b) { return a.load() != b.load(); } -private: - store_t flags; + friend forceinline bool operator == (self_type a, value_type b) { return a.load() == value_type(b); } + friend forceinline bool operator != (self_type a, value_type b) { return a.load() != value_type(b); } + friend forceinline bool operator == (value_type a, self_type b) { return value_type(a) == b.load(); } + friend forceinline bool operator != (value_type a, self_type b) { return value_type(a) != b.load(); } + + friend forceinline bool operator == (self_type a, enum_type b) { return a.load() == value_type(b); } + friend forceinline bool operator != (self_type a, enum_type b) { return a.load() != value_type(b); } + + friend forceinline bool operator == (enum_type a, self_type b) { return value_type(a) == b.load(); } + friend forceinline bool operator != (enum_type a, self_type b) { return value_type(a) != b.load(); } + + friend forceinline bool operator == (self_type a, Enum<enum_type> b) { return a.load() == value_type(b); } + friend forceinline bool operator != (self_type a, Enum<enum_type> b) { return a.load() != value_type(b); } + + friend forceinline bool operator == (Enum<enum_type> a, self_type b) { return value_type(a) == b.load(); } + friend forceinline bool operator != (Enum<enum_type> a, self_type b) { return value_type(a) != b.load(); } + + friend forceinline const value_type operator | (self_type a, self_type b) { return a.load() | b.load(); } + friend forceinline const value_type operator & (self_type a, self_type b) { return a.load() & b.load(); } + friend forceinline const value_type operator ^ (self_type a, self_type b) { return a.load() ^ b.load(); } + + friend forceinline const value_type operator | (self_type a, value_type b) { return a.load() | value_type(b); } + friend forceinline const value_type operator & (self_type a, value_type b) { return a.load() & value_type(b); } + friend forceinline const value_type operator ^ (self_type a, value_type b) { return a.load() ^ value_type(b); } + + friend forceinline const value_type operator | (value_type a, self_type b) { return value_type(a) | b.load(); } + friend forceinline const value_type operator & (value_type a, self_type b) { return value_type(a) & b.load(); } + friend forceinline const value_type operator ^ (value_type a, self_type b) { return value_type(a) ^ b.load(); } + + friend forceinline const value_type operator | (self_type a, enum_type b) { return a.load() | value_type(b); } + friend forceinline const value_type operator & (self_type a, enum_type b) { return a.load() & value_type(b); } + friend forceinline const value_type operator ^ (self_type a, enum_type b) { return a.load() ^ value_type(b); } + + friend forceinline const value_type operator | (enum_type a, self_type b) { return value_type(a) | b.load(); } + friend forceinline const value_type operator & (enum_type a, self_type b) { return value_type(a) & b.load(); } + friend forceinline const value_type operator ^ (enum_type a, self_type b) { return value_type(a) ^ b.load(); } + + friend forceinline const value_type operator | (self_type a, Enum<enum_type> b) { return a.load() | value_type(b); } + friend forceinline const value_type operator & (self_type a, Enum<enum_type> b) { return a.load() & value_type(b); } + friend forceinline const value_type operator ^ (self_type a, Enum<enum_type> b) { return a.load() ^ value_type(b); } + + friend forceinline const value_type operator | (Enum<enum_type> a, self_type b) { return value_type(a) | b.load(); } + friend forceinline const value_type operator & (Enum<enum_type> a, self_type b) { return value_type(a) & b.load(); } + friend forceinline const value_type operator ^ (Enum<enum_type> a, self_type b) { return value_type(a) ^ b.load(); } + }; -// Declare typesafe logical operators for flag set -#define DECLARE_FLAGSET(enum_t) \ - inline enum_t operator | (enum_t a, enum_t b) { return static_cast<enum_t>(+a | +b); } \ - inline enum_t operator & (enum_t a, enum_t b) { return static_cast<enum_t>(+a & +b); } \ - inline enum_t &operator &= (enum_t &a, enum_t b) { a = (a & b); return a; } \ - inline enum_t &operator |= (enum_t &a, enum_t b) { a = (a | b); return a; } \ - inline enum_t operator ~ (enum_t a) { return static_cast<enum_t>(~(+a)); } +// Declare typesafe logical operators for enum_t +#define MPT_DECLARE_ENUM(enum_t) \ + forceinline enum_value_type<enum_t> operator | (enum_t a, enum_t b) { return enum_value_type<enum_t>(a) | enum_value_type<enum_t>(b); } \ + forceinline enum_value_type<enum_t> operator & (enum_t a, enum_t b) { return enum_value_type<enum_t>(a) & enum_value_type<enum_t>(b); } \ + forceinline enum_value_type<enum_t> operator ^ (enum_t a, enum_t b) { return enum_value_type<enum_t>(a) ^ enum_value_type<enum_t>(b); } \ + forceinline enum_value_type<enum_t> operator ~ (enum_t a) { return ~enum_value_type<enum_t>(a); } \ +/**/ +// backwards compatibility +#define DECLARE_FLAGSET MPT_DECLARE_ENUM + OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/common/typedefs.h 2014-12-03 16:36:24 UTC (rev 4630) @@ -432,6 +432,37 @@ #endif // HAS_TYPE_TRAITS +namespace detail { + +template <std::size_t size> struct int_of_size { }; +template <> struct int_of_size<1> { typedef int8 type; }; +template <> struct int_of_size<2> { typedef int16 type; }; +template <> struct int_of_size<3> { typedef int32 type; }; +template <> struct int_of_size<4> { typedef int32 type; }; +template <> struct int_of_size<5> { typedef int64 type; }; +template <> struct int_of_size<6> { typedef int64 type; }; +template <> struct int_of_size<7> { typedef int64 type; }; +template <> struct int_of_size<8> { typedef int64 type; }; + +template <std::size_t size> struct uint_of_size { }; +template <> struct uint_of_size<1> { typedef uint8 type; }; +template <> struct uint_of_size<2> { typedef uint16 type; }; +template <> struct uint_of_size<3> { typedef uint32 type; }; +template <> struct uint_of_size<4> { typedef uint32 type; }; +template <> struct uint_of_size<5> { typedef uint64 type; }; +template <> struct uint_of_size<6> { typedef uint64 type; }; +template <> struct uint_of_size<7> { typedef uint64 type; }; +template <> struct uint_of_size<8> { typedef uint64 type; }; + +} // namespace detail + +// Simplified version of C++11 std::make_signed and std::make_unsigned: +// - we do not require a C++11 <type_traits> header +// - no support fr CV-qualifiers +// - does not error out on non-integral types +template <typename T> struct make_signed { typedef typename mpt::detail::int_of_size<sizeof(T)>::type type; }; +template <typename T> struct make_unsigned { typedef typename mpt::detail::uint_of_size<sizeof(T)>::type type; }; + } // namespace mpt Modified: trunk/OpenMPT/mptrack/Autotune.cpp =================================================================== --- trunk/OpenMPT/mptrack/Autotune.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Autotune.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -323,10 +323,10 @@ sample.nC5Speed = Util::Round<uint32>(sample.nC5Speed * pitchReference / newFundamentalFreq); - if((modType & (MOD_TYPE_XM | MOD_TYPE_MOD)) != 0) + if((modType & (MOD_TYPE_XM | MOD_TYPE_MOD))) { sample.FrequencyToTranspose(); - if((modType & MOD_TYPE_MOD) != 0) + if((modType & MOD_TYPE_MOD)) { sample.RelativeTone = 0; } Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -1742,8 +1742,8 @@ }; -CString KeyCombination::GetKeyEventText(KeyEventType event) -//--------------------------------------------------------- +CString KeyCombination::GetKeyEventText(FlagSet<KeyEventType> event) +//------------------------------------------------------------------ { CString text=""; @@ -1989,7 +1989,7 @@ { bool modConflict = (kc1.Modifier()==kc2.Modifier()); bool codeConflict = (kc1.KeyCode()==kc2.KeyCode()); - bool eventConflict = ((kc1.EventType()&kc2.EventType())!=0); + bool eventConflict = ((kc1.EventType()&kc2.EventType())); bool ctxConflict = (kc1.Context() == kc2.Context()); bool crossCxtConflict = IsCrossContextConflict(kc1, kc2); Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/CommandSet.h 2014-12-03 16:36:24 UTC (rev 4630) @@ -60,6 +60,7 @@ kKeyEventRepeat = 1 << 2, kNumKeyEvents = 1 << 3 }; +template <> struct enum_traits<KeyEventType> { typedef uint8 store_type; }; DECLARE_FLAGSET(KeyEventType) @@ -1162,11 +1163,11 @@ STATIC_ASSERT(static_cast<uint8>(kNumKeyEvents - 1) == kNumKeyEvents - 1); public: - KeyCombination(InputTargetContext context = kCtxAllContexts, UINT modifier = 0, UINT key = 0, KeyEventType type = kKeyEventNone) + KeyCombination(InputTargetContext context = kCtxAllContexts, UINT modifier = 0, UINT key = 0, FlagSet<KeyEventType> type = kKeyEventNone) : ctx(static_cast<uint8>(context)) , mod(static_cast<uint8>(modifier)) , code(static_cast<uint8>(key)) - , event(static_cast<uint8>(type)) + , event(type.GetRaw()) { } bool operator== (const KeyCombination &other) const @@ -1197,8 +1198,8 @@ void KeyCode(UINT key) { code = static_cast<uint8>(key); } UINT KeyCode() const { return static_cast<UINT>(code); } - void EventType(KeyEventType type) { event = static_cast<uint8>(type); } - KeyEventType EventType() const { return static_cast<KeyEventType>(event); } + void EventType(FlagSet<KeyEventType> type) { event = type.GetRaw(); } + FlagSet<KeyEventType> EventType() const { FlagSet<KeyEventType> result; result.SetRaw(event); return result; } // Key combination to string static CString GetContextText(InputTargetContext ctx); @@ -1210,7 +1211,7 @@ static CString GetKeyText(UINT mod, UINT code); CString GetKeyText() const { return GetKeyText(Modifier(), KeyCode()); } - static CString GetKeyEventText(KeyEventType event); + static CString GetKeyEventText(FlagSet<KeyEventType> event); CString GetKeyEventText() const { return GetKeyEventText(EventType()); } static bool IsExtended(UINT code); Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -206,7 +206,7 @@ //------------------------------------------------------------ { if (pHint == this) return; - HintType hintType = hint.GetType(); + FlagSet<HintType> hintType = hint.GetType(); if (hintType & HINT_MODSEQUENCE) { // Set max valid restart position Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -982,8 +982,8 @@ // Set instrument (and moddoc) as modified. // updateAll: Update all views including this one. Otherwise, only update update other views. -void CCtrlInstruments::SetModified(HintType mask, bool updateAll, bool modified) -//------------------------------------------------------------------------------ +void CCtrlInstruments::SetModified(FlagSet<HintType> mask, bool updateAll, bool modified) +//--------------------------------------------------------------------------------------- { m_modDoc.UpdateAllViews(NULL, InstrumentHint(mask, m_nInstrument), updateAll ? nullptr : this); if(modified) m_modDoc.SetModified(); @@ -1128,7 +1128,7 @@ //--------------------------------------------------------------- { if(pObj == this) return; - HintType hintType = hint.GetType(); + FlagSet<HintType> hintType = hint.GetType(); if (hintType & HINT_MPTOPTIONS) { m_ToolBar.UpdateStyle(); @@ -1169,7 +1169,7 @@ m_SpinMidiPR.EnableWindow(bITandXM); m_SpinMidiBK.EnableWindow(bITandXM); - const bool extendedFadeoutRange = (m_sndFile.GetType() & MOD_TYPE_XM) != 0; + const bool extendedFadeoutRange = (m_sndFile.GetType() & MOD_TYPE_XM); m_SpinFadeOut.EnableWindow(bITandXM); m_SpinFadeOut.SetRange(0, extendedFadeoutRange ? 32767 : 8192); m_EditFadeOut.SetLimitText(extendedFadeoutRange ? 5 : 4); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-12-03 16:36:24 UTC (rev 4630) @@ -122,7 +122,7 @@ virtual ~CCtrlInstruments(); public: - void SetModified(HintType mask, bool updateAll, bool modified = true); + void SetModified(FlagSet<HintType> mask, bool updateAll, bool modified = true); BOOL SetCurrentInstrument(UINT nIns, BOOL bUpdNum=TRUE); BOOL OpenInstrument(const mpt::PathString &fileName); BOOL OpenInstrument(CSoundFile &sndFile, INSTRUMENTINDEX nInstr); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -243,7 +243,7 @@ //------------------------------------------------------------ { m_OrderList.UpdateView(hint, pObj); - HintType hintType = hint.GetType(); + FlagSet<HintType> hintType = hint.GetType(); if(hintType & HINT_MODSEQUENCE) { @@ -431,7 +431,7 @@ case CTRLMSG_SETVIEWWND: { SendViewMessage(VIEWMSG_FOLLOWSONG, IsDlgButtonChecked(IDC_PATTERN_FOLLOWSONG)); - SendViewMessage(VIEWMSG_PATTERNLOOP, (SONG_PATTERNLOOP & m_sndFile.m_SongFlags)); + SendViewMessage(VIEWMSG_PATTERNLOOP, (m_sndFile.m_SongFlags & SONG_PATTERNLOOP) ? TRUE : FALSE); OnSpacingChanged(); SendViewMessage(VIEWMSG_SETDETAIL, m_nDetailLevel); SendViewMessage(VIEWMSG_SETRECORD, m_bRecord); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -342,7 +342,7 @@ changedPos = true; } else if(m_pParent.GetFollowSong()) { - SongFlags pausedFlags = sndFile.m_SongFlags & (SONG_PAUSED | SONG_STEP | SONG_PATTERNLOOP); + FlagSet<SongFlags> pausedFlags = sndFile.m_SongFlags & (SONG_PAUSED | SONG_STEP | SONG_PATTERNLOOP); sndFile.m_PlayState.m_nCurrentOrder = m_nScrollPos; sndFile.SetCurrentOrder(m_nScrollPos); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -551,7 +551,7 @@ //----------------------------------------------------------- { if(pObj == this) return; - HintType hintType = hint.GetType(); + FlagSet<HintType> hintType = hint.GetType(); if (hintType & HINT_MPTOPTIONS) { m_ToolBar1.UpdateStyle(); @@ -777,8 +777,8 @@ // updateAll: Update all views including this one. Otherwise, only update update other views. -void CCtrlSamples::SetModified(HintType mask, bool updateAll, bool waveformModified) -//---------------------------------------------------------------------------------- +void CCtrlSamples::SetModified(FlagSet<HintType> mask, bool updateAll, bool waveformModified) +//------------------------------------------------------------------------------------------- { m_modDoc.SetModified(); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-03 16:36:24 UTC (rev 4630) @@ -128,7 +128,7 @@ afx_msg void OnEnableStretchToSize(); afx_msg void OnEstimateSampleSize(); - void SetModified(HintType mask, bool updateAll, bool waveformModified); + void SetModified(FlagSet<HintType> mask, bool updateAll, bool waveformModified); //}}AFX_MSG DECLARE_MESSAGE_MAP() Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -231,7 +231,7 @@ { return; } - HintType hintType = hint.GetType(); + FlagSet<HintType> hintType = hint.GetType(); if(hintType & HINT_MPTOPTIONS) { UpdateColors(); Modified: trunk/OpenMPT/mptrack/EffectInfo.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectInfo.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/EffectInfo.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -27,20 +27,25 @@ ModCommand::PARAM paramMask; // 0 = default ModCommand::PARAM paramValue; // 0 = default ModCommand::PARAM paramLimit; // Parameter Editor limit - MODTYPE supportedFormats; // MOD_TYPE_XXX combo + FlagSet<MODTYPE>::store_type supportedFormats; // MOD_TYPE_XXX combo const char *name; // e.g. "Tone Portamento" + FlagSet<MODTYPE> GetSupportedFormats() const { return FlagSet<MODTYPE>(supportedFormats); } }; -#define MOD_TYPE_MODXM (MOD_TYPE_MOD | MOD_TYPE_XM) -#define MOD_TYPE_S3MIT (MOD_TYPE_S3M | MOD_TYPE_IT) -#define MOD_TYPE_S3MITMPT (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT) -#define MOD_TYPE_NOMOD (MOD_TYPE_S3M | MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT) -#define MOD_TYPE_XMIT (MOD_TYPE_XM | MOD_TYPE_IT) -#define MOD_TYPE_XMITMPT (MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT) -#define MOD_TYPE_ITMPT (MOD_TYPE_IT | MOD_TYPE_MPT) -#define MOD_TYPE_ALL ((MODTYPE)~0) +// Force built-in integer operations. +// C++11 constexpr operations on the enum value_type would also solve this. +#define ModType FlagSet<MODTYPE>::store_type +#define MOD_TYPE_MODXM (ModType(0) | MOD_TYPE_MOD | MOD_TYPE_XM) +#define MOD_TYPE_S3MIT (ModType(0) | MOD_TYPE_S3M | MOD_TYPE_IT) +#define MOD_TYPE_S3MITMPT (ModType(0) | MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT) +#define MOD_TYPE_NOMOD (ModType(0) | MOD_TYPE_S3M | MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT) +#define MOD_TYPE_XMIT (ModType(0) | MOD_TYPE_XM | MOD_TYPE_IT) +#define MOD_TYPE_XMITMPT (ModType(0) | MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT) +#define MOD_TYPE_ITMPT (ModType(0) | MOD_TYPE_IT | MOD_TYPE_MPT) +#define MOD_TYPE_ALL (~ModType(0)) + const MPTEFFECTINFO gFXInfo[] = { {CMD_ARPEGGIO, 0,0, 0, MOD_TYPE_ALL, "Arpeggio"}, @@ -118,8 +123,8 @@ // -> DESC="add extended parameter mechanism to pattern effects" {CMD_XPARAM, 0,0, 0, MOD_TYPE_XMITMPT, "Parameter Extension"}, // -! NEW_FEATURE#0010 - {CMD_NOTESLIDEUP, 0,0, 0, MOD_TYPE_IMF | MOD_TYPE_PTM, "Note Slide Up"}, // IMF / PTM effect - {CMD_NOTESLIDEDOWN, 0,0, 0, MOD_TYPE_IMF | MOD_TYPE_PTM, "Note Slide Down"}, // IMF / PTM effect + {CMD_NOTESLIDEUP, 0,0, 0, ModType(0) | MOD_TYPE_IMF | MOD_TYPE_PTM, "Note Slide Up"}, // IMF / PTM effect + {CMD_NOTESLIDEDOWN, 0,0, 0, ModType(0) | MOD_TYPE_IMF | MOD_TYPE_PTM, "Note Slide Down"}, // IMF / PTM effect {CMD_NOTESLIDEUPRETRIG, 0,0, 0, MOD_TYPE_PTM, "Note Slide Up + Retrigger Note"}, // PTM effect {CMD_NOTESLIDEDOWNRETRIG,0,0, 0, MOD_TYPE_PTM, "Note Slide Down + Retrigger Note"}, // PTM effect {CMD_REVERSEOFFSET, 0,0, 0, MOD_TYPE_PTM, "Revert Sample + Offset"}, // PTM effect @@ -155,12 +160,12 @@ // if format is compatible, everything is fine. if not, let's still search // for another command. this fixes searching for the EFx command, which // does different things in MOD format. - if((sndFile.GetType() & gFXInfo[i].supportedFormats) != 0) + if((sndFile.GetType() & gFXInfo[i].GetSupportedFormats())) break; } } if (fxndx == CountOf(gFXInfo)) return false; - bSupported = ((sndFile.GetType() & gFXInfo[fxndx].supportedFormats) != 0); + bSupported = ((sndFile.GetType() & gFXInfo[fxndx].GetSupportedFormats())); if (gFXInfo[fxndx].name) { if ((bXX) && (bSupported)) @@ -228,7 +233,7 @@ && ((param & gFXInfo[i].paramMask) == gFXInfo[i].paramValue)) // Value { ndx = i; - if((sndFile.GetType() & gFXInfo[i].supportedFormats) != 0) + if((sndFile.GetType() & gFXInfo[i].GetSupportedFormats())) break; // found fitting format; this is correct for sure } } @@ -296,7 +301,7 @@ if (s) s[0] = 0; if (prangeMin) *prangeMin = 0; if (prangeMax) *prangeMax = 0; - if ((ndx >= CountOf(gFXInfo)) || (!(sndFile.GetType() & gFXInfo[ndx].supportedFormats))) return FALSE; + if ((ndx >= CountOf(gFXInfo)) || (!(sndFile.GetType() & gFXInfo[ndx].GetSupportedFormats()))) return FALSE; if (s) GetEffectName(s, gFXInfo[ndx].effect, gFXInfo[ndx].paramValue, bXX); if ((prangeMin) && (prangeMax)) { @@ -885,8 +890,9 @@ struct MPTVOLCMDINFO { ModCommand::VOLCMD volCmd; // VOLCMD_XXXX - MODTYPE supportedFormats; // MOD_TYPE_XXX combo + FlagSet<MODTYPE>::store_type supportedFormats; // MOD_TYPE_XXX combo const char *name; // e.g. "Set Volume" + FlagSet<MODTYPE> GetSupportedFormats() const { return FlagSet<MODTYPE>(supportedFormats); } }; const MPTVOLCMDINFO gVolCmdInfo[] = @@ -960,7 +966,7 @@ *prangeMax = (sndFile.GetType() & MOD_TYPE_XM) ? 15 : 9; } } - return (gVolCmdInfo[ndx].supportedFormats & sndFile.GetType()) != 0; + return (sndFile.GetType() & gVolCmdInfo[ndx].GetSupportedFormats()); } Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -745,12 +745,12 @@ return; } - KeyEventType event = kKeyEventNone; + FlagSet<KeyEventType> event = kKeyEventNone; if(m_bKeyDown.GetCheck()) event |= kKeyEventDown; if(m_bKeyHold.GetCheck()) event |= kKeyEventRepeat; if(m_bKeyUp.GetCheck()) event |= kKeyEventUp; - KeyCombination kc((commandCategories[m_nCurCategory]).id, m_eCustHotKey.mod, m_eCustHotKey.code, (KeyEventType)event); + KeyCombination kc((commandCategories[m_nCurCategory]).id, m_eCustHotKey.mod, m_eCustHotKey.code, event); //detect invalid input if (!kc.KeyCode()) { Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -530,7 +530,7 @@ CHANGEMODTYPE_WARNING(wLinearSlides); } if(oldTypeIsXM && newTypeIsIT_MPT) m_SndFile.m_SongFlags.set(SONG_ITCOMPATGXX); - m_SndFile.m_SongFlags &= (specs.songFlags | SONG_PLAY_FLAGS); + m_SndFile.m_SongFlags &= (specs.GetSongFlags() | SONG_PLAY_FLAGS); // Adjust mix levels if(newTypeIsMOD || newTypeIsS3M) Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -185,10 +185,10 @@ m_SndFile.ChangeModTypeTo(CTrackApp::GetDefaultDocType()); theApp.GetDefaultMidiMacro(m_SndFile.m_MidiCfg); - m_SndFile.m_SongFlags.set(SONG_LINEARSLIDES & m_SndFile.GetModSpecifications().songFlags); + m_SndFile.m_SongFlags.set(SONG_LINEARSLIDES & m_SndFile.GetModSpecifications().GetSongFlags()); if(!m_SndFile.m_MidiCfg.IsMacroDefaultSetupUsed()) { - m_SndFile.m_SongFlags.set(SONG_EMBEDMIDICFG & m_SndFile.GetModSpecifications().songFlags); + m_SndFile.m_SongFlags.set(SONG_EMBEDMIDICFG & m_SndFile.GetModSpecifications().GetSongFlags()); } @@ -1108,7 +1108,7 @@ chn.nC5Speed = sample.nC5Speed; chn.nLoopStart = sample.nLoopStart; chn.nLoopEnd = sample.nLoopEnd; - chn.dwFlags = static_cast<ChannelFlags>(sample.uFlags) & (CHN_SAMPLEFLAGS & ~CHN_MUTE); + chn.dwFlags = (sample.uFlags & (CHN_SAMPLEFLAGS & ~CHN_MUTE)); chn.nPan = 128; if (sample.uFlags[CHN_PANNING]) chn.nPan = sample.nPan; chn.nInsVol = sample.nGlobalVol; @@ -1212,7 +1212,7 @@ } //end rewbs.vstiLive - const ChannelFlags mask = (fade ? CHN_NOTEFADE : (CHN_NOTEFADE | CHN_KEYOFF)); + const FlagSet<ChannelFlags> mask = (fade ? CHN_NOTEFADE : (CHN_NOTEFADE | CHN_KEYOFF)); ModChannel *pChn = &m_SndFile.m_PlayState.Chn[stopChn != CHANNELINDEX_INVALID ? stopChn : m_SndFile.m_nChannels]; for(CHANNELINDEX i = m_SndFile.GetNumChannels(); i < MAX_CHANNELS; i++, pChn++) { @@ -1709,7 +1709,7 @@ int nRenderPasses = 1; // Channel mode std::vector<bool> usedChannels; - std::vector<ChannelFlags> channelFlags; + std::vector<FlagSet<ChannelFlags> > channelFlags; // Instrument mode std::vector<bool> instrMuteState; Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Moddoc.h 2014-12-03 16:36:24 UTC (rev 4630) @@ -162,7 +162,7 @@ HWND GetFollowWnd() const { return m_hWndFollow; } void SetFollowWnd(HWND hwnd); - void SetNotifications(Notification::Type type, Notification::Item item = 0) { m_notifyType = type; m_notifyItem = item; } + void SetNotifications(FlagSet<Notification::Type> type, Notification::Item item = 0) { m_notifyType = type; m_notifyItem = item; } FlagSet<Notification::Type, uint16> GetNotificationType() const { return m_notifyType; } Notification::Item GetNotificationItem() const { return m_notifyItem; } Modified: trunk/OpenMPT/mptrack/Notification.h =================================================================== --- trunk/OpenMPT/mptrack/Notification.h 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/Notification.h 2014-12-03 16:36:24 UTC (rev 4630) @@ -36,7 +36,7 @@ static const uint32 ClipVU = 0x80000000; // Master VU clip indicator bit (sound output has previously clipped) int64 timestampSamples; - FlagSet<Type, uint16> type; + FlagSet<Notification::Type> type; Item item; // Sample or instrument number, depending on type ROWINDEX row; // Always valid uint32 tick; // ditto @@ -47,7 +47,7 @@ uint8 masterVUchannels; // ditto SmpLength pos[MAX_CHANNELS]; // Sample / envelope pos for each channel if != PosInvalid, or pattern channel VUs - Notification(Type t = Default, Item i = 0, int64 s = 0, ROWINDEX r = 0, uint32 ti = 0, ORDERINDEX o = 0, PATTERNINDEX p = 0, uint32 x = 0, uint8 outChannels = 0) : timestampSamples(s), type(t), item(i), row(r), tick(ti), order(o), pattern(p), mixedChannels(x), masterVUchannels(outChannels) + Notification(FlagSet<Notification::Type> t = Default, Item i = 0, int64 s = 0, ROWINDEX r = 0, uint32 ti = 0, ORDERINDEX o = 0, PATTERNINDEX p = 0, uint32 x = 0, uint8 outChannels = 0) : timestampSamples(s), type(t), item(i), row(r), tick(ti), order(o), pattern(p), mixedChannels(x), masterVUchannels(outChannels) { MemsetZero(masterVU); } Modified: trunk/OpenMPT/mptrack/PatternClipboard.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternClipboard.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/PatternClipboard.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -444,7 +444,7 @@ const bool overflowPaste = ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OVERFLOWPASTE) && mode != pmPasteFlood && mode != pmPushForward) && !multiPaste; const bool doITStyleMix = (mode == pmMixPasteIT); const bool doMixPaste = (mode == pmMixPaste) || doITStyleMix; - const bool clipboardHasS3MCommands = (pasteFormat & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)) != 0; + const bool clipboardHasS3MCommands = (pasteFormat & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)); PatternCursor startPoint(startRow, startChan, PatternCursor::lastColumn), endPoint(startRow, startChan, PatternCursor::firstColumn); ModCommand *patData = sndFile.Patterns[pattern].GetpModCommand(startRow, 0); Modified: trunk/OpenMPT/mptrack/UpdateHints.h =================================================================== --- trunk/OpenMPT/mptrack/UpdateHints.h 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/UpdateHints.h 2014-12-03 16:36:24 UTC (rev 4630) @@ -62,12 +62,22 @@ else return 1 + PowerOf2Exponent<v / 2>(); } - void Set(HintType type, uint16_t item = 0) + void Set(FlagSet<HintType> type, uint16_t item = 0) { - data = type | item << PowerOf2Exponent<HINT_MAXHINTFLAG>(); + data = type.GetRaw() | item << PowerOf2Exponent<HINT_MAXHINTFLAG>(); } public: + UpdateHint(FlagSet<HintType>::value_type type, uint16_t item = 0) + { + Set(type, item); + } + + UpdateHint(FlagSet<HintType> type, uint16_t item = 0) + { + Set(type, item); + } + UpdateHint(HintType type, uint16_t item = 0) { Set(type, item); @@ -75,7 +85,7 @@ explicit UpdateHint(LPARAM data) : data(static_cast<uint32_t>(data)) { } - HintType GetType() const { return static_cast<HintType>(data & (HINT_MAXHINTFLAG | (HINT_MAXHINTFLAG - 1))); } + FlagSet<HintType> GetType() const { return FlagSet<HintType>(static_cast<FlagSet<HintType>::store_type>(data & (HINT_MAXHINTFLAG | (HINT_MAXHINTFLAG - 1)))); } uint16_t GetData() const { return static_cast<uint16_t>(data >> PowerOf2Exponent<HINT_MAXHINTFLAG>()); } LPARAM AsLPARAM() const { return data; } @@ -85,30 +95,30 @@ struct SampleHint : public UpdateHint { - SampleHint(HintType type, SAMPLEINDEX item) : UpdateHint(type, item) { } + SampleHint(FlagSet<HintType> type, SAMPLEINDEX item) : UpdateHint(type, item) { } }; struct InstrumentHint : public UpdateHint { - InstrumentHint(HintType type, INSTRUMENTINDEX item) : UpdateHint(type, item) { } + InstrumentHint(FlagSet<HintType> type, INSTRUMENTINDEX item) : UpdateHint(type, item) { } }; struct PatternHint : public UpdateHint { - PatternHint(HintType type, PATTERNINDEX item) : UpdateHint(type, item) { } + PatternHint(FlagSet<HintType> type, PATTERNINDEX item) : UpdateHint(type, item) { } }; struct RowHint : public UpdateHint { - RowHint(HintType type, ROWINDEX item) : UpdateHint(type, static_cast<uint16_t>(item)) { } + RowHint(FlagSet<HintType> type, ROWINDEX item) : UpdateHint(type, static_cast<uint16_t>(item)) { } }; struct SequenceHint : public UpdateHint { - SequenceHint(HintType type, SEQUENCEINDEX item) : UpdateHint(type, item) { } + SequenceHint(FlagSet<HintType> type, SEQUENCEINDEX item) : UpdateHint(type, item) { } }; struct ChannelTabHint : public UpdateHint { - ChannelTabHint(HintType type, int item) : UpdateHint(type, static_cast<uint16_t>(item)) { } + ChannelTabHint(FlagSet<HintType> type, int item) : UpdateHint(type, static_cast<uint16_t>(item)) { } }; Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -308,7 +308,7 @@ if (!pModDoc) return; CSoundFile &sndFile = pModDoc->GetrSoundFile(); - HintType hintType = hint.GetType(); + FlagSet<HintType> hintType = hint.GetType(); if (!(hintType & (HINT_MODTYPE|HINT_MODCHANNELS|HINT_MIXPLUGINS))) return; nTabCount = (sndFile.m_nChannels + 3) / 4; if (nTabCount != m_TabCtrl.GetItemCount()) Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -183,8 +183,8 @@ // Set instrument (and moddoc) as modified. // updateAll: Update all views including this one. Otherwise, only update update other views. -void CViewInstrument::SetModified(HintType mask, bool updateAll) -//-------------------------------------------------------------- +void CViewInstrument::SetModified(FlagSet<HintType> mask, bool updateAll) +//----------------------------------------------------------------------- { CModDoc *pModDoc = GetDocument(); if(pModDoc == nullptr) return; @@ -570,7 +570,7 @@ { InstrumentEnvelope &env = ins.GetEnvelope(envelope); - const EnvelopeFlags flags = (ENV_ENABLED | extraFlags); + const FlagSet<EnvelopeFlags> flags = (ENV_ENABLED | extraFlags); env.dwFlags.set(flags, enable); if(enable && !env.nNodes) @@ -781,7 +781,7 @@ { return; } - HintType hintType = hint.GetType(); + FlagSet<HintType> hintType = hint.GetType(); const INSTRUMENTINDEX updateIns = hint.GetData(); if((hintType & (HINT_MPTOPTIONS | HINT_MODTYPE)) || ((hintType & HINT_ENVELOPE) && (m_nInstrument == updateIns || updateIns == 0))) Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/View_ins.h 2014-12-03 16:36:24 UTC (rev 4630) @@ -133,7 +133,7 @@ //////////////////////// // Misc stuff void UpdateScrollSize(); - void SetModified(HintType mask, bool updateAll); + void SetModified(FlagSet<HintType> mask, bool updateAll); BOOL SetCurrentInstrument(INSTRUMENTINDEX nIns, enmEnvelopeTypes m_nEnv = ENV_VOLUME); ModInstrument *GetInstrumentPtr() const; InstrumentEnvelope *GetEnvelopePtr() const; Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -164,8 +164,8 @@ // updateAll: Update all views including this one. Otherwise, only update update other views. -void CViewSample::SetModified(HintType mask, bool updateAll, bool waveformModified) -//--------------------------------------------------------------------------------- +void CViewSample::SetModified(FlagSet<HintType> mask, bool updateAll, bool waveformModified) +//------------------------------------------------------------------------------------------ { CModDoc *pModDoc = GetDocument(); pModDoc->SetModified(); @@ -521,7 +521,7 @@ { return; } - HintType hintType = hint.GetType(); + FlagSet<HintType> hintType = hint.GetType(); const SAMPLEINDEX updateSmp = hint.GetData(); if((hintType & (HINT_MPTOPTIONS | HINT_MODTYPE)) || ((hintType & HINT_SAMPLEDATA) && (m_nSample == updateSmp || updateSmp == 0))) @@ -543,8 +543,8 @@ // Draw one channel of sample data, 1:1 ratio or higher (zoomed in) -void CViewSample::DrawSampleData1(HDC hdc, int ymed, int cx, int cy, SmpLength len, int uFlags, const void *pSampleData) -//---------------------------------------------------------------------------------------------------------------------- +void CViewSample::DrawSampleData1(HDC hdc, int ymed, int cx, int cy, SmpLength len, SampleFlags uFlags, const void *pSampleData) +//------------------------------------------------------------------------------------------------------------------------------ { int smplsize; int yrange = cy/2; @@ -901,8 +901,8 @@ // Draw one channel of zoomed-out sample data -void CViewSample::DrawSampleData2(HDC hdc, int ymed, int cx, int cy, SmpLength len, int uFlags, const void *pSampleData) -//---------------------------------------------------------------------------------------------------------------------- +void CViewSample::DrawSampleData2(HDC hdc, int ymed, int cx, int cy, SmpLength len, SampleFlags uFlags, const void *pSampleData) +//------------------------------------------------------------------------------------------------------------------------------ { int oldsmin, oldsmax; int yrange = cy/2; @@ -1993,7 +1993,7 @@ //------------------------------ { CModDoc *pModDoc = GetDocument(); - HintType updateFlags = HINT_SAMPLEINFO | HINT_SAMPLEDATA; + FlagSet<HintType> updateFlags = HINT_SAMPLEINFO | HINT_SAMPLEDATA; if (!pModDoc) return; CSoundFile &sndFile = pModDoc->GetrSoundFile(); Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/View_smp.h 2014-12-03 16:36:24 UTC (rev 4630) @@ -62,7 +62,7 @@ DECLARE_SERIAL(CViewSample) protected: - void SetModified(HintType mask, bool updateAll, bool waveformModified); + void SetModified(FlagSet<HintType> mask, bool updateAll, bool waveformModified); void UpdateScrollSize() { UpdateScrollSize(m_nZoom, true); } void UpdateScrollSize(int newZoom, bool forceRefresh, SmpLength centeredSample = SmpLength(-1)); BOOL SetCurrentSample(SAMPLEINDEX nSmp); @@ -75,8 +75,8 @@ void SetCurSel(SmpLength nBegin, SmpLength nEnd); void ScrollToPosition(int x); void DrawPositionMarks(); - void DrawSampleData1(HDC hdc, int ymed, int cx, int cy, SmpLength len, int uFlags, const void *pSampleData); - void DrawSampleData2(HDC hdc, int ymed, int cx, int cy, SmpLength len, int uFlags, const void *pSampleData); + void DrawSampleData1(HDC hdc, int ymed, int cx, int cy, SmpLength len, SampleFlags uFlags, const void *pSampleData); + void DrawSampleData2(HDC hdc, int ymed, int cx, int cy, SmpLength len, SampleFlags uFlags, const void *pSampleData); void DrawNcButton(CDC *pDC, UINT nBtn); BOOL GetNcButtonRect(UINT nBtn, LPRECT lpRect); void UpdateNcButtonState(); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -744,7 +744,7 @@ TCHAR s[256], stmp[256]; TV_ITEM tvi; MemsetZero(tvi); - const HintType hintFlagPart = hint.GetType(); + const FlagSet<HintType> hintFlagPart = hint.GetType(); if (IsSampleBrowser() || !hintFlagPart) return; const CModDoc &modDoc = info.modDoc; @@ -2313,7 +2313,7 @@ } } // what should be updated? - HintType hintFlags = (updateSamples ? HINT_SAMPLEINFO : HINT_NONE) | (updateInstruments ? HINT_INSTRUMENT : HINT_NONE); + FlagSet<HintType> hintFlags = (updateSamples ? HINT_SAMPLEINFO : HINT_NONE) | (updateInstruments ? HINT_INSTRUMENT : HINT_NONE); if(hintFlags != HINT_NONE) UpdateView(*pInfo, hintFlags); } Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -177,9 +177,9 @@ m_CheckBox5.ShowWindow(type != MOD_TYPE_MOD ? SW_SHOW : SW_HIDE); if(allowedFlags[SONG_PT1XMODE]) OnPTModeChanged(); - const bool XMorITorMPT = (type & (MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT)) != 0; - const bool ITorMPT = (type & (MOD_TYPE_IT | MOD_TYPE_MPT)) != 0; - const bool XM = (type & (MOD_TYPE_XM)) != 0; + const bool XMorITorMPT = (type & (MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT)); + const bool ITorMPT = (type & (MOD_TYPE_IT | MOD_TYPE_MPT)); + const bool XM = (type & (MOD_TYPE_XM)); // Misc Flags if(ITorMPT) @@ -344,7 +344,7 @@ sndFile.SetMixLevels(static_cast<mixLevels>(m_PlugMixBox.GetItemData(sel))); } - sndFile.SetModFlags(0); + sndFile.SetModFlags(FlagSet<ModSpecificFlag>()); if(IsDlgButtonChecked(IDC_CHK_COMPATPLAY)) sndFile.SetModFlag(MSF_COMPATIBLE_PLAY, true); if(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM)) { Modified: trunk/OpenMPT/mptrack/view_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/view_com.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/mptrack/view_com.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -189,18 +189,19 @@ CModDoc *pModDoc = GetDocument(); LV_COLUMN lvc; LV_ITEM lvi, lvi2; + FlagSet<HintType> hintType = UpdateHint(lHint).GetType(); if ((!pModDoc) || (pSender == this) || (!(m_ItemList.m_hWnd))) return; - if (lHint & HINT_MPTOPTIONS) + if (hintType & HINT_MPTOPTIONS) { m_ToolBar.UpdateStyle(); - lHint &= ~HINT_MPTOPTIONS; + hintType &= ~HINT_MPTOPTIONS; } - lHint &= (HINT_MODTYPE + hintType &= (HINT_MODTYPE |HINT_SMPNAMES|HINT_SAMPLEINFO |HINT_INSNAMES|HINT_INSTRUMENT /*|HINT_PATNAMES|HINT_PATTERNROW*/); // pattern stuff currently unused - if (!lHint) return; + if (!hintType) return; const CSoundFile &sndFile = pModDoc->GetrSoundFile(); @@ -208,7 +209,7 @@ m_ItemList.SetRedraw(FALSE); // Add sample headers - if ((m_nListId != m_nCurrentListId) || (lHint & HINT_MODTYPE)) + if ((m_nListId != m_nCurrentListId) || (hintType & HINT_MODTYPE)) { UINT ichk = 0; m_ItemList.DeleteAllItems(); @@ -246,12 +247,12 @@ nCol++; } } else - lHint |= HINT_MODTYPE; + hintType |= HINT_MODTYPE; } // Add Items UINT nCount = m_ItemList.GetItemCount(); // Add Samples - if ((m_nCurrentListId == IDC_LIST_SAMPLES) && (lHint & (HINT_MODTYPE|HINT_SMPNAMES|HINT_SAMPLEINFO))) + if ((m_nCurrentListId == IDC_LIST_SAMPLES) && (hintType & (HINT_MODTYPE|HINT_SMPNAMES|HINT_SAMPLEINFO))) { SAMPLEINDEX nMax = static_cast<SAMPLEINDEX>(nCount); if (nMax < sndFile.GetNumSamples()) nMax = sndFile.GetNumSamples(); @@ -354,7 +355,7 @@ } } else // Add Instruments - if ((m_nCurrentListId == IDC_LIST_INSTRUMENTS) && (lHint & (HINT_MODTYPE|HINT_INSNAMES|HINT_INSTRUMENT))) + if ((m_nCurrentListId == IDC_LIST_INSTRUMENTS) && (hintType & (HINT_MODTYPE|HINT_INSNAMES|HINT_INSTRUMENT))) { INSTRUMENTINDEX nMax = static_cast<INSTRUMENTINDEX>(nCount); if (nMax < sndFile.GetNumInstruments()) nMax = sndFile.GetNumInstruments(); @@ -449,7 +450,7 @@ } } else // Add Patterns - if ((m_nCurrentListId == IDC_LIST_PATTERNS) && (lHint & (HINT_MODTYPE|HINT_PATNAMES|HINT_PATTERNROW))) + if ((m_nCurrentListId == IDC_LIST_PATTERNS) && (hintType & (HINT_MODTYPE|HINT_PATNAMES|HINT_PATTERNROW))) { } m_ItemList.SetRedraw(TRUE); Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2014-12-03 16:28:36 UTC (rev 4629) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2014-12-03 16:36:24 UTC (rev 4630) @@ -1194,7 +1194,7 @@ //-------------------------------------------- { MPT_TRACE(); - const FlagSet<AsioFeatures> unsupported((AsioFeatures)(AsioFeatureNoDirectProcess | AsioFeatureOverload | AsioFeatureBufferSizeChange | AsioFeatureSampleRateChange)); + const FlagSet<AsioF... [truncated message content] |
From: <man...@us...> - 2014-12-03 18:28:36
|
Revision: 4632 http://sourceforge.net/p/modplug/code/4632 Author: manxorist Date: 2014-12-03 18:28:28 +0000 (Wed, 03 Dec 2014) Log Message: ----------- [Ref] serialization_utils: Simplify WriteItem<std::string>. Modified Paths: -------------- trunk/OpenMPT/common/serialization_utils.cpp trunk/OpenMPT/common/serialization_utils.h trunk/OpenMPT/soundlib/ModSequence.cpp Modified: trunk/OpenMPT/common/serialization_utils.cpp =================================================================== --- trunk/OpenMPT/common/serialization_utils.cpp 2014-12-03 17:32:16 UTC (rev 4631) +++ trunk/OpenMPT/common/serialization_utils.cpp 2014-12-03 18:28:28 UTC (rev 4632) @@ -75,15 +75,15 @@ } -void WriteItemString(std::ostream& oStrm, const char* const pStr, const size_t nSize) -//-------------------------------------------------------------------------------- +void WriteItemString(std::ostream& oStrm, const std::string &str) +//--------------------------------------------------------------- { - uint32 id = static_cast<uint32>(std::min<std::size_t>(nSize, (uint32_max >> 4))) << 4; + uint32 id = static_cast<uint32>(std::min<std::size_t>(str.size(), (uint32_max >> 4))) << 4; id |= 12; // 12 == 1100b Binarywrite<uint32>(oStrm, id); id >>= 4; if(id > 0) - oStrm.write(pStr, id); + oStrm.write(str.data(), id); } Modified: trunk/OpenMPT/common/serialization_utils.h =================================================================== --- trunk/OpenMPT/common/serialization_utils.h 2014-12-03 17:32:16 UTC (rev 4631) +++ trunk/OpenMPT/common/serialization_utils.h 2014-12-03 18:28:28 UTC (rev 4632) @@ -142,15 +142,12 @@ Binarywrite(oStrm, data); } -void WriteItemString(std::ostream& oStrm, const char* const pStr, const size_t nSize); +void WriteItemString(std::ostream& oStrm, const std::string &str); template <> -inline void WriteItem<std::string>(std::ostream& oStrm, const std::string& str) {WriteItemString(oStrm, str.c_str(), str.length());} +inline void WriteItem<std::string>(std::ostream& oStrm, const std::string& str) {WriteItemString(oStrm, str);} -template <> -inline void WriteItem<const char *>(std::ostream& oStrm, const char * const & psz) { WriteItemString(oStrm, psz, std::strlen(psz));} - template<class T> inline void Binaryread(std::istream& iStrm, T& data) //-------------------------------------------------- Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2014-12-03 17:32:16 UTC (rev 4631) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2014-12-03 18:28:28 UTC (rev 4632) @@ -816,7 +816,7 @@ { srlztn::SsbWrite ssb(oStrm); ssb.BeginWrite(FileIdSequence, MptVersion::num); - ssb.WriteItem(seq.m_sName.c_str(), "n"); + ssb.WriteItem(seq.m_sName, "n"); const uint16 nLength = seq.GetLengthTailTrimmed(); ssb.WriteItem<uint16>(nLength, "l"); ssb.WriteItem(seq.m_pArray, "a", srlztn::ArrayWriter<uint16>(nLength)); @@ -833,7 +833,7 @@ return; std::string str; ssb.ReadItem(str, "n"); - seq.m_sName = str.c_str(); + seq.m_sName = str; uint16 nSize = MAX_ORDERS; ssb.ReadItem<uint16>(nSize, "l"); LimitMax(nSize, ModSpecs::mptm.ordersMax); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-03 21:39:48
|
Revision: 4633 http://sourceforge.net/p/modplug/code/4633 Author: saga-games Date: 2014-12-03 21:39:34 +0000 (Wed, 03 Dec 2014) Log Message: ----------- [Mod] When loading a sample from disk that is being normalized, instantly set its modified flag (easy fix for http://bugs.openmpt.org/view.php?id=601) [Fix] Sample Undo: Undoing something should never re-enable the keep-on-disk flag. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/soundlib/SampleIO.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-03 18:28:28 UTC (rev 4632) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-03 21:39:34 UTC (rev 4633) @@ -861,7 +861,7 @@ sample.nGlobalVol = 64; sample.nVolume = 256; sample.nPan = 128; - sample.uFlags.reset(CHN_LOOP | CHN_SUSTAINLOOP); + sample.uFlags.reset(CHN_LOOP | CHN_SUSTAINLOOP | SMP_MODIFIED); sample.filename[0] = '\0'; m_sndFile.m_szNames[m_nSample][0] = '\0'; if(!sample.nC5Speed) sample.nC5Speed = 22050; @@ -900,7 +900,7 @@ sample.uFlags.set(CHN_PANNING); } SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, true, false); - sample.uFlags.reset(SMP_MODIFIED | SMP_KEEPONDISK); + sample.uFlags.reset(SMP_KEEPONDISK); } return true; } Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2014-12-03 18:28:28 UTC (rev 4632) +++ trunk/OpenMPT/mptrack/Undo.cpp 2014-12-03 21:39:34 UTC (rev 4633) @@ -444,6 +444,7 @@ ModSample &sample = sndFile.GetSample(smp); int8 *pCurrentSample = sample.pSample8; int8 *pNewSample = nullptr; // a new sample is possibly going to be allocated, depending on what's going to be undone. + bool keepOnDisk = sample.uFlags[SMP_KEEPONDISK]; bool replace = false; uint8 bytesPerSample = undo.OldSample.GetBytesPerSample(); @@ -520,6 +521,12 @@ { sample.uFlags.set(SMP_MODIFIED); } + if(!keepOnDisk) + { + // Never re-enable the keep on disk flag after it was disabled. + // This can lead to quite some dangerous situations when replacing samples. + sample.uFlags.reset(SMP_KEEPONDISK); + } fromBuf[smp - 1].push_back(undo); DeleteStep(fromBuf, smp, fromBuf[smp - 1].size() - 1); Modified: trunk/OpenMPT/soundlib/SampleIO.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleIO.cpp 2014-12-03 18:28:28 UTC (rev 4632) +++ trunk/OpenMPT/soundlib/SampleIO.cpp 2014-12-03 21:39:34 UTC (rev 4633) @@ -325,10 +325,11 @@ { bytesRead = CopyAndNormalizeSample<SC::NormalizationChain<SC::Convert<int16, int32>, SC::DecodeInt24<0, bigEndian24> > >(sample, sourceBuf, fileSize, &srcPeak); } - if(bytesRead) + if(bytesRead && srcPeak != uint32(1)<<31) { // Adjust sample volume so we do not affect relative volume of the sample. Normalizing is only done to increase precision. sample.nGlobalVol = static_cast<uint16>(Clamp(Util::muldivr_unsigned(sample.nGlobalVol, srcPeak, uint32(1)<<31), uint32(1), uint32(64))); + sample.uFlags.set(SMP_MODIFIED); } } @@ -345,10 +346,11 @@ { bytesRead = CopyAndNormalizeSample<SC::NormalizationChain<SC::Convert<int16, int32>, SC::DecodeInt32<0, bigEndian32> > >(sample, sourceBuf, fileSize, &srcPeak); } - if(bytesRead) + if(bytesRead && srcPeak != uint32(1)<<31) { // Adjust sample volume so we do not affect relative volume of the sample. Normalizing is only done to increase precision. sample.nGlobalVol = static_cast<uint16>(Clamp(Util::muldivr_unsigned(sample.nGlobalVol, srcPeak, uint32(1)<<31), uint32(1), uint32(64))); + sample.uFlags.set(SMP_MODIFIED); } } @@ -365,10 +367,11 @@ { bytesRead = CopyAndNormalizeSample<SC::NormalizationChain<SC::Convert<int16, float32>, SC::DecodeFloat32<bigEndian32> > >(sample, sourceBuf, fileSize, &srcPeak); } - if(bytesRead) + if(bytesRead && srcPeak != uint32(1)<<31) { // Adjust sample volume so we do not affect relative volume of the sample. Normalizing is only done to increase precision. sample.nGlobalVol = Util::Round<uint16>(Clamp(sample.nGlobalVol * srcPeak, 1.0f, 64.0f)); + sample.uFlags.set(SMP_MODIFIED); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-06 18:57:04
|
Revision: 4635 http://sourceforge.net/p/modplug/code/4635 Author: saga-games Date: 2014-12-06 18:56:49 +0000 (Sat, 06 Dec 2014) Log Message: ----------- [Mod] Plugin Bridge: Default to sharing the plugin bridge between all instances of a plugin. This can greatly speed up loading the same plugin several times. If a plugin crashes a lot, it can still be isolated into its own process, though. [Mod] OpenMPT: Version is now 1.24.00.20 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/Vstplug.h Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-12-06 17:17:11 UTC (rev 4634) +++ trunk/OpenMPT/common/versionNumber.h 2014-12-06 18:56:49 UTC (rev 4635) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 24 #define VER_MINOR 00 -#define VER_MINORMINOR 19 +#define VER_MINORMINOR 20 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2014-12-06 17:17:11 UTC (rev 4634) +++ trunk/OpenMPT/mptrack/Vstplug.h 2014-12-06 18:56:49 UTC (rev 4635) @@ -75,7 +75,7 @@ libraryName(libraryName), dllPath(dllPath), pluginId1(0), pluginId2(0), category(catUnknown), - isInstrument(false), useBridge(false), shareBridgeInstance(false), + isInstrument(false), useBridge(false), shareBridgeInstance(true), dllBits(0) { } @@ -108,14 +108,8 @@ isInstrument = true; category = catSynth; } - if(flags & 0x100) - { - useBridge = true; - } - if(flags & 0x200) - { - shareBridgeInstance = true; - } + useBridge = (flags & 0x100) != 0; + shareBridgeInstance = (flags & 0x200) != 0; dllBits = ((flags >> 10) & 0x3F) * 8; } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-06 19:15:54
|
Revision: 4636 http://sourceforge.net/p/modplug/code/4636 Author: saga-games Date: 2014-12-06 19:15:40 +0000 (Sat, 06 Dec 2014) Log Message: ----------- [Imp] Allow soundfonts to be previewed in the sample browser and to be loaded as instruments. Useful for browsing through single-instrument banks. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/Dlsbank.h trunk/OpenMPT/soundlib/SampleFormats.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-06 18:56:49 UTC (rev 4635) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-06 19:15:40 UTC (rev 4636) @@ -1698,10 +1698,12 @@ .AllowMultiSelect() .EnableAudioPreview() .ExtensionFilter( - "All Instruments|*.xi;*.pat;*.iti;*.flac;*.wav;*.aif;*.aiff|" + "All Instruments|*.xi;*.pat;*.iti;*.flac;*.wav;*.aif;*.aiff;*.sf2;*.sbk;*.dls|" "FastTracker II Instruments (*.xi)|*.xi|" "GF1 Patches (*.pat)|*.pat|" "Impulse Tracker Instruments (*.iti)|*.iti|" + "SoundFont 2.0 Banks (*.sf2)|*.sf2;*.sbk|" + "DLS Sound Banks (*.dls)|*.dls|" "All Files (*.*)|*.*||") .WorkingDirectory(TrackerDirectories::Instance().GetWorkingDirectory(DIR_INSTRUMENTS)) .FilterIndex(&nLastIndex); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-12-06 18:56:49 UTC (rev 4635) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-12-06 19:15:40 UTC (rev 4636) @@ -1806,6 +1806,9 @@ // Instruments if ((!strcmp(s, "xi")) || (!strcmp(s, "iti")) + || (!strcmp(s, "sf2")) + || (!strcmp(s, "sbk")) + || (!strcmp(s, "dls")) || (!strcmp(s, "pat")) ) { if (IsSampleBrowser()) Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2014-12-06 18:56:49 UTC (rev 4635) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2014-12-06 19:15:40 UTC (rev 4636) @@ -1151,21 +1151,28 @@ bool CDLSBank::Open(const mpt::PathString &filename) //-------------------------------------------------- { + if(filename.empty()) return false; + m_szFileName = filename; + CMappedFile MapFile; + if (!MapFile.Open(filename)) return false; + return Open(FileReader(MapFile.Lock(), MapFile.GetLength(), &m_szFileName)); +} + + +bool CDLSBank::Open(FileReader file) +//---------------------------------- +{ SF2LOADERINFO sf2info; const BYTE *lpMemFile; // Pointer to memory-mapped file RIFFCHUNKID *priff; DWORD dwMemPos, dwMemLength; UINT nInsDef; - if(filename.empty()) return false; - m_szFileName = filename; - lpMemFile = NULL; - // Memory-Mapped file - CMappedFile MapFile; - if (!MapFile.Open(filename)) return false; - dwMemLength = MapFile.GetLength(); - if (dwMemLength >= 256) lpMemFile = (const BYTE *)MapFile.Lock(); - if (!lpMemFile) + file.Rewind(); + m_szFileName = file.GetFileName(); + lpMemFile = reinterpret_cast<const BYTE *>(file.GetRawData()); + dwMemLength = file.GetLength(); + if (!lpMemFile || dwMemLength < 256) { return false; } Modified: trunk/OpenMPT/soundlib/Dlsbank.h =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.h 2014-12-06 18:56:49 UTC (rev 4635) +++ trunk/OpenMPT/soundlib/Dlsbank.h 2014-12-06 19:15:40 UTC (rev 4636) @@ -139,6 +139,7 @@ public: bool Open(const mpt::PathString &filename); + bool Open(FileReader file); mpt::PathString GetFileName() const { return m_szFileName; } UINT GetBankType() const { return m_nType; } UINT GetBankInfo(SOUNDBANKINFO *pBankInfo=NULL) const { if (pBankInfo) *pBankInfo = m_BankInfo; return m_nType; } Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-12-06 18:56:49 UTC (rev 4635) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-12-06 19:15:40 UTC (rev 4636) @@ -14,6 +14,7 @@ #ifdef MODPLUG_TRACKER #include "../mptrack/Moddoc.h" #include "../mptrack/TrackerSettings.h" +#include "Dlsbank.h" #endif //MODPLUG_TRACKER #include "../common/AudioCriticalSection.h" #ifndef MODPLUG_NO_FILESAVE @@ -106,7 +107,18 @@ && !ReadXIInstrument(nInstr, file) && !ReadITIInstrument(nInstr, file) // Generic read - && !ReadSampleAsInstrument(nInstr, file, mayNormalize)) return false; + && !ReadSampleAsInstrument(nInstr, file, mayNormalize)) + { + bool ok = false; +#ifdef MODPLUG_TRACKER + CDLSBank bank; + if(bank.Open(file)) + { + ok = bank.ExtractInstrument(*this, nInstr, 0, 0); + } +#endif // MODPLUG_TRACKER + if(!ok) return false; + } if(nInstr > GetNumInstruments()) m_nInstruments = nInstr; return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-06 22:52:11
|
Revision: 4638 http://sourceforge.net/p/modplug/code/4638 Author: saga-games Date: 2014-12-06 22:52:04 +0000 (Sat, 06 Dec 2014) Log Message: ----------- [Fix] Pattern tab: Don't show (00) in the status bar if there is no effect [Imp] When loading a sample through the instrument tab, also set its path. Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-12-06 19:54:08 UTC (rev 4637) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-12-06 22:52:04 UTC (rev 4638) @@ -1683,8 +1683,11 @@ case PatternCursor::effectColumn: case PatternCursor::paramColumn: // display effect command - if(!m->IsPcNote()) + if(m->IsPcNote()) { + s.Format(_T("Parameter value: %u"), m->GetValueEffectCol()); + } else if(m->command != CMD_NONE) + { TCHAR sztmp[64] = ""; /*LONG fxndx = effectInfo.GetIndexFromEffect(m->command, m->param); if(fxndx >= 0) @@ -1692,10 +1695,7 @@ effectInfo.GetEffectNameEx(sztmp, fxndx, m->param); }*/ effectInfo.GetEffectName(sztmp, m->command, m->param, false, nChn); - s.Format(_T("%s (%02X)"), sztmp, m->param); - } else - { - s.Format(_T("Parameter value: %u"), m->GetValueEffectCol()); + if(sztmp[0]) s.Format(_T("%s (%02X)"), sztmp, m->param); } break; } Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-12-06 19:54:08 UTC (rev 4637) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-12-06 22:52:04 UTC (rev 4638) @@ -171,6 +171,9 @@ Instruments[nInstr] = pIns; ReadSampleFromFile(nSample, file, mayNormalize); +#if defined(MPT_WITH_FILEIO) + SetSamplePath(nSample, file.GetFileName()); +#endif return true; } return false; @@ -1824,7 +1827,7 @@ } }; -STATIC_ASSERT(sizeof(AIFFChunk) == 8); +STATIC_ASSERT(sizeof(IFFChunk) == 8); struct PACKED IFFSampleHeader This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-07 01:54:06
|
Revision: 4640 http://sourceforge.net/p/modplug/code/4640 Author: saga-games Date: 2014-12-07 01:53:57 +0000 (Sun, 07 Dec 2014) Log Message: ----------- [Fix] Potentially inefficient file I/O handling in unzip class. [Var] Remove unused vstudio project files from zlib folder Modified Paths: -------------- trunk/OpenMPT/unarchiver/unzip.cpp Removed Paths: ------------- trunk/OpenMPT/include/zlib/contrib/vstudio/ Modified: trunk/OpenMPT/unarchiver/unzip.cpp =================================================================== --- trunk/OpenMPT/unarchiver/unzip.cpp 2014-12-06 22:59:36 UTC (rev 4639) +++ trunk/OpenMPT/unarchiver/unzip.cpp 2014-12-07 01:53:57 UTC (rev 4640) @@ -48,7 +48,7 @@ static uLong ZCALLBACK fread_mem(voidpf opaque, voidpf, void *buf, uLong size) { FileReader &file = *static_cast<FileReader *>(opaque); - if(size > file.BytesLeft()) + if(!file.CanRead(size)) { size = file.BytesLeft(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-11 22:47:36
|
Revision: 4643 http://sourceforge.net/p/modplug/code/4643 Author: saga-games Date: 2014-12-11 22:47:28 +0000 (Thu, 11 Dec 2014) Log Message: ----------- [Imp] Sample tab: Changing the sample frequency updates all playing notes' sample frequency (only works with IT and MPTM for now) [Mod] OpenMPT: Version is now 1.24.00.21 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-12-11 21:35:01 UTC (rev 4642) +++ trunk/OpenMPT/common/versionNumber.h 2014-12-11 22:47:28 UTC (rev 4643) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 24 #define VER_MINOR 00 -#define VER_MINORMINOR 20 +#define VER_MINORMINOR 21 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-11 21:35:01 UTC (rev 4642) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-11 22:47:28 UTC (rev 4643) @@ -107,6 +107,7 @@ ON_EN_CHANGE(IDC_EDIT14, OnVibSweepChanged) ON_EN_CHANGE(IDC_EDIT15, OnVibDepthChanged) ON_EN_CHANGE(IDC_EDIT16, OnVibRateChanged) + ON_EN_KILLFOCUS(IDC_EDIT5, OnFineTuneChangedDone) ON_CBN_SELCHANGE(IDC_COMBO_BASENOTE,OnBaseNoteChanged) ON_CBN_SELCHANGE(IDC_COMBO_ZOOM, OnZoomChanged) ON_CBN_SELCHANGE(IDC_COMBO1, OnLoopTypeChanged) @@ -2457,11 +2458,12 @@ if (IsLocked()) return; int n = GetDlgItemInt(IDC_EDIT5); m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Finetune"); + ModSample &sample = m_sndFile.GetSample(m_nSample); if (m_sndFile.m_nType & (MOD_TYPE_IT|MOD_TYPE_S3M|MOD_TYPE_MPT)) { if ((n > 0) && (n <= (m_sndFile.GetType() == MOD_TYPE_S3M ? 65535 : 9999999)) && (n != (int)m_sndFile.GetSample(m_nSample).nC5Speed)) { - m_sndFile.GetSample(m_nSample).nC5Speed = n; + sample.nC5Speed = n; int transp = ModSample::FrequencyToTranspose(n) >> 7; int basenote = (NOTE_MIDDLEC - NOTE_MIN) + transp; Clamp(basenote, BASENOTE_MIN, BASENOTE_MAX); @@ -2480,16 +2482,40 @@ n = MOD2XMFineTune(n); if ((n >= -128) && (n <= 127)) { - m_sndFile.GetSample(m_nSample).nFineTune = (signed char)n; + sample.nFineTune = (signed char)n; SetModified(SampleHint().Info(), false, false); } + } +} + +void CCtrlSamples::OnFineTuneChangedDone() +//---------------------------------------- +{ + // Update all playing channels + ModSample &sample = m_sndFile.GetSample(m_nSample); + for(CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) + { + ModChannel &chn = m_sndFile.m_PlayState.Chn[i]; + if(chn.pModSample == &m_sndFile.GetSample(m_nSample)) + { + chn.nTranspose = sample.RelativeTone; + chn.nFineTune = sample.nFineTune; + if(chn.nC5Speed != 0 && sample.nC5Speed != 0) + { + if(m_sndFile.m_SongFlags[SONG_LINEARSLIDES] && (m_sndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) + chn.nPeriod = Util::muldivr(chn.nPeriod, sample.nC5Speed, chn.nC5Speed); + else + chn.nPeriod = Util::muldivr(chn.nPeriod, chn.nC5Speed, sample.nC5Speed); + } + chn.nC5Speed = sample.nC5Speed; + } } } void CCtrlSamples::OnBaseNoteChanged() -//------------------------------------- +//------------------------------------ { if (IsLocked()) return; int n = static_cast<int>(m_CbnBaseNote.GetItemData(m_CbnBaseNote.GetCurSel())); @@ -2506,6 +2532,7 @@ sample.nC5Speed = newTrans; LockControls(); SetDlgItemInt(IDC_EDIT5, newTrans, FALSE); + OnFineTuneChangedDone(); UnlockControls(); SetModified(SampleHint().Info(), false, false); } @@ -2514,6 +2541,7 @@ if ((n >= -128) && (n < 128)) { sample.RelativeTone = (int8)n; + OnFineTuneChangedDone(); SetModified(SampleHint().Info(), false, false); } } @@ -2958,6 +2986,7 @@ } redraw = true; m_SpinFineTune.SetPos(0); + OnFineTuneChangedDone(); } if(nCode == SB_ENDSCROLL) SwitchToView(); if(redraw) Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-11 21:35:01 UTC (rev 4642) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-11 22:47:28 UTC (rev 4643) @@ -110,6 +110,7 @@ afx_msg void OnSetPanningChanged(); afx_msg void OnPanningChanged(); afx_msg void OnFineTuneChanged(); + afx_msg void OnFineTuneChangedDone(); afx_msg void OnBaseNoteChanged(); afx_msg void OnLoopTypeChanged(); afx_msg void OnLoopPointsChanged(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-12-13 09:59:41
|
Revision: 4645 http://sourceforge.net/p/modplug/code/4645 Author: manxorist Date: 2014-12-13 09:59:22 +0000 (Sat, 13 Dec 2014) Log Message: ----------- [Ref] Move FileReader.h from soundlib/ to common/. Modified Paths: -------------- trunk/OpenMPT/build/vs2008/libopenmpt/libopenmpt.vcproj trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj.filters trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj.filters trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/MIDIMapping.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/PNG.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/VstPresets.cpp trunk/OpenMPT/mptrack/Vstplug.cpp 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/Dlsbank.cpp trunk/OpenMPT/soundlib/ITCompression.h trunk/OpenMPT/soundlib/Loaders.h trunk/OpenMPT/soundlib/Message.cpp trunk/OpenMPT/soundlib/Mmcmp.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/test/test.cpp trunk/OpenMPT/unarchiver/archive.h trunk/OpenMPT/unarchiver/unarchiver.cpp trunk/OpenMPT/unarchiver/unarchiver.h trunk/OpenMPT/unarchiver/ungzip.cpp trunk/OpenMPT/unarchiver/unzip.cpp Added Paths: ----------- trunk/OpenMPT/common/FileReader.h Removed Paths: ------------- trunk/OpenMPT/soundlib/FileReader.h Modified: trunk/OpenMPT/build/vs2008/libopenmpt/libopenmpt.vcproj =================================================================== --- trunk/OpenMPT/build/vs2008/libopenmpt/libopenmpt.vcproj 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/build/vs2008/libopenmpt/libopenmpt.vcproj 2014-12-13 09:59:22 UTC (rev 4645) @@ -174,6 +174,10 @@ > </File> <File + RelativePath="..\..\..\common\FileReader.h" + > + </File> + <File RelativePath="..\..\..\common\FlagSet.h" > </File> @@ -318,10 +322,6 @@ > </File> <File - RelativePath="..\..\..\soundlib\FileReader.h" - > - </File> - <File RelativePath="..\..\..\soundlib\FloatMixer.h" > </File> Copied: trunk/OpenMPT/common/FileReader.h (from rev 4644, trunk/OpenMPT/soundlib/FileReader.h) =================================================================== --- trunk/OpenMPT/common/FileReader.h (rev 0) +++ trunk/OpenMPT/common/FileReader.h 2014-12-13 09:59:22 UTC (rev 4645) @@ -0,0 +1,810 @@ +/* + * 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 "typedefs.h" +#include "StringFixer.h" +#include "misc_util.h" +#include "Endianness.h" +#include "mptIO.h" +#include <algorithm> +#include <limits> +#include <vector> +#include <cstring> + + +OPENMPT_NAMESPACE_BEGIN + + +// change to show warnings for functions which trigger pre-caching the whole file for unseekable streams +//#define FILEREADER_DEPRECATED MPT_DEPRECATED +#define FILEREADER_DEPRECATED + + +//============== +class FileReader +//============== +{ + +public: + +#if defined(MPT_FILEREADER_STD_ISTREAM) + typedef IFileDataContainer::off_t off_t; +#else + typedef FileDataContainerMemory::off_t off_t; +#endif + +private: + +#if defined(MPT_FILEREADER_STD_ISTREAM) + const IFileDataContainer & DataContainer() const { return *data; } + IFileDataContainer & DataContainer() { return *data; } + MPT_SHARED_PTR<IFileDataContainer> data; +#else + const FileDataContainerMemory & DataContainer() const { return data; } + FileDataContainerMemory & DataContainer() { return data; } + FileDataContainerMemory data; +#endif + + off_t streamPos; // Cursor location in the file + +#if defined(MPT_WITH_FILEIO) + const mpt::PathString *fileName; // Filename that corresponds to this FileReader. It is only set if this FileReader represents the whole contents of fileName. May be nullptr. + #define MPT_FILEREADER_INIT_FILENAME ,fileName(nullptr) +#else // !MPT_WITH_FILEIO + #define MPT_FILEREADER_INIT_FILENAME +#endif // MPT_WITH_FILEIO + +public: + +#if defined(MPT_FILEREADER_STD_ISTREAM) + + // Initialize invalid file reader object. + FileReader() : data(mpt::make_shared<FileDataContainerDummy>()), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } + + // Initialize file reader object with pointer to data and data length. + FileReader(const void *voiddata, off_t length) : data(mpt::make_shared<FileDataContainerMemory>(static_cast<const char *>(voiddata), length)), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } + FileReader(const char *chardata, off_t length) : data(mpt::make_shared<FileDataContainerMemory>(chardata, length)), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } + FileReader(const uint8 *uint8data, off_t length) : data(mpt::make_shared<FileDataContainerMemory>(reinterpret_cast<const char *>(uint8data), length)), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } +#if defined(MPT_WITH_FILEIO) + FileReader(const void *voiddata, off_t length, const mpt::PathString *filename) : data(mpt::make_shared<FileDataContainerMemory>(static_cast<const char *>(voiddata), length)), streamPos(0), fileName(filename) { } + FileReader(const char *chardata, off_t length, const mpt::PathString *filename) : data(mpt::make_shared<FileDataContainerMemory>(chardata, length)), streamPos(0), fileName(filename) { } + FileReader(const uint8 *uint8data, off_t length, const mpt::PathString *filename) : data(mpt::make_shared<FileDataContainerMemory>(reinterpret_cast<const char *>(uint8data), length)), streamPos(0), fileName(filename) { } +#endif // MPT_WITH_FILEIO + + // Initialize file reader object with a std::istream. + FileReader(std::istream *s) : data(mpt::make_shared<FileDataContainerStdStream>(s)), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } +#if defined(MPT_WITH_FILEIO) + FileReader(std::istream *s, const mpt::PathString *filename) : data(mpt::make_shared<FileDataContainerStdStream>(s)), streamPos(0), fileName(filename) { } +#endif // MPT_WITH_FILEIO + + // Initialize file reader object based on an existing file reader object window. + FileReader(MPT_SHARED_PTR<IFileDataContainer> other) : data(other), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } + + // Initialize file reader object based on an existing file reader object. The other object's stream position is copied. + FileReader(const FileReader &other) : data(other.data), streamPos(other.streamPos) +#if defined(MPT_WITH_FILEIO) + , fileName(other.fileName) +#endif // MPT_WITH_FILEIO + { } + +#else // !MPT_FILEREADER_STD_ISTREAM + + // Initialize invalid file reader object. + FileReader() : data(nullptr, 0), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } + + // Initialize file reader object with pointer to data and data length. + FileReader(const void *voiddata, off_t length) : data(static_cast<const char *>(voiddata), length), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } + FileReader(const char *chardata, off_t length) : data(chardata, length), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } + FileReader(const uint8 *uint8data, off_t length) : data(reinterpret_cast<const char *>(uint8data), length), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } +#if defined(MPT_WITH_FILEIO) + FileReader(const void *voiddata, off_t length, const mpt::PathString *filename) : data(static_cast<const char *>(voiddata), length), streamPos(0), fileName(filename) { } + FileReader(const char *chardata, off_t length, const mpt::PathString *filename) : data(chardata, length), streamPos(0), fileName(filename) { } + FileReader(const uint8 *uint8data, off_t length, const mpt::PathString *filename) : data(reinterpret_cast<const char *>(uint8data), length), streamPos(0), fileName(filename) { } +#endif // MPT_WITH_FILEIO + + // Initialize file reader object based on an existing file reader object. The other object's stream position is copied. + FileReader(const FileReader &other) : data(other.data), streamPos(other.streamPos) +#if defined(MPT_WITH_FILEIO) + , fileName(other.fileName) +#endif // MPT_WITH_FILEIO + { } + +#endif // MPT_FILEREADER_STD_ISTREAM + + +#if defined(MPT_WITH_FILEIO) + mpt::PathString GetFileName() const + { + if(!fileName) + { + return mpt::PathString(); + } + return *fileName; + } +#endif // MPT_WITH_FILEIO + + // Returns true if the object points to a valid stream. + bool IsValid() const + { + return DataContainer().IsValid(); + } + + // 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(off_t position) + { + if(position <= streamPos) + { + streamPos = position; + return true; + } + if(position <= DataContainer().GetLength()) + { + 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(off_t skipBytes) + { + if(CanRead(skipBytes)) + { + streamPos += skipBytes; + return true; + } else + { + streamPos = DataContainer().GetLength(); + return false; + } + } + + // Decreases position by skipBytes. + // Returns true if skipBytes could be skipped or false if the file start was reached earlier. + bool SkipBack(off_t skipBytes) + { + if(streamPos >= skipBytes) + { + streamPos -= skipBytes; + return true; + } else + { + streamPos = 0; + return false; + } + } + + // Returns cursor position in the mapped file. + off_t GetPosition() const + { + return streamPos; + } + + // Returns size of the mapped file in bytes. + FILEREADER_DEPRECATED off_t GetLength() const + { + // deprecated because in case of an unseekable std::istream, this triggers caching of the whole file + return DataContainer().GetLength(); + } + + // Return byte count between cursor position and end of file, i.e. how many bytes can still be read. + FILEREADER_DEPRECATED off_t BytesLeft() const + { + // deprecated because in case of an unseekable std::istream, this triggers caching of the whole file + return DataContainer().GetLength() - streamPos; + } + + bool AreBytesLeft() const + { + return CanRead(1); + } + + bool NoBytesLeft() const + { + return !CanRead(1); + } + + // Check if "amount" bytes can be read from the current position in the stream. + bool CanRead(off_t amount) const + { + return DataContainer().CanRead(streamPos, amount); + } + + // 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(off_t position, off_t length) const + { + off_t readableLength = DataContainer().GetReadableLength(position, length); + if(readableLength == 0) + { + return FileReader(); + } + #if defined(MPT_FILEREADER_STD_ISTREAM) + return FileReader(mpt::make_shared<FileDataContainerWindow>(data, position, std::min(length, DataContainer().GetLength() - position))); + #else + return FileReader(DataContainer().GetRawData() + position, std::min(length, DataContainer().GetLength() - position)); + #endif + } + + // 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 ReadChunk(off_t length) + { + off_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. + FILEREADER_DEPRECATED const char *GetRawData() const + { + // deprecated because in case of an unseekable std::istream, this triggers caching of the whole file + return DataContainer().GetRawData() + streamPos; + } + + std::size_t ReadRaw(char *dst, std::size_t count) + { + std::size_t result = static_cast<std::size_t>(DataContainer().Read(dst, streamPos, count)); + streamPos += result; + return result; + } + +protected: + + // 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(sizeof(T) != DataContainer().Read(reinterpret_cast<char*>(&target), streamPos, sizeof(T))) + { + return false; + } + streamPos += sizeof(T); + return true; + } + +public: + + // 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 SwapBytesReturnLE(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 SwapBytesReturnBE(target); + } else + { + return 0; + } + } + + // Read a integer in little-endian format which has some of its higher bytes not stored in file. + // If successful, the file cursor is advanced by the given size. + template <typename T> + T ReadTruncatedIntLE(off_t size) + { + static_assert(std::numeric_limits<T>::is_integer == true, "Target type is a not an integer"); + MPT_ASSERT(sizeof(T) >= size); + if(size == 0) + { + return 0; + } + if(!CanRead(size)) + { + return 0; + } + uint8 buf[sizeof(T)]; + for(std::size_t i = 0; i < sizeof(T); ++i) + { + if(i < size) + { + Read(buf[i]); + } else + { + if(std::numeric_limits<T>::is_signed) + { + // sign extend + const bool negative = (i > 0) && ((buf[i-1] & 0x80) != 0x00); + buf[i] = negative ? 0xff : 0x00; + } else + { + // zero extend + buf[i] = 0x00; + } + } + } + T target; + std::memcpy(&target, buf, sizeof(T)); + return SwapBytesReturnLE(target); + } + + // Read a supplied-size little endian integer to a fixed size variable. + // The data is properly sign-extended when fewer bytes are stored. + // If more bytes are stored, higher order bytes are silently ignored. + // If successful, the file cursor is advanced by the given size. + template <typename T> + T ReadSizedIntLE(off_t size) + { + static_assert(std::numeric_limits<T>::is_integer == true, "Target type is a not an integer"); + if(size == 0) + { + return 0; + } + if(!CanRead(size)) + { + return 0; + } + if(size < sizeof(T)) + { + return ReadTruncatedIntLE<T>(size); + } + T retval = ReadIntLE<T>(); + Skip(size - sizeof(T)); + return retval; + } + + // 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() + { + IEEE754binary32LE target; + if(Read(target)) + { + return target; + } 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() + { + IEEE754binary32BE target; + if(Read(target)) + { + return target; + } else + { + return 0.0f; + } + } + + // Read 64-Bit float in little-endian format. + // If successful, the file cursor is advanced by the size of the float. + double ReadDoubleLE() + { + IEEE754binary64LE target; + if(Read(target)) + { + return target; + } else + { + return 0.0f; + } + } + + // Read 64-Bit float in big-endian format. + // If successful, the file cursor is advanced by the size of the float. + double ReadDoubleBE() + { + IEEE754binary64BE target; + if(Read(target)) + { + return target; + } 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, off_t partialSize = sizeof(T)) + { + off_t copyBytes = std::min(partialSize, sizeof(T)); + if(!CanRead(copyBytes)) + { + copyBytes = BytesLeft(); + } + DataContainer().Read(reinterpret_cast<char *>(&target), 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<mpt::String::ReadWriteMode mode, off_t destSize> + bool ReadString(char (&destBuffer)[destSize], const off_t srcSize) + { + if(CanRead(srcSize)) + { + mpt::String::Read<mode, destSize>(destBuffer, DataContainer().GetPartialRawData(streamPos, srcSize), srcSize); + streamPos += srcSize; + return true; + } else + { + return false; + } + } + + // Read a string of length srcSize into a std::string dest using a given read mode. + // The file cursor is advanced by "srcSize" bytes. + template<mpt::String::ReadWriteMode mode> + bool ReadString(std::string &dest, const off_t srcSize) + { + if(CanRead(srcSize)) + { + mpt::String::Read<mode>(dest, DataContainer().GetPartialRawData(streamPos, srcSize), srcSize); + streamPos += srcSize; + return true; + } else + { + return false; + } + } + + // Read a null-terminated string into a std::string + bool ReadNullString(std::string &dest, const off_t maxLength = std::numeric_limits<std::size_t>::max()) + { + dest.clear(); + char c; + while(Read(c) && c != 0 && dest.length() < maxLength) + { + dest += c; + } + return dest.length() != 0; + } + + // Read an array of byte-sized values. + // If successful, the file cursor is advanced by the size of the array. + // Otherwise, the target is zeroed. + template<typename T, off_t destSize> + bool ReadArray(T (&destArray)[destSize]) + { + STATIC_ASSERT(sizeof(T) == 1); + if(CanRead(sizeof(destArray))) + { + for(std::size_t i = 0; i < destSize; ++i) + { + Read(destArray[i]); + } + return true; + } else + { + MemsetZero(destArray); + 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, off_t destSize> + bool ReadArrayLE(T (&destArray)[destSize]) + { + if(CanRead(sizeof(destArray))) + { + for(std::size_t i = 0; i < destSize; ++i) + { + destArray[i] = ReadIntLE<T>(); + } + return true; + } else + { + MemsetZero(destArray); + return false; + } + } + + // Read destSize elements of byte-sized type T into a vector. + // If successful, the file cursor is advanced by the size of the vector. + // Otherwise, the vector is resized to destSize, but possibly existing contents are not cleared. + template<typename T> + bool ReadVector(std::vector<T> &destVector, size_t destSize) + { + STATIC_ASSERT(sizeof(T) == 1); + const off_t readSize = sizeof(T) * destSize; + destVector.resize(destSize); + if(CanRead(readSize)) + { + for(std::size_t i = 0; i < destSize; ++i) + { + Read(destVector[i]); + } + return true; + } else + { + 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 resized to destSize, but possibly existing contents are not cleared. + template<typename T> + bool ReadVectorLE(std::vector<T> &destVector, size_t destSize) + { + const off_t readSize = sizeof(T) * destSize; + destVector.resize(destSize); + if(CanRead(readSize)) + { + for(std::size_t i = 0; i < destSize; ++i) + { + destVector[i] = ReadIntLE<T>(); + } + return true; + } else + { + return false; + } + } + + // Compare a magic string with the current stream position. + // Returns true if they are identical and advances the file cursor by the the length of the "magic" string. + // Returns false if the string could not be found. The file cursor is not advanced in this case. + bool ReadMagic(const char *const magic) + { + const off_t magicLength = strlen(magic); + if(CanRead(magicLength)) + { + if(!memcmp(DataContainer().GetPartialRawData(streamPos, magicLength), magic, magicLength)) + { + streamPos += magicLength; + return true; + } else + { + return false; + } + } 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(NoBytesLeft()) + { + 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(AreBytesLeft() && (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; + } + +}; + + +#if defined(MPT_WITH_FILEIO) +// templated in order to reduce header inter-depoendencies +template <typename TInputFile> +FileReader GetFileReader(TInputFile &file) +{ + #if defined(MPT_FILEREADER_STD_ISTREAM) + typename TInputFile::ContentsRef tmp = file.Get(); + if(!tmp.first) + { + return FileReader(); + } + if(!tmp.first->good()) + { + return FileReader(); + } + #ifdef MPT_WITH_FILEIO + return FileReader(tmp.first, tmp.second); + #else + return FileReader(tmp.first); + #endif + #else + typename TInputFile::ContentsRef tmp = file.Get(); + #ifdef MPT_WITH_FILEIO + return FileReader(tmp.first.data, tmp.first.size, tmp.second); + #else + return FileReader(tmp.first.data, tmp.first.size); + #endif + #endif +} +#endif // MPT_WITH_FILEIO + + +OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2014-12-13 09:59:22 UTC (rev 4645) @@ -181,6 +181,7 @@ <ClInclude Include="..\common\CompilerDetect.h" /> <ClInclude Include="..\common\ComponentManager.h" /> <ClInclude Include="..\common\Endianness.h" /> + <ClInclude Include="..\common\FileReader.h" /> <ClInclude Include="..\common\FlagSet.h" /> <ClInclude Include="..\common\Logging.h" /> <ClInclude Include="..\common\misc_util.h" /> @@ -202,7 +203,6 @@ <ClInclude Include="..\soundlib\ChunkReader.h" /> <ClInclude Include="..\soundlib\Dither.h" /> <ClInclude Include="..\soundlib\Dlsbank.h" /> - <ClInclude Include="..\soundlib\FileReader.h" /> <ClInclude Include="..\soundlib\FloatMixer.h" /> <ClInclude Include="..\soundlib\IntMixer.h" /> <ClInclude Include="..\soundlib\ITCompression.h" /> Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2014-12-13 09:59:22 UTC (rev 4645) @@ -74,9 +74,6 @@ <ClInclude Include="..\soundlib\Dlsbank.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> - <ClInclude Include="..\soundlib\FileReader.h"> - <Filter>Header Files\soundlib</Filter> - </ClInclude> <ClInclude Include="..\soundlib\ITCompression.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> @@ -269,6 +266,9 @@ <ClInclude Include="..\common\mptFileIO.h"> <Filter>Header Files\common</Filter> </ClInclude> + <ClInclude Include="..\common\FileReader.h"> + <Filter>Header Files\common</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="..\common\AudioCriticalSection.cpp"> Modified: trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj 2014-12-13 09:59:22 UTC (rev 4645) @@ -189,6 +189,7 @@ <ClInclude Include="..\common\CompilerDetect.h" /> <ClInclude Include="..\common\ComponentManager.h" /> <ClInclude Include="..\common\Endianness.h" /> + <ClInclude Include="..\common\FileReader.h" /> <ClInclude Include="..\common\FlagSet.h" /> <ClInclude Include="..\common\Logging.h" /> <ClInclude Include="..\common\misc_util.h" /> @@ -210,7 +211,6 @@ <ClInclude Include="..\soundlib\ChunkReader.h" /> <ClInclude Include="..\soundlib\Dither.h" /> <ClInclude Include="..\soundlib\Dlsbank.h" /> - <ClInclude Include="..\soundlib\FileReader.h" /> <ClInclude Include="..\soundlib\FloatMixer.h" /> <ClInclude Include="..\soundlib\IntMixer.h" /> <ClInclude Include="..\soundlib\ITCompression.h" /> Modified: trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj.filters 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj.filters 2014-12-13 09:59:22 UTC (rev 4645) @@ -74,9 +74,6 @@ <ClInclude Include="..\soundlib\Dlsbank.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> - <ClInclude Include="..\soundlib\FileReader.h"> - <Filter>Header Files\soundlib</Filter> - </ClInclude> <ClInclude Include="..\soundlib\ITCompression.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> @@ -275,6 +272,9 @@ <ClInclude Include="..\common\mptFileIO.h"> <Filter>Header Files\common</Filter> </ClInclude> + <ClInclude Include="..\common\FileReader.h"> + <Filter>Header Files\common</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="..\common\AudioCriticalSection.cpp"> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -27,9 +27,9 @@ #include "common/version.h" #include "common/misc_util.h" +#include "common/FileReader.h" #include "soundlib/Sndfile.h" #include "soundlib/AudioReadTarget.h" -#include "soundlib/FileReader.h" using namespace OpenMPT; Modified: trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj 2014-12-13 09:59:22 UTC (rev 4645) @@ -185,6 +185,7 @@ <ClInclude Include="..\common\CompilerDetect.h" /> <ClInclude Include="..\common\ComponentManager.h" /> <ClInclude Include="..\common\Endianness.h" /> + <ClInclude Include="..\common\FileReader.h" /> <ClInclude Include="..\common\FlagSet.h" /> <ClInclude Include="..\common\Logging.h" /> <ClInclude Include="..\common\misc_util.h" /> @@ -206,7 +207,6 @@ <ClInclude Include="..\soundlib\ChunkReader.h" /> <ClInclude Include="..\soundlib\Dither.h" /> <ClInclude Include="..\soundlib\Dlsbank.h" /> - <ClInclude Include="..\soundlib\FileReader.h" /> <ClInclude Include="..\soundlib\FloatMixer.h" /> <ClInclude Include="..\soundlib\IntMixer.h" /> <ClInclude Include="..\soundlib\ITCompression.h" /> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj.filters 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj.filters 2014-12-13 09:59:22 UTC (rev 4645) @@ -74,9 +74,6 @@ <ClInclude Include="..\soundlib\Dlsbank.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> - <ClInclude Include="..\soundlib\FileReader.h"> - <Filter>Header Files\soundlib</Filter> - </ClInclude> <ClInclude Include="..\soundlib\ITCompression.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> @@ -269,6 +266,9 @@ <ClInclude Include="..\common\mptFileIO.h"> <Filter>Header Files\common</Filter> </ClInclude> + <ClInclude Include="..\common\FileReader.h"> + <Filter>Header Files\common</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="..\common\AudioCriticalSection.cpp"> Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -19,7 +19,7 @@ #include "../common/StringFixer.h" #include "MIDIMacros.h" #include "VstPresets.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include "InputHandler.h" #include "dlg_misc.h" Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -24,7 +24,7 @@ #include "../common/StringFixer.h" #include "SelectPluginDialog.h" #include "../common/mptFileIO.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include "FileDialog.h" Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -28,7 +28,7 @@ #include "Autotune.h" #include "../common/StringFixer.h" #include "../common/mptFileIO.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include "../soundlib/SampleFormatConverters.h" #include "FileDialog.h" #include "../common/ComponentManager.h" Modified: trunk/OpenMPT/mptrack/MIDIMapping.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMapping.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/MIDIMapping.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -11,7 +11,7 @@ #include "stdafx.h" #include "../soundlib/MIDIEvents.h" #include "Mainfrm.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include "MIDIMapping.h" Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -35,7 +35,7 @@ #include "ExceptionHandler.h" #include "PatternClipboard.h" #include "../common/mptFileIO.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include "../common/Profiler.h" #include "FileDialog.h" #include <HtmlHelp.h> Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -30,7 +30,7 @@ #include "CleanupSong.h" #include "../common/StringFixer.h" #include "../common/mptFileIO.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include <shlwapi.h> #include "FileDialog.h" #include "ExternalSamples.h" Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -20,7 +20,7 @@ // VST cloning #include "Vstplug.h" #include "VstPresets.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include <sstream> Modified: trunk/OpenMPT/mptrack/PNG.cpp =================================================================== --- trunk/OpenMPT/mptrack/PNG.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/PNG.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -12,7 +12,7 @@ #include "stdafx.h" #include "MPTrackUtil.h" #include "PNG.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #if !defined(NO_ZLIB) #include <zlib.h> #elif !defined(NO_MINIZ) Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -23,7 +23,7 @@ #include "../soundlib/MIDIEvents.h" #include "SampleEditorDialogs.h" #include "../soundlib/WAVTools.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include "../soundlib/SampleFormatConverters.h" Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -19,7 +19,7 @@ #include "dlg_misc.h" #include "vstplug.h" #include "../common/mptFileIO.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include "FileDialog.h" #include "Globals.h" #include "ExternalSamples.h" Modified: trunk/OpenMPT/mptrack/VstPresets.cpp =================================================================== --- trunk/OpenMPT/mptrack/VstPresets.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/VstPresets.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -15,7 +15,7 @@ #include "Vstplug.h" #include <vstsdk2.4/pluginterfaces/vst2.x/vstfxstore.h> #include "VstPresets.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include <ostream> Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -24,7 +24,7 @@ #include "MIDIMappingDialog.h" #include "../common/StringFixer.h" #include "../common/mptFileIO.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include "FileDialog.h" Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-12-13 09:59:22 UTC (rev 4645) @@ -1254,7 +1254,7 @@ > </File> <File - RelativePath=".\FolderScanner.h" + RelativePath="..\common\FileReader.h" > </File> <File @@ -1266,6 +1266,10 @@ > </File> <File + RelativePath=".\FolderScanner.h" + > + </File> + <File RelativePath=".\globals.h" > </File> @@ -1770,10 +1774,6 @@ > </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 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-12-13 09:59:22 UTC (rev 4645) @@ -941,6 +941,7 @@ <ClInclude Include="..\common\CompilerDetect.h" /> <ClInclude Include="..\common\ComponentManager.h" /> <ClInclude Include="..\common\Endianness.h" /> + <ClInclude Include="..\common\FileReader.h" /> <ClInclude Include="..\common\FlagSet.h" /> <ClInclude Include="..\common\Logging.h" /> <ClInclude Include="..\common\misc_util.h" /> @@ -975,7 +976,6 @@ <ClInclude Include="..\soundlib\ChunkReader.h" /> <ClInclude Include="..\soundlib\Dither.h" /> <ClInclude Include="..\soundlib\Dlsbank.h" /> - <ClInclude Include="..\soundlib\FileReader.h" /> <ClInclude Include="..\soundlib\FloatMixer.h" /> <ClInclude Include="..\soundlib\IntMixer.h" /> <ClInclude Include="..\soundlib\ITCompression.h" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-12-13 09:59:22 UTC (rev 4645) @@ -609,9 +609,6 @@ <ClInclude Include="..\soundlib\ChunkReader.h"> <Filter>Source Files\soundlib\Module Loaders</Filter> </ClInclude> - <ClInclude Include="..\soundlib\FileReader.h"> - <Filter>Source Files\soundlib\Module Loaders</Filter> - </ClInclude> <ClInclude Include="..\soundlib\WAVTools.h"> <Filter>Source Files\soundlib\Module Loaders</Filter> </ClInclude> @@ -1053,6 +1050,9 @@ <ClInclude Include="CListCtrl.h"> <Filter>Header Files\mptrack</Filter> </ClInclude> + <ClInclude Include="..\common\FileReader.h"> + <Filter>Header Files\common</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> Modified: trunk/OpenMPT/soundlib/ChunkReader.h =================================================================== --- trunk/OpenMPT/soundlib/ChunkReader.h 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/soundlib/ChunkReader.h 2014-12-13 09:59:22 UTC (rev 4645) @@ -10,7 +10,7 @@ #pragma once -#include "FileReader.h" +#include "../common/FileReader.h" #include <vector> Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2014-12-13 09:59:22 UTC (rev 4645) @@ -18,7 +18,7 @@ #include "Dlsbank.h" #include "Wav.h" #include "../common/StringFixer.h" -#include "../soundlib/FileReader.h" +#include "../common/FileReader.h" #include "../common/Endianness.h" #include "SampleIO.h" Deleted: trunk/OpenMPT/soundlib/FileReader.h =================================================================== --- trunk/OpenMPT/soundlib/FileReader.h 2014-12-12 10:51:53 UTC (rev 4644) +++ trunk/OpenMPT/soundlib/FileReader.h 2014-12-13 09:59:22 UTC (rev 4645) @@ -1,810 +0,0 @@ -/* - * 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 "../common/misc_util.h" -#include "../common/Endianness.h" -#include "../common/mptIO.h" -#include <algorithm> -#include <limits> -#include <vector> -#include <cstring> - - -OPENMPT_NAMESPACE_BEGIN - - -// change to show warnings for functions which trigger pre-caching the whole file for unseekable streams -//#define FILEREADER_DEPRECATED MPT_DEPRECATED -#define FILEREADER_DEPRECATED - - -//============== -class FileReader -//============== -{ - -public: - -#if defined(MPT_FILEREADER_STD_ISTREAM) - typedef IFileDataContainer::off_t off_t; -#else - typedef FileDataContainerMemory::off_t off_t; -#endif - -private: - -#if defined(MPT_FILEREADER_STD_ISTREAM) - const IFileDataContainer & DataContainer() const { return *data; } - IFileDataContainer & DataContainer() { return *data; } - MPT_SHARED_PTR<IFileDataContainer> data; -#else - const FileDataContainerMemory & DataContainer() const { return data; } - FileDataContainerMemory & DataContainer() { return data; } - FileDataContainerMemory data; -#endif - - off_t streamPos; // Cursor location in the file - -#if defined(MPT_WITH_FILEIO) - const mpt::PathString *fileName; // Filename that corresponds to this FileReader. It is only set if this FileReader represents the whole contents of fileName. May be nullptr. - #define MPT_FILEREADER_INIT_FILENAME ,fileName(nullptr) -#else // !MPT_WITH_FILEIO - #define MPT_FILEREADER_INIT_FILENAME -#endif // MPT_WITH_FILEIO - -public: - -#if defined(MPT_FILEREADER_STD_ISTREAM) - - // Initialize invalid file reader object. - FileReader() : data(mpt::make_shared<FileDataContainerDummy>()), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } - - // Initialize file reader object with pointer to data and data length. - FileReader(const void *voiddata, off_t length) : data(mpt::make_shared<FileDataContainerMemory>(static_cast<const char *>(voiddata), length)), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } - FileReader(const char *chardata, off_t length) : data(mpt::make_shared<FileDataContainerMemory>(chardata, length)), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } - FileReader(const uint8 *uint8data, off_t length) : data(mpt::make_shared<FileDataContainerMemory>(reinterpret_cast<const char *>(uint8data), length)), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } -#if defined(MPT_WITH_FILEIO) - FileReader(const void *voiddata, off_t length, const mpt::PathString *filename) : data(mpt::make_shared<FileDataContainerMemory>(static_cast<const char *>(voiddata), length)), streamPos(0), fileName(filename) { } - FileReader(const char *chardata, off_t length, const mpt::PathString *filename) : data(mpt::make_shared<FileDataContainerMemory>(chardata, length)), streamPos(0), fileName(filename) { } - FileReader(const uint8 *uint8data, off_t length, const mpt::PathString *filename) : data(mpt::make_shared<FileDataContainerMemory>(reinterpret_cast<const char *>(uint8data), length)), streamPos(0), fileName(filename) { } -#endif // MPT_WITH_FILEIO - - // Initialize file reader object with a std::istream. - FileReader(std::istream *s) : data(mpt::make_shared<FileDataContainerStdStream>(s)), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } -#if defined(MPT_WITH_FILEIO) - FileReader(std::istream *s, const mpt::PathString *filename) : data(mpt::make_shared<FileDataContainerStdStream>(s)), streamPos(0), fileName(filename) { } -#endif // MPT_WITH_FILEIO - - // Initialize file reader object based on an existing file reader object window. - FileReader(MPT_SHARED_PTR<IFileDataContainer> other) : data(other), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } - - // Initialize file reader object based on an existing file reader object. The other object's stream position is copied. - FileReader(const FileReader &other) : data(other.data), streamPos(other.streamPos) -#if defined(MPT_WITH_FILEIO) - , fileName(other.fileName) -#endif // MPT_WITH_FILEIO - { } - -#else // !MPT_FILEREADER_STD_ISTREAM - - // Initialize invalid file reader object. - FileReader() : data(nullptr, 0), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } - - // Initialize file reader object with pointer to data and data length. - FileReader(const void *voiddata, off_t length) : data(static_cast<const char *>(voiddata), length), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } - FileReader(const char *chardata, off_t length) : data(chardata, length), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } - FileReader(const uint8 *uint8data, off_t length) : data(reinterpret_cast<const char *>(uint8data), length), streamPos(0) MPT_FILEREADER_INIT_FILENAME { } -#if defined(MPT_WITH_FILEIO) - FileReader(const void *voiddata, off_t length, const mpt::PathString *filename) : data(static_cast<const char *>(voiddata), length), streamPos(0), fileName(filename) { } - FileReader(const char *chardata, off_t length, const mpt::PathString *filename) : data(chardata, length), streamPos(0), fileName(filename) { } - FileReader(const uint8 *uint8data, off_t length, const mpt::PathString *filename) : data(reinterpret_cast<const char *>(uint8data), length), streamPos(0), fileName(filename) { } -#endif // MPT_WITH_FILEIO - - // Initialize file reader object based on an existing file reader object. The other object's stream position is copied. - FileReader(const FileReader &other) : data(other.data), streamPos(other.streamPos) -#if defined(MPT_WITH_FILEIO) - , fileName(other.fileName) -#endif // MPT_WITH_FILEIO - { } - -#endif // MPT_FILEREADER_STD_ISTREAM - - -#if defined(MPT_WITH_FILEIO) - mpt::PathString GetFileName() const - { - if(!fileName) - { - return mpt::PathString(); - } - return *fileName; - } -#endif // MPT_WITH_FILEIO - - // Returns true if the object points to a valid stream. - bool IsValid() const - { - return DataContainer().IsValid(); - } - - // 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(off_t position) - { - if(position <= streamPos) - { - streamPos = position; - return true; - } - if(position <= DataContainer().GetLength()) - { - 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(off_t skipBytes) - { - if(CanRead(skipBytes)) - { - streamPos += skipBytes; - return true; - } else - { - streamPos = DataContainer().GetLength(); - return false; - } - } - - // Decreases position by skipBytes. - // Returns true if skipBytes could be skipped or false if the file start was reached earlier. - bool SkipBack(off_t skipBytes) - { - if(streamPos >= skipBytes) - { - streamPos -= skipBytes; - return true; - } else - { - streamPos = 0; - return false; - } - } - - // Returns cursor position in the mapped file. - off_t GetPosition() const - { - return streamPos; - } - - // Returns size of the mapped file in bytes. - FILEREADER_DEPRECATED off_t GetLength() const - { - // deprecated because in case of an unseekable std::istream, this triggers caching of the whole file - return DataContainer().GetLength(); - } - - // Return byte count between cursor position and end of file, i.e. how many bytes can still be read. - FILEREADER_DEPRECATED off_t BytesLeft() const - { - // deprecated because in case of an unseekable std::istream, this triggers caching of the whole file - return DataContainer().GetLength() - streamPos; - } - - bool AreBytesLeft() const - { - return CanRead(1); - } - - bool NoBytesLeft() const - { - return !CanRead(1); - } - - // Check if "amount" bytes can be read from the current position in the stream. - bool CanRead(off_t amount) const - { - return DataContainer().CanRead(streamPos, amount); - } - - // 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(off_t position, off_t length) const - { - off_t readableLength = DataContainer().GetReadableLength(position, length); - if(readableLength == 0) - { - return FileReader(); - } - #if defined(MPT_FILEREADER_STD_ISTREAM) - return FileReader(mpt::make_shared<FileDataContainerWindow>(data, position, std::min(length, DataContainer().GetLength() - position))); - #else - return FileReader(DataContainer().GetRawData() + position, std::min(length, DataContainer().GetLength() - position)); - #endif - } - - // 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 ReadChunk(off_t length) - { - off_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. - FILEREADER_DEPRECATED const char *GetRawData() const - { - // deprecated because in case of an unseekable std::istream, this triggers caching of the whole file - return DataContainer().GetRawData() + streamPos; - } - - std::size_t ReadRaw(char *dst, std::size_t count) - { - std::size_t result = static_cast<std::size_t>(DataContainer().Read(dst, streamPos, count)); - streamPos += result; - return result; - } - -protected: - - // 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(sizeof(T) != DataContainer().Read(reinterpret_cast<char*>(&target), streamPos, sizeof(T))) - { - return false; - } - streamPos += sizeof(T); - return true; - } - -public: - - // 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 SwapBytesReturnLE(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 SwapBytesReturnBE(target); - } else - { - return 0; - } - } - - // Read a integer in little-endian format which has some of its higher bytes not stored in file. - // If successful, the file cursor is advanced by the given size. - template <typename T> - T ReadTruncatedIntLE(off_t size) - { - static_assert(std::numeric_limits<T>::is_integer == true, "Target type is a not an integer"); - MPT_ASSERT(sizeof(T) >= size); - if(size == 0) - { - return 0; - } - if(!CanRead(size)) - { - return 0; - } - uint8 buf[sizeof(T)]; - for(std::size_t i = 0; i < sizeof(T); ++i) - { - if(i < size) - { - Read(buf[i]); - } else - { - if(std::numeric_limits<T>::is_signed) - { - // sign extend - const bool negative = (i > 0) && ((buf[i-1] & 0x80) != 0x00); - buf[i] = negative ? 0xff : 0x00; - } else - { - // zero extend - buf[i] = 0x00; - } - } - } - T target; - std::memcpy(&target, buf, sizeof(T)); - return SwapBytesReturnLE(target); - } - - // Read a supplied-size little endian integer to a fixed size variable. - // The data is properly sign-extended when fewer bytes are stored. - // If more bytes are stored, higher order bytes are silently ignored. - // If successful, the file cursor is advanced by the given size. - template <typename T> - T ReadSizedIntLE(off_t size) - { - static_assert(std::numeric_limits<T>::is_integer == true, "Target type is a not an integer"); - if(size == 0) - { - return 0; - } - if(!CanRead(size)) - { - return 0; - } - if(size < sizeof(T)) - { - return ReadTruncatedIntLE<T>(size); - } - T retval = ReadIntLE<T>(); - Skip(size - sizeof(T)); - return retval; - } - - // 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() - { - IEEE754binary32LE target; - if(Read(target)) - { - return target; - } 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() - { - IEEE754binary32BE target; - if(Read(target)) - { - return target; - } else - { - return 0.0f; - } - } - - // Read 64-Bit float in little-endian format. - // If successful, the file cursor is advanced by the size of the float. - double ReadDoubleLE() - { - IEEE754binary64LE target; - if(Read(target)) - { - return target; - } else - { - return 0.0f; - } - } - - // Read 64-Bit float in big-endian format. - // If successful, the file cursor is advanced by the size of the float. - double ReadDoubleBE() - { - IEEE754binary64BE target; - if(Read(target)) - { - return target; - } 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, off_t partialSize = sizeof(T)) - { - off_t copyBytes = std::min(partialSize, sizeof(T)); - if(!CanRead(copyBytes)) - { - copyBytes = BytesLeft(); - } - DataContainer().Read(reinterpret_cast<char *>(&target), 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<mpt::String::ReadWriteMode mode, off_t destSize> - bool ReadString(char (&destBuffer)[destSize], const off_t srcSize) - { - if(CanRead(srcSize)) - { - mpt::String::Read<mode, destSize>(destBuffer, DataContainer().GetPartialRawData(streamPos, srcSize), srcSize); - streamPos += srcSize; - return true; - } else - { - return false; - } - } - - // Read a string of length srcSize into a std::string dest using a given read mode. - // The file cursor is advanced by "srcSize" bytes. - template<mpt::String::ReadWriteMode mode> - bool ReadString(std::string &dest, const off_t srcSize) - { - if(CanRead(srcSize)) - { - mpt::String::Read<mode>(dest, DataContainer().GetPartialRawData(streamPos, srcSize), srcSize); - streamPos += srcSize; - return true; - } else - { - return false; - } - } - - // Read... [truncated message content] |
From: <sag...@us...> - 2014-12-13 21:47:45
|
Revision: 4648 http://sourceforge.net/p/modplug/code/4648 Author: saga-games Date: 2014-12-13 21:47:31 +0000 (Sat, 13 Dec 2014) Log Message: ----------- [Imp] Add shortcuts for upsample, downsample, resample (default: Ctrl+R) in sample editor. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2014-12-13 20:10:24 UTC (rev 4647) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2014-12-13 21:47:31 UTC (rev 4648) @@ -667,6 +667,9 @@ DefineKeyCommand(kcSampleTransposeOctDown, 1910, _T("Transpose -12")); DefineKeyCommand(kcPatternInterpolateInstr, 1911, _T("Interpolate Instrument")); DefineKeyCommand(kcDummyShortcut, 1912, _T("Dummy Shortcut")); + DefineKeyCommand(kcSampleUpsample, 1913, _T("Upsample")); + DefineKeyCommand(kcSampleDownsample, 1914, _T("Downsample")); + DefineKeyCommand(kcSampleResample, 1915, _T("Resample")); // Add new key commands here. Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2014-12-13 20:10:24 UTC (rev 4647) +++ trunk/OpenMPT/mptrack/CommandSet.h 2014-12-13 21:47:31 UTC (rev 4648) @@ -680,6 +680,9 @@ kcSampleMonoLeft, kcSampleMonoRight, kcSampleMonoSplit, + kcSampleUpsample, + kcSampleDownsample, + kcSampleResample, kcSampleInvert, kcSampleSignUnsign, kcSampleRemoveDCOffset, Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-13 20:10:24 UTC (rev 4647) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-13 21:47:31 UTC (rev 4648) @@ -1484,9 +1484,18 @@ { return; } + ApplyResample(dlg.GetFrequency()); +} + +void CCtrlSamples::ApplyResample(uint32_t newRate) +//------------------------------------------------ +{ BeginWaitCursor(); + ModSample &sample = m_sndFile.GetSample(m_nSample); + if(sample.pSample == nullptr) return; + SampleSelectionPoints selection = GetSelectionPoints(); LimitMax(selection.nEnd, sample.nLength); if(selection.nStart >= selection.nEnd) @@ -1495,7 +1504,7 @@ selection.nEnd = sample.nLength; } - const uint32 newRate = dlg.GetFrequency(); + const uint32_t oldRate = sample.GetSampleRate(m_sndFile.GetType()); const SmpLength selLength = (selection.nEnd - selection.nStart); const SmpLength newSelLength = Util::muldivr_unsigned(selLength, newRate, oldRate); const SmpLength newSelEnd = selection.nStart + newSelLength; @@ -3042,6 +3051,17 @@ case kcSampleTransposeDown: transpose = -1; break; case kcSampleTransposeOctUp: transpose = 12; break; case kcSampleTransposeOctDown: transpose = -12; break; + + case kcSampleUpsample: + case kcSampleDownsample: + { + uint32_t oldRate = m_sndFile.GetSample(m_nSample).GetSampleRate(m_sndFile.GetType()); + ApplyResample(wParam == kcSampleUpsample ? oldRate * 2 : oldRate / 2); + } + break; + case kcSampleResample: + OnResample(); + break; } if(transpose) Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-13 20:10:24 UTC (rev 4647) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-12-13 21:47:31 UTC (rev 4648) @@ -55,6 +55,7 @@ // Applies amplification to sample. Negative values // can be used to invert phase. void ApplyAmplify(int32 nAmp, bool fadeIn = false, bool fadeOut = false); + void ApplyResample(uint32_t newRate); SampleSelectionPoints GetSelectionPoints(); void SetSelectionPoints(SmpLength nStart, SmpLength nEnd); Modified: trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb =================================================================== --- trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2014-12-13 20:10:24 UTC (rev 4647) +++ trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2014-12-13 21:47:31 UTC (rev 4648) @@ -290,6 +290,7 @@ 8:1386:0:107:1 //Zoom Out: NUM PLUS (KeyDown) 8:1387:0:109:1 //Zoom In: NUM SUB (KeyDown) 8:1882:0:32:1 //Zoom into Selection: Space (KeyDown) +8:1915:2:82:1 //Resample: Ctrl+R (KeyDown) 8:1784:2:73:1 //Invert Sample Phase: Ctrl+I (KeyDown) 8:1785:2:85:1 //Signed / Unsigned Conversion: Ctrl+U (KeyDown) 8:1790:2:69:1 //Remove DC Offset: Ctrl+E (KeyDown) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2014-12-13 20:10:24 UTC (rev 4647) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2014-12-13 21:47:31 UTC (rev 4648) @@ -23,9 +23,8 @@ 0:1026:2:118:5 //Play Pattern from Cursor: Ctrl+F7 (KeyDown|KeyHold) 0:1376:0:120:1 //Toggle MIDI Record: F9 (KeyDown) 0:1359:2:90:5 //Undo: Ctrl+Z (KeyDown|KeyHold) +0:1905:3:90:5 //Redo: Shift+Ctrl+Z (KeyDown|KeyHold) 0:1905:2:89:5 //Redo: Ctrl+Y (KeyDown|KeyHold) -0:1905:3:90:5 //Redo: Shift+Ctrl+Z (KeyDown|KeyHold) -0:1905:2:89:1 //Redo: Ctrl+Y (KeyDown) 0:1360:2:88:1 //Cut: Ctrl+X (KeyDown) 0:1361:2:67:1 //Copy: Ctrl+C (KeyDown) 0:1362:2:86:1 //Paste: Ctrl+V (KeyDown) @@ -71,10 +70,12 @@ 2:1038:0:40:5 //Navigate down by 1 row: NACH-UNTEN (KeyDown|KeyHold) 2:1039:0:38:5 //Navigate up by 1 row: NACH-OBEN (KeyDown|KeyHold) 2:1691:4:32:5 //Navigate down by spacing: Alt+LEER (KeyDown|KeyHold) +2:1691:4:40:5 //Navigate down by spacing: Alt+NACH-UNTEN (KeyDown|KeyHold) +2:1692:4:38:5 //Navigate up by spacing: Alt+NACH-OBEN (KeyDown|KeyHold) 2:1040:0:37:5 //Navigate left: NACH-LINKS (KeyDown|KeyHold) 2:1041:0:39:5 //Navigate right: NACH-RECHTS (KeyDown|KeyHold) -2:1042:0:9:1 //Navigate to next channel: TABULATOR (KeyDown) -2:1043:1:9:1 //Navigate to previous channel: Shift+TABULATOR (KeyDown) +2:1042:0:9:5 //Navigate to next channel: TABULATOR (KeyDown|KeyHold) +2:1043:1:9:5 //Navigate to previous channel: Shift+TABULATOR (KeyDown|KeyHold) 2:1044:0:36:1 //Go to first channel: POS1 (KeyDown) 2:1045:2:36:1 //Go to first row: Ctrl+POS1 (KeyDown) 2:1046:6:36:1 //Go to first row of first channel: Ctrl+Alt+POS1 (KeyDown) @@ -134,7 +135,7 @@ 2:1013:2:73:1 //Apply current instrument: Ctrl+I (KeyDown) 2:1660:4:69:5 //Grow selection: Alt+E (KeyDown|KeyHold) 2:1661:4:68:5 //Shrink selection: Alt+D (KeyDown|KeyHold) -2:1059:2:46:1 //Clear row and step: Ctrl+ENTF (KeyDown) +2:1059:2:46:5 //Clear row and step: Ctrl+ENTF (KeyDown|KeyHold) 2:1060:1:46:1 //Clear field and step: Shift+ENTF (KeyDown) 2:1665:0:46:1 //Clear field and step (IT Style): ENTF (KeyDown) 2:1061:0:8:5 //Delete rows: R\xDCCK (KeyDown|KeyHold) @@ -312,11 +313,14 @@ 8:1386:0:107:1 //Zoom Out: + (ZEHNERTASTATUR) (KeyDown) 8:1387:0:109:1 //Zoom In: - (ZEHNERTASTATUR) (KeyDown) 8:1882:0:32:1 //Zoom into Selection: LEER (KeyDown) -8:1887:2:56:1 //Convert to 8-bit: Ctrl+8 (KeyDown) +8:1887:2:56:1 //Convert to 8-bit / 16-bit: Ctrl+8 (KeyDown) 8:1888:1:77:1 //Convert to Mono (Mix): Shift+M (KeyDown) 8:1889:1:76:1 //Convert to Mono (Left Channel): Shift+L (KeyDown) 8:1890:1:82:1 //Convert to Mono (Right Channel): Shift+R (KeyDown) 8:1891:1:83:1 //Convert to Mono (Split Sample): Shift+S (KeyDown) +8:1913:2:70:1 //Upsample: Ctrl+F (KeyDown) +8:1914:2:71:1 //Downsample: Ctrl+G (KeyDown) +8:1915:2:82:1 //Resample: Ctrl+R (KeyDown) 8:1784:2:73:1 //Invert Sample Phase: Ctrl+I (KeyDown) 8:1785:2:85:1 //Signed / Unsigned Conversion: Ctrl+U (KeyDown) 8:1790:2:69:1 //Remove DC Offset: Ctrl+E (KeyDown) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-13 23:30:42
|
Revision: 4649 http://sourceforge.net/p/modplug/code/4649 Author: saga-games Date: 2014-12-13 23:30:29 +0000 (Sat, 13 Dec 2014) Log Message: ----------- [Mod] Move some options from the installer to a first-use dialog that is shown when detecting a fresh OpenMPT installation. [Mod] OpenMPT: Version is now 1.24.00.22 Modified Paths: -------------- trunk/OpenMPT/common/mptPathString.h trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/installer/install.iss trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.h trunk/OpenMPT/mptrack/TrackerSettings.cpp 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 trunk/OpenMPT/mptrack/view_com.cpp Added Paths: ----------- trunk/OpenMPT/mptrack/WelcomeDialog.cpp trunk/OpenMPT/mptrack/WelcomeDialog.h Removed Paths: ------------- trunk/OpenMPT/installer/vst_scan.iss Modified: trunk/OpenMPT/common/mptPathString.h =================================================================== --- trunk/OpenMPT/common/mptPathString.h 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/common/mptPathString.h 2014-12-13 23:30:29 UTC (rev 4649) @@ -100,6 +100,12 @@ // Verify if this path represents a valid directory on the file system. bool IsDirectory() const { return ::PathIsDirectoryW(path.c_str()) != FALSE; } + bool IsFile() const + { + DWORD dwAttrib = ::GetFileAttributesW(path.c_str()); + return (dwAttrib != INVALID_FILE_ATTRIBUTES && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); + } + bool FileOrDirectoryExists() const { return ::PathFileExistsW(path.c_str()) != FALSE; } // Return the same path string with a different (or appended) extension (including "."), e.g. "foo.bar",".txt" -> "foo.txt" or "C:\OpenMPT\foo",".txt" -> "C:\OpenMPT\foo.txt" PathString ReplaceExt(const mpt::PathString &newExt) const; Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/common/versionNumber.h 2014-12-13 23:30:29 UTC (rev 4649) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 24 #define VER_MINOR 00 -#define VER_MINORMINOR 21 +#define VER_MINORMINOR 22 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/installer/install.iss =================================================================== --- trunk/OpenMPT/installer/install.iss 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/installer/install.iss 2014-12-13 23:30:29 UTC (rev 4649) @@ -49,9 +49,7 @@ #ifdef DOWNLOAD_MO3 Name: downloadmo3; Description: Download unmo3 (library needed for reading MO3 files, recommended); GroupDescription: Options: #endif -Name: update_c; Description: Automatically check for updates; GroupDescription: Options: Name: portable; Description: Portable mode (use program folder for storing settings, no registry changes); GroupDescription: Options:; Flags: unchecked -Name: vst_scan; Description: Scan for previously installed VST plugins; GroupDescription: Options:; Flags: unchecked ; file associations - put this below all other [tasks]! #include "filetypes.iss" @@ -146,7 +144,6 @@ #endif #include "utilities.iss" -#include "vst_scan.iss" #include "plugins.iss" [Code] @@ -191,15 +188,7 @@ end; procedure CurStepChanged(CurStep: TSetupStep); -var - INIFile: String; - keyboardFilepath: String; - baseLanguage: Integer; - begin - // Get the right INI path. - INIFile := GetINIPath(); - case CurStep of ssPostInstall: begin @@ -212,55 +201,6 @@ // Copy old config files from app's directory, if possible and necessary. CopyConfigsToAppDataDir(); - - // Find a suitable keyboard layout (might not be very precise sometimes, as it's based on the UI language) - // Check http://msdn.microsoft.com/en-us/library/ms776294%28VS.85%29.aspx for the correct language codes. - keyboardFilepath := ''; - baseLanguage := (GetUILanguage and $3FF); - case baseLanguage of - $07: // German - begin - keyboardFilepath := 'DE_jojo'; - end; - $0a: // Spanish - begin - // Spanish latin-american keymap, so we ignore Spain. - if(GetUILanguage <> $0c0a) then - begin - keyboardFilepath := 'es-LA_mpt_(jmkz)'; - end; - end; - $0c: // French - begin - keyboardFilepath := 'FR_mpt_(legovitch)'; - end; - $14: // Norwegian - begin - keyboardFilepath := 'NO_mpt_classic_(rakib)'; - end; - end; - - // Found an alternative keybinding. - if(keyboardFilepath <> '') then - begin - FileCopy(ExpandConstant('{app}\extraKeymaps\') + keyboardFilepath + '.mkb', ExtractFilePath(INIFile) + 'Keybindings.mkb', true); - end; - - // Update check - if(not IsTaskSelected('update_c')) then - begin - SetIniString('Update', 'UpdateCheckPeriod', '0', INIFile); - end else - begin - SetIniString('Update', 'UpdateCheckPeriod', '7', INIFile); - //SetIniString('Update', 'LastUpdateCheck', GetDateTimeString('yyyy-mm-dd hh:nn', #0, #0), INIFile); - end; - - // Scan for pre-installed VST plugins - if(IsTaskSelected('vst_scan')) then - begin - OnVSTScan(INIFile); - end; end; end; end; Deleted: trunk/OpenMPT/installer/vst_scan.iss =================================================================== --- trunk/OpenMPT/installer/vst_scan.iss 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/installer/vst_scan.iss 2014-12-13 23:30:29 UTC (rev 4649) @@ -1,108 +0,0 @@ -[CustomMessages] -english.ProgressTitle=Searching -english.ProgressCaption=Searching for VST plugins -english.ProgressText=Searching for plugin files... - -; http://www.vincenzo.net/isxkb/index.php?title=Search_for_a_file - -[Code] -var - ProgressPage: TOutputProgressWizardPage; - ProgressValue: Integer; - ArrayLen: LongInt; - bExitSetup: Boolean; - VSTPluginNumber: Integer; - OldVSTPluginNumber: Integer; - -procedure ProcessDirectory (RootDir: String; Progress: Boolean; INIFile: String); -var - NewRoot: String; - FilePath: String; - FindRec: TFindRec; -begin - if bExitSetup then - Exit; - NewRoot := AddBackSlash (RootDir); - if FindFirst (NewRoot + '*', FindRec) then - begin - try - repeat - if (FindRec.Name <> '.') AND (FindRec.Name <> '..') then - begin - FilePath := NewRoot + FindRec.Name; - if FindRec.Attributes AND FILE_ATTRIBUTE_DIRECTORY > 0 then - ProcessDirectory (FilePath, Progress, INIFile) - else if CompareFilename(FindRec.Name, '.dll') then - begin - // Start action --> - // . - // Add your custom code here. - // FilePath contains the file name - // including its full path name. - // Try not to call a function for every file - // as this could take a very long time. - // . - SetIniString('VST Plugins', 'Plugin' + IntToStr(VSTPluginNumber), FilePath, INIFile); - VSTPluginNumber := VSTPluginNumber + 1; - // <-- End action. - - ArrayLen := ArrayLen + 1; - if (Progress) then - begin - if (ArrayLen mod 1000) = (ArrayLen / 1000) then - begin - ProgressValue := ProgressValue + 1; - if ProgressValue = 100 then - ProgressValue := 0; - ProgressPage.SetProgress (ProgressValue, 100); - end; - end; - end; - end; - if (bExitSetup) then - Exit; - until NOT FindNext (FindRec); - finally - FindClose(FindRec); - end; - end; -end; - -procedure OnVSTScan(INIFile: String); -var - Dir: String; -begin - VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugins', 0, 0, 0, INIFile); - OldVSTPluginNumber := VSTPluginNumber; - - // The folder to scan. - Dir := ExpandConstant('{pf}\Steinberg\VstPlugins'); - 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'), - CustomMessage ('ProgressCaption')); - ProgressPage.SetText (CustomMessage ('ProgressText'), Dir); - ProgressPage.SetProgress(0, 0); - ProgressPage.Show; - // Make the Cancel button visible during the operation. - ;WizardForm.CancelButton.Visible := TRUE; - // Scan the folder. - ProcessDirectory (Dir, TRUE, INIFile); - // Hide the progress page. - try - finally - ProgressPage.Hide; - end; - - // Update INI key - - if(VSTPluginNumber <> OldVSTPluginNumber) then - begin - SetIniInt('VST Plugins', 'NumPlugins', VSTPluginNumber, INIFile); - // Also write the detected VST dir to the INI file if there was no previous entry in it. - if(GetIniString('Paths', 'Plugins_Directory', '', INIFile) = '') then - SetIniString('Paths', 'Plugins_Directory', Dir, INIFile); - end; -end; - - Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-12-13 23:30:29 UTC (rev 4649) @@ -31,6 +31,7 @@ #include "FileDialog.h" #include "PNG.h" #include "../common/ComponentManager.h" +#include "WelcomeDialog.h" // rewbs.memLeak #define _CRTDBG_MAP_ALLOC @@ -119,7 +120,7 @@ { CMainFrame::GetMainFrame()->UpdateMRUList(); } - if(PathFileExistsW(filename.AsNative().c_str()) == FALSE) + if(!filename.IsFile()) { Reporting::Error(L"Unable to open \"" + filename.ToWide() + L"\": file does not exist."); } @@ -767,7 +768,7 @@ sNewPath += sFileName; } - if(PathFileExistsW(sNewPath.AsNative().c_str()) == 0 && PathFileExistsW(sOldPath.AsNative().c_str()) != 0) + if(!sNewPath.IsFile() && sOldPath.IsFile()) { return (MoveFileW(sOldPath.AsNative().c_str(), sNewPath.AsNative().c_str()) != 0); } @@ -1014,18 +1015,24 @@ m_dwTimeStarted = timeGetTime(); m_bInitialized = TRUE; - if(CUpdateCheck::GetUpdateCheckPeriod() != 0) + const bool firstRun = TrackerSettings::Instance().gcsPreviousVersion == 0; + if(CUpdateCheck::GetUpdateCheckPeriod() != 0 && !firstRun) { CUpdateCheck::DoUpdateCheck(true); } // Open settings if the previous execution was with an earlier version. - if(TrackerSettings::Instance().ShowSettingsOnNewVersion && TrackerSettings::Instance().gcsPreviousVersion < MptVersion::num) + if(TrackerSettings::Instance().ShowSettingsOnNewVersion && !firstRun && TrackerSettings::Instance().gcsPreviousVersion < MptVersion::num) { StopSplashScreen(); m_pMainWnd->PostMessage(WM_COMMAND, ID_VIEW_OPTIONS); } + if(firstRun) + { + new WelcomeDlg(m_pMainWnd); + } + EndWaitCursor(); #ifdef _DEBUG Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/Mptrack.h 2014-12-13 23:30:29 UTC (rev 4649) @@ -271,6 +271,7 @@ return *m_pTrackerSettings; } bool IsPortableMode() { return m_bPortableMode; } + void SetPortableMode(bool portable) { m_bPortableMode = portable; } SettingsContainer & GetPluginCache() { ASSERT(m_pPluginCache); Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-12-13 23:30:29 UTC (rev 4649) @@ -475,8 +475,8 @@ } -bool CSelectPluginDlg::VerifyPlug(VSTPluginLib *plug) -//--------------------------------------------------- +bool CSelectPluginDlg::VerifyPlug(VSTPluginLib *plug, CWnd *parent) +//----------------------------------------------------------------- { // TODO: Keep these lists up-to-date. static const struct @@ -514,7 +514,7 @@ { CString s; s.Format("WARNING: This plugin has been identified as %s,\nwhich is known to have the following problem with OpenMPT:\n\n%s\n\nWould you still like to add this plugin to the library?", problemPlugs[p].name, problemPlugs[p].problem); - if(Reporting::Confirm(s, false, false, this) == cnfNo) + if(Reporting::Confirm(s, false, false, parent) == cnfNo) { return false; } @@ -563,7 +563,7 @@ if(lib != nullptr) { update = true; - if(!VerifyPlug(lib)) + if(!VerifyPlug(lib, this)) { pManager->RemovePlugin(lib); } else @@ -618,20 +618,28 @@ if(!dlg.Show(this)) return; TrackerDirectories::Instance().SetWorkingDirectory(dlg.GetDirectory(), DIR_PLUGINS); + VSTPluginLib *plugLib = ScanPlugins(dlg.GetDirectory(), this); + UpdatePluginsList(plugLib ? plugLib->pluginId2 : 0); +} + +VSTPluginLib *CSelectPluginDlg::ScanPlugins(const mpt::PathString &path, CWnd *parent) +//------------------------------------------------------------------------------------ +{ CVstPluginManager *pManager = theApp.GetPluginManager(); VSTPluginLib *plugLib = nullptr; bool update = false; CDialog pluginScanDlg; - pluginScanDlg.Create(IDD_SCANPLUGINS, this); - pluginScanDlg.CenterWindow(this); + pluginScanDlg.Create(IDD_SCANPLUGINS, parent); + pluginScanDlg.CenterWindow(parent); + pluginScanDlg.ModifyStyle(0, WS_SYSMENU, WS_SYSMENU); pluginScanDlg.ShowWindow(SW_SHOW); - FolderScanner scan(dlg.GetDirectory(), true); + FolderScanner scan(path, true); mpt::PathString fileName; int files = 0; - while(scan.NextFile(fileName)) + while(scan.NextFile(fileName) && pluginScanDlg.IsWindowVisible()) { if(!mpt::PathString::CompareNoCase(fileName.GetFileExt(), MPT_PATHSTRING(".dll"))) { @@ -649,7 +657,7 @@ if(lib) { update = true; - if(!VerifyPlug(lib)) + if(!VerifyPlug(lib, parent)) { pManager->RemovePlugin(lib); } else @@ -664,11 +672,12 @@ if(update) { // Force selection to last added plug. - Reporting::Information(mpt::String::Print("Found %1 plugins.", files).c_str(), this); - UpdatePluginsList(plugLib ? plugLib->pluginId2 : 0); + Reporting::Information(mpt::String::Print("Found %1 plugins.", files).c_str(), parent); + return plugLib; } else { Reporting::Error("Could not find any valid VST plugins."); + return nullptr; } } Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.h =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.h 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.h 2014-12-13 23:30:29 UTC (rev 4649) @@ -38,12 +38,14 @@ CSelectPluginDlg(CModDoc *pModDoc, int nPlugSlot, CWnd *parent); ~CSelectPluginDlg(); + static VSTPluginLib *ScanPlugins(const mpt::PathString &path, CWnd *parent); + protected: VSTPluginLib *GetSelectedPlugin() { return reinterpret_cast<VSTPluginLib *>(m_treePlugins.GetItemData(m_treePlugins.GetSelectedItem())); } void DoClose(); void UpdatePluginsList(VstInt32 forceSelect = 0); - bool VerifyPlug(VSTPluginLib *plug); + static bool VerifyPlug(VSTPluginLib *plug, CWnd *parent); virtual void DoDataExchange(CDataExchange* pDX); virtual BOOL OnInitDialog(); virtual void OnOK(); Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-12-13 23:30:29 UTC (rev 4649) @@ -55,7 +55,7 @@ static MptVersion::VersionNum GetStoredVersion(const std::string &iniVersion) //--------------------------------------------------------------------------- { - MptVersion::VersionNum result = MptVersion::num; + MptVersion::VersionNum result = 0; if(!iniVersion.empty()) { result = MptVersion::ToNum(iniVersion); @@ -375,7 +375,7 @@ // Fixups: // ------- - const MptVersion::VersionNum storedVersion = gcsPreviousVersion; + const MptVersion::VersionNum storedVersion = gcsPreviousVersion ? gcsPreviousVersion : MptVersion::num; // Version if(gcsInstallGUID.Get().empty()) Added: trunk/OpenMPT/mptrack/WelcomeDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/WelcomeDialog.cpp (rev 0) +++ trunk/OpenMPT/mptrack/WelcomeDialog.cpp 2014-12-13 23:30:29 UTC (rev 4649) @@ -0,0 +1,176 @@ +/* + * WelcomeDialog.cpp + * ----------------- + * Purpose: "First run" OpenMPT welcome dialog + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#include "stdafx.h" +#include "WelcomeDialog.h" +#include "resource.h" +#include "Mainfrm.h" +#include "../common/StringFixer.h" +#include "InputHandler.h" +#include "CommandSet.h" +#include "SelectPluginDialog.h" +#include "UpdateCheck.h" + + +OPENMPT_NAMESPACE_BEGIN + +BEGIN_MESSAGE_MAP(WelcomeDlg, CDialog) + ON_COMMAND(IDC_BUTTON1, OnOptions) + ON_COMMAND(IDC_BUTTON2, OnScanPlugins) +END_MESSAGE_MAP() + + +WelcomeDlg::WelcomeDlg(CWnd *parent) +//---------------------------------- +{ + Create(IDD_WECLOME, parent); + CenterWindow(parent); +} + + +static mpt::PathString GetFullKeyPath(const char *keyFile) +//-------------------------------------------------------- +{ + return theApp.GetAppDirPath() + MPT_PATHSTRING("extraKeymaps\\") + mpt::PathString::FromUTF8(keyFile) + MPT_PATHSTRING(".mkb"); +} + + +BOOL WelcomeDlg::OnInitDialog() +//----------------------------- +{ + CDialog::OnInitDialog(); + + HKEY hkEnum = NULL; + WCHAR str[MAX_PATH]; + DWORD datasize = sizeof(str); + DWORD datatype = REG_SZ; + if(RegOpenKeyW(HKEY_LOCAL_MACHINE, L"Software\\VST", &hkEnum) == ERROR_SUCCESS + && RegQueryValueExW(hkEnum, L"VSTPluginsPath", 0, &datatype, (LPBYTE)str, &datasize) == ERROR_SUCCESS) + { + mpt::String::SetNullTerminator(str); + vstPath = mpt::PathString::FromNative(str); + } else if(SHGetSpecialFolderPathW(0, str, CSIDL_PROGRAM_FILES, FALSE)) + { + mpt::String::SetNullTerminator(str); + vstPath = mpt::PathString::FromNative(str) + MPT_PATHSTRING("\\Steinberg\\VstPlugins\\"); + if(!vstPath.IsDirectory()) + { + vstPath = mpt::PathString(); + } + } + if(!vstPath.empty()) + { + SetDlgItemTextW(m_hWnd, IDC_EDIT1, vstPath.AsNative().c_str()); + if(TrackerDirectories::Instance().GetDefaultDirectory(DIR_PLUGINS).empty()) + { + TrackerDirectories::Instance().SetDefaultDirectory(vstPath, DIR_PLUGINS); + } + } else + { + SetDlgItemText(IDC_EDIT1, _T("No plugin path found!")); + GetDlgItem(IDC_BUTTON2)->EnableWindow(FALSE); + } + + const char *keyFile = nullptr; + const TCHAR *keyFileName = nullptr; + const uint16_t language = LOWORD(GetKeyboardLayout(0)), primaryLang = language & 0x3FF; + CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO1); + combo->AddString(_T("OpenMPT / Chromatic (Default)")); + combo->SetCurSel(0); + switch(primaryLang) + { + case LANG_GERMAN: + keyFile = "DE_jojo"; + keyFileName = _T("German"); + break; + case LANG_SPANISH: + // Spanish latin-american keymap, so we ignore Spain. + if(language != SUBLANG_SPANISH_MODERN && language != SUBLANG_SPANISH) + { + keyFile = "es-LA_mpt_(jmkz)"; + keyFileName = _T("Spanish"); + } + break; + case LANG_FRENCH: + keyFile = "FR_mpt_(legovitch)"; + keyFileName = _T("French"); + break; + case LANG_NORWEGIAN: + keyFile = "NO_mpt_classic_(rakib)"; + keyFileName = _T("Norwegian"); + break; + } + if(keyFile != nullptr) + { + if(GetFullKeyPath(keyFile).IsFile()) + { + int i = combo->AddString(_T("OpenMPT / Chromatic (") + CString(keyFileName) + _T(")")); + combo->SetItemDataPtr(i, (void *)keyFile); + combo->SetCurSel(i); + } + } + combo->SetItemDataPtr(combo->AddString(_T("Impulse Tracker")), "US_mpt-ft2_classic"); + combo->SetItemDataPtr(combo->AddString(_T("FastTracker 2")), "US_mpt-it2_classic"); + + CheckDlgButton(IDC_CHECK1, BST_CHECKED); + CheckDlgButton(IDC_CHECK2, (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_SMALLFONT) ? BST_UNCHECKED : BST_CHECKED); + CheckDlgButton(IDC_CHECK3, theApp.IsPortableMode() ? BST_CHECKED : BST_UNCHECKED); + GetDlgItem(IDC_CHECK3)->EnableWindow(theApp.IsPortableMode() ? FALSE : TRUE); + + ShowWindow(SW_SHOW); + + return TRUE; +} + + +void WelcomeDlg::OnOptions() +//-------------------------- +{ + OnOK(); + CMainFrame::GetMainFrame()->PostMessage(WM_COMMAND, ID_VIEW_OPTIONS); +} + + +void WelcomeDlg::OnScanPlugins() +//------------------------------ +{ + CSelectPluginDlg::ScanPlugins(vstPath, this); +} + + +void WelcomeDlg::OnOK() +//--------------------- +{ + CDialog::OnOK(); + + bool runUpdates = IsDlgButtonChecked(IDC_CHECK1) != BST_UNCHECKED; + CUpdateCheck::SetUpdateSettings(0, runUpdates ? 7 : 0, CUpdateCheck::GetUpdateURL(), CUpdateCheck::GetSendGUID(), CUpdateCheck::GetShowUpdateHint()); + if(IsDlgButtonChecked(IDC_CHECK2) != BST_UNCHECKED) + TrackerSettings::Instance().m_dwPatternSetup &= ~PATTERN_SMALLFONT; + else + TrackerSettings::Instance().m_dwPatternSetup |= PATTERN_SMALLFONT; + theApp.SetPortableMode(IsDlgButtonChecked(IDC_CHECK3) != BST_UNCHECKED); + + CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO1); + const char *keyFile = static_cast<char *>(combo->GetItemDataPtr(combo->GetCurSel())); + if(keyFile != nullptr) + { + CCommandSet cmdSet; + cmdSet.LoadFile(GetFullKeyPath(keyFile)); + CMainFrame::GetInputHandler()->SetNewCommandSet(&cmdSet); + } + if(runUpdates) + { + CUpdateCheck::DoUpdateCheck(true); + } + CMainFrame::GetMainFrame()->PostMessage(WM_MOD_INVALIDATEPATTERNS, HINT_MPTOPTIONS); +} + +OPENMPT_NAMESPACE_END Property changes on: trunk/OpenMPT/mptrack/WelcomeDialog.cpp ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-c++src \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/OpenMPT/mptrack/WelcomeDialog.h =================================================================== --- trunk/OpenMPT/mptrack/WelcomeDialog.h (rev 0) +++ trunk/OpenMPT/mptrack/WelcomeDialog.h 2014-12-13 23:30:29 UTC (rev 4649) @@ -0,0 +1,38 @@ +/* + * WelcomeDialog.cpp + * ----------------- + * Purpose: "First run" OpenMPT welcome dialog + * 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/mptPathString.h" + +OPENMPT_NAMESPACE_BEGIN + +//=============================== +class WelcomeDlg : public CDialog +//=============================== +{ +protected: + mpt::PathString vstPath; + +public: + WelcomeDlg(CWnd *parent); + +protected: + virtual BOOL OnInitDialog(); + virtual void OnOK(); + virtual void PostNcDestroy() { CDialog::PostNcDestroy(); delete this; } + + afx_msg void OnOptions(); + afx_msg void OnScanPlugins(); + + DECLARE_MESSAGE_MAP() +}; + +OPENMPT_NAMESPACE_END Property changes on: trunk/OpenMPT/mptrack/WelcomeDialog.h ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-chdr \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-12-13 23:30:29 UTC (rev 4649) @@ -337,7 +337,28 @@ PUSHBUTTON "&Cancel",IDCANCEL,120,24,50,14 END +IDD_WECLOME DIALOGEX 0, 0, 256, 154 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Welcome to OpenMPT!" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "&OK",IDOK,198,135,50,14 + LTEXT "Please review the following settings before using this software:",IDC_STATIC,6,6,246,8 + CONTROL "&Automatically check for new versions of OpenMPT",IDC_CHECK1, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,24,246,10 + CONTROL "Store settings in installation directory (&portable mode)",IDC_CHECK3, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,42,246,10 + CONTROL "&Use a big font in the pattern editor",IDC_CHECK2, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,60,246,10 + LTEXT "&Default keyboard scheme:",IDC_STATIC,6,81,108,8 + COMBOBOX IDC_COMBO1,114,79,132,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Scan for existing VST plugins in the following location:",IDC_STATIC,6,100,172,8 + PUSHBUTTON "&Scan",IDC_BUTTON2,198,97,50,14 + EDITTEXT IDC_EDIT1,6,113,240,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + PUSHBUTTON "&More Settings",IDC_BUTTON1,6,135,60,14 +END + ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO @@ -489,6 +510,14 @@ TOPMARGIN, 7 BOTTOMMARGIN, 58 END + + IDD_WECLOME, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 249 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END END #endif // APSTUDIO_INVOKED Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-12-13 23:30:29 UTC (rev 4649) @@ -920,6 +920,10 @@ > </File> <File + RelativePath=".\WelcomeDialog.cpp" + > + </File> + <File RelativePath="..\soundlib\WindowedFIR.cpp" > </File> @@ -1634,6 +1638,10 @@ > </File> <File + RelativePath=".\WelcomeDialog.h" + > + </File> + <File RelativePath="..\soundlib\Wav.h" > </File> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-12-13 23:30:29 UTC (rev 4649) @@ -931,6 +931,7 @@ <ClCompile Include="VSTEditor.cpp" /> <ClCompile Include="Vstplug.cpp" /> <ClCompile Include="VstPresets.cpp" /> + <ClCompile Include="WelcomeDialog.cpp" /> </ItemGroup> <ItemGroup> <ResourceCompile Include="mptrack.rc" /> @@ -1107,6 +1108,7 @@ <ClInclude Include="VSTEditor.h" /> <ClInclude Include="Vstplug.h" /> <ClInclude Include="VstPresets.h" /> + <ClInclude Include="WelcomeDialog.h" /> </ItemGroup> <ItemGroup> <None Include="..\soundlib\Tunings\built-inTunings.tc" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-12-13 23:30:29 UTC (rev 4649) @@ -538,6 +538,9 @@ <ClCompile Include="ExternalSamples.cpp"> <Filter>Source Files\mptrack\Dialogs</Filter> </ClCompile> + <ClCompile Include="WelcomeDialog.cpp"> + <Filter>Source Files\mptrack\Dialogs</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\soundlib\Loaders.h"> @@ -1053,6 +1056,9 @@ <ClInclude Include="..\common\FileReader.h"> <Filter>Header Files\common</Filter> </ClInclude> + <ClInclude Include="WelcomeDialog.h"> + <Filter>Header Files\mptrack\Dialogs</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/resource.h 2014-12-13 23:30:29 UTC (rev 4649) @@ -136,6 +136,7 @@ #define IDD_SCANPLUGINS 536 #define IDD_RESAMPLE 537 #define IDD_MISSINGSAMPLES 538 +#define IDD_WECLOME 539 #define IDC_BUTTON1 1001 #define IDC_BUTTON2 1002 #define IDC_BUTTON3 1003 @@ -1252,7 +1253,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 539 +#define _APS_NEXT_RESOURCE_VALUE 540 #define _APS_NEXT_COMMAND_VALUE 44645 #define _APS_NEXT_CONTROL_VALUE 2483 #define _APS_NEXT_SYMED_VALUE 901 Modified: trunk/OpenMPT/mptrack/view_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/view_com.cpp 2014-12-13 21:47:31 UTC (rev 4648) +++ trunk/OpenMPT/mptrack/view_com.cpp 2014-12-13 23:30:29 UTC (rev 4649) @@ -198,7 +198,6 @@ m_ToolBar.ChangeBitmap(IDC_LIST_INSTRUMENTS, sndFile.GetNumInstruments() ? IMAGE_INSTRUMENTS : IMAGE_INSTRMUTE); TCHAR s[512], stmp[256]; - LV_COLUMN lvc; LV_ITEM lvi, lvi2; m_ItemList.SetRedraw(FALSE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-14 23:50:26
|
Revision: 4650 http://sourceforge.net/p/modplug/code/4650 Author: saga-games Date: 2014-12-14 23:50:14 +0000 (Sun, 14 Dec 2014) Log Message: ----------- [New] Remember window positions for each tune individually when it is being saved (http://forum.openmpt.org/index.php?topic=3280.0). [Mod] VST editor positions are now stored alongside other song window settings in SongSettings.ini Modified Paths: -------------- trunk/OpenMPT/common/misc_util.cpp trunk/OpenMPT/common/mptString.cpp trunk/OpenMPT/installer/install.iss trunk/OpenMPT/mptrack/Childfrm.cpp trunk/OpenMPT/mptrack/Childfrm.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/Globals.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/view_com.cpp trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/common/misc_util.cpp =================================================================== --- trunk/OpenMPT/common/misc_util.cpp 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/common/misc_util.cpp 2014-12-14 23:50:14 UTC (rev 4650) @@ -559,7 +559,7 @@ namespace Util { - + static const MPT_UCHAR_TYPE EncodeNibble[16] = { MPT_UCHAR('0'), MPT_UCHAR('1'), MPT_UCHAR('2'), MPT_UCHAR('3'), MPT_UCHAR('4'), MPT_UCHAR('5'), MPT_UCHAR('6'), MPT_UCHAR('7'), @@ -613,10 +613,10 @@ std::vector<char> HexToBin(const mpt::ustring &src) { std::vector<char> result; - for(std::size_t i = 0; i+1 < src.size(); i += 2) + for(std::size_t i = 0; (i + 1) < src.size(); i += 2) { uint8 byte = 0; - if(!DecodeByte(byte, src[i*2+0], src[i*2+1])) + if(!DecodeByte(byte, src[i], src[i + 1])) { return result; } @@ -643,7 +643,7 @@ #if defined(MODPLUG_TRACKER) - + static bool SystemIsNT = true; // Initialize to used SDK version @@ -840,7 +840,7 @@ break; #if 0 // Using restricted search paths applies to potential DLL dependencies - // recursively. + // recursively. // This fails loading for e.g. Codec or Plugin DLLs in application // directory if they depend on the MSVC C or C++ runtime (which is // located in the system directory). @@ -946,7 +946,7 @@ inited = false; } } - + public: bool IsValid() const Modified: trunk/OpenMPT/common/mptString.cpp =================================================================== --- trunk/OpenMPT/common/mptString.cpp 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/common/mptString.cpp 2014-12-14 23:50:14 UTC (rev 4650) @@ -1454,6 +1454,7 @@ { Tstring result; const std::size_t len = format.length(); + result.reserve(len); for(std::size_t pos = 0; pos != len; ++pos) { typename Tstring::value_type c = format[pos]; Modified: trunk/OpenMPT/installer/install.iss =================================================================== --- trunk/OpenMPT/installer/install.iss 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/installer/install.iss 2014-12-14 23:50:14 UTC (rev 4650) @@ -93,6 +93,7 @@ ; kind of auto-backup - handy! Source: {userappdata}\OpenMPT\Keybindings.mkb; DestDir: {userappdata}\OpenMPT; DestName: Keybindings.mkb.old; Flags: external skipifsourcedoesntexist; Tasks: not portable Source: {userappdata}\OpenMPT\mptrack.ini; DestDir: {userappdata}\OpenMPT; DestName: mptrack.ini.old; Flags: external skipifsourcedoesntexist; Tasks: not portable +Source: {userappdata}\OpenMPT\SongSettings.ini; DestDir: {userappdata}\OpenMPT; DestName: SongSettings.ini.old; Flags: external skipifsourcedoesntexist; Tasks: not portable Source: {userappdata}\OpenMPT\plugin.cache; DestDir: {userappdata}\OpenMPT; DestName: plugin.cache.old; Flags: external skipifsourcedoesntexist; Tasks: not portable [Dirs] @@ -105,8 +106,6 @@ [Icons] ; start menu Name: {group}\OpenMPT; Filename: {app}\mptrack.exe -Name: {group}\{cm:UninstallProgram,OpenMPT}; Filename: {uninstallexe} -Name: {group}\ModPlug Central; Filename: {app}\ModPlug Central.url ; app's directory and keymaps directory (for ease of use) Name: {app}\Configuration files; Filename: {userappdata}\OpenMPT\; Tasks: not portable @@ -214,7 +213,7 @@ case CurUninstallStep of usUninstall: begin - if MsgBox('Do you want to keep your OpenMPT settings files (mptrack.ini, Keybindings.mkb, plugin.cache and local_tunings.tc)?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDNO then + if MsgBox('Do you want to keep your OpenMPT settings files (mptrack.ini, SongSettings.ini, Keybindings.mkb, plugin.cache and local_tunings.tc)?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDNO then begin if(GetIniInt('Paths', 'UseAppDataDirectory', 1, 0, 0, ExpandConstant('{app}\mptrack.ini')) = 1) then begin @@ -224,6 +223,7 @@ begin end; DeleteFile(filepath + 'mptrack.ini'); + DeleteFile(filepath + 'SongSettings.ini'); DeleteFile(filepath + 'Keybindings.mkb'); DeleteFile(filepath + 'plugin.cache'); DeleteFile(filepath + 'tunings\local_tunings.tc'); Modified: trunk/OpenMPT/mptrack/Childfrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.cpp 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Childfrm.cpp 2014-12-14 23:50:14 UTC (rev 4650) @@ -10,14 +10,25 @@ #include "stdafx.h" #include <afxpriv.h> -#include "mptrack.h" -#include "mainfrm.h" +#include "Mptrack.h" +#include "Mainfrm.h" #include "ChildFrm.h" -#include "moddoc.h" -#include "globals.h" -#include "view_gen.h" -#include ".\childfrm.h" +#include "Moddoc.h" +#include "Globals.h" +#include "View_gen.h" +#include "Ctrl_pat.h" +#include "View_pat.h" +#include "Ctrl_smp.h" +#include "View_smp.h" +#include "Ctrl_ins.h" +#include "View_ins.h" +#include "View_com.h" +#include "Childfrm.h" +#include "../common/FileReader.h" +#include "../common/mptIO.h" +#include <sstream> + #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE @@ -29,7 +40,7 @@ ///////////////////////////////////////////////////////////////////////////// -// +// IMPLEMENT_DYNAMIC(CViewExSplitWnd, CSplitterWnd) @@ -69,7 +80,7 @@ ON_WM_SETFOCUS() //rewbs.customKeysAutoEffects END_MESSAGE_MAP() -LONG CChildFrame::glMdiOpenCount = 0; +int CChildFrame::glMdiOpenCount = 0; ///////////////////////////////////////////////////////////////////////////// // CChildFrame construction/destruction @@ -87,6 +98,7 @@ RtlZeroMemory(&m_ViewSamples, sizeof(m_ViewSamples)); RtlZeroMemory(&m_ViewInstruments, sizeof(m_ViewInstruments)); RtlZeroMemory(&m_ViewComments, sizeof(m_ViewComments)); + m_ViewPatterns.initialOrder = ORDERINDEX_INVALID; } @@ -110,10 +122,10 @@ int cy = TrackerSettings::Instance().glGeneralWindowHeight; //rewbs.varWindowSize - default to general tab. if (cy <= 1) cy = (lpcs->cy*2) / 3; if (!m_wndSplitter.CreateView(0, 0, pContext->m_pNewViewClass, CSize(0, cy), pContext)) return FALSE; - + // Get 2nd window handle CModControlView *pModView; - if ((pModView = (CModControlView *)m_wndSplitter.GetPane(0, 0)) != NULL) + if ((pModView = GetModControlView()) != NULL) { m_hWndCtrl = pModView->m_hWnd; pModView->SetMDIParentFrame(m_hWnd); @@ -235,7 +247,7 @@ //------------------------------ { CModControlView *pModView; - if ((pModView = (CModControlView *)m_wndSplitter.GetPane(0, 0)) != NULL) + if ((pModView = GetModControlView()) != nullptr) { pModView->ForceRefresh(); } @@ -249,7 +261,7 @@ if (m_hWnd) { CRect rect; - + m_bMaxWhenClosed = IsZoomed(); if (bForce) TrackerSettings::Instance().gbMdiMaximize = (m_bMaxWhenClosed != 0); if (!IsIconic()) @@ -260,15 +272,15 @@ pWnd->GetWindowRect(&rect); LONG l = rect.Height(); //rewbs.varWindowSize - not the nicest piece of code, but we need to distinguish btw the views: - if (strcmp("CViewGlobals",m_szCurrentViewClassName) == 0) + if (strcmp(CViewGlobals::classCViewGlobals.m_lpszClassName, m_szCurrentViewClassName) == 0) TrackerSettings::Instance().glGeneralWindowHeight = l; - else if (strcmp("CViewPattern", m_szCurrentViewClassName) == 0) + else if (strcmp(CViewPattern::classCViewPattern.m_lpszClassName, m_szCurrentViewClassName) == 0) TrackerSettings::Instance().glPatternWindowHeight = l; - else if (strcmp("CViewSample", m_szCurrentViewClassName) == 0) + else if (strcmp(CViewSample::classCViewSample.m_lpszClassName, m_szCurrentViewClassName) == 0) TrackerSettings::Instance().glSampleWindowHeight = l; - else if (strcmp("CViewInstrument", m_szCurrentViewClassName) == 0) + else if (strcmp(CViewInstrument::classCViewInstrument.m_lpszClassName, m_szCurrentViewClassName) == 0) TrackerSettings::Instance().glInstrumentWindowHeight = l; - else if (strcmp("CViewComments", m_szCurrentViewClassName) == 0) + else if (strcmp(CViewComments::classCViewComments.m_lpszClassName, m_szCurrentViewClassName) == 0) TrackerSettings::Instance().glCommentsWindowHeight = l; //rewbs.graph else if (strcmp("CViewGraph", m_szCurrentViewClassName) == 0) @@ -293,7 +305,7 @@ { pWnd->GetWindowRect(&rect); return rect.Height(); - } + } } return 15; // tidy default }; @@ -456,4 +468,62 @@ //end rewbs.customKeysAutoEffects +std::ostringstream CChildFrame::SerializeView() const +//--------------------------------------------------- +{ + std::ostringstream f(std::ios::out | std::ios::binary); + // Version + mpt::IO::WriteVarInt(f, 0u); + // Current page + mpt::IO::WriteVarInt(f, static_cast<uint8_t>(GetModControlView()->GetActivePage())); + + CModControlView *view = GetModControlView(); + if (strcmp(CViewPattern::classCViewPattern.m_lpszClassName, m_szCurrentViewClassName) == 0) + { + mpt::IO::WriteVarInt(f, (uint32_t)view->SendMessage(WM_MOD_CTRLMSG, CTRLMSG_GETCURRENTORDER)); // Order number + } else if (strcmp(CViewSample::classCViewSample.m_lpszClassName, m_szCurrentViewClassName) == 0) + { + mpt::IO::WriteVarInt(f, (uint32_t)view->SendMessage(WM_MOD_CTRLMSG, CTRLMSG_GETCURRENTINSTRUMENT)); // Sample number + } else if (strcmp(CViewInstrument::classCViewInstrument.m_lpszClassName, m_szCurrentViewClassName) == 0) + { + mpt::IO::WriteVarInt(f, (uint32_t)view->SendMessage(WM_MOD_CTRLMSG, CTRLMSG_GETCURRENTINSTRUMENT)); // Instrument number + } + return f; +} + + +void CChildFrame::DeserializeView(FileReader &file) +//------------------------------------------------- +{ + uint32_t version, page; + if(file.ReadVarInt(version) && version == 0 && + file.ReadVarInt(page) && page >= 0 && page < CModControlView::MAX_PAGES) + { + UINT pageDlg = 0; + switch(page) + { + case CModControlView::VIEW_GLOBALS: + pageDlg = IDD_CONTROL_GLOBALS; + break; + case CModControlView::VIEW_PATTERNS: + pageDlg = IDD_CONTROL_PATTERNS; + file.ReadVarInt(m_ViewPatterns.initialOrder); + break; + case CModControlView::VIEW_SAMPLES: + pageDlg = IDD_CONTROL_SAMPLES; + file.ReadVarInt(m_ViewSamples.initialSample); + break; + case CModControlView::VIEW_INSTRUMENTS: + pageDlg = IDD_CONTROL_INSTRUMENTS; + file.ReadVarInt(m_ViewInstruments.initialInstrument); + break; + case CModControlView::VIEW_COMMENTS: + pageDlg = IDD_CONTROL_COMMENTS; + break; + } + GetModControlView()->PostMessage(WM_MOD_ACTIVATEVIEW, pageDlg); + } + +} + OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/mptrack/Childfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.h 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Childfrm.h 2014-12-14 23:50:14 UTC (rev 4650) @@ -14,7 +14,9 @@ OPENMPT_NAMESPACE_BEGIN +class CModControlView; class CModControlDlg; +class FileReader; class CChildFrame; typedef struct _GENERALVIEWSTATE @@ -34,6 +36,7 @@ PatternRect selection; PatternCursor::Columns nDetailLevel; ORDERINDEX nOrder; //rewbs.playSongFromCursor + ORDERINDEX initialOrder; } PATTERNVIEWSTATE; typedef struct SAMPLEVIEWSTATE @@ -42,6 +45,7 @@ SmpLength dwBeginSel; SmpLength dwEndSel; SAMPLEINDEX nSample; + SAMPLEINDEX initialSample; } SAMPLEVIEWSTATE; @@ -49,6 +53,7 @@ { DWORD cbStruct; enmEnvelopeTypes nEnv; + INSTRUMENTINDEX initialInstrument; bool bGrid; } INSTRUMENTVIEWSTATE; @@ -84,7 +89,7 @@ CChildFrame(); protected: - static LONG glMdiOpenCount; + static int glMdiOpenCount; // Attributes protected: @@ -101,6 +106,7 @@ // Operations public: + CModControlView *GetModControlView() const { return (CModControlView *)m_wndSplitter.GetPane(0, 0); } BOOL ChangeViewClass(CRuntimeClass* pNewViewClass, CCreateContext* pContext=NULL); void ForceRefresh(); void SavePosition(BOOL bExit=FALSE); @@ -109,15 +115,18 @@ LRESULT ActivateView(UINT nId, LPARAM lParam) { return ::SendMessage(m_hWndCtrl, WM_MOD_ACTIVATEVIEW, nId, lParam); } HWND GetHwndCtrl() const { return m_hWndCtrl; } HWND GetHwndView() const { return m_hWndView; } - GENERALVIEWSTATE *GetGeneralViewState() { return &m_ViewGeneral; } - PATTERNVIEWSTATE *GetPatternViewState() { return &m_ViewPatterns; } - SAMPLEVIEWSTATE *GetSampleViewState() { return &m_ViewSamples; } - INSTRUMENTVIEWSTATE *GetInstrumentViewState() { return &m_ViewInstruments; } - COMMENTVIEWSTATE *GetCommentViewState() { return &m_ViewComments; } + GENERALVIEWSTATE &GetGeneralViewState() { return m_ViewGeneral; } + PATTERNVIEWSTATE &GetPatternViewState() { return m_ViewPatterns; } + SAMPLEVIEWSTATE &GetSampleViewState() { return m_ViewSamples; } + INSTRUMENTVIEWSTATE &GetInstrumentViewState() { return m_ViewInstruments; } + COMMENTVIEWSTATE &GetCommentViewState() { return m_ViewComments; } - void SetSplitterHeight(int x); //rewbs.varWindowSize - int GetSplitterHeight(); //rewbs.varWindowSize + void SetSplitterHeight(int x); + int GetSplitterHeight(); + std::ostringstream SerializeView() const; + void DeserializeView(FileReader &file); + // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CChildFrame) Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-14 23:50:14 UTC (rev 4650) @@ -68,18 +68,18 @@ 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) || + 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); InputTargetContext ctx = (InputTargetContext)(kCtxInsNoteMap); - + if (ih->KeyEvent(ctx, nChar, nRepCnt, nFlags, kT) != kcNull) return true; // Mapped to a command, no need to pass message on. @@ -90,7 +90,7 @@ return true; // Mapped to a command, no need to pass message on. } } - + //The key was not handled by a command, but it might still be useful if (pMsg->message == WM_CHAR) //key is a character { @@ -100,7 +100,7 @@ if (kT == kKeyEventDown) if (HandleChar(wParam)) return true; - } + } else if (pMsg->message == WM_KEYDOWN) //key is not a character { if (HandleNav(wParam)) @@ -255,7 +255,7 @@ DrawButtonRect(hdc, &rect, "", FALSE, FALSE); if (ypaint < rcClient.bottom) { - rect.SetRect(rcClient.left, ypaint, rcClient.right, rcClient.bottom); + rect.SetRect(rcClient.left, ypaint, rcClient.right, rcClient.bottom); FillRect(hdc, &rect, CMainFrame::brushGray); } } @@ -322,7 +322,7 @@ { CHAR s[64]; CInputHandler* ih = CMainFrame::GetInputHandler(); - + CSoundFile &sndFile = m_modDoc.GetrSoundFile(); ModInstrument *pIns = sndFile.Instruments[m_nInstrument]; if (pIns) @@ -519,7 +519,7 @@ { if (wParam == kcNull) return NULL; - + CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); ModInstrument *pIns = m_modDoc.GetrSoundFile().Instruments[m_nInstrument]; @@ -532,10 +532,10 @@ HandleChar(lParam); else EnterNote(wParam-kcInsNoteMapStartNotes+1+pMainFrm->GetBaseOctave()*12); - + return wParam; } - + if (wParam>=kcInsNoteMapStartNoteStops && wParam<=kcInsNoteMapEndNoteStops) { StopNote(m_nPlayingNote); @@ -563,7 +563,7 @@ case kcNextInstrument: m_pParent.PostMessage(WM_COMMAND, ID_NEXTINSTRUMENT); return wParam; case kcPrevInstrument: m_pParent.PostMessage(WM_COMMAND, ID_PREVINSTRUMENT); return wParam; } - + return NULL; } @@ -579,22 +579,22 @@ UINT n = pIns->NoteMap[m_nNote]; bool bOk = false; if ((note >= sndFile.GetModSpecifications().noteMin) && (note <= sndFile.GetModSpecifications().noteMax)) - { + { n = note; bOk = true; - } + } if (n != pIns->NoteMap[m_nNote]) { pIns->NoteMap[m_nNote] = n; m_pParent.SetModified(InstrumentHint().Info(), false); InvalidateRect(NULL, FALSE); } - if (bOk) + if (bOk) { PlayNote(m_nNote + 1); //SetCurrentNote(m_nNote+1); } - + } } } @@ -656,7 +656,7 @@ m_pParent.SetModified(InstrumentHint().Info(), false); InvalidateRect(NULL, FALSE); } - + if (c == ' ') { SetCurrentNote(m_nNote+1); @@ -720,7 +720,7 @@ default: return false; } - if (bRedraw) + if (bRedraw) { InvalidateRect(NULL, FALSE); } @@ -966,7 +966,7 @@ GetDlgItem(IDC_PITCHWHEELDEPTH)->EnableWindow(FALSE); BuildTuningComboBox(); - + CheckDlgButton(IDC_CHECK_PITCHTEMPOLOCK, MF_UNCHECKED); m_EditPitchTempoLock.SetLimitText(4); @@ -1043,13 +1043,20 @@ UpdatePluginList(); + CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); + INSTRUMENTVIEWSTATE &instrumentState = pFrame->GetInstrumentViewState(); + if(instrumentState.initialInstrument != 0) + { + m_nInstrument = instrumentState.initialInstrument; + instrumentState.initialInstrument = 0; + } + SetCurrentInstrument((lParam > 0) ? lParam : m_nInstrument); // Initial Update if (!m_bInitialized) UpdateView(InstrumentHint(m_nInstrument).Info().Envelope().ModType(), NULL); - CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); - if (pFrame) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)pFrame->GetInstrumentViewState()); + if (pFrame) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&instrumentState); SwitchToView(); // Combo boxes randomly disappear without this... why? @@ -1062,7 +1069,7 @@ { m_modDoc.NoteOff(0, true); CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); - if ((pFrame) && (m_hWndView)) SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)pFrame->GetInstrumentViewState()); + if ((pFrame) && (m_hWndView)) SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)&pFrame->GetInstrumentViewState()); } @@ -1071,6 +1078,10 @@ { switch(wParam) { + case CTRLMSG_GETCURRENTINSTRUMENT: + return m_nInstrument; + break; + case CTRLMSG_INS_PREVINSTRUMENT: OnPrevInstrument(); break; @@ -1195,7 +1206,7 @@ m_NoteMap.EnableWindow(bITandXM); m_CbnResampling.EnableWindow(bITandXM); - + m_ComboNNA.EnableWindow(bITandMPT); m_SliderVolSwing.EnableWindow(bITandMPT); m_SliderPanSwing.EnableWindow(bITandMPT); @@ -1264,7 +1275,7 @@ if (pIns->nMidiChannel < 18) { - m_CbnMidiCh.SetCurSel(pIns->nMidiChannel); + m_CbnMidiCh.SetCurSel(pIns->nMidiChannel); } else { m_CbnMidiCh.SetCurSel(0); @@ -1404,7 +1415,7 @@ { strcpy(s, "No Change"); } - + SetDlgItemText(IDC_FILTERTEXT, s); } } @@ -1415,7 +1426,7 @@ //-------------------------------------------------------------------- { BOOL bFirst, bOk; - + BeginWaitCursor(); InputFile f(fileName); if(!f.IsValid()) @@ -1453,7 +1464,7 @@ { mpt::PathString name, ext; fileName.SplitPath(nullptr, nullptr, &name, &ext); - + if (!pIns->name[0] && m_sndFile.GetModSpecifications().instrNameLengthMax > 0) { mpt::String::CopyN(pIns->name, name.ToLocale().c_str(), m_sndFile.GetModSpecifications().instrNameLengthMax); @@ -1526,7 +1537,7 @@ //------------------------------------------------------------ { //Note: pszText seems to point to char array of length 256 (Noverber 2006). - //Note2: If there's problems in getting tooltips showing for certain tools, + //Note2: If there's problems in getting tooltips showing for certain tools, // setting the tab order may have effect. ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; @@ -1716,7 +1727,7 @@ { //If loading multiple instruments, advancing to next instrument and creating //new instrument if necessary. - if(counter > 0) + if(counter > 0) { if(m_nInstrument >= MAX_INSTRUMENTS - 1) break; @@ -1741,7 +1752,7 @@ { TCHAR szFileName[_MAX_PATH] = ""; ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; - + if (!pIns) return; if (pIns->filename[0]) { @@ -1767,7 +1778,7 @@ .WorkingDirectory(TrackerDirectories::Instance().GetWorkingDirectory(DIR_INSTRUMENTS)) .FilterIndex(&index); if(!dlg.Show(this)) return; - + BeginWaitCursor(); bool ok = false; @@ -1845,7 +1856,7 @@ m_SpinFadeOut.GetRange(minval, maxval); int nVol = GetDlgItemInt(IDC_EDIT7); Limit(nVol, minval, maxval); - + if(nVol != (int)pIns->nFadeOut) { pIns->nFadeOut = nVol; @@ -2001,7 +2012,7 @@ } //rewbs.MidiBank: we will not set the midi bank/program if it is 0 if (n==0) - { + { LockControls(); SetDlgItemText(IDC_EDIT10, "---"); UnlockControls(); @@ -2025,7 +2036,7 @@ } //rewbs.MidiBank: we will not set the midi bank/program if it is 0 if(w == 0) - { + { LockControls(); SetDlgItemText(IDC_EDIT11, "---"); UnlockControls(); @@ -2050,7 +2061,7 @@ } } -void CCtrlInstruments::OnResamplingChanged() +void CCtrlInstruments::OnResamplingChanged() //------------------------------------------ { ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; @@ -2085,7 +2096,7 @@ if(nPlug >= 0 && nPlug <= MAX_MIXPLUGINS) { if ((!IsLocked()) && pIns->nMixPlug != nPlug) - { + { pIns->nMixPlug = nPlug; SetModified(InstrumentHint().Info(), false); } @@ -2120,7 +2131,7 @@ if(plugin.pMixPlugin != nullptr) { GetDlgItem(IDC_INSVIEWPLG)->EnableWindow(true); - + if(active && plugin.pMixPlugin->isInstrument()) { if(pIns->nMidiChannel == MidiNoChannel) @@ -2157,7 +2168,7 @@ } } } - + } ::EnableWindow(::GetDlgItem(m_hWnd, IDC_INSVIEWPLG), false); } @@ -2285,7 +2296,7 @@ SwitchToView(); } -void CCtrlInstruments::OnFilterModeChanged() +void CCtrlInstruments::OnFilterModeChanged() //------------------------------------------ { ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; @@ -2350,9 +2361,9 @@ SetModified(InstrumentHint().Info(), false); } // -! NEW_FEATURE#0027 - } + } // Volume Swing - else if (pSlider == &m_SliderVolSwing) + else if (pSlider == &m_SliderVolSwing) { n = m_SliderVolSwing.GetPos(); if ((n >= 0) && (n <= 100) && (n != (int)pIns->nVolSwing)) @@ -2362,7 +2373,7 @@ } } // Pan Swing - else if (pSlider == &m_SliderPanSwing) + else if (pSlider == &m_SliderPanSwing) { n = m_SliderPanSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nPanSwing)) @@ -2372,7 +2383,7 @@ } } //Cutoff swing - else if (pSlider == &m_SliderCutSwing) + else if (pSlider == &m_SliderCutSwing) { n = m_SliderCutSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nCutSwing)) @@ -2382,7 +2393,7 @@ } } //Resonance swing - else if (pSlider == &m_SliderResSwing) + else if (pSlider == &m_SliderResSwing) { n = m_SliderResSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nResSwing)) @@ -2415,7 +2426,7 @@ filterChanger = true; } } - + // Update channels if (filterChanger) { @@ -2434,7 +2445,7 @@ { SwitchToView(); } - + } @@ -2474,24 +2485,24 @@ 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) || + 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); InputTargetContext ctx = (InputTargetContext)(kCtxCtrlInstruments); - + if (ih->KeyEvent(ctx, nChar, nRepCnt, nFlags, kT) != kcNull) return true; // Mapped to a command, no need to pass message on. } } - + return CModControlDlg::PreTranslateMessage(pMsg); } @@ -2500,7 +2511,7 @@ { if (wParam == kcNull) return NULL; - + switch(wParam) { case kcInstrumentCtrlLoad: OnInstrumentOpen(); return wParam; @@ -2509,7 +2520,7 @@ case kcInstrumentCtrlDuplicate: OnInstrumentDuplicate(); return wParam; } - + return 0; } @@ -2538,7 +2549,7 @@ sel -= 1; CTuningCollection* tc = 0; - + if(sel < CSoundFile::GetBuiltInTunings().GetNumTunings()) tc = &CSoundFile::GetBuiltInTunings(); else @@ -2586,7 +2597,7 @@ //Recreating tuning combobox so that possible //new tuning(s) come visible. BuildTuningComboBox(); - + UpdateView(InstrumentHint(m_nInstrument).Info()); } @@ -2849,10 +2860,10 @@ CHAR s[64]; for (PLUGINDEX nPlug = 0; nPlug <= MAX_MIXPLUGINS; nPlug++) { - if(!nPlug) - { + if(!nPlug) + { strcpy(s, "No plugin"); - } + } else { const SNDMIXPLUGIN &plugin = m_sndFile.m_MixPlugins[nPlug - 1]; Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-12-14 23:50:14 UTC (rev 4650) @@ -108,7 +108,7 @@ //--------------------------------------------------------------------------------------------------------------------------------------- { m_nInstrument = 0; - + m_bVUMeters = TrackerSettings::Instance().gbPatternVUMeters; m_bPluginNames = TrackerSettings::Instance().gbPatternPluginNames; //rewbs.patPlugNames m_bRecord = TrackerSettings::Instance().gbPatternRecord; @@ -198,7 +198,7 @@ m_SpinSequence.SetPos(m_sndFile.Order.GetCurrentSequenceIndex()); SetDlgItemText(IDC_EDIT_SEQUENCE_NAME, m_sndFile.Order.GetName().c_str()); - m_OrderList.SetFocus(); + m_OrderList.SetFocus(); UpdateView(PatternHint().Names().ModType(), NULL); RecalcLayout(); @@ -467,7 +467,7 @@ case CTRLMSG_PREVORDER: m_OrderList.SetCurSel(m_OrderList.GetCurSel(true).firstOrd - 1, true); break; - + case CTRLMSG_NEXTORDER: m_OrderList.SetCurSel(m_OrderList.GetCurSel(true).firstOrd + 1, true); break; @@ -497,7 +497,7 @@ { setLoop = (lParam != 0); } - + if (setLoop) { m_sndFile.m_SongFlags.set(SONG_PATTERNLOOP); @@ -505,7 +505,7 @@ } else { m_sndFile.m_SongFlags.reset(SONG_PATTERNLOOP); - CheckDlgButton(IDC_PATTERN_LOOP, BST_UNCHECKED); + CheckDlgButton(IDC_PATTERN_LOOP, BST_UNCHECKED); } break; @@ -595,7 +595,7 @@ } } SetCurrentPattern(nPat); - } + } else if ((lParam & 0x80000000)) { // Order item @@ -616,12 +616,18 @@ OnSpacingChanged(); if (m_bRecord) SendViewMessage(VIEWMSG_SETRECORD, m_bRecord); CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); - + //Restore all save pattern state, except pattern number which we might have just set. - PATTERNVIEWSTATE* patternViewState = pFrame->GetPatternViewState(); - patternViewState->nPattern = static_cast<PATTERNINDEX>(SendViewMessage(VIEWMSG_GETCURRENTPATTERN)); - if (pFrame) SendViewMessage(VIEWMSG_LOADSTATE, (LPARAM)patternViewState); - + PATTERNVIEWSTATE &patternViewState = pFrame->GetPatternViewState(); + if(patternViewState.initialOrder != ORDERINDEX_INVALID) + { + m_OrderList.SetCurSel(patternViewState.initialOrder); + patternViewState.initialOrder = ORDERINDEX_INVALID; + } + + patternViewState.nPattern = static_cast<PATTERNINDEX>(SendViewMessage(VIEWMSG_GETCURRENTPATTERN)); + if (pFrame) SendViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&patternViewState); + SwitchToView(); } @@ -634,7 +640,7 @@ //------------------------------------ { CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); - if ((pFrame) && (m_hWndView)) SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)pFrame->GetPatternViewState()); + if ((pFrame) && (m_hWndView)) SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)&pFrame->GetPatternViewState()); } @@ -723,7 +729,7 @@ if ((m_EditSpacing.m_hWnd) && (m_EditSpacing.GetWindowTextLength() > 0)) { TrackerSettings::Instance().gnPatternSpacing = GetDlgItemInt(IDC_EDIT_SPACING); - if (TrackerSettings::Instance().gnPatternSpacing > MAX_SPACING) + if (TrackerSettings::Instance().gnPatternSpacing > MAX_SPACING) { TrackerSettings::Instance().gnPatternSpacing = MAX_SPACING; SetDlgItemInt(IDC_EDIT_SPACING, TrackerSettings::Instance().gnPatternSpacing, FALSE); @@ -1089,7 +1095,7 @@ CHAR s[MAX_PATTERNNAME]; m_EditPatName.GetWindowText(s, CountOf(s)); mpt::String::SetNullTerminator(s); - + if(m_sndFile.Patterns[nPat].GetName() != s) { if(m_sndFile.Patterns[nPat].SetName(s)) @@ -1140,7 +1146,7 @@ m_sndFile.m_SongFlags.set(SONG_EMBEDMIDICFG); m_modDoc.SetModified(); } - } + } } } } @@ -1238,7 +1244,7 @@ return CModControlDlg::OnMouseWheel(nFlags, zDelta, pt); } -BOOL CCtrlPatterns::OnToolTip(UINT /*id*/, NMHDR *pNMHDR, LRESULT* /*pResult*/) +BOOL CCtrlPatterns::OnToolTip(UINT /*id*/, NMHDR *pNMHDR, LRESULT* /*pResult*/) //--------------------------------------------------------------------- { TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR; @@ -1268,7 +1274,7 @@ // avoid reloading the order list and thus setting the document modified if(newSeq == m_sndFile.Order.GetCurrentSequenceIndex()) return; - + if (newSeq >= MAX_SEQUENCES) { newSeq = MAX_SEQUENCES - 1; @@ -1278,5 +1284,4 @@ } } - OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-14 23:50:14 UTC (rev 4650) @@ -257,13 +257,13 @@ GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_SHOW); // PitchShiftTimeStretch GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_SHOW); // EstimateSampleSize GetDlgItem(IDC_CHECK3)->ShowWindow(SW_SHOW); // EnableStretchToSize - GetDlgItem(IDC_EDIT6)->ShowWindow(SW_SHOW); // + GetDlgItem(IDC_EDIT6)->ShowWindow(SW_SHOW); // GetDlgItem(IDC_GROUPBOX_PITCH_TIME)->ShowWindow(SW_SHOW); // GetDlgItem(IDC_TEXT_PITCH)->ShowWindow(SW_SHOW); // GetDlgItem(IDC_TEXT_QUALITY)->ShowWindow(SW_SHOW); // GetDlgItem(IDC_TEXT_FFT)->ShowWindow(SW_SHOW); // GetDlgItem(IDC_GROUPBOX_PITCH_TIME)->ShowWindow(SW_SHOW); // - + CHAR str[16]; // Pitch selection @@ -400,12 +400,20 @@ m_parent.InstrumentChanged(lParam); } } + + CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); + SAMPLEVIEWSTATE &sampleState = pFrame->GetSampleViewState(); + if(sampleState.initialSample != 0) + { + m_nSample = sampleState.initialSample; + sampleState.initialSample = 0; + } + SetCurrentSample((lParam > 0) ? ((SAMPLEINDEX)lParam) : m_nSample); // Initial Update if (!m_bInitialized) UpdateView(SampleHint(m_nSample).Info().ModType(), NULL); - CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); - if ((pFrame) && (m_hWndView)) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)pFrame->GetSampleViewState()); + if ((pFrame) && (m_hWndView)) PostViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&sampleState); SwitchToView(); // Combo boxes randomly disappear without this... why? @@ -417,7 +425,7 @@ //----------------------------------- { CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); - if ((pFrame) && (m_hWndView)) SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)pFrame->GetSampleViewState()); + if ((pFrame) && (m_hWndView)) SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)&pFrame->GetSampleViewState()); m_modDoc.NoteOff(0, true); } @@ -427,6 +435,10 @@ { switch(wParam) { + case CTRLMSG_GETCURRENTINSTRUMENT: + return m_nSample; + break; + case CTRLMSG_SMP_PREVINSTRUMENT: OnPrevInstrument(); break; @@ -505,7 +517,7 @@ case IDC_SAMPLE_SAVEAS: OnSampleSave(); break; - + case IDC_SAMPLE_NEW: OnSampleNew(); break; @@ -814,7 +826,7 @@ EndWaitCursor(); return false; } - + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Replace"); bool bOk = m_sndFile.ReadSampleFromFile(m_nSample, file, TrackerSettings::Instance().m_MayNormalizeSamplesOnLoad); ModSample &sample = m_sndFile.GetSample(m_nSample); @@ -834,7 +846,7 @@ rememberRawFormat = dlg.GetRemeberFormat(); BeginWaitCursor(); - + m_sndFile.DestroySampleThreadsafe(m_nSample); sample.nLength = file.GetLength(); @@ -1235,7 +1247,7 @@ { bool bOk = false; ModSample &sample = m_sndFile.GetSample(iSmp); - + if(minSample != maxSample) { //if more than one sample is selected, always amplify the whole sample. @@ -1589,7 +1601,7 @@ SmpLength procCount = resampler.process(&convBuffer[0], smpCount, outBuffer); const SmpLength procLatency = std::min(outLatency, procCount); procCount = std::min(procCount- procLatency, writeCount); - + switch(sample.GetElementarySampleSize()) { case 1: @@ -1699,7 +1711,7 @@ //Open dialog CPSRatioCalc dlg(m_sndFile, m_nSample, m_dTimeStretchRatio, this); if (dlg.DoModal() != IDOK) return; - + //Update ratio value&textbox m_dTimeStretchRatio = dlg.m_dRatio; UpdateData(FALSE); @@ -1740,7 +1752,7 @@ sample.uFlags[CHN_PINGPONGSUSTAIN], m_sndFile); } - + } // Pitch shifting else @@ -1855,7 +1867,7 @@ } // Initialize soundtouch object. - { + { soundtouch_setSampleRate(handleSt, nSampleRate); soundtouch_setChannels(handleSt, nChn); @@ -2376,7 +2388,7 @@ //------------------------------------ { TCHAR s[MAX_SAMPLEFILENAME] = _T(""); - + if(IsLocked()) return; m_EditFileName.GetWindowText(s, CountOf(s)); @@ -2775,7 +2787,7 @@ const uint8 *pSample = static_cast<const uint8 *>(sample.pSample); int pos; bool redraw = false; - + LockControls(); if ((!sample.nLength) || (!pSample)) goto NoSample; if (sample.uFlags[CHN_16BIT]) @@ -3013,24 +3025,24 @@ 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) || + 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 = (UINT)pMsg->wParam; UINT nRepCnt = LOWORD(pMsg->lParam); UINT nFlags = HIWORD(pMsg->lParam); KeyEventType kT = ih->GetKeyEventType(nFlags); InputTargetContext ctx = (InputTargetContext)(kCtxViewSamples); - + if (ih->KeyEvent(ctx, nChar, nRepCnt, nFlags, kT) != kcNull) return true; // Mapped to a command, no need to pass message on. } } - + return CModControlDlg::PreTranslateMessage(pMsg); } @@ -3039,7 +3051,7 @@ { if (wParam == kcNull) return NULL; - + int transpose = 0; switch(wParam) { @@ -3077,7 +3089,7 @@ } return wParam; } - + return 0; } //end rewbs.customKeys @@ -3251,5 +3263,4 @@ } } - OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/mptrack/Globals.cpp =================================================================== --- trunk/OpenMPT/mptrack/Globals.cpp 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Globals.cpp 2014-12-14 23:50:14 UTC (rev 4650) @@ -272,32 +272,27 @@ } -void CModControlView::OnUpdate(CView*, LPARAM lHint, CObject*pHint) -//----------------------------------------------------------------- +void CModControlView::OnUpdate(CView *, LPARAM lHint, CObject *pHint) +//------------------------------------------------------------------- { UpdateView(UpdateHint::FromLPARAM(lHint), pHint); } -void CModControlView::ForceRefresh() +void CModControlView::ForceRefresh() //--------------------------------- { SetActivePage(GetActivePage()); } -int CModControlView::GetActivePage() -//----------------------------------- -{ - return m_nActiveDlg; -} BOOL CModControlView::SetActivePage(int nIndex, LPARAM lParam) //------------------------------------------------------------ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModControlDlg *pDlg = NULL; - - + + if (nIndex == -1) nIndex = m_TabCtrl.GetCurSel(); const UINT nID = m_TabCtrl.GetItemData(nIndex); @@ -398,7 +393,7 @@ pMainFrm->SetInfoText(""); pMainFrm->SetXInfoText(""); //rewbs.xinfo pDlg->ShowWindow(SW_SHOW); - ((CChildFrame *)GetParentFrame())->SetSplitterHeight(*(pDlg->GetSplitPosRef())); //rewbs.varWindowSize + ((CChildFrame *)GetParentFrame())->SetSplitterHeight(*(pDlg->GetSplitPosRef())); //rewbs.varWindowSize if (m_hWndMDI) ::PostMessage(m_hWndMDI, WM_MOD_CHANGEVIEWCLASS, (WPARAM)lParam, (LPARAM)pDlg); return TRUE; } @@ -761,8 +756,8 @@ btn.iString = 0; return AddButtons(1, &btn); } - + void CModControlBar::UpdateStyle() //-------------------------------- { @@ -796,5 +791,4 @@ return 0; } - OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/mptrack/Globals.h =================================================================== --- trunk/OpenMPT/mptrack/Globals.h 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Globals.h 2014-12-14 23:50:14 UTC (rev 4650) @@ -116,8 +116,18 @@ class CModControlView: public CView //================================= { -protected: - enum { MAX_PAGES=6 }; //rewbs.graph: 5 to 6 +public: + enum Views + { + VIEW_UNKNOWN = -1, + VIEW_GLOBALS = 0, + VIEW_PATTERNS, + VIEW_SAMPLES, + VIEW_INSTRUMENTS, + VIEW_COMMENTS, + VIEW_PLUGINS, + MAX_PAGES + }; protected: CModTabCtrl m_TabCtrl; @@ -141,9 +151,11 @@ protected: void RecalcLayout(); void UpdateView(UpdateHint hint, CObject *pHint = nullptr); - BOOL SetActivePage(int nIndex=-1, LPARAM lParam=-1); - int GetActivePage(); + BOOL SetActivePage(int nIndex = -1, LPARAM lParam=-1); +public: + int GetActivePage() const { return m_nActiveDlg; } +protected: //{{AFX_VIRTUAL(CModControlView) public: virtual BOOL PreCreateWindow(CREATESTRUCT& cs); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-12-14 23:50:14 UTC (rev 4650) @@ -34,6 +34,8 @@ #include <shlwapi.h> #include "FileDialog.h" #include "ExternalSamples.h" +#include "Globals.h" +#include <sstream> #ifdef _DEBUG #define new DEBUG_NEW @@ -287,7 +289,7 @@ if (CDLSBank::IsDLSBank(pszMidiMapName)) { CDLSBank *pDLSBank = NULL; - + if ((pCachedBank) && (!mpt::PathString::CompareNoCase(szCachedBankFile, pszMidiMapName))) { pDLSBank = pCachedBank; @@ -375,11 +377,13 @@ ReinitRecordState(); // -! NEW_FEATURE#0015 + DeserializeViews(); + // Show warning if file was made with more recent version of OpenMPT except if(MptVersion::RemoveBuildNumber(m_SndFile.m_dwLastSavedWithVersion) > MptVersion::num) { char s[256]; - wsprintf(s, "Warning: this song was last saved with a more recent version of OpenMPT.\r\nSong saved with: v%s. Current version: v%s.\r\n", + wsprintf(s, "Warning: this song was last saved with a more recent version of OpenMPT.\r\nSong saved with: v%s. Current version: v%s.\r\n", MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion).c_str(), MptVersion::str); Reporting::Notification(s); @@ -410,7 +414,7 @@ static int greccount = 0; BOOL bOk = FALSE; m_SndFile.m_dwLastSavedWithVersion = MptVersion::num; - if(filename.empty()) + if(filename.empty()) return FALSE; MODTYPE type = m_SndFile.GetType(); // CModSpecifications::ExtensionToType(fext); @@ -447,6 +451,7 @@ if (pMainFrame) pMainFrame->CreateTemplateModulesMenu(); } + SerializeViews(); } else { ErrorBox(IDS_ERR_SAVESONG, CMainFrame::GetMainFrame()); @@ -579,7 +584,7 @@ { const mpt::PathString docFileName = GetPathNameMpt(); const std::string defaultExtension = m_SndFile.GetModSpecifications().fileExtension; - + switch(m_SndFile.GetBestSaveFormat()) { case MOD_TYPE_MOD: @@ -595,7 +600,7 @@ break; case MOD_TYPE_MPT: break; - default: + default: ErrorBox(IDS_ERR_SAVESONG, CMainFrame::GetMainFrame()); return FALSE; } @@ -614,7 +619,7 @@ fileName = mpt::PathString::FromCStringSilent(GetTitle()).SanitizeComponent(); } mpt::PathString defaultSaveName = drive + dir + fileName + ext; - + FileDialog dlg = SaveFileDialog() .DefaultExtension(defaultExtension) .DefaultFilename(defaultSaveName) @@ -634,10 +639,10 @@ if((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_CREATEBACKUP) && (IsModified()) && (!mpt::PathString::CompareNoCase(saveFileName, docFileName))) { - if(PathFileExistsW(saveFileName.AsNative().c_str())) + if(saveFileName.IsFile()) { mpt::PathString backupFileName = saveFileName.ReplaceExt(MPT_PATHSTRING(".bak")); - if(PathFileExistsW(backupFileName.AsNative().c_str())) + if(backupFileName.IsFile()) { DeleteFileW(backupFileName.AsNative().c_str()); } @@ -785,7 +790,7 @@ { CView* pView = GetNextView(pos); if (pView) pView->PostMessage(uMsg, wParam, lParam); - } + } } @@ -1052,7 +1057,7 @@ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CHANNELINDEX nChn = GetNumChannels(); - + if (pMainFrm == nullptr || note == NOTE_NONE) return FALSE; if (nVol > 256) nVol = 256; if (ModCommand::IsNote(ModCommand::NOTE(note))) @@ -1060,7 +1065,7 @@ //kill notes if required. if ( (pause) || (m_SndFile.IsPaused()) || pMainFrm->GetModPlaying() != this) - { + { CriticalSection cs; //OnPlayerPause(); // pause song - pausing VSTis is too slow @@ -1087,7 +1092,7 @@ // Find a channel to play on nChn = FindAvailableChannel(); ModChannel &chn = m_SndFile.m_PlayState.Chn[nChn]; - + // reset channel properties; in theory the chan is completely unused anyway. chn.Reset(ModChannel::resetTotal, m_SndFile, CHANNELINDEX_INVALID); chn.nMasterChn = 0; // remove NNA association @@ -1117,7 +1122,7 @@ m_SndFile.NoteChange(&chn, note, false, true, true); if (nVol >= 0) chn.nVolume = nVol; - + // Handle sample looping. // Changed line to fix http://forum.openmpt.org/index.php?topic=1700.0 //if ((loopstart + 16 < loopend) && (loopstart >= 0) && (loopend <= (LONG)pchn.nLength)) @@ -1137,7 +1142,7 @@ if(sampleOffset > 0 && chn.pModSample) { chn.nPos = sampleOffset; - // If start position is after loop end, set loop end to sample end so that the sample starts + // If start position is after loop end, set loop end to sample end so that the sample starts // playing. if(chn.nLoopEnd < sampleOffset) chn.nLength = chn.nLoopEnd = chn.pModSample->nLength; @@ -1150,13 +1155,13 @@ if (pIns && pIns->HasValidMIDIChannel()) // instro sends to a midi chan { // UINT nPlugin = m_SndFile.GetBestPlugin(nChn, PRIORITISE_INSTRUMENT, EVEN_IF_MUTED); - + PLUGINDEX nPlugin = 0; - if (chn.pModInstrument) + if (chn.pModInstrument) nPlugin = chn.pModInstrument->nMixPlug; // First try instrument plugin if ((!nPlugin || nPlugin > MAX_MIXPLUGINS) && nCurrentChn != CHANNELINDEX_INVALID) nPlugin = m_SndFile.ChnSettings[nCurrentChn].nMixPlugin; // Then try channel plugin - + if ((nPlugin) && (nPlugin <= MAX_MIXPLUGINS)) { IMixPlugin *pPlugin = m_SndFile.m_MixPlugins[nPlugin - 1].pMixPlugin; @@ -1199,7 +1204,7 @@ { plug = m_SndFile.ChnSettings[currentChn].nMixPlugin;// Then try Channel VST } - + if(plug && plug <= MAX_MIXPLUGINS) { IMixPlugin *pPlugin = m_SndFile.m_MixPlugins[plug - 1].pMixPlugin; @@ -1314,7 +1319,7 @@ if (m_SndFile.m_PlayState.Chn[i].nMasterChn == nChn + 1u) { if (doMute) - { + { m_SndFile.m_PlayState.Chn[i].dwFlags.set(muteType); } else { @@ -1636,7 +1641,7 @@ void CModDoc::ActivateWindow() //---------------------------- { - + CChildFrame *pChildFrm = GetChildFrame(); if(pChildFrm) pChildFrm->MDIActivate(); } @@ -1812,7 +1817,7 @@ MuteInstrument((INSTRUMENTINDEX)(i + 1), false); } } - + if(strcmp(fileNameAdd, "")) { SanitizeFilename(fileNameAdd); @@ -2104,7 +2109,7 @@ //User has sent play song command: set loop pattern checkbox to false. pChildFrm->SendViewMessage(VIEWMSG_PATTERNLOOP, 0); } - + pMainFrm->PauseMod(); CriticalSection cs; m_SndFile.m_SongFlags.reset(SONG_STEP | SONG_PATTERNLOOP); @@ -2270,7 +2275,7 @@ { s.AppendFormat(_T("\n\nTotal length:\t%.0fmn%02.0fs"), std::floor(totalLength / 60.0), std::fmod(totalLength, 60.0)); } - + Reporting::Information(s); } @@ -2339,7 +2344,7 @@ followSonghWnd = pChildFrm->GetHwndView(); PATTERNVIEWSTATE patternViewState; pChildFrm->SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)(&patternViewState)); - + pat = patternViewState.nPattern; row = patternViewState.cursor.GetRow(); ord = patternViewState.nOrder; @@ -2347,11 +2352,11 @@ { //patern editor object does not exist (i.e. is not active) - use saved state. followSonghWnd = NULL; - PATTERNVIEWSTATE *patternViewState = pChildFrm->GetPatternViewState(); + PATTERNVIEWSTATE &patternViewState = pChildFrm->GetPatternViewState(); - pat = patternViewState->nPattern; - row = patternViewState->cursor.GetRow(); - ord = patternViewState->nOrder; + pat = patternViewState.nPattern; + row = patternViewState.cursor.GetRow(); + ord = patternViewState.nOrder; } if(ord >= m_SndFile.Order.size()) @@ -2409,7 +2414,7 @@ followSonghWnd = GetEditPosition(nRow, nPat, nOrd); CModDoc *pModPlaying = pMainFrm->GetModPlaying(); - + CriticalSection cs; // Cut instruments/samples @@ -2437,7 +2442,7 @@ } cs.Leave(); - + if(pModPlaying != this) { SetNotifications(m_notifyType|Notification::Position|Notification::VUMeters, m_notifyItem); @@ -2470,7 +2475,7 @@ followSonghWnd = GetEditPosition(nRow,nPat,nOrd); CModDoc *pModPlaying = pMainFrm->GetModPlaying(); - + CriticalSection cs; // Cut instruments/samples @@ -2482,7 +2487,7 @@ m_SndFile.m_SongFlags.reset(SONG_PAUSED | SONG_STEP); m_SndFile.LoopPattern(nPat); m_SndFile.m_PlayState.m_nNextRow = nRow; - + // set playback timer in the status bar (and update channel status) SetElapsedTime(nOrd, nRow, true); @@ -2618,8 +2623,8 @@ case kcStopSong: OnPlayerStop(); break; case kcPanic: OnPanic(); break; // case kcPauseSong: OnPlayerPause(); break; - + } return wParam; @@ -2714,7 +2719,7 @@ for (int checkMacro = 0; checkMacro < NUM_MACROS; checkMacro++) { int macroType = m_SndFile.m_MidiCfg.GetParameteredMacroType(checkMacro); - + if (macroType == sfx_plug && m_SndFile.m_MidiCfg.MacroToPlugParam(checkMacro) == paramToUse) { CString message; @@ -2739,7 +2744,7 @@ CString message; message.Format("Parameter %02d can now be controlled with macro %X.", paramToUse, macroToSet); Reporting::Information(message, "Macro assigned for this parameter"); - + return; } @@ -2749,7 +2754,7 @@ { CModTypeDlg dlg(m_SndFile, CMainFrame::GetMainFrame()); if (dlg.DoModal() == IDOK) - { + { ScopedLogCapturer logcapturer(*this, "Conversion Status"); bool bShowLog = false; if(dlg.m_nType) @@ -2757,7 +2762,7 @@ if (!ChangeModType(dlg.m_nType)) return; bShowLog = true; } - + CHANNELINDEX nNewChannels = Clamp(dlg.m_nChannels, m_SndFile.GetModSpecifications().channelsMin, m_SndFile.GetModSpecifications().channelsMax); if (nNewChannels != GetNumChannels()) @@ -2799,7 +2804,7 @@ return TEXT(""); CString displayName, instrumentName, pluginName; - + // Get instrument name. instrumentName = m_SndFile.GetInstrumentName(nInstr); @@ -2892,7 +2897,7 @@ // Pattern names // std::string, doesn't need to be fixed. - + // Sequence names. // std::string, doesn't need to be fixed. } @@ -2960,4 +2965,162 @@ } +// Store all view positions t settings file +void CModDoc::SerializeViews() const +//---------------------------------- +{ + const mpt::PathString pathName = GetPathNameMpt(); + if(pathName.empty()) + { + return; + } + std::ostringstream f(std::ios::out | std::ios::binary); + + CRect mdiRect; + ::GetClientRect(CMainFrame::GetMainFrame()->m_hWndMDIClient, &mdiRect); + const int width = mdiRect.Width(); + const int height = mdiRect.Height(); + + // Document view positions and sizes + POSITION pos = GetFirstViewPosition(); + while(pos != nullptr) + { + CModControlView *pView = dynamic_cast<CModControlView *>(GetNextView(pos)); + if(pView) + { + CChildFrame *pChildFrm = (CChildFrame *)pView->GetParentFrame(); + WINDOWPLACEMENT wnd; + wnd.length = sizeof(WINDOWPLACEMENT); + pChildFrm->GetWindowPlacement(&wnd); + const CRect rect = wnd.rcNormalPosition; + + // Write size information + uint8_t windowState = 0; + if(wnd.showCmd == SW_SHOWMAXIMIZED) windowState = 1; + else if(wnd.showCmd == SW_SHOWMINIMIZED) windowState = 2; + mpt::IO::WriteIntLE<uint8_t>(f, 0); // Window type + mpt::IO::WriteIntLE<uint8_t>(f, windowState); + mpt::IO::WriteIntLE<int32_t>(f, Util::muldivr(rect.left, 1 << 30, width)); + mpt::IO::WriteIntLE<int32_t>(f, Util::muldivr(rect.top, 1 << 30, height)); + mpt::IO::WriteIntLE<int32_t>(f, Util::muldivr(rect.Width(), 1 << 30, width)); + mpt::IO::WriteIntLE<int32_t>(f, Util::muldivr(rect.Height(), 1 << 30, height)); + + std::string s = pChildFrm->SerializeView().str(); + mpt::IO::WriteVarInt(f, s.size()); + f << s; + } + } + // Plugin window positions + for(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; i++) + { + if(m_SndFile.m_MixPlugins[i].IsValidPlugin() && m_SndFile.m_MixPlugins[i].editorX != int32_min) + { + mpt::IO::WriteIntLE<uint8_t>(f, 1); // Window type + mpt::IO::WriteIntLE<uint8_t>(f, 0); // Version + mpt::IO::WriteVarInt(f, i); + mpt::IO::WriteIntLE<int32_t>(f, m_SndFile.m_MixPlugins[i].editorX); + mpt::IO::WriteIntLE<int32_t>(f, m_SndFile.m_MixPlugins[i].editorY); + } + } + + SettingsContainer &settings = theApp.GetSongSettings(); + const std::string s = f.str(); + const std::vector<char> data(s.begin(), s.end()); + settings.Write("WindowSettings", pathName.GetFullFileName().ToWide(), pathName); + settings.Write("WindowSettings", pathName.ToWide(), Util::BinToHex(data)); +} + + +// Restore all view positions from settings file +void CModDoc::DeserializeViews() +//------------------------------ +{ + const mpt::PathString pathName = GetPathNameMpt(); + if(pathName.empty()) return; + + SettingsContainer &settings = theApp.GetSongSettings(); + mpt::ustring s = settings.Read<mpt::ustring>("WindowSettings", pathName.ToWide()); + if(s.size() < 2) + { + // Try searching for filename instead of full path name + const std::wstring altName = settings.Read<std::wstring>("WindowSettings", pathName.GetFullFileName().ToWide()); + s = settings.Read<mpt::ustring>("WindowSettings", altName); + if(s.size() < 2) return; + } + std::vector<char> data = Util::HexToBin(s); + + FileReader file(&data[0], data.size()); + + CRect mdiRect; + ::GetWindowRect(CMainFrame::GetMainFrame()->m_hWndMDIClient, &mdiRect); + const int width = mdiRect.Width(); + const int height = mdiRect.Height(); + + POSITION pos = GetFirstViewPosition(); + CChildFrame *pChildFrm = nullptr; + if(pos != nullptr) pChildFrm = dynamic_cast<CChildFrame *>(GetNextView(pos)->GetParentFrame()); + + bool anyMaximized = false; + while(file.AreBytesLeft()) + { + const uint8 windowType = file.ReadUint8(); + if(windowType == 0) + { + // Document view positions and sizes + const uint8 windowState = file.ReadUint8(); + CRect rect; + rect.left = Util::muldivr(file.ReadInt32LE(), width, 1 << 30); + rect.top = Util::muldivr(file.ReadInt32LE(), height, 1 << 30); + rect.right = rect.left + Util::muldivr(file.ReadInt32LE(), width, 1 << 30); + rect.bottom = rect.top + Util::muldivr(file.ReadInt32LE(), height, 1 << 30); + size_t dataSize; + file.ReadVarInt(dataSize); + FileReader data = file.ReadChunk(dataSize); + + if(pChildFrm == nullptr) + { + CModDocTemplate *pTemplate = static_cast<CModDocTemplate *>(GetDocTemplate()); + ASSERT_VALID(pTemplate); + pChildFrm = static_cast<CChildFrame *>(pTemplate->CreateNewFrame(this, nullptr)); + if(pChildFrm != nullptr) + { + pTemplate->InitialUpdateFrame(pChildFrm, this); + } + } + if(pChildFrm != nullptr) + { + WINDOWPLACEMENT wnd; + wnd.length = sizeof(wnd); + pChildFrm->GetWindowPlacement(&wnd); + wnd.showCmd = SW_SHOWNOACTIVATE; + if(windowState == 1 || anyMaximized) + { + // Once a window has been maximized, all following windows have to be marked as maximized as well. + wnd.showCmd = SW_MAXIMIZE; + anyMaximized = true; + } else if(windowState == 2) + { + wnd.showCmd = SW_MINIMIZE; + } + if(rect.left < width && rect.right > 0 && rect.top < height && rect.bottom > 0) + { + wnd.rcNormalPosition = CRect(rect.left, rect.top, rect.right, rect.bottom); + } + pChildFrm->SetWindowPlacement(&wnd); + pChildFrm->DeserializeView(data); + pChildFrm = nullptr; + } + } else if(windowType == 1 && file.ReadUint8() == 0) + { + // Plugin window positions + PLUGINDEX plug = 0; + if(file.ReadVarInt(plug) && plug < MAX_MIXPLUGINS) + { + m_SndFile.m_MixPlugins[plug].editorX = file.ReadInt32LE(); + m_SndFile.m_MixPlugins[plug].editorY = file.ReadInt32LE(); + } + } + } +} + OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Moddoc.h 2014-12-14 23:50:14 UTC (rev 4650) @@ -177,7 +177,7 @@ SplitKeyboardSettings &GetSplitKeyboardSettings() { return m_SplitKeyboardSettings; } time_t GetCreationTime() const { return m_creationTime; } - + // operations public: bool ChangeModType(MODTYPE wType); @@ -226,7 +226,7 @@ bool IsChannelMuted(CHANNELINDEX nChn) const; bool IsSampleMuted(SAMPLEINDEX nSample) const; bool IsInstrumentMuted(INSTRUMENTINDEX nInstr) const; - + bool NoFxChannel(CHANNELINDEX nChn, bool bNoFx, bool updateMix = true); bool IsChannelNoFx(CHANNELINDEX nChn) const; bool IsChannelRecord1(CHANNELINDEX channel) const; @@ -274,7 +274,7 @@ void OnFileWaveConvert(ORDERINDEX nMinOrder, ORDERINDEX nMaxOrder, const std::vector<EncoderFactoryBase*> &encFactories); // Returns formatted ModInstrument name. - // [in] bEmptyInsteadOfNoName: In case of unnamed instrument string, "(no name)" is returned unless this + // [in] bEmptyInsteadOfNoName: In case of unnamed instrument string, "(no name)" is returned unless this // parameter is true is case which an empty name is returned. // [in] bIncludeIndex: True to include instrument index in front of the instrument name, false otherwise. CString GetPatternViewInstrumentName(INSTRUMENTINDEX nInstr, bool bEmptyInsteadOfNoName = false, bool bIncludeIndex = true) const; @@ -357,6 +357,8 @@ uint8 GetPlaybackMidiChannel(const ModInstrument *pIns, CHANNELINDEX nChn) const; + void SerializeViews() const; + void DeserializeViews(); // Implementation public: Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-12-14 23:50:14 UTC (rev 4650) @@ -58,8 +58,8 @@ const char *szSpecialNoteShortDesc[] = {TEXT("Param Control (Smooth)"), TEXT("Param Control"), TEXT("Note Fade"), TEXT("Note Cut"), TEXT("Note Off")}; // Make sure that special note arrays include string for every note. -STATIC_ASSERT(NOTE_MAX_SPECIAL - NOTE_MIN_SPECIAL + 1 == CountOf(szSpecialNoteNamesMPT)); -STATIC_ASSERT(CountOf(szSpecialNoteShortDesc) == CountOf(szSpecialNoteNamesMPT)); +STATIC_ASSERT(NOTE_MAX_SPECIAL - NOTE_MIN_SPECIAL + 1 == CountOf(szSpecialNoteNamesMPT)); +STATIC_ASSERT(CountOf(szSpecialNoteShortDesc) == CountOf(szSpecialNoteNamesMPT)); const char *szHexChar = "0123456789ABCDEF"; @@ -642,6 +642,7 @@ : m_GuiThreadId(0) , m_pTrackerDirectories(nullptr) , m_pSettingsIniFile(nullptr) + , m_pSongSettings(nullptr) , m_pSettings(nullptr) , m_pTrackerSettings(nullptr) , m_pComponentManagerSettings(nullptr) @@ -653,7 +654,7 @@ m_GuiThreadId = GetCurrentThreadId(); mpt::log::Trace::SetThreadId(mpt::log::Trace::ThreadKindGUI, m_GuiThreadId); - + ExceptionHandler::Register(); m_bPortableMode = false; @@ -926,11 +927,12 @@ CMainFrame::m_pAutoSaver = new CAutoSaver(); m_pSettingsIniFile = new IniFileSettingsBackend(m_szConfigFileName); - m_pSettings = new SettingsContainer(m_pSettingsIniFile); - m_pTrackerSettings = new TrackerSettings(*m_pSettings); + m_pSongSettingsIniFile = new IniFileSettingsBackend(m_szConfigDirectory + MPT_PATHSTRING("SongSettings.ini")); + m_pSongSettings = new SettingsContainer(m_pSongSettingsIniFile); + // enable debug features (as early as possible after reading the settings) if(TrackerSettings::Instance().DebugTraceEnable) { @@ -1068,7 +1070,7 @@ UninitializeDXPlugins(); ComponentManager::Release(); - + delete m_pPluginCache; m_pPluginCache = nullptr; delete m_pComponentManagerSettings; @@ -1079,6 +1081,10 @@ m_pSettings = nullptr; delete m_pSettingsIniFile; m_pSettingsIniFile = nullptr; + delete m_pSongSettings; + m_pSongSettings = nullptr; + delete m_pSongSettingsIniFile; + m_pSongSettingsIniFile = nullptr; delete m_pTrackerDirectories; m_pTrackerDirectories = nullptr; @@ -1300,7 +1306,7 @@ //--------------------------- { CPaintDC dc(this); - + CDC hdcMem; hdcMem.CreateCompatibleDC(&dc); CBitmap *oldBitmap = hdcMem.SelectObject(&m_Bitmap); @@ -1843,5 +1849,4 @@ return false; } - OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2014-12-13 23:30:29 UTC (rev 4649) +++ trunk/OpenMPT/mptrack/Mptrack.h 2014-12-14 23:50:14 UTC (rev 4650) @@ -176,7 +176,7 @@ { CDocument* pDoc = CWinApp::OpenDocumentFile(filename.empty() ? NULL : mpt::PathString::TunnelIntoCString(filename).GetString()); if (pDoc && bAddToMRU != TRUE) - RemoveMruItem(0); // This doesn't result to the same behaviour as not adding to MRU + RemoveMruItem(0); // This doesn't result to the same behaviour as not adding to MRU // (if the new item got added, it might have already dropped the last item out) return pDoc; } @@ -205,6 +205,8 @@ IniFileSettingsBackend *m_pSettingsIniFile; SettingsContainer *m_pSettings; TrackerSettings *m_pTrackerSettings; + IniFileSettingsBackend *m_pSongSettingsIniFile; + SettingsContainer *m_pSongSettings; ComponentManagerSettings *m_pComponentManagerSettings; IniFileSettingsContainer *m_pPluginCache; CModDocTemplate *m_pModTemplate; @@ -278,6 +280,12 @@ return *m_pPluginCache; } + SettingsContainer & GetSongSettings() + { + ASSERT(m_pSongSettings); + return *m_pSongSettings; + } + /// Returns path to config fold... [truncated message content] |
From: <sag...@us...> - 2014-12-16 21:49:56
|
Revision: 4657 http://sourceforge.net/p/modplug/code/4657 Author: saga-games Date: 2014-12-16 21:49:48 +0000 (Tue, 16 Dec 2014) Log Message: ----------- [Fix] Instrument tab was not updated properly after adding the first instrument (http://bugs.openmpt.org/view.php?id=618) [Mod] OpenMPT: Version is now 1.24.00.23 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-12-16 17:53:37 UTC (rev 4656) +++ trunk/OpenMPT/common/versionNumber.h 2014-12-16 21:49:48 UTC (rev 4657) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 24 #define VER_MINOR 00 -#define VER_MINORMINOR 22 +#define VER_MINORMINOR 23 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-16 17:53:37 UTC (rev 4656) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-12-16 21:49:48 UTC (rev 4657) @@ -1476,7 +1476,9 @@ } SetCurrentInstrument(m_nInstrument); - SetModified(InstrumentHint().Info().Envelope().Names(), true); + InstrumentHint hint = InstrumentHint().Info().Envelope().Names(); + if(bFirst) hint.ModType(); + SetModified(hint, true); } else bOk = FALSE; } SampleHint hint = SampleHint().Info().Data().Names(); @@ -1512,10 +1514,16 @@ cs.Leave(); - SetModified(InstrumentHint().Info().Envelope().Names(), true); - SampleHint hint = SampleHint().Info().Data().Names(); - if (bFirst) hint.ModType(); - m_modDoc.UpdateAllViews(nullptr, hint, this); + { + InstrumentHint hint = InstrumentHint().Info().Envelope().Names(); + if (bFirst) hint.ModType(); + SetModified(hint, true); + } + { + SampleHint hint = SampleHint().Info().Data().Names(); + if (bFirst) hint.ModType(); + m_modDoc.UpdateAllViews(nullptr, hint, this); + } EndWaitCursor(); return TRUE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-19 19:04:39
|
Revision: 4658 http://sourceforge.net/p/modplug/code/4658 Author: saga-games Date: 2014-12-19 19:04:33 +0000 (Fri, 19 Dec 2014) Log Message: ----------- [Imp] Update r8brain to r72. Revision Links: -------------- http://sourceforge.net/p/modplug/code/72 Modified Paths: -------------- trunk/OpenMPT/include/r8brain/CDSPBlockConvolver.h trunk/OpenMPT/include/r8brain/CDSPResampler.h trunk/OpenMPT/include/r8brain/OpenMPT.txt trunk/OpenMPT/include/r8brain/r8bbase.h trunk/OpenMPT/mptrack/Ctrl_smp.cpp Modified: trunk/OpenMPT/include/r8brain/CDSPBlockConvolver.h =================================================================== --- trunk/OpenMPT/include/r8brain/CDSPBlockConvolver.h 2014-12-16 21:49:48 UTC (rev 4657) +++ trunk/OpenMPT/include/r8brain/CDSPBlockConvolver.h 2014-12-19 19:04:33 UTC (rev 4658) @@ -294,7 +294,7 @@ ilu = InputLen; } - const int pil = PrevInputLen * sizeof( double ); + const int pil = (int) ( PrevInputLen * sizeof( double )); memcpy( &CurInput[ ilu ], PrevInput, pil ); memcpy( PrevInput, &CurInput[ ilu - PrevInputLen ], pil ); Modified: trunk/OpenMPT/include/r8brain/CDSPResampler.h =================================================================== --- trunk/OpenMPT/include/r8brain/CDSPResampler.h 2014-12-16 21:49:48 UTC (rev 4657) +++ trunk/OpenMPT/include/r8brain/CDSPResampler.h 2014-12-19 19:04:33 UTC (rev 4658) @@ -383,7 +383,7 @@ } double* ip = ip0; - double* op; + double* op = NULL; int i; for( i = 0; i < ConvCount; i++ ) Modified: trunk/OpenMPT/include/r8brain/OpenMPT.txt =================================================================== --- trunk/OpenMPT/include/r8brain/OpenMPT.txt 2014-12-16 21:49:48 UTC (rev 4657) +++ trunk/OpenMPT/include/r8brain/OpenMPT.txt 2014-12-19 19:04:33 UTC (rev 4658) @@ -1,4 +1,4 @@ -r8brain-free resampling library from https://code.google.com/p/r8brain-free-src/ revision 71. +r8brain-free resampling library from https://code.google.com/p/r8brain-free-src/ revision 72. The (non-functional) example program, DLL folder and logo file have been removed. No further local changes have been made. For building, premake4 is used to generate Visual Studio project files. Modified: trunk/OpenMPT/include/r8brain/r8bbase.h =================================================================== --- trunk/OpenMPT/include/r8brain/r8bbase.h 2014-12-16 21:49:48 UTC (rev 4657) +++ trunk/OpenMPT/include/r8brain/r8bbase.h 2014-12-19 19:04:33 UTC (rev 4658) @@ -859,40 +859,54 @@ /** * Function calculates frequency response of the specified FIR filter at the - * specified circular frequency. + * specified circular frequency. Phase can be calculated as atan2( im, re ). * * @param flt FIR filter's coefficients. * @param fltlen Number of coefficients (taps) in the filter. * @param th Circular frequency [0; pi]. * @param[out] re0 Resulting real part of the complex frequency response. * @param[out] im0 Resulting imaginary part of the complex frequency response. + * @param fltlat Filter's latency in samples. */ inline void calcFIRFilterResponse( const double* flt, int fltlen, - const double th, double& re0, double& im0 ) + const double th, double& re0, double& im0, const int fltlat = 0 ) { - double svalue1 = 0.0; - double svalue2 = sin( -th ); const double sincr = 2.0 * cos( th ); - double cvalue1 = 1.0; - double cvalue2 = sin( M_PId2 - th ); + double cvalue1; + double svalue1; + + if( fltlat == 0 ) + { + cvalue1 = 1.0; + svalue1 = 0.0; + } + else + { + cvalue1 = cos( -fltlat * th ); + svalue1 = sin( -fltlat * th ); + } + + double cvalue2 = cos( -( fltlat + 1 ) * th ); + double svalue2 = sin( -( fltlat + 1 ) * th ); + double re = 0.0; double im = 0.0; while( fltlen > 0 ) { - re += svalue1 * flt[ 0 ]; - im += cvalue1 * flt[ 0 ]; + re += cvalue1 * flt[ 0 ]; + im += svalue1 * flt[ 0 ]; flt++; fltlen--; - double tmp = svalue1; + double tmp = cvalue1; + cvalue1 = sincr * cvalue1 - cvalue2; + cvalue2 = tmp; + + tmp = svalue1; svalue1 = sincr * svalue1 - svalue2; svalue2 = tmp; - - tmp = cvalue1; - cvalue1 = sincr * cvalue1 - cvalue2; - cvalue2 = tmp; } re0 = re; Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-16 21:49:48 UTC (rev 4657) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-12-19 19:04:33 UTC (rev 4658) @@ -36,9 +36,7 @@ #include <math.h> #endif -#pragma warning(disable:4701) #include "../include/r8brain/CDSPResampler.h" -#pragma warning(default:4701) #ifdef _DEBUG #define new DEBUG_NEW This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-12-20 20:06:46
|
Revision: 4661 http://sourceforge.net/p/modplug/code/4661 Author: saga-games Date: 2014-12-20 20:06:32 +0000 (Sat, 20 Dec 2014) Log Message: ----------- [Imp] General tab: Show formatted parameter value by default, change to float representation on click [Fix] MIDI I/O Plugin: Fix display of parameter value if it has not been initalized yet Modified Paths: -------------- trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_gen.h trunk/OpenMPT/plugins/MidiInOut/MidiInOut.cpp trunk/OpenMPT/plugins/MidiInOut/MidiInOut.h Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2014-12-20 02:05:39 UTC (rev 4660) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2014-12-20 20:06:32 UTC (rev 4661) @@ -52,6 +52,26 @@ ON_COMMAND(IDC_CHECK4, OnSurround2) ON_COMMAND(IDC_CHECK6, OnSurround3) ON_COMMAND(IDC_CHECK8, OnSurround4) + + ON_EN_UPDATE(IDC_EDIT1, OnEditVol1) + ON_EN_UPDATE(IDC_EDIT3, OnEditVol2) + ON_EN_UPDATE(IDC_EDIT5, OnEditVol3) + ON_EN_UPDATE(IDC_EDIT7, OnEditVol4) + ON_EN_UPDATE(IDC_EDIT2, OnEditPan1) + ON_EN_UPDATE(IDC_EDIT4, OnEditPan2) + ON_EN_UPDATE(IDC_EDIT6, OnEditPan3) + ON_EN_UPDATE(IDC_EDIT8, OnEditPan4) + ON_EN_UPDATE(IDC_EDIT9, OnEditName1) + ON_EN_UPDATE(IDC_EDIT10, OnEditName2) + ON_EN_UPDATE(IDC_EDIT11, OnEditName3) + ON_EN_UPDATE(IDC_EDIT12, OnEditName4) + + ON_CBN_SELCHANGE(IDC_COMBO1, OnFx1Changed) + ON_CBN_SELCHANGE(IDC_COMBO2, OnFx2Changed) + ON_CBN_SELCHANGE(IDC_COMBO3, OnFx3Changed) + ON_CBN_SELCHANGE(IDC_COMBO4, OnFx4Changed) + + // Plugins ON_COMMAND(IDC_CHECK9, OnMixModeChanged) ON_COMMAND(IDC_CHECK10, OnBypassChanged) ON_COMMAND(IDC_CHECK11, OnDryMixChanged) @@ -64,28 +84,14 @@ ON_COMMAND(IDC_INSERTFXSLOT,OnInsertSlot) ON_COMMAND(IDC_CLONEPLUG, OnClonePlug) - ON_COMMAND(IDC_BUTTON6, OnLoadParam) ON_COMMAND(IDC_BUTTON8, OnSaveParam) ON_COMMAND(IDC_BUTTON7, OnSetWetDry) - ON_EN_UPDATE(IDC_EDIT1, OnEditVol1) - ON_EN_UPDATE(IDC_EDIT3, OnEditVol2) - ON_EN_UPDATE(IDC_EDIT5, OnEditVol3) - ON_EN_UPDATE(IDC_EDIT7, OnEditVol4) - ON_EN_UPDATE(IDC_EDIT2, OnEditPan1) - ON_EN_UPDATE(IDC_EDIT4, OnEditPan2) - ON_EN_UPDATE(IDC_EDIT6, OnEditPan3) - ON_EN_UPDATE(IDC_EDIT8, OnEditPan4) - ON_EN_UPDATE(IDC_EDIT9, OnEditName1) - ON_EN_UPDATE(IDC_EDIT10, OnEditName2) - ON_EN_UPDATE(IDC_EDIT11, OnEditName3) - ON_EN_UPDATE(IDC_EDIT12, OnEditName4) ON_EN_UPDATE(IDC_EDIT13, OnPluginNameChanged) - ON_CBN_SELCHANGE(IDC_COMBO1, OnFx1Changed) - ON_CBN_SELCHANGE(IDC_COMBO2, OnFx2Changed) - ON_CBN_SELCHANGE(IDC_COMBO3, OnFx3Changed) - ON_CBN_SELCHANGE(IDC_COMBO4, OnFx4Changed) + ON_EN_UPDATE(IDC_EDIT14, OnSetParameter) + ON_EN_SETFOCUS(IDC_EDIT14, OnFocusParam) + ON_EN_KILLFOCUS(IDC_EDIT14, OnParamChanged) ON_CBN_SELCHANGE(IDC_COMBO5, OnPluginChanged) ON_CBN_SELCHANGE(IDC_COMBO6, OnParamChanged) @@ -972,23 +978,48 @@ if(cursel >= 0 && cursel < nParams) m_nCurrentParam = cursel; if(m_nCurrentParam < nParams) { - TCHAR s[32]; - //wsprintf(s, _T("Value: %s"), pVstPlugin->GetFormattedParamValue(m_nCurrentParam)); - //SetDlgItemText(IDC_TEXT5, s); - float fValue = pVstPlugin->GetParameter(m_nCurrentParam); - int nValue = (int)(fValue * 100.0f + 0.5f); - sprintf(s, _T("%f"), fValue); //wsprintf(s, "%d.%02d", nValue/100, nValue%100); // ericus 25/01/2005 - SetDlgItemText(IDC_EDIT14, s); + int nValue = Util::Round<int>(pVstPlugin->GetParameter(m_nCurrentParam) * 100.0f); + LockControls(); + if(GetFocus() != GetDlgItem(IDC_EDIT14)) + { + CString s = pVstPlugin->GetFormattedParamValue(m_nCurrentParam).Trim(); + if(s.IsEmpty()) + { + s.Format(_T("%f"), pVstPlugin->GetParameter(m_nCurrentParam)); + } + SetDlgItemText(IDC_EDIT14, s); + } m_sbValue.SetPos(nValue); + UnlockControls(); return; } } - //SetDlgItemText(IDC_TEXT5, "Value:"); SetDlgItemText(IDC_EDIT14, ""); m_sbValue.SetPos(0); } +// When focussing the parameter value, show its real value to edit +void CViewGlobals::OnFocusParam() +//------------------------------- +{ + IMixPlugin *pVstPlugin = GetCurrentPlugin(); + if(pVstPlugin != nullptr) + { + const PlugParamIndex nParams = pVstPlugin->GetNumParameters(); + if(m_nCurrentParam < nParams) + { + TCHAR s[32]; + float fValue = pVstPlugin->GetParameter(m_nCurrentParam); + sprintf(s, _T("%f"), fValue); + LockControls(); + SetDlgItemText(IDC_EDIT14, s); + UnlockControls(); + } + } +} + + void CViewGlobals::SetPluginModified() //------------------------------------ { @@ -1048,13 +1079,9 @@ void CViewGlobals::OnSetParameter() //--------------------------------- { - CModDoc *pModDoc = GetDocument(); - CSoundFile *pSndFile; + if(m_nCurrentPlugin >= MAX_MIXPLUGINS || IsLocked()) return; + IMixPlugin *pVstPlugin = GetCurrentPlugin(); - if ((m_nCurrentPlugin >= MAX_MIXPLUGINS) || (!pModDoc)) return; - pSndFile = pModDoc->GetSoundFile(); - CVstPlugin *pVstPlugin = GetCurrentPlugin(); - if(pVstPlugin != nullptr) { const PlugParamIndex nParams = pVstPlugin->GetNumParameters(); Modified: trunk/OpenMPT/mptrack/View_gen.h =================================================================== --- trunk/OpenMPT/mptrack/View_gen.h 2014-12-20 02:05:39 UTC (rev 4660) +++ trunk/OpenMPT/mptrack/View_gen.h 2014-12-20 20:06:32 UTC (rev 4661) @@ -120,20 +120,14 @@ afx_msg void OnPluginNameChanged(); afx_msg void OnFillParamCombo(); afx_msg void OnParamChanged(); -// -> CODE#0002 -// -> DESC="VST plugins presets" + afx_msg void OnFocusParam(); afx_msg void OnFillProgramCombo(); afx_msg void OnProgramChanged(); afx_msg void OnLoadParam(); afx_msg void OnSaveParam(); -// -! NEW_FEATURE#0002 afx_msg void OnSelectPlugin(); afx_msg void OnSetParameter(); -// -> CODE#0014 -// -> DESC="vst wet/dry slider" afx_msg void OnSetWetDry(); -// afx_msg void OnWetDryChanged(); -// -! NEW_FEATURE#0014 afx_msg void OnEditPlugin(); afx_msg void OnMixModeChanged(); afx_msg void OnBypassChanged(); @@ -142,11 +136,8 @@ afx_msg void OnInsertSlot(); afx_msg void OnClonePlug(); -// -> CODE#0028 -// -> DESC="effect plugin mixing mode combo" afx_msg void OnWetDryExpandChanged(); afx_msg void OnSpecialMixProcessingChanged(); -// -! NEW_FEATURE#0028 afx_msg void OnOutputRoutingChanged(); afx_msg void OnPrevPlugin(); Modified: trunk/OpenMPT/plugins/MidiInOut/MidiInOut.cpp =================================================================== --- trunk/OpenMPT/plugins/MidiInOut/MidiInOut.cpp 2014-12-20 02:05:39 UTC (rev 4660) +++ trunk/OpenMPT/plugins/MidiInOut/MidiInOut.cpp 2014-12-20 20:06:32 UTC (rev 4661) @@ -433,8 +433,7 @@ if(device.index == noDevice) { // Dummy device - device.stream = nullptr; - device.name = "<none>"; + device = MidiDevice(); return; } Modified: trunk/OpenMPT/plugins/MidiInOut/MidiInOut.h =================================================================== --- trunk/OpenMPT/plugins/MidiInOut/MidiInOut.h 2014-12-20 02:05:39 UTC (rev 4660) +++ trunk/OpenMPT/plugins/MidiInOut/MidiInOut.h 2014-12-20 20:06:32 UTC (rev 4661) @@ -23,7 +23,7 @@ OPENMPT_NAMESPACE_BEGIN - + //============== class MidiDevice //============== @@ -38,6 +38,7 @@ { index = -1; // MidiInOut::noDevice stream = nullptr; + name = "<none>"; } }; @@ -68,9 +69,9 @@ // I/O device settings MidiDevice inputDevice; MidiDevice outputDevice; - bool isProcessing; - bool isBypassed; - bool latencyCompensation; + bool isProcessing : 1; + bool isBypassed : 1; + bool latencyCompensation : 1; char programName[kVstMaxProgNameLen + 1]; static int numInstances; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |