diff options
author | James Cowgill <jcowgill@debian.org> | 2019-09-23 20:28:33 +0100 |
---|---|---|
committer | James Cowgill <jcowgill@debian.org> | 2019-09-23 20:28:33 +0100 |
commit | 78aaa5916faa9e65466570db1283cdb2a60bab80 (patch) | |
tree | f363453fb64eeca251b9aac8babbc124cf96250d | |
parent | de25217d43edc67144f8ec4065f8f5e0ffd6c5ba (diff) | |
parent | 057f26b51acc1ec75a03ec539569860efd9e9d33 (diff) |
Update upstream source from tag 'upstream/0.4.7'
Update to upstream version '0.4.7'
with Debian dir 20e5f67270ccb35f9d0507e74c5a14791f138eca
-rw-r--r-- | common/BuildSettings.h | 22 | ||||
-rw-r--r-- | common/CompilerDetect.h | 11 | ||||
-rw-r--r-- | common/mptAlloc.cpp | 8 | ||||
-rw-r--r-- | common/mptAlloc.h | 8 | ||||
-rw-r--r-- | common/mptFileIO.cpp | 3 | ||||
-rw-r--r-- | common/versionNumber.h | 2 | ||||
-rwxr-xr-x | configure | 26 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | libopenmpt/dox/changelog.md | 13 | ||||
-rw-r--r-- | libopenmpt/libopenmpt_version.h | 2 | ||||
-rw-r--r-- | libopenmpt/libopenmpt_version.mk | 4 | ||||
-rw-r--r-- | man/openmpt123.1 | 2 | ||||
-rw-r--r-- | soundlib/Dlsbank.cpp | 22 | ||||
-rw-r--r-- | soundlib/Load_it.cpp | 4 | ||||
-rw-r--r-- | soundlib/Load_mid.cpp | 3 | ||||
-rw-r--r-- | soundlib/Load_mo3.cpp | 31 | ||||
-rw-r--r-- | soundlib/Load_mt2.cpp | 2 | ||||
-rw-r--r-- | soundlib/Snd_fx.cpp | 2 | ||||
-rw-r--r-- | soundlib/Sndmix.cpp | 4 | ||||
-rw-r--r-- | soundlib/Tables.cpp | 23 | ||||
-rw-r--r-- | soundlib/Tables.h | 1 | ||||
-rw-r--r-- | soundlib/plugins/PluginMixBuffer.h | 19 |
22 files changed, 134 insertions, 86 deletions
diff --git a/common/BuildSettings.h b/common/BuildSettings.h index 6e1354d..ce631f7 100644 --- a/common/BuildSettings.h +++ b/common/BuildSettings.h @@ -578,6 +578,10 @@ #define NO_DMO #endif +#if defined(ENABLE_ASM) || !defined(NO_VST) +#define MPT_ENABLE_ALIGNED_ALLOC +#endif + #if defined(MODPLUG_TRACKER) && !defined(MPT_BUILD_WINESUPPORT) && !defined(MPT_BUILD_WINESUPPORT_WRAPPER) @@ -731,6 +735,24 @@ + + +// standard library quirks + +#if MPT_CXX_AT_LEAST(17) +#if (MPT_COMPILER_GCC || MPT_COMPILER_CLANG) +// we need to detect the standard library via macro __GLIBCXX__ +#include <vector> +#endif +#if MPT_COMPILER_MSVC || MPT_GCC_BEFORE(8,1,0) || MPT_CLANG_BEFORE(5,0,0) || (MPT_COMPILER_GCC && defined(__GLIBCXX__) && (defined(__MINGW32__) || defined(__MINGW64__))) || (MPT_COMPILER_CLANG && defined(__GLIBCXX__)) || (MPT_COMPILER_CLANG && MPT_OS_MACOSX_OR_IOS) || MPT_OS_OPENBSD || MPT_OS_EMSCRIPTEN || MPT_OS_HAIKU || (defined(__clang__) && defined(_MSC_VER)) +#define MPT_COMPILER_QUIRK_NO_ALIGNEDALLOC +#endif +#endif + + + + + // third-party library configuration #if defined(MODPLUG_TRACKER) diff --git a/common/CompilerDetect.h b/common/CompilerDetect.h index 3b3dbec..5087163 100644 --- a/common/CompilerDetect.h +++ b/common/CompilerDetect.h @@ -232,6 +232,8 @@ //#elif TARGET_OS_MAC //#else //#endif +#elif defined(__HAIKU__) + #define MPT_OS_HAIKU 1 #elif defined(__ANDROID__) || defined(ANDROID) #define MPT_OS_ANDROID 1 #elif defined(__linux__) @@ -265,6 +267,9 @@ #ifndef MPT_OS_MACOSX_OR_IOS #define MPT_OS_MACOSX_OR_IOS 0 #endif +#ifndef MPT_OS_HAIKU +#define MPT_OS_HAIKU 0 +#endif #ifndef MPT_OS_ANDROID #define MPT_OS_ANDROID 0 #endif @@ -311,9 +316,3 @@ #define MPT_COMPILER_QUIRK_MSVC_STRINGSTREAM #endif -#if MPT_CXX_AT_LEAST(17) -#if MPT_COMPILER_MSVC || MPT_GCC_BEFORE(8,1,0) || MPT_CLANG_BEFORE(5,0,0) || (MPT_COMPILER_GCC && defined(__GLIBCXX__) && (defined(__MINGW32__) || defined(__MINGW64__))) || (MPT_COMPILER_CLANG && defined(__GLIBCXX__)) || (MPT_COMPILER_CLANG && MPT_OS_MACOSX_OR_IOS) || MPT_OS_OPENBSD || MPT_OS_EMSCRIPTEN || (defined(__clang__) && defined(_MSC_VER)) -#define MPT_COMPILER_QUIRK_NO_ALIGNEDALLOC -#endif -#endif - diff --git a/common/mptAlloc.cpp b/common/mptAlloc.cpp index 3eae6f3..faaa7d0 100644 --- a/common/mptAlloc.cpp +++ b/common/mptAlloc.cpp @@ -30,6 +30,10 @@ OPENMPT_NAMESPACE_BEGIN +#if defined(MPT_ENABLE_ALIGNED_ALLOC) + + + namespace mpt { @@ -118,4 +122,8 @@ void aligned_free(aligned_raw_memory raw) +#endif // MPT_ENABLE_ALIGNED_ALLOC + + + OPENMPT_NAMESPACE_END diff --git a/common/mptAlloc.h b/common/mptAlloc.h index f881be9..42e93a3 100644 --- a/common/mptAlloc.h +++ b/common/mptAlloc.h @@ -95,6 +95,10 @@ std::unique_ptr<T> make_unique(Args&&... args) +#if defined(MPT_ENABLE_ALIGNED_ALLOC) + + + namespace mpt { @@ -259,4 +263,8 @@ public: +#endif // MPT_ENABLE_ALIGNED_ALLOC + + + OPENMPT_NAMESPACE_END diff --git a/common/mptFileIO.cpp b/common/mptFileIO.cpp index 4f957f3..eae979c 100644 --- a/common/mptFileIO.cpp +++ b/common/mptFileIO.cpp @@ -515,7 +515,8 @@ InputFile::ContentsRef InputFile::Get() return result; } result.first.data = m_File.Lock(); - result.first.size = m_File.GetLength(); + if(result.first.data) + result.first.size = m_File.GetLength(); result.second = &m_Filename; return result; } diff --git a/common/versionNumber.h b/common/versionNumber.h index 03a5400..789201e 100644 --- a/common/versionNumber.h +++ b/common/versionNumber.h @@ -20,7 +20,7 @@ OPENMPT_NAMESPACE_BEGIN //Version definitions. The only thing that needs to be changed when changing version number. #define VER_MAJORMAJOR 1 #define VER_MAJOR 28 -#define VER_MINOR 06 +#define VER_MINOR 07 #define VER_MINORMINOR 00 //Numerical value of the version. @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libopenmpt 0.4.6+release.autotools. +# Generated by GNU Autoconf 2.69 for libopenmpt 0.4.7+release.autotools. # # Report bugs to <https://bugs.openmpt.org/>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libopenmpt' PACKAGE_TARNAME='libopenmpt' -PACKAGE_VERSION='0.4.6+release.autotools' -PACKAGE_STRING='libopenmpt 0.4.6+release.autotools' +PACKAGE_VERSION='0.4.7+release.autotools' +PACKAGE_STRING='libopenmpt 0.4.7+release.autotools' PACKAGE_BUGREPORT='https://bugs.openmpt.org/' PACKAGE_URL='https://lib.openmpt.org/' @@ -1485,7 +1485,7 @@ if test "$ac_init_help" = "long"; then # 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.4.6+release.autotools to adapt to many kinds of systems. +\`configure' configures libopenmpt 0.4.7+release.autotools to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1556,7 +1556,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libopenmpt 0.4.6+release.autotools:";; + short | recursive ) echo "Configuration of libopenmpt 0.4.7+release.autotools:";; esac cat <<\_ACEOF @@ -1756,7 +1756,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libopenmpt configure 0.4.6+release.autotools +libopenmpt configure 0.4.7+release.autotools generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2246,7 +2246,7 @@ cat >config.log <<_ACEOF 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.4.6+release.autotools, which was +It was created by libopenmpt $as_me 0.4.7+release.autotools, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3117,7 +3117,7 @@ fi # Define the identity of the package. PACKAGE='libopenmpt' - VERSION='0.4.6+release.autotools' + VERSION='0.4.7+release.autotools' cat >>confdefs.h <<_ACEOF @@ -17281,13 +17281,13 @@ LIBOPENMPT_LTVER_AGE=1 -$as_echo "#define MPT_SVNURL \"https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.4.6\"" >>confdefs.h +$as_echo "#define MPT_SVNURL \"https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.4.7\"" >>confdefs.h -$as_echo "#define MPT_SVNVERSION \"11911\"" >>confdefs.h +$as_echo "#define MPT_SVNVERSION \"12088\"" >>confdefs.h -$as_echo "#define MPT_SVNDATE \"2019-08-10T16:17:06.209813Z\"" >>confdefs.h +$as_echo "#define MPT_SVNDATE \"2019-09-23T10:02:47.236448Z\"" >>confdefs.h $as_echo "#define MPT_PACKAGE true" >>confdefs.h @@ -23527,7 +23527,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # 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.4.6+release.autotools, which was +This file was extended by libopenmpt $as_me 0.4.7+release.autotools, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23594,7 +23594,7 @@ _ACEOF 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.4.6+release.autotools +libopenmpt config.status 0.4.7+release.autotools configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 3bb702f..fbbf6ae 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([libopenmpt], [0.4.6+release.autotools], [https://bugs.openmpt.org/], [libopenmpt], [https://lib.openmpt.org/]) +AC_INIT([libopenmpt], [0.4.7+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_CURRENT]) AC_SUBST([LIBOPENMPT_LTVER_REVISION]) AC_SUBST([LIBOPENMPT_LTVER_AGE]) -AC_DEFINE([MPT_SVNURL], ["https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.4.6"], [svn version]) -AC_DEFINE([MPT_SVNVERSION], ["11911"], [svn version]) -AC_DEFINE([MPT_SVNDATE], ["2019-08-10T16:17:06.209813Z"], [svn date]) +AC_DEFINE([MPT_SVNURL], ["https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.4.7"], [svn version]) +AC_DEFINE([MPT_SVNVERSION], ["12088"], [svn version]) +AC_DEFINE([MPT_SVNDATE], ["2019-09-23T10:02:47.236448Z"], [svn date]) AC_DEFINE([MPT_PACKAGE], [true], [is package]) diff --git a/libopenmpt/dox/changelog.md b/libopenmpt/dox/changelog.md index 1eb1677..0b72795 100644 --- a/libopenmpt/dox/changelog.md +++ b/libopenmpt/dox/changelog.md @@ -5,6 +5,19 @@ Changelog {#changelog} For fully detailed change log, please see the source repository directly. This is just a high-level summary. +### libopenmpt 0.4.7 (2019-09-23) + + * [**Bug**] Compilation fix for various platforms that do not provide + `std::aligned_alloc` in C++17 mode. The problematic dependency has been + removed. This should fix build problems on MinGW, OpenBSD, Haiku, and others + for good. + + * J2B: Ignore notes with non-existing instrument (fixes Ending.j2b). + + * mpg123: Update to v1.25.13 (2019-08-24). + * ogg: Update to v1.3.4. (2019-08-31). + * flac: Update to v1.3.3. (2019-08-04). + ### libopenmpt 0.4.6 (2019-08-10) * [**Bug**] Compilation fix for OpenBSD. diff --git a/libopenmpt/libopenmpt_version.h b/libopenmpt/libopenmpt_version.h index 0d319f6..4bb9027 100644 --- a/libopenmpt/libopenmpt_version.h +++ b/libopenmpt/libopenmpt_version.h @@ -19,7 +19,7 @@ /*! \brief libopenmpt minor version number */ #define OPENMPT_API_VERSION_MINOR 4 /*! \brief libopenmpt patch version number */ -#define OPENMPT_API_VERSION_PATCH 6 +#define OPENMPT_API_VERSION_PATCH 7 /*! \brief libopenmpt pre-release tag */ #define OPENMPT_API_VERSION_PREREL "" /*! \brief libopenmpt pre-release flag */ diff --git a/libopenmpt/libopenmpt_version.mk b/libopenmpt/libopenmpt_version.mk index fce55bb..ff3b723 100644 --- a/libopenmpt/libopenmpt_version.mk +++ b/libopenmpt/libopenmpt_version.mk @@ -1,8 +1,8 @@ LIBOPENMPT_VERSION_MAJOR=0 LIBOPENMPT_VERSION_MINOR=4 -LIBOPENMPT_VERSION_PATCH=6 +LIBOPENMPT_VERSION_PATCH=7 LIBOPENMPT_VERSION_PREREL= LIBOPENMPT_LTVER_CURRENT=1 -LIBOPENMPT_LTVER_REVISION=6 +LIBOPENMPT_LTVER_REVISION=7 LIBOPENMPT_LTVER_AGE=1 diff --git a/man/openmpt123.1 b/man/openmpt123.1 index b1d9bc3..3bfca91 100644 --- a/man/openmpt123.1 +++ b/man/openmpt123.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. -.TH OPENMPT123 "1" "August 2019" "openmpt123 v0.4.6" "User Commands" +.TH OPENMPT123 "1" "September 2019" "openmpt123 v0.4.7" "User Commands" .SH NAME openmpt123 - command line module music player based on libopenmpt .SH SYNOPSIS diff --git a/soundlib/Dlsbank.cpp b/soundlib/Dlsbank.cpp index 381b918..39d10a0 100644 --- a/soundlib/Dlsbank.cpp +++ b/soundlib/Dlsbank.cpp @@ -563,7 +563,7 @@ bool CDLSBank::IsDLSBank(const mpt::PathString &filename) const DLSINSTRUMENT *CDLSBank::FindInstrument(bool isDrum, uint32 bank, uint32 program, uint32 key, uint32 *pInsNo) const { - if (m_Instruments.empty()) return NULL; + if (m_Instruments.empty()) return nullptr; for (uint32 iIns=0; iIns<m_Instruments.size(); iIns++) { const DLSINSTRUMENT &dlsIns = m_Instruments[iIns]; @@ -956,7 +956,7 @@ bool CDLSBank::UpdateSF2PresetData(SF2LOADERINFO &sf2info, const IFFCHUNK &heade dlsSmp.dwSampleRate = p.dwSampleRate; dlsSmp.byOriginalPitch = p.byOriginalPitch; dlsSmp.chPitchCorrection = static_cast<int8>(Util::muldivr(p.chPitchCorrection, 128, 100)); - if (((p.sfSampleType & 0x7FFF) <= 4) && (p.dwStart < 0x08000000) && (p.dwEnd >= p.dwStart+8)) + if (((p.sfSampleType & 0x7FFF) <= 4) && (p.dwEnd >= p.dwStart + 4)) { dlsSmp.dwLen = (p.dwEnd - p.dwStart) * 2; if ((p.dwEndloop > p.dwStartloop + 7) && (p.dwStartloop >= p.dwStart)) @@ -1192,7 +1192,6 @@ bool CDLSBank::Open(FileReader file) m_szFileName = file.GetFileName(); file.Rewind(); - const uint8 *lpMemFile = file.GetRawData<uint8>(); size_t dwMemLength = file.GetLength(); size_t dwMemPos = 0; if(!file.CanRead(256)) @@ -1397,13 +1396,14 @@ bool CDLSBank::Open(FileReader file) Log("ptbl not present: building table (%d wavelinks)...\n", m_nMaxWaveLink); #endif m_WaveForms.reserve(m_nMaxWaveLink); - dwMemPos = m_dwWavePoolOffset; - while (dwMemPos + sizeof(IFFCHUNK) < dwMemLength) + file.Seek(m_dwWavePoolOffset); + while(m_WaveForms.size() < m_nMaxWaveLink && file.CanRead(sizeof(IFFCHUNK))) { - IFFCHUNK *pchunk = (IFFCHUNK *)(lpMemFile + dwMemPos); - if (pchunk->id == IFFID_LIST) m_WaveForms.push_back(dwMemPos - m_dwWavePoolOffset); - dwMemPos += 8 + pchunk->len; - if (m_WaveForms.size() >= m_nMaxWaveLink) break; + IFFCHUNK chunk; + file.ReadStruct(chunk); + if (chunk.id == IFFID_LIST) + m_WaveForms.push_back(file.GetPosition() - m_dwWavePoolOffset - sizeof(IFFCHUNK)); + file.Skip(chunk.len); } #ifdef DLSBANK_LOG Log("Found %d waveforms\n", m_WaveForms.size()); @@ -1467,13 +1467,13 @@ bool CDLSBank::ExtractWaveForm(uint32 nIns, uint32 nRgn, std::vector<uint8> &wav return false; } - long dwOffset = mpt::saturate_cast<long>(m_WaveForms[nWaveLink] + m_dwWavePoolOffset); mpt::ifstream f(m_szFileName, std::ios::binary); if(!f) { return false; } - if (mpt::IO::SeekAbsolute(f, dwOffset)) + mpt::IO::Offset sampleOffset = mpt::saturate_cast<mpt::IO::Offset>(m_WaveForms[nWaveLink] + m_dwWavePoolOffset); + if(mpt::IO::SeekAbsolute(f, sampleOffset)) { if (m_nType & SOUNDBANK_TYPE_SF2) { diff --git a/soundlib/Load_it.cpp b/soundlib/Load_it.cpp index c98400a..069e4a4 100644 --- a/soundlib/Load_it.cpp +++ b/soundlib/Load_it.cpp @@ -819,14 +819,14 @@ bool CSoundFile::ReadIT(FileReader &file, ModLoadingFlags loadFlags) // External sample in MPTM file size_t strLen; file.ReadVarInt(strLen); - if(loadFlags & loadSampleData) + if((loadFlags & loadSampleData) && strLen) { std::string filenameU8; file.ReadString<mpt::String::maybeNullTerminated>(filenameU8, strLen); #if defined(MPT_EXTERNAL_SAMPLES) SetSamplePath(i + 1, mpt::PathString::FromUTF8(filenameU8)); #elif !defined(LIBOPENMPT_BUILD_TEST) - AddToLog(LogWarning, mpt::format(U_("Loading external sample %1 ('%2') failed: External samples are not supported."))(i, mpt::ToUnicode(mpt::CharsetUTF8, filenameU8))); + AddToLog(LogWarning, mpt::format(U_("Loading external sample %1 ('%2') failed: External samples are not supported."))(i + 1, mpt::ToUnicode(mpt::CharsetUTF8, filenameU8))); #endif // MPT_EXTERNAL_SAMPLES } else { diff --git a/soundlib/Load_mid.cpp b/soundlib/Load_mid.cpp index 013e741..02b1f10 100644 --- a/soundlib/Load_mid.cpp +++ b/soundlib/Load_mid.cpp @@ -516,6 +516,7 @@ static void MIDINoteOff(MidiChannelState &midiChn, std::vector<ModChannelState> uint8 midiCh = modChnStatus[chn].midiCh; modChnStatus[chn].note = NOTE_NONE; + modChnStatus[chn].sustained = false; midiChn.noteOn[note] = CHANNELINDEX_INVALID; ModCommand &m = patRow[chn]; if(m.note == NOTE_NONE) @@ -953,7 +954,7 @@ bool CSoundFile::ReadMID(FileReader &file, ModLoadingFlags loadFlags) // Release notes that are still being held after note-off for(const auto &chnState : modChnStatus) { - if(chnState.midiCh == midiCh && chnState.sustained) + if(chnState.midiCh == midiCh && chnState.sustained && chnState.note != NOTE_NONE) { MIDINoteOff(midiChnStatus[midiCh], modChnStatus, chnState.note - NOTE_MIN, delay, patRow, drumChns); } diff --git a/soundlib/Load_mo3.cpp b/soundlib/Load_mo3.cpp index 5233d50..d940154 100644 --- a/soundlib/Load_mo3.cpp +++ b/soundlib/Load_mo3.cpp @@ -210,10 +210,16 @@ struct MO3Instrument } if(mptIns.nMidiChannel != MidiNoChannel) { - if(mptIns.wMidiBank < 128) - mptIns.wMidiBank = midiBank + 1; - if(mptIns.nMidiProgram < 128) + if(type == MOD_TYPE_XM) + { mptIns.nMidiProgram = midiPatch + 1; + } else + { + if(midiBank < 128) + mptIns.wMidiBank = midiBank + 1; + if(midiPatch < 128) + mptIns.nMidiProgram = midiPatch + 1; + } mptIns.midiPWD = midiBend; } @@ -1394,7 +1400,7 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags) sampleData.Seek(frame.frameSize); mpegData = sampleData.ReadChunk(sampleData.BytesLeft()); } - + if(ReadMP3Sample(smp, mpegData, true, true) || ReadMediaFoundationSample(smp, mpegData, true)) { if(smpHeader.encoderDelay > 0 && smpHeader.encoderDelay < sample.GetSampleSizeInBytes()) @@ -1579,10 +1585,9 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags) sampleChunk.chunk.Rewind(); FileReader::PinnedRawDataView sampleChunkView = sampleChunk.chunk.GetPinnedRawDataView(); - mergedData.insert(mergedData.end(), mpt::byte_cast<const char*>(sampleChunkView.begin()), mpt::byte_cast<const char*>(sampleChunkView.end())); + mergedData.insert(mergedData.end(), mpt::byte_cast<const char *>(sampleChunkView.begin()), mpt::byte_cast<const char *>(sampleChunkView.end())); #endif - } FileReader mergedDataChunk(mpt::byte_cast<mpt::const_byte_span>(mpt::as_span(mergedData))); @@ -1647,10 +1652,10 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags) { if(sample.uFlags[CHN_16BIT]) { - CopyChannelToInterleaved<SC::Convert<int16, float> >(sample.sample16() + offset * sample.GetNumChannels(), output[chn], channels, decodedSamples, chn); + CopyChannelToInterleaved<SC::Convert<int16, float>>(sample.sample16() + offset * sample.GetNumChannels(), output[chn], channels, decodedSamples, chn); } else { - CopyChannelToInterleaved<SC::Convert<int8, float> >(sample.sample8() + offset * sample.GetNumChannels(), output[chn], channels, decodedSamples, chn); + CopyChannelToInterleaved<SC::Convert<int8, float>>(sample.sample8() + offset * sample.GetNumChannels(), output[chn], channels, decodedSamples, chn); } } } @@ -1687,7 +1692,7 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags) if(sharedHeader) { FileReader::PinnedRawDataView headChunkView = headerChunk.GetPinnedRawDataView(initialRead); - vorb = stb_vorbis_open_pushdata(mpt::byte_cast<const unsigned char*>(headChunkView.data()), mpt::saturate_cast<int>(headChunkView.size()), &consumed, &error, nullptr); + vorb = stb_vorbis_open_pushdata(mpt::byte_cast<const unsigned char *>(headChunkView.data()), mpt::saturate_cast<int>(headChunkView.size()), &consumed, &error, nullptr); headerChunk.Skip(consumed); } FileReader::PinnedRawDataView sampleDataView = sampleData.GetPinnedRawDataView(); @@ -1695,7 +1700,7 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags) std::size_t dataLeft = sampleDataView.size(); if(!sharedHeader) { - vorb = stb_vorbis_open_pushdata(mpt::byte_cast<const unsigned char*>(data), mpt::saturate_cast<int>(dataLeft), &consumed, &error, nullptr); + vorb = stb_vorbis_open_pushdata(mpt::byte_cast<const unsigned char *>(data), mpt::saturate_cast<int>(dataLeft), &consumed, &error, nullptr); sampleData.Skip(consumed); data += consumed; dataLeft -= consumed; @@ -1711,7 +1716,7 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags) { int channels = 0, decodedSamples = 0; float **output; - consumed = stb_vorbis_decode_frame_pushdata(vorb, mpt::byte_cast<const unsigned char*>(data), mpt::saturate_cast<int>(dataLeft), &channels, &output, &decodedSamples); + consumed = stb_vorbis_decode_frame_pushdata(vorb, mpt::byte_cast<const unsigned char *>(data), mpt::saturate_cast<int>(dataLeft), &channels, &output, &decodedSamples); sampleData.Skip(consumed); data += consumed; dataLeft -= consumed; @@ -1721,9 +1726,9 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags) for(int chn = 0; chn < channels; chn++) { if(sample.uFlags[CHN_16BIT]) - CopyChannelToInterleaved<SC::Convert<int16, float> >(sample.sample16() + offset * sample.GetNumChannels(), output[chn], channels, decodedSamples, chn); + CopyChannelToInterleaved<SC::Convert<int16, float>>(sample.sample16() + offset * sample.GetNumChannels(), output[chn], channels, decodedSamples, chn); else - CopyChannelToInterleaved<SC::Convert<int8, float> >(sample.sample8() + offset * sample.GetNumChannels(), output[chn], channels, decodedSamples, chn); + CopyChannelToInterleaved<SC::Convert<int8, float>>(sample.sample8() + offset * sample.GetNumChannels(), output[chn], channels, decodedSamples, chn); } } offset += decodedSamples; diff --git a/soundlib/Load_mt2.cpp b/soundlib/Load_mt2.cpp index e256cb1..bdd6b73 100644 --- a/soundlib/Load_mt2.cpp +++ b/soundlib/Load_mt2.cpp @@ -1156,7 +1156,7 @@ bool CSoundFile::ReadMT2(FileReader &file, ModLoadingFlags loadFlags) } SetSamplePath(i + 1, mpt::PathString::FromLocaleSilent(filename)); #elif !defined(LIBOPENMPT_BUILD_TEST) - AddToLog(LogWarning, mpt::format(U_("Loading external sample %1 ('%2') failed: External samples are not supported."))(i, mpt::ToUnicode(GetCharsetFile(), filename))); + AddToLog(LogWarning, mpt::format(U_("Loading external sample %1 ('%2') failed: External samples are not supported."))(i + 1, mpt::ToUnicode(GetCharsetFile(), filename))); #endif // MPT_EXTERNAL_SAMPLES } } diff --git a/soundlib/Snd_fx.cpp b/soundlib/Snd_fx.cpp index 8681d48..112ec82 100644 --- a/soundlib/Snd_fx.cpp +++ b/soundlib/Snd_fx.cpp @@ -2638,7 +2638,7 @@ bool CSoundFile::ProcessEffects() { note = NOTE_NONE; } - } else if((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && GetNumInstruments() != 0 && ModCommand::IsNoteOrEmpty(static_cast<ModCommand::NOTE>(note))) + } else if((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_J2B)) && GetNumInstruments() != 0 && ModCommand::IsNoteOrEmpty(static_cast<ModCommand::NOTE>(note))) { // IT compatibility: Invalid instrument numbers do nothing, but they are remembered for upcoming notes and do not trigger a note in that case. // Test case: InstrumentNumberChange.it diff --git a/soundlib/Sndmix.cpp b/soundlib/Sndmix.cpp index 7f51ccf..603e923 100644 --- a/soundlib/Sndmix.cpp +++ b/soundlib/Sndmix.cpp @@ -1817,13 +1817,13 @@ void CSoundFile::ProcessSampleAutoVibrato(ModChannel &chn, int &period, Tuning:: default: if(GetType() != MOD_TYPE_MT2) { - vdelta = ft2VibratoTable[chn.nAutoVibPos & 0xFF]; + vdelta = -ITSinusTable[chn.nAutoVibPos & 0xFF]; } else { // Fix flat-sounding pads in "another worlds" by Eternal Engine. // Vibrato starts at the maximum amplitude of the sine wave // and the vibrato frequency never decreases below the original note's frequency. - vdelta = (ft2VibratoTable[(chn.nAutoVibPos + 192) & 0xFF] + 64) / 2; + vdelta = (-ITSinusTable[(chn.nAutoVibPos + 192) & 0xFF] + 64) / 2; } } int n = (vdelta * chn.nAutoVibDepth) / 256; diff --git a/soundlib/Tables.cpp b/soundlib/Tables.cpp index bd4fa2b..3a701b2 100644 --- a/soundlib/Tables.cpp +++ b/soundlib/Tables.cpp @@ -476,28 +476,6 @@ const uint32 XMLinearTable[768] = }; -const int8 ft2VibratoTable[256] = -{ - 0,-2,-3,-5,-6,-8,-9,-11,-12,-14,-16,-17,-19,-20,-22,-23, - -24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42, - -43,-44,-45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56, - -56,-57,-58,-59,-59,-60,-60,-61,-61,-62,-62,-62,-63,-63, - -63,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-63,-63, - -63,-62,-62,-62,-61,-61,-60,-60,-59,-59,-58,-57,-56,-56, - -55,-54,-53,-52,-51,-50,-49,-48,-47,-46,-45,-44,-43,-42, - -41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26,-24,-23, - -22,-20,-19,-17,-16,-14,-12,-11,-9,-8,-6,-5,-3,-2,0, - 2,3,5,6,8,9,11,12,14,16,17,19,20,22,23,24,26,27,29,30, - 32,33,34,36,37,38,39,41,42,43,44,45,46,47,48,49,50,51, - 52,53,54,55,56,56,57,58,59,59,60,60,61,61,62,62,62,63, - 63,63,64,64,64,64,64,64,64,64,64,64,64,63,63,63,62,62, - 62,61,61,60,60,59,59,58,57,56,56,55,54,53,52,51,50,49, - 48,47,46,45,44,43,42,41,39,38,37,36,34,33,32,30,29,27, - 26,24,23,22,20,19,17,16,14,12,11,9,8,6,5,3,2 -}; - - - // round(65536 * 2**(n/768)) // 768 = 64 extra-fine finetune steps for 12 notes // Table content is in 16.16 format @@ -782,7 +760,6 @@ void CResampler::InitFloatmixerTables() void CResampler::InitializeTablesFromScratch(bool force) { - bool initParameterIndependentTables = false; if(force) { diff --git a/soundlib/Tables.h b/soundlib/Tables.h index 092d7ac..0e4b045 100644 --- a/soundlib/Tables.h +++ b/soundlib/Tables.h @@ -31,7 +31,6 @@ extern const int8 retrigTable1[16]; extern const int8 retrigTable2[16]; extern const uint16 XMPeriodTable[104]; extern const uint32 XMLinearTable[768]; -extern const int8 ft2VibratoTable[256]; extern const uint32 FineLinearSlideUpTable[16]; extern const uint32 FineLinearSlideDownTable[16]; extern const uint32 LinearSlideUpTable[256]; diff --git a/soundlib/plugins/PluginMixBuffer.h b/soundlib/plugins/PluginMixBuffer.h index e7a62dc..4e18524 100644 --- a/soundlib/plugins/PluginMixBuffer.h +++ b/soundlib/plugins/PluginMixBuffer.h @@ -12,6 +12,9 @@ #include "BuildSettings.h" +#include "../../common/mptAlloc.h" + + OPENMPT_NAMESPACE_BEGIN @@ -25,7 +28,11 @@ protected: std::vector<buffer_t *> inputs; // Pointers to input buffers std::vector<buffer_t *> outputs; // Pointers to output buffers +#if defined(MPT_ENABLE_ALIGNED_ALLOC) mpt::aligned_buffer<buffer_t, 16> alignedBuffer; // Aligned buffer pointed into +#else + std::vector<buffer_t> alignedBuffer; +#endif // Return pointer to an aligned buffer const buffer_t *GetBuffer(size_t index) const @@ -56,7 +63,11 @@ public: outputs.resize(numOutputs); // Create inputs + outputs buffers - alignedBuffer.destructive_resize(bufferSize * (numInputs + numOutputs)); + #if defined(MPT_ENABLE_ALIGNED_ALLOC) + alignedBuffer.destructive_resize(bufferSize * (numInputs + numOutputs)); + #else + alignedBuffer.resize(bufferSize * (numInputs + numOutputs)); + #endif } MPT_EXCEPTION_CATCH_OUT_OF_MEMORY(e) { @@ -65,7 +76,11 @@ public: inputs.shrink_to_fit(); outputs.clear(); outputs.shrink_to_fit(); - alignedBuffer.destructive_resize(0); + #if defined(MPT_ENABLE_ALIGNED_ALLOC) + alignedBuffer.destructive_resize(0); + #else + alignedBuffer.resize(0); + #endif return false; } |