Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libopenmpt for openSUSE:Factory checked in at 2021-10-29 22:33:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libopenmpt (Old) and /work/SRC/openSUSE:Factory/.libopenmpt.new.1890 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libopenmpt" Fri Oct 29 22:33:37 2021 rev:31 rq:927424 version:0.5.12 Changes: -------- --- /work/SRC/openSUSE:Factory/libopenmpt/libopenmpt.changes 2021-08-26 23:14:20.792271616 +0200 +++ /work/SRC/openSUSE:Factory/.libopenmpt.new.1890/libopenmpt.changes 2021-10-29 22:34:27.391687181 +0200 @@ -1,0 +2,23 @@ +Fri Oct 22 13:02:36 UTC 2021 - Danilo Spinella <danilo.spine...@suse.com> + +- Update to 0.5.12: + * [Sec] Possible crash when loading malformed MDL files. (r15603) + + * [Bug] Fixed various undefined behaviour found with ubsan. + * Seeking with sample sync sometimes didn???t compute the correct + sample position with pingpong-looped samples. + * IT: Tremor command I11 erroneously behaved like I00 (use previous + parameter) unless IT Old Effects were enabled. + * PTM: Panning was translated wrong in some edge cases. + * IMF / PTM: Note Slide commands were sometimes slightly off. + * OKT: Better support for fine note slides. + * DBM: Echo enable effect parameter range checks were incorrect. + + * XM: Sample texts in XMs made with MadTracker are now also + decoded using Windows-1252 encoding. + + * in_openmpt: Song metadata is no longer reverted when viewing + file info. + * mpg123: Update to v1.29.0 (2021-09-06). + +------------------------------------------------------------------- Old: ---- libopenmpt-0.5.11+release.autotools.tar.gz New: ---- libopenmpt-0.5.12+release.autotools.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libopenmpt.spec ++++++ --- /var/tmp/diff_new_pack.puHiqn/_old 2021-10-29 22:34:27.839687350 +0200 +++ /var/tmp/diff_new_pack.puHiqn/_new 2021-10-29 22:34:27.843687351 +0200 @@ -21,7 +21,7 @@ %define libopenmpt_modplug_version 0.8.9.0 Name: libopenmpt -Version: 0.5.11 +Version: 0.5.12 Release: 0 Summary: C++ and C library to decode tracker music files License: BSD-3-Clause ++++++ libopenmpt-0.5.11+release.autotools.tar.gz -> libopenmpt-0.5.12+release.autotools.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/common/versionNumber.h new/libopenmpt-0.5.12+release.autotools/common/versionNumber.h --- old/libopenmpt-0.5.11+release.autotools/common/versionNumber.h 2021-08-22 14:54:32.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/common/versionNumber.h 2021-10-03 17:44:24.000000000 +0200 @@ -17,7 +17,7 @@ // Version definitions. The only thing that needs to be changed when changing version number. #define VER_MAJORMAJOR 1 #define VER_MAJOR 29 -#define VER_MINOR 12 +#define VER_MINOR 13 #define VER_MINORMINOR 00 OPENMPT_NAMESPACE_END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/configure new/libopenmpt-0.5.12+release.autotools/configure --- old/libopenmpt-0.5.11+release.autotools/configure 2021-08-22 15:24:59.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/configure 2021-10-04 15:51:33.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libopenmpt 0.5.11+release.autotools. +# Generated by GNU Autoconf 2.69 for libopenmpt 0.5.12+release.autotools. # # Report bugs to <https://bugs.openmpt.org/>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libopenmpt' PACKAGE_TARNAME='libopenmpt' -PACKAGE_VERSION='0.5.11+release.autotools' -PACKAGE_STRING='libopenmpt 0.5.11+release.autotools' +PACKAGE_VERSION='0.5.12+release.autotools' +PACKAGE_STRING='libopenmpt 0.5.12+release.autotools' PACKAGE_BUGREPORT='https://bugs.openmpt.org/' PACKAGE_URL='https://lib.openmpt.org/' @@ -1472,7 +1472,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libopenmpt 0.5.11+release.autotools to adapt to many kinds of systems. +\`configure' configures libopenmpt 0.5.12+release.autotools to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1543,7 +1543,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libopenmpt 0.5.11+release.autotools:";; + short | recursive ) echo "Configuration of libopenmpt 0.5.12+release.autotools:";; esac cat <<\_ACEOF @@ -1729,7 +1729,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libopenmpt configure 0.5.11+release.autotools +libopenmpt configure 0.5.12+release.autotools generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2219,7 +2219,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libopenmpt $as_me 0.5.11+release.autotools, which was +It was created by libopenmpt $as_me 0.5.12+release.autotools, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3090,7 +3090,7 @@ # Define the identity of the package. PACKAGE='libopenmpt' - VERSION='0.5.11+release.autotools' + VERSION='0.5.12+release.autotools' cat >>confdefs.h <<_ACEOF @@ -17251,13 +17251,13 @@ -$as_echo "#define MPT_SVNURL \"https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.5.11\"" >>confdefs.h +$as_echo "#define MPT_SVNURL \"https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.5.12\"" >>confdefs.h -$as_echo "#define MPT_SVNVERSION \"15552\"" >>confdefs.h +$as_echo "#define MPT_SVNVERSION \"15759\"" >>confdefs.h -$as_echo "#define MPT_SVNDATE \"2021-08-22T13:20:52.381159Z\"" >>confdefs.h +$as_echo "#define MPT_SVNDATE \"2021-10-04T13:48:02.912129Z\"" >>confdefs.h $as_echo "#define MPT_PACKAGE true" >>confdefs.h @@ -22524,7 +22524,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libopenmpt $as_me 0.5.11+release.autotools, which was +This file was extended by libopenmpt $as_me 0.5.12+release.autotools, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22591,7 +22591,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libopenmpt config.status 0.5.11+release.autotools +libopenmpt config.status 0.5.12+release.autotools configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/configure.ac new/libopenmpt-0.5.12+release.autotools/configure.ac --- old/libopenmpt-0.5.11+release.autotools/configure.ac 2021-08-22 15:24:50.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/configure.ac 2021-10-04 15:51:11.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT([libopenmpt], [0.5.11+release.autotools], [https://bugs.openmpt.org/], [libopenmpt], [https://lib.openmpt.org/]) +AC_INIT([libopenmpt], [0.5.12+release.autotools], [https://bugs.openmpt.org/], [libopenmpt], [https://lib.openmpt.org/]) AC_PREREQ([2.68]) AC_CONFIG_MACRO_DIR([m4]) @@ -27,9 +27,9 @@ AC_SUBST([LIBOPENMPT_LTVER_REVISION]) AC_SUBST([LIBOPENMPT_LTVER_AGE]) -AC_DEFINE([MPT_SVNURL], ["https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.5.11"], [svn version]) -AC_DEFINE([MPT_SVNVERSION], ["15552"], [svn version]) -AC_DEFINE([MPT_SVNDATE], ["2021-08-22T13:20:52.381159Z"], [svn date]) +AC_DEFINE([MPT_SVNURL], ["https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.5.12"], [svn version]) +AC_DEFINE([MPT_SVNVERSION], ["15759"], [svn version]) +AC_DEFINE([MPT_SVNDATE], ["2021-10-04T13:48:02.912129Z"], [svn date]) AC_DEFINE([MPT_PACKAGE], [true], [is package]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/libopenmpt/dox/changelog.md new/libopenmpt-0.5.12+release.autotools/libopenmpt/dox/changelog.md --- old/libopenmpt-0.5.11+release.autotools/libopenmpt/dox/changelog.md 2021-08-22 15:20:49.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/libopenmpt/dox/changelog.md 2021-10-04 15:48:00.000000000 +0200 @@ -5,6 +5,25 @@ For fully detailed change log, please see the source repository directly. This is just a high-level summary. +### libopenmpt 0.5.12 (2021-10-04) + + * [**Sec**] Possible crash when loading malformed MDL files. (r15603) + + * [**Bug**] Fixed various undefined behaviour found with ubsan. + + * Seeking with sample sync sometimes didn't compute the correct sample + position with pingpong-looped samples. + * IT: Tremor command I11 erroneously behaved like I00 (use previous parameter) + unless IT Old Effects were enabled. + * PTM: Panning was translated wrong in some edge cases. + * IMF / PTM: Note Slide commands were sometimes slightly off. + * OKT: Better support for fine note slides. + * DBM: Echo enable effect parameter range checks were incorrect. + * XM: Sample texts in XMs made with MadTracker are now also decoded using + Windows-1252 encoding. + + * in_openmpt: Song metadata is no longer reverted when viewing file info. + ### libopenmpt 0.5.11 (2021-08-22) * [**Sec**] Possible crash with malformed modules when trying to access diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/libopenmpt/libopenmpt_version.h new/libopenmpt-0.5.12+release.autotools/libopenmpt/libopenmpt_version.h --- old/libopenmpt-0.5.11+release.autotools/libopenmpt/libopenmpt_version.h 2021-08-22 15:20:49.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/libopenmpt/libopenmpt_version.h 2021-10-04 15:48:00.000000000 +0200 @@ -19,7 +19,7 @@ /*! \brief libopenmpt minor version number */ #define OPENMPT_API_VERSION_MINOR 5 /*! \brief libopenmpt patch version number */ -#define OPENMPT_API_VERSION_PATCH 11 +#define OPENMPT_API_VERSION_PATCH 12 /*! \brief libopenmpt pre-release tag */ #define OPENMPT_API_VERSION_PREREL "" /*! \brief libopenmpt pre-release flag */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/libopenmpt/libopenmpt_version.mk new/libopenmpt-0.5.12+release.autotools/libopenmpt/libopenmpt_version.mk --- old/libopenmpt-0.5.11+release.autotools/libopenmpt/libopenmpt_version.mk 2021-08-22 15:20:49.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/libopenmpt/libopenmpt_version.mk 2021-10-04 15:48:00.000000000 +0200 @@ -1,8 +1,8 @@ LIBOPENMPT_VERSION_MAJOR=0 LIBOPENMPT_VERSION_MINOR=5 -LIBOPENMPT_VERSION_PATCH=11 +LIBOPENMPT_VERSION_PATCH=12 LIBOPENMPT_VERSION_PREREL= LIBOPENMPT_LTVER_CURRENT=2 -LIBOPENMPT_LTVER_REVISION=11 +LIBOPENMPT_LTVER_REVISION=12 LIBOPENMPT_LTVER_AGE=2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/man/openmpt123.1 new/libopenmpt-0.5.12+release.autotools/man/openmpt123.1 --- old/libopenmpt-0.5.11+release.autotools/man/openmpt123.1 2021-08-22 15:24:49.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/man/openmpt123.1 2021-10-04 15:51:11.000000000 +0200 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8. -.TH OPENMPT123 "1" "August 2021" "openmpt123 v0.5.11" "User Commands" +.TH OPENMPT123 "1" "October 2021" "openmpt123 v0.5.12" "User Commands" .SH NAME openmpt123 - command line module music player based on libopenmpt .SH SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/openmpt123/openmpt123.cpp new/libopenmpt-0.5.12+release.autotools/openmpt123/openmpt123.cpp --- old/libopenmpt-0.5.11+release.autotools/openmpt123/openmpt123.cpp 2021-02-24 16:08:09.000000000 +0100 +++ new/libopenmpt-0.5.12+release.autotools/openmpt123/openmpt123.cpp 2021-09-15 17:09:22.000000000 +0200 @@ -504,7 +504,7 @@ SDL_version sdlver; std::memset( &sdlver, 0, sizeof( SDL_version ) ); SDL_GetVersion( &sdlver ); - log << static_cast<int>( sdlver.major ) << "." << static_cast<int>( sdlver.minor ) << "." << static_cast<int>( sdlver.patch ) << "." << SDL_GetRevisionNumber(); + log << static_cast<int>( sdlver.major ) << "." << static_cast<int>( sdlver.minor ) << "." << static_cast<int>( sdlver.patch ); const char * revision = SDL_GetRevision(); if ( revision ) { log << " (" << revision << ")"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Dlsbank.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Dlsbank.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Dlsbank.cpp 2021-08-15 20:42:21.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Dlsbank.cpp 2021-09-13 00:47:14.000000000 +0200 @@ -583,8 +583,6 @@ { if(m_Instruments.empty()) return nullptr; - uint8 smallestRegion = uint8_max; - uint32 bestMatch = uint32_max; for (uint32 iIns = 0; iIns < m_Instruments.size(); iIns++) { const DLSINSTRUMENT &dlsIns = m_Instruments[iIns]; @@ -599,16 +597,15 @@ { if(region.nWaveLink == Util::MaxValueOfType(region.nWaveLink)) continue; - const uint8 regionSize = region.uKeyMax - region.uKeyMin; - if(regionSize > smallestRegion) + if(region.fuOptions & DLSREGION_ISGLOBAL) continue; - if((!key) || (key >= 0x80) - || ((key >= region.uKeyMin) - && (key <= region.uKeyMax))) + if((!key || key >= 0x80) + || (key >= region.uKeyMin && key <= region.uKeyMax)) { - smallestRegion = regionSize; - bestMatch = iIns; + if(pInsNo) + *pInsNo = iIns; + return &dlsIns; } } } @@ -624,9 +621,7 @@ } } - if(pInsNo && bestMatch != uint32_max) - *pInsNo = bestMatch; - return bestMatch != uint32_max ? &m_Instruments[bestMatch] : nullptr; + return nullptr; } @@ -795,9 +790,7 @@ case ART_DEFAULTPAN: { int32 pan = 128 + blk.lScale / (65536000/128); - if (pan < 0) pan = 0; - if (pan > 255) pan = 255; - dlsEnv.nDefPan = (uint8)pan; + dlsEnv.nDefPan = mpt::saturate_cast<uint8>(pan); } break; @@ -1168,7 +1161,8 @@ case SF2_GEN_PAN: { int32 pan = static_cast<int16>(value); - pan = (((pan + 500) * 127) / 500) + 128; + pan = std::clamp(Util::muldivr(pan + 500, 256, 1000), 0, 256); + pRgn->panning = static_cast<int16>(pan); pDlsEnv->nDefPan = mpt::saturate_cast<uint8>(pan); } break; @@ -1407,6 +1401,7 @@ { DLSINSTRUMENT *pDlsIns = &m_Instruments[nInsDef]; //Log("Instrument %d:\n", nInsDef); + pDlsIns->Regions.push_back({}); UpdateInstrumentDefinition(pDlsIns, subData); nInsDef++; } @@ -1495,19 +1490,15 @@ if(nIns >= m_Instruments.size()) return 0; const DLSINSTRUMENT &dlsIns = m_Instruments[nIns]; - uint8 smallestRegion = uint8_max; - uint32 region = 0; for(uint32 rgn = 0; rgn < static_cast<uint32>(dlsIns.Regions.size()); rgn++) { if(nKey < dlsIns.Regions[rgn].uKeyMin || nKey > dlsIns.Regions[rgn].uKeyMax) continue; - const uint8 regionSize = dlsIns.Regions[rgn].uKeyMax - dlsIns.Regions[rgn].uKeyMin; - if(regionSize > smallestRegion) + if(dlsIns.Regions[rgn].fuOptions & DLSREGION_ISGLOBAL) continue; - region = rgn; - smallestRegion = regionSize; + return rgn; } - return region; + return 0; } @@ -1862,7 +1853,7 @@ uint32 nmaxsmp = (m_nType & MOD_TYPE_XM) ? 16 : 32; if (nLoadedSmp >= nmaxsmp) { - nSmp = RgnToSmp[nRgn-1]; + nSmp = RgnToSmp[nRgn - 1]; } else { nextSample = sndFile.GetNextFreeSample(nInstr, nextSample + 1); @@ -1891,7 +1882,7 @@ } else if(sndFile.GetSample(nSmp).GetNumChannels() == 1) { // Try to combine stereo samples - uint8 pan1 = GetPanning(nIns, nRgn), pan2 = GetPanning(nIns, iDup); + const uint16 pan1 = GetPanning(nIns, nRgn), pan2 = GetPanning(nIns, iDup); if((pan1 < 16 && pan2 >= 240) || (pan2 < 16 && pan1 >= 240)) { ModSample &sample = sndFile.GetSample(nSmp); @@ -2046,6 +2037,7 @@ pIns->VolEnv[3] = EnvelopeNode(pIns->VolEnv[2].tick * 2u, ENVELOPE_MIN); // 1 second max. for drums } } + pIns->Sanitize(MOD_TYPE_MPT); pIns->Convert(MOD_TYPE_MPT, sndFile.GetType()); return true; } @@ -2071,12 +2063,15 @@ } -uint8 CDLSBank::GetPanning(uint32 ins, uint32 region) const +uint16 CDLSBank::GetPanning(uint32 ins, uint32 region) const { const DLSINSTRUMENT &dlsIns = m_Instruments[ins]; if(region >= dlsIns.Regions.size()) return 128; const DLSREGION &rgn = dlsIns.Regions[region]; + if(rgn.panning >= 0) + return static_cast<uint16>(rgn.panning); + if(dlsIns.ulBank & F_INSTRUMENT_DRUMS) { if(rgn.uPercEnv > 0 && rgn.uPercEnv <= m_Envelopes.size()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Dlsbank.h new/libopenmpt-0.5.12+release.autotools/soundlib/Dlsbank.h --- old/libopenmpt-0.5.11+release.autotools/soundlib/Dlsbank.h 2021-08-01 19:32:27.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Dlsbank.h 2021-08-23 23:33:58.000000000 +0200 @@ -29,9 +29,10 @@ uint32 ulLoopEnd; uint16 nWaveLink; uint16 uPercEnv; - uint16 usVolume; // 0..256 - uint16 fuOptions; // flags + key group - int16 sFineTune; // +128 = +1 semitone + uint16 usVolume; // 0..256 + uint16 fuOptions; // flags + key group + int16 sFineTune; // +128 = +1 semitone + int16 panning = -1; // -1= unset (DLS), otherwise 0...256 uint8 uKeyMin; uint8 uKeyMax; uint8 uUnityNote; @@ -41,11 +42,11 @@ struct DLSENVELOPE { // Volume Envelope - uint16 wVolAttack; // Attack Time: 0-1000, 1 = 20ms (1/50s) -> [0-20s] - uint16 wVolDecay; // Decay Time: 0-1000, 1 = 20ms (1/50s) -> [0-20s] - uint16 wVolRelease; // Release Time: 0-1000, 1 = 20ms (1/50s) -> [0-20s] - uint8 nVolSustainLevel; // Sustain Level: 0-128, 128=100% - uint8 nDefPan; // Default Pan + uint16 wVolAttack; // Attack Time: 0-1000, 1 = 20ms (1/50s) -> [0-20s] + uint16 wVolDecay; // Decay Time: 0-1000, 1 = 20ms (1/50s) -> [0-20s] + uint16 wVolRelease; // Release Time: 0-1000, 1 = 20ms (1/50s) -> [0-20s] + uint8 nVolSustainLevel; // Sustain Level: 0-128, 128=100% + uint8 nDefPan; // Default Pan }; // Special Bank bits @@ -128,7 +129,7 @@ bool ExtractSample(CSoundFile &sndFile, SAMPLEINDEX nSample, uint32 nIns, uint32 nRgn, int transpose = 0) const; bool ExtractInstrument(CSoundFile &sndFile, INSTRUMENTINDEX nInstr, uint32 nIns, uint32 nDrumRgn) const; const char *GetRegionName(uint32 nIns, uint32 nRgn) const; - uint8 GetPanning(uint32 ins, uint32 region) const; + uint16 GetPanning(uint32 ins, uint32 region) const; // Internal Loader Functions protected: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Load_dmf.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Load_dmf.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Load_dmf.cpp 2021-03-20 14:30:01.000000000 +0100 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Load_dmf.cpp 2021-09-03 23:45:33.000000000 +0200 @@ -1126,6 +1126,8 @@ try { tree.DMFNewNode(); + if(tree.nodes[0].left < 0 || tree.nodes[0].right < 0) + return tree.file.GetPosition(); for(uint32 i = 0; i < maxlen; i++) { int actnode = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Load_it.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Load_it.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Load_it.cpp 2021-08-01 16:20:49.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Load_it.cpp 2021-09-03 23:50:39.000000000 +0200 @@ -2112,7 +2112,9 @@ if(!memcmp(code, "DWRT", 4)) { - plugin.fDryRatio = dataChunk.ReadFloatLE(); + plugin.fDryRatio = std::clamp(dataChunk.ReadFloatLE(), 0.0f, 1.0f); + if(!std::isnormal(plugin.fDryRatio)) + plugin.fDryRatio = 0.0f; } else if(!memcmp(code, "PROG", 4)) { plugin.defaultProgram = dataChunk.ReadUint32LE(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Load_mdl.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Load_mdl.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Load_mdl.cpp 2021-05-05 20:58:20.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Load_mdl.cpp 2021-09-03 23:46:05.000000000 +0200 @@ -679,7 +679,7 @@ } for(CHANNELINDEX chn = 0; chn < numChans; chn++) { - if(chunk.ReadUint16LE() > 0 && chn >= m_nChannels) + if(chunk.ReadUint16LE() > 0 && chn >= m_nChannels && chn < 32) m_nChannels = chn + 1; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Load_mt2.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Load_mt2.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Load_mt2.cpp 2021-04-26 13:49:22.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Load_mt2.cpp 2021-09-03 23:46:41.000000000 +0200 @@ -590,7 +590,7 @@ { m_nTempoMode = tempoModeModern; double d = chunk.ReadDoubleLE(); - if(d != 0.0) + if(d > 0.00000001) { m_nDefaultTempo = TEMPO(44100.0 * 60.0 / (m_nDefaultSpeed * m_nDefaultRowsPerBeat * d)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Load_okt.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Load_okt.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Load_okt.cpp 2019-11-02 10:13:50.000000000 +0100 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Load_okt.cpp 2021-10-03 00:22:43.000000000 +0200 @@ -389,6 +389,12 @@ sampleChunks.push_back(chunk); } break; + + default: + // Non-ASCII chunk ID? + if(iffHead.signature & 0x80808080) + return false; + break; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Load_ptm.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Load_ptm.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Load_ptm.cpp 2019-12-24 10:29:44.000000000 +0100 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Load_ptm.cpp 2021-09-14 19:49:54.000000000 +0200 @@ -267,13 +267,9 @@ switch(m.command) { case CMD_PANNING8: - // My observations of this weird command... - // 800...887 pan from hard left to hard right (whereas the low nibble seems to be ignored) - // 888...8FF do the same (so 888...88F is hard left, and 890 is identical to 810) - if(m.param >= 0x88) m.param &= 0x7F; - else if(m.param > 0x80) m.param = 0x80; - m.param &= 0x7F; - m.param = (m.param * 0xFF) / 0x7F; + // Don't be surprised about the strange formula, this is directly translated from original disassembly... + m.command = CMD_S3MCMDEX; + m.param = 0x80 | ((std::max<uint8>(m.param >> 3, 1u) - 1u) & 0x0F); break; case CMD_GLOBALVOLUME: m.param = std::min(m.param, uint8(0x40)) * 2u; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Load_stp.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Load_stp.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Load_stp.cpp 2021-08-01 23:12:39.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Load_stp.cpp 2021-09-03 23:47:12.000000000 +0200 @@ -374,13 +374,13 @@ patternLength = file.ReadUint16BE(); channels = file.ReadUint16BE(); + if(channels > MAX_BASECHANNELS) + return false; m_nChannels = std::max(m_nChannels, channels); file.Skip(channels * patternLength * 4u); } file.Seek(patOffset); - if(m_nChannels > MAX_BASECHANNELS) - return false; } struct ChannelMemory diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Load_xm.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Load_xm.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Load_xm.cpp 2020-05-01 17:06:30.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Load_xm.cpp 2021-09-15 17:55:06.000000000 +0200 @@ -603,6 +603,7 @@ FlagSet<TrackerVersions> madeWith(verUnknown); mpt::ustring madeWithTracker; + bool isMadTracker = false; if(!memcmp(fileHeader.trackerName, "FastTracker v2.00 ", 20) && fileHeader.size == 276) { @@ -645,6 +646,7 @@ m_playBehaviour.reset(kFT2PortaNoNote); // Fix arpeggios in kragle_-_happy_day.xm m_playBehaviour.reset(kFT2Arpeggio); + isMadTracker = true; } else if(!memcmp(fileHeader.trackerName, "Skale Tracker\0", 14)) { m_playBehaviour.reset(kFT2ST3OffsetOutOfRange); @@ -1021,20 +1023,18 @@ Order().Replace(0xFF, Order.GetInvalidPatIndex()); } + m_modFormat.formatName = mpt::format(U_("FastTracker 2 v%1.%2"))(fileHeader.version >> 8, mpt::ufmt::hex0<2>(fileHeader.version & 0xFF)); + m_modFormat.madeWithTracker = std::move(madeWithTracker); + m_modFormat.charset = (m_dwLastSavedWithVersion || isMadTracker) ? mpt::Charset::Windows1252 : mpt::Charset::CP437; if(isOXM) { + m_modFormat.originalFormatName = std::move(m_modFormat.formatName); m_modFormat.formatName = U_("OggMod FastTracker 2"); m_modFormat.type = U_("oxm"); - m_modFormat.originalFormatName = mpt::format(U_("FastTracker 2 v%1.%2"))(fileHeader.version >> 8, mpt::ufmt::hex0<2>(fileHeader.version & 0xFF)); m_modFormat.originalType = U_("xm"); - m_modFormat.madeWithTracker = std::move(madeWithTracker); - m_modFormat.charset = m_dwLastSavedWithVersion ? mpt::Charset::Windows1252 : mpt::Charset::CP437; } else { - m_modFormat.formatName = mpt::format(U_("FastTracker 2 v%1.%2"))(fileHeader.version >> 8, mpt::ufmt::hex0<2>(fileHeader.version & 0xFF)); m_modFormat.type = U_("xm"); - m_modFormat.madeWithTracker = std::move(madeWithTracker); - m_modFormat.charset = m_dwLastSavedWithVersion ? mpt::Charset::Windows1252 : mpt::Charset::CP437; } return true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/ModInstrument.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/ModInstrument.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/ModInstrument.cpp 2021-08-08 15:22:27.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/ModInstrument.cpp 2021-09-03 23:47:50.000000000 +0200 @@ -106,7 +106,7 @@ { // Linear approximation between the points; // f(x + d) ~ f(x) + f'(x) * d, where f'(x) = (y2 - y1) / (x2 - x1) - value += ((position - x1) * (at(pt).value * ENV_PRECISION / rangeIn - value)) / (x2 - x1); + value += Util::muldiv(position - x1, (at(pt).value * ENV_PRECISION / rangeIn - value), x2 - x1); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/SampleFormatSFZ.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/SampleFormatSFZ.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/SampleFormatSFZ.cpp 2021-03-31 21:06:22.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/SampleFormatSFZ.cpp 2021-09-21 18:20:19.000000000 +0200 @@ -30,6 +30,12 @@ return l.substr(0, N - 1) == r; } +template <size_t N> +static bool SFZEndsWith(const std::string_view &l, const char (&r)[N]) +{ + return l.size() >= (N - 1) && l.substr(l.size() - (N - 1), N - 1) == r; +} + static bool SFZIsNumeric(const std::string_view &str) { return std::find_if(str.begin(), str.end(), [](char c) { return c < '0' || c > '9'; }) == str.end(); @@ -243,7 +249,7 @@ auto &env = eg.points; if(attack > 0 || delay > 0) { - env.push_back({0, startLevel}); + env.push_back({0.0, startLevel}); if(delay > 0) env.push_back({delay, env.back().second}); env.push_back({attack, 100.0}); @@ -255,7 +261,7 @@ env.push_back({hold, env.back().second}); } if(env.empty()) - env.push_back({0, 100.0}); + env.push_back({0.0, 100.0}); if(env.back().second != sustainLevel) env.push_back({decay, sustainLevel}); if(sustainLevel != 0) @@ -685,7 +691,8 @@ break; } const std::string key = mpt::ToLowerCaseAscii(s.substr(0, keyEnd)); - if(key == "sample" || key == "default_path" || SFZStartsWith(key, "label_cc") || SFZStartsWith(key, "label_key") || SFZStartsWith(key, "region_label")) + // Currently defined *_label opcodes are global_label, group_label, master_label, region_label, sw_label + if(key == "sample" || key == "default_path" || SFZStartsWith(key, "label_cc") || SFZStartsWith(key, "label_key") || SFZEndsWith(key, "_label")) { // Sample / CC name may contain spaces... charsRead = s.find_first_of("=\t<", valueStart); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/SampleIO.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/SampleIO.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/SampleIO.cpp 2021-02-18 18:24:25.000000000 +0100 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/SampleIO.cpp 2021-09-03 23:49:16.000000000 +0200 @@ -56,6 +56,8 @@ restrictedSampleDataView = file.GetPinnedRawDataView(CalculateEncodedSize(sample.nLength)); sourceBuf = restrictedSampleDataView.data(); fileSize = restrictedSampleDataView.size(); + if(sourceBuf == nullptr) + return 0; } else { MPT_ASSERT_NOTREACHED(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Snd_fx.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Snd_fx.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Snd_fx.cpp 2021-05-16 21:21:17.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Snd_fx.cpp 2021-10-03 13:56:57.000000000 +0200 @@ -113,7 +113,8 @@ return; } - const SmpLength sampleEnd = chn.dwFlags[CHN_LOOP] ? chn.nLoopEnd : chn.nLength; + const SamplePosition loopStart(chn.dwFlags[CHN_LOOP] ? chn.nLoopStart : 0u, 0); + const SamplePosition sampleEnd(chn.dwFlags[CHN_LOOP] ? chn.nLoopEnd : chn.nLength, 0); const SmpLength loopLength = chn.nLoopEnd - chn.nLoopStart; const bool itEnvMode = sndFile.m_playBehaviour[kITEnvelopePositionHandling]; const bool updatePitchEnv = (chn.PitchEnv.flags & (ENV_ENABLED | ENV_FILTER)) == ENV_ENABLED; @@ -176,52 +177,50 @@ chn.position += inc; - if(chn.position.GetUInt() >= sampleEnd) + if(chn.position >= sampleEnd || (chn.position < loopStart && inc.IsNegative())) { - if(chn.dwFlags[CHN_LOOP]) + if(!chn.dwFlags[CHN_LOOP]) { - // We exceeded the sample loop, go back to loop start. - if(chn.dwFlags[CHN_PINGPONGLOOP]) + // Past sample end. + stopNote = true; + break; + } + // We exceeded the sample loop, go back to loop start. + if(chn.dwFlags[CHN_PINGPONGLOOP]) + { + if(chn.position < loopStart) { - if(chn.position < SamplePosition(chn.nLoopStart, 0)) - { - chn.position = SamplePosition(chn.nLoopStart + chn.nLoopStart, 0) - chn.position; - chn.dwFlags.flip(CHN_PINGPONGFLAG); - inc.Negate(); - } - SmpLength posInt = chn.position.GetUInt() - chn.nLoopStart; - SmpLength pingpongLength = loopLength * 2; - if(sndFile.m_playBehaviour[kITPingPongMode]) pingpongLength--; - posInt %= pingpongLength; - bool forward = (posInt < loopLength); - if(forward) - chn.position.SetInt(chn.nLoopStart + posInt); - else - chn.position.SetInt(chn.nLoopEnd - (posInt - loopLength)); - if(forward == chn.dwFlags[CHN_PINGPONGFLAG]) - { - chn.dwFlags.flip(CHN_PINGPONGFLAG); - inc.Negate(); - } - } else + chn.position = SamplePosition(chn.nLoopStart + chn.nLoopStart, 0) - chn.position; + chn.dwFlags.flip(CHN_PINGPONGFLAG); + inc.Negate(); + } + SmpLength posInt = chn.position.GetUInt() - chn.nLoopStart; + SmpLength pingpongLength = loopLength * 2; + if(sndFile.m_playBehaviour[kITPingPongMode]) pingpongLength--; + posInt %= pingpongLength; + bool forward = (posInt < loopLength); + if(forward) + chn.position.SetInt(chn.nLoopStart + posInt); + else + chn.position.SetInt(chn.nLoopEnd - (posInt - loopLength)); + if(forward == chn.dwFlags[CHN_PINGPONGFLAG]) { - SmpLength posInt = chn.position.GetUInt(); - if(posInt >= chn.nLoopEnd + loopLength) - { - const SmpLength overshoot = posInt - chn.nLoopEnd; - posInt -= (overshoot / loopLength) * loopLength; - } - while(posInt >= chn.nLoopEnd) - { - posInt -= loopLength; - } - chn.position.SetInt(posInt); + chn.dwFlags.flip(CHN_PINGPONGFLAG); + inc.Negate(); } } else { - // Past sample end. - stopNote = true; - break; + SmpLength posInt = chn.position.GetUInt(); + if(posInt >= chn.nLoopEnd + loopLength) + { + const SmpLength overshoot = posInt - chn.nLoopEnd; + posInt -= (overshoot / loopLength) * loopLength; + } + while(posInt >= chn.nLoopEnd) + { + posInt -= loopLength; + } + chn.position.SetInt(posInt); } } } @@ -1794,7 +1793,7 @@ } } - // IT compatibility tentative fix: Clear channel note memory. + // IT compatibility tentative fix: Clear channel note memory (TRANCE_N.IT by A3F). if(m_playBehaviour[kITClearOldNoteAfterCut]) { chn.nNote = chn.nNewNote = NOTE_NONE; @@ -2758,7 +2757,6 @@ // Now it's time for some FT2 crap... if (GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)) { - // XM: Key-Off + Sample == Note Cut (BUT: Only if no instr number or volume effect is present!) // Test case: NoteOffVolume.xm if(note == NOTE_KEYOFF @@ -3347,8 +3345,11 @@ if(param && !m_SongFlags[SONG_ITOLDEFFECTS]) { // Old effects have different length interpretation (+1 for both on and off) - if(param & 0xF0) param -= 0x10; - if(param & 0x0F) param -= 0x01; + if(param & 0xF0) + param -= 0x10; + if(param & 0x0F) + param -= 0x01; + chn.nTremorParam = static_cast<ModCommand::PARAM>(param); } chn.nTremorCount |= 0x80; // set on/off flag } else if(m_playBehaviour[kFT2Tremor]) @@ -3358,7 +3359,8 @@ } chn.nCommand = CMD_TREMOR; - if (param) chn.nTremorParam = static_cast<ModCommand::PARAM>(param); + if(param) + chn.nTremorParam = static_cast<ModCommand::PARAM>(param); break; @@ -3579,13 +3581,13 @@ case CMD_DBMECHO: if(m_PlayState.m_nTickCount == 0) { - uint32 chns = (param >> 4), enable = (param & 0x0F); - if(chns > 1 || enable > 2) + uint32 echoType = (param >> 4), enable = (param & 0x0F); + if(echoType > 2 || enable > 1) { break; } CHANNELINDEX firstChn = nChn, lastChn = nChn; - if(chns == 1) + if(echoType == 1) { firstChn = 0; lastChn = m_nChannels - 1; @@ -4115,8 +4117,10 @@ } } -// Implemented for IMF compatibility, can't actually save this in any formats + +// Implemented for IMF / PTM / OKT compatibility, can't actually save this in any formats // Slide up / down every x ticks by y semitones +// Oktalyzer: Slide down on first tick only, or on every tick void CSoundFile::NoteSlide(ModChannel &chn, uint32 param, bool slideUp, bool retrig) const { uint8 x, y; @@ -4129,23 +4133,26 @@ if (y) chn.nNoteSlideStep = y; chn.nNoteSlideCounter = chn.nNoteSlideSpeed; - } else + } + + bool doTrigger = false; + if(GetType() == MOD_TYPE_OKT) + doTrigger = (chn.nNoteSlideSpeed == 0x10) || m_SongFlags[SONG_FIRSTTICK]; + else + doTrigger = !m_SongFlags[SONG_FIRSTTICK] && (--chn.nNoteSlideCounter == 0); + + if(doTrigger) { - if (--chn.nNoteSlideCounter == 0) - { - chn.nNoteSlideCounter = chn.nNoteSlideSpeed; - // update it - const int32 delta = (slideUp ? 1 : -1) * chn.nNoteSlideStep; - if(chn.HasCustomTuning()) - chn.m_PortamentoFineSteps += delta * chn.pModInstrument->pTuning->GetFineStepCount(); - else - chn.nPeriod = GetPeriodFromNote(delta + GetNoteFromPeriod(chn.nPeriod), 8363, 0); + chn.nNoteSlideCounter = chn.nNoteSlideSpeed; + // update it + const int32 delta = (slideUp ? 1 : -1) * chn.nNoteSlideStep; + if(chn.HasCustomTuning()) + chn.m_PortamentoFineSteps += delta * chn.pModInstrument->pTuning->GetFineStepCount(); + else + chn.nPeriod = GetPeriodFromNote(delta + GetNoteFromPeriod(chn.nPeriod, 0, chn.nC5Speed), 0, chn.nC5Speed); - if(retrig) - { - chn.position.Set(0); - } - } + if(retrig) + chn.position.Set(0); } } @@ -5622,9 +5629,9 @@ if(!m_playBehaviour[kFT2Retrigger] || !(chn.rowCommand.volcmd == VOLCMD_VOLUME)) { if(retrigTable1[dv]) - vol = (vol * retrigTable1[dv]) >> 4; + vol = (vol * retrigTable1[dv]) / 16; else - vol += ((int)retrigTable2[dv]) << 2; + vol += ((int)retrigTable2[dv]) * 4; } Limit(vol, 0, 256); @@ -5675,7 +5682,7 @@ if(m_playBehaviour[kITRetrigger]) chn.position.Set(0); offset--; - if(offset >= 0 && offset <= static_cast<int>(CountOf(chn.pModSample->cues)) && chn.pModSample != nullptr) + if(chn.pModSample != nullptr && offset >= 0 && offset <= static_cast<int>(CountOf(chn.pModSample->cues))) { if(offset == 0) offset = chn.oldOffset; @@ -6034,6 +6041,8 @@ // MDL uses non-linear slides, but their effectiveness does not depend on the middle-C frequency. return (FreqS3MTable[note % 12u] << 4) >> (note / 12); } + if(!nC5Speed) + nC5Speed = 8363; if(m_SongFlags[SONG_LINEARSLIDES] || GetType() == MOD_TYPE_669) { // In IT linear slide mode, directly use frequency in Hertz rather than periods. @@ -6043,8 +6052,6 @@ return (FreqS3MTable[note % 12u] << 5) >> (note / 12); } else { - if (!nC5Speed) - nC5Speed = 8363; LimitMax(nC5Speed, uint32_max >> (note / 12u)); //(a*b)/c return Util::muldiv_unsigned(8363, (FreqS3MTable[note % 12u] << 5), nC5Speed << (note / 12u)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Sndfile.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Sndfile.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Sndfile.cpp 2021-08-08 15:22:27.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Sndfile.cpp 2021-09-03 23:49:48.000000000 +0200 @@ -557,6 +557,7 @@ m_nDefaultRowsPerMeasure = m_nDefaultRowsPerBeat; LimitMax(m_nDefaultRowsPerBeat, MAX_ROWS_PER_BEAT); LimitMax(m_nDefaultRowsPerMeasure, MAX_ROWS_PER_BEAT); + LimitMax(m_nDefaultGlobalVolume, MAX_GLOBAL_VOLUME); if(!m_tempoSwing.empty()) m_tempoSwing.resize(m_nDefaultRowsPerBeat); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/Sndmix.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/Sndmix.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/Sndmix.cpp 2021-05-13 14:37:50.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/Sndmix.cpp 2021-09-03 23:50:12.000000000 +0200 @@ -125,10 +125,10 @@ { ModChannel &pramp = m_PlayState.Chn[m_PlayState.ChnMix[noff]]; pramp.newRightVol = pramp.newLeftVol = 0; - pramp.leftRamp = (-pramp.leftVol << VOLUMERAMPPRECISION) / nRampLength; - pramp.rightRamp = (-pramp.rightVol << VOLUMERAMPPRECISION) / nRampLength; - pramp.rampLeftVol = pramp.leftVol << VOLUMERAMPPRECISION; - pramp.rampRightVol = pramp.rightVol << VOLUMERAMPPRECISION; + pramp.leftRamp = -pramp.leftVol * (1 << VOLUMERAMPPRECISION) / nRampLength; + pramp.rightRamp = -pramp.rightVol * (1 << VOLUMERAMPPRECISION) / nRampLength; + pramp.rampLeftVol = pramp.leftVol * (1 << VOLUMERAMPPRECISION); + pramp.rampRightVol = pramp.rightVol * (1 << VOLUMERAMPPRECISION); pramp.nRampLength = nRampLength; pramp.dwFlags.set(CHN_VOLUMERAMP); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/UpgradeModule.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/UpgradeModule.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/UpgradeModule.cpp 2021-05-09 23:52:31.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/UpgradeModule.cpp 2021-10-03 17:38:10.000000000 +0200 @@ -112,6 +112,12 @@ m.vol = 0; } } + + // Command I11 accidentally behaved the same as command I00 with compatible IT tremor and old effects disabled + if(m.command == CMD_TREMOR && m.param == 0x11 && version < MPT_V("1.29.12.02") && sndFile.m_playBehaviour[kITTremor] && !sndFile.m_SongFlags[SONG_ITOLDEFFECTS]) + { + m.param = 0; + } } else if(modType == MOD_TYPE_XM) @@ -250,7 +256,7 @@ if(!compatModeIT || m_dwLastSavedWithVersion < MPT_V("1.18.00.00")) { - // Previously, Pitch/Pan Separation was only half depth. + // Previously, Pitch/Pan Separation was only half depth (plot twist: it was actually only quarter depth). // This was corrected in compatible mode in OpenMPT 1.18, and in OpenMPT 1.20 it is corrected in normal mode as well. ins->nPPS = (ins->nPPS + (ins->nPPS >= 0 ? 1 : -1)) / 2; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/opal.h new/libopenmpt-0.5.12+release.autotools/soundlib/opal.h --- old/libopenmpt-0.5.11+release.autotools/soundlib/opal.h 2020-03-14 19:34:01.000000000 +0100 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/opal.h 2021-09-26 19:48:06.000000000 +0200 @@ -645,6 +645,8 @@ ModulationType = 0; ChannelPair = 0; Enable = true; + LeftEnable = true; + RightEnable = true; } @@ -672,12 +674,13 @@ else { if (clk & 1) vibrato >>= 1; // Odd positions are half the magnitude + + vibrato <<= Octave; + if (clk & 4) vibrato = -vibrato; // The second half positions are negative } - vibrato <<= Octave; - // Combine individual operator outputs int16_t out, acc; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/plugins/LFOPlugin.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/plugins/LFOPlugin.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/plugins/LFOPlugin.cpp 2021-05-29 21:09:35.000000000 +0200 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/plugins/LFOPlugin.cpp 2021-09-03 23:48:47.000000000 +0200 @@ -165,8 +165,6 @@ break; case kWaveform: m_waveForm = ParamToWaveform(value); - if(m_waveForm >= kNumWaveforms) - m_waveForm = static_cast<LFOWaveform>(kNumWaveforms - 1); break; case kPolarity: m_polarity = (value >= 0.5f); break; case kBypassed: m_bypassed = (value >= 0.5f); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/plugins/LFOPlugin.h new/libopenmpt-0.5.12+release.autotools/soundlib/plugins/LFOPlugin.h --- old/libopenmpt-0.5.11+release.autotools/soundlib/plugins/LFOPlugin.h 2020-12-18 23:51:02.000000000 +0100 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/plugins/LFOPlugin.h 2021-09-03 23:48:47.000000000 +0200 @@ -144,7 +144,7 @@ IMixPlugin *GetOutputPlugin() const; public: - static LFOWaveform ParamToWaveform(float param) { return static_cast<LFOWaveform>(mpt::saturate_round<int>(param * 32.0f)); } + static LFOWaveform ParamToWaveform(float param) { return static_cast<LFOWaveform>(std::clamp(mpt::saturate_round<int>(param * 32.0f), 0, kNumWaveforms - 1)); } static float WaveformToParam(LFOWaveform waveform) { return static_cast<int>(waveform) / 32.0f; } }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libopenmpt-0.5.11+release.autotools/soundlib/plugins/dmo/Distortion.cpp new/libopenmpt-0.5.12+release.autotools/soundlib/plugins/dmo/Distortion.cpp --- old/libopenmpt-0.5.11+release.autotools/soundlib/plugins/dmo/Distortion.cpp 2019-12-24 10:29:44.000000000 +0100 +++ new/libopenmpt-0.5.12+release.autotools/soundlib/plugins/dmo/Distortion.cpp 2021-10-02 22:05:18.000000000 +0200 @@ -27,7 +27,7 @@ // Computes (log2(x) + 1) * 2 ^ (shiftL - shiftR) (x = -2^31...2^31) float logGain(float x, int32 shiftL, int32 shiftR) { - uint32 intSample = static_cast<uint32>(static_cast<int32>(x)); + uint32 intSample = static_cast<uint32>(static_cast<int64>(x)); const uint32 sign = intSample & 0x80000000; if(sign) intSample = (~intSample) + 1;