[libOpenMPT] Updated to version 0.6.3

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2022-06-11 07:26:39 -07:00
parent af0a2436fc
commit dd307d27a7
23 changed files with 75 additions and 43 deletions

View file

@ -39,7 +39,7 @@ How to compile
To compile the project, open `build/vsVERSIONwin7/OpenMPT.sln` (VERSION To compile the project, open `build/vsVERSIONwin7/OpenMPT.sln` (VERSION
being 2017, 2019, or 2022) and hit the compile button. Other target being 2017, 2019, or 2022) and hit the compile button. Other target
systems can be found in the `vs2017*`, `vs2019*`, and `vs2022` sibling systems can be found in the `vs2017*`, `vs2019*`, and `vs2022*` sibling
folders. folders.
Note that you have to build the `PluginBridge` and `PluginBridgeLegacy` Note that you have to build the `PluginBridge` and `PluginBridgeLegacy`

View file

@ -1,4 +1,4 @@
MPT_SVNVERSION=17108 MPT_SVNVERSION=17274
MPT_SVNURL=https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.2 MPT_SVNURL=https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.3
MPT_SVNDATE=2022-03-13T14:50:28.374505Z MPT_SVNDATE=2022-04-24T13:18:24.140099Z

View file

@ -3,6 +3,7 @@ ifeq ($(HOST),unix)
ifeq ($(HOST_FLAVOUR),MACOSX) ifeq ($(HOST_FLAVOUR),MACOSX)
NO_PULSEAUDIO?=1
include build/make/config-clang.mk include build/make/config-clang.mk
# Mac OS X overrides # Mac OS X overrides
DYNLINK=0 DYNLINK=0

View file

@ -1,10 +1,10 @@
#pragma once #pragma once
#define OPENMPT_VERSION_SVNVERSION "17108" #define OPENMPT_VERSION_SVNVERSION "17274"
#define OPENMPT_VERSION_REVISION 17108 #define OPENMPT_VERSION_REVISION 17274
#define OPENMPT_VERSION_DIRTY 0 #define OPENMPT_VERSION_DIRTY 0
#define OPENMPT_VERSION_MIXEDREVISIONS 0 #define OPENMPT_VERSION_MIXEDREVISIONS 0
#define OPENMPT_VERSION_URL "https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.2" #define OPENMPT_VERSION_URL "https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.3"
#define OPENMPT_VERSION_DATE "2022-03-13T14:50:28.374505Z" #define OPENMPT_VERSION_DATE "2022-04-24T13:18:24.140099Z"
#define OPENMPT_VERSION_IS_PACKAGE 1 #define OPENMPT_VERSION_IS_PACKAGE 1

View file

@ -20,6 +20,10 @@
#endif // MODPLUG_TRACKER && MPT_OS_WINDOWS #endif // MODPLUG_TRACKER && MPT_OS_WINDOWS
#endif // MPT_ENABLE_FILEIO #endif // MPT_ENABLE_FILEIO
#if defined(MPT_ENABLE_FILEIO)
#include <stdexcept>
#endif // MPT_ENABLE_FILEIO
#ifdef MODPLUG_TRACKER #ifdef MODPLUG_TRACKER
#if MPT_OS_WINDOWS #if MPT_OS_WINDOWS
#include <windows.h> #include <windows.h>

View file

@ -17,7 +17,7 @@ OPENMPT_NAMESPACE_BEGIN
// Version definitions. The only thing that needs to be changed when changing version number. // Version definitions. The only thing that needs to be changed when changing version number.
#define VER_MAJORMAJOR 1 #define VER_MAJORMAJOR 1
#define VER_MAJOR 30 #define VER_MAJOR 30
#define VER_MINOR 03 #define VER_MINOR 04
#define VER_MINORMINOR 00 #define VER_MINORMINOR 00
OPENMPT_NAMESPACE_END OPENMPT_NAMESPACE_END

View file

@ -193,6 +193,7 @@ cleanup:
if ( pa_initialized ) { if ( pa_initialized ) {
Pa_Terminate(); Pa_Terminate();
pa_initialized = 0; pa_initialized = 0;
(void)pa_initialized;
} }
if ( mod ) { if ( mod ) {

View file

@ -121,7 +121,7 @@ static blob_t * load_file( const char * filename ) {
if ( tell_result < 0 ) { if ( tell_result < 0 ) {
goto fail; goto fail;
} }
if ( (unsigned long)tell_result > SIZE_MAX ) { if ( (unsigned long)(size_t)(unsigned long)tell_result != (unsigned long)tell_result ) {
goto fail; goto fail;
} }
blob->size = (size_t)tell_result; blob->size = (size_t)tell_result;
@ -283,6 +283,7 @@ cleanup:
if ( pa_initialized ) { if ( pa_initialized ) {
Pa_Terminate(); Pa_Terminate();
pa_initialized = 0; pa_initialized = 0;
(void)pa_initialized;
} }
if ( mod ) { if ( mod ) {

View file

@ -80,7 +80,6 @@ static int probe_file( const char * filename ) {
#if ( LIBOPENMPT_EXAMPLE_PROBE_RESULT == LIBOPENMPT_EXAMPLE_PROBE_RESULT_BINARY ) #if ( LIBOPENMPT_EXAMPLE_PROBE_RESULT == LIBOPENMPT_EXAMPLE_PROBE_RESULT_BINARY )
probe_file_header_result = openmpt_probe_file_header_from_stream( OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT, openmpt_stream_get_file_callbacks(), file, &libopenmpt_example_logfunc, NULL, &openmpt_error_func_default, NULL, &mod_err, NULL ); probe_file_header_result = openmpt_probe_file_header_from_stream( OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT, openmpt_stream_get_file_callbacks(), file, &libopenmpt_example_logfunc, NULL, &openmpt_error_func_default, NULL, &mod_err, NULL );
probe_file_header_result_str = NULL; probe_file_header_result_str = NULL;
result_binary = 0;
switch ( probe_file_header_result ) { switch ( probe_file_header_result ) {
case OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS: case OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS:
probe_file_header_result_str = "Success "; probe_file_header_result_str = "Success ";
@ -96,11 +95,13 @@ static int probe_file( const char * filename ) {
break; break;
case OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR: case OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR:
result_binary = 0; result_binary = 0;
(void)result_binary;
fprintf( stderr, "Error: %s\n", "openmpt_probe_file_header() failed." ); fprintf( stderr, "Error: %s\n", "openmpt_probe_file_header() failed." );
goto fail; goto fail;
break; break;
default: default:
result_binary = 0; result_binary = 0;
(void)result_binary;
fprintf( stderr, "Error: %s\n", "openmpt_probe_file_header() failed." ); fprintf( stderr, "Error: %s\n", "openmpt_probe_file_header() failed." );
goto fail; goto fail;
break; break;

View file

@ -36,6 +36,7 @@
#if ( defined( _WIN32 ) || defined( WIN32 ) ) && ( defined( _UNICODE ) || defined( UNICODE ) ) #if ( defined( _WIN32 ) || defined( WIN32 ) ) && ( defined( _UNICODE ) || defined( UNICODE ) )
#if defined( __GNUC__ ) #if defined( __GNUC__ )
// mingw-w64 g++ does only default to special C linkage for "main", but not for "wmain" (see <https://sourceforge.net/p/mingw-w64/wiki2/Unicode%20apps/>). // mingw-w64 g++ does only default to special C linkage for "main", but not for "wmain" (see <https://sourceforge.net/p/mingw-w64/wiki2/Unicode%20apps/>).
extern "C" int wmain( int /*argc*/, wchar_t * /*argv*/[] );
extern "C" int wmain( int argc, wchar_t * argv[] ) { extern "C" int wmain( int argc, wchar_t * argv[] ) {
#else #else
int wmain( int argc, wchar_t * argv[] ) { int wmain( int argc, wchar_t * argv[] ) {

View file

@ -5,6 +5,16 @@ Changelog {#changelog}
For fully detailed change log, please see the source repository directly. This For fully detailed change log, please see the source repository directly. This
is just a high-level summary. is just a high-level summary.
### libopenmpt 0.6.3 (2022-04-24)
* Pitch / Pan Separation and Random Variation instrument properties were not
resetting properly when seeking, potentially causing instruments to be
played e.g. at a vastly different pan position compared to playing the
module continuously.
* MED: Stereo samples were not imported correctly.
* zlib: Update to v1.2.12 (2022-03-27).
### libopenmpt 0.6.2 (2022-03-13) ### libopenmpt 0.6.2 (2022-03-13)
* [**Sec**] Possible out-of-bounds write in malformed IT / XM / MPTM files * [**Sec**] Possible out-of-bounds write in malformed IT / XM / MPTM files

View file

@ -21,7 +21,7 @@
/*! \brief libopenmpt minor version number */ /*! \brief libopenmpt minor version number */
#define OPENMPT_API_VERSION_MINOR 6 #define OPENMPT_API_VERSION_MINOR 6
/*! \brief libopenmpt patch version number */ /*! \brief libopenmpt patch version number */
#define OPENMPT_API_VERSION_PATCH 2 #define OPENMPT_API_VERSION_PATCH 3
/*! \brief libopenmpt pre-release tag */ /*! \brief libopenmpt pre-release tag */
#define OPENMPT_API_VERSION_PREREL "" #define OPENMPT_API_VERSION_PREREL ""
/*! \brief libopenmpt pre-release flag */ /*! \brief libopenmpt pre-release flag */

View file

@ -1,8 +1,8 @@
LIBOPENMPT_VERSION_MAJOR=0 LIBOPENMPT_VERSION_MAJOR=0
LIBOPENMPT_VERSION_MINOR=6 LIBOPENMPT_VERSION_MINOR=6
LIBOPENMPT_VERSION_PATCH=2 LIBOPENMPT_VERSION_PATCH=3
LIBOPENMPT_VERSION_PREREL= LIBOPENMPT_VERSION_PREREL=
LIBOPENMPT_LTVER_CURRENT=3 LIBOPENMPT_LTVER_CURRENT=3
LIBOPENMPT_LTVER_REVISION=2 LIBOPENMPT_LTVER_REVISION=3
LIBOPENMPT_LTVER_AGE=3 LIBOPENMPT_LTVER_AGE=3

View file

@ -764,7 +764,10 @@ bool CSoundFile::ReadMED(FileReader &file, ModLoadingFlags loadFlags)
if(instrOffsets[ins - 1] != 0 && file.Seek(instrOffsets[ins - 1])) if(instrOffsets[ins - 1] != 0 && file.Seek(instrOffsets[ins - 1]))
{ {
file.ReadStruct(instrHeader); file.ReadStruct(instrHeader);
sampleChunk = file.ReadChunk(instrHeader.length); uint32 chunkLength = instrHeader.length;
if(instrHeader.type > 0 && (instrHeader.type & MMDInstrHeader::STEREO))
chunkLength *= 2u;
sampleChunk = file.ReadChunk(chunkLength);
} }
const bool isSynth = instrHeader.type < 0; const bool isSynth = instrHeader.type < 0;
const size_t maskedType = static_cast<size_t>(instrHeader.type & MMDInstrHeader::TYPEMASK); const size_t maskedType = static_cast<size_t>(instrHeader.type & MMDInstrHeader::TYPEMASK);
@ -916,7 +919,7 @@ bool CSoundFile::ReadMED(FileReader &file, ModLoadingFlags loadFlags)
sampleIO |= SampleIO::_16bit; sampleIO |= SampleIO::_16bit;
length /= 2; length /= 2;
} }
if (instrHeader.type & MMDInstrHeader::STEREO) if(instrHeader.type & MMDInstrHeader::STEREO)
{ {
sampleIO |= SampleIO::stereoSplit; sampleIO |= SampleIO::stereoSplit;
length /= 2; length /= 2;

View file

@ -524,6 +524,7 @@ bool CSoundFile::ReadS3M(FileReader &file, ModLoadingFlags loadFlags)
// All Scream Tracker versions except for some probably early revisions of Scream Tracker 3.00 write GUS addresses. GUS support might not have existed at that point (1992). // All Scream Tracker versions except for some probably early revisions of Scream Tracker 3.00 write GUS addresses. GUS support might not have existed at that point (1992).
// Hence if a file claims to be written with ST3 (but not ST3.00), but has no GUS addresses, we deduce that it must be written by some other software (e.g. some PSM -> S3M conversions) // Hence if a file claims to be written with ST3 (but not ST3.00), but has no GUS addresses, we deduce that it must be written by some other software (e.g. some PSM -> S3M conversions)
isST3 = false; isST3 = false;
MPT_UNUSED(isST3);
m_modFormat.madeWithTracker = U_("Unknown"); m_modFormat.madeWithTracker = U_("Unknown");
} else if(isST3) } else if(isST3)
{ {

View file

@ -792,6 +792,7 @@ bool CSoundFile::ReadSTP(FileReader &file, ModLoadingFlags loadFlags)
else if(m.param & 0xF0) else if(m.param & 0xF0)
m.param |= 0x0F; m.param |= 0x0F;
didVolSlide = true; didVolSlide = true;
MPT_UNUSED(didVolSlide);
} else if(chnMem.autoTremolo) } else if(chnMem.autoTremolo)
{ {

View file

@ -155,6 +155,28 @@ void ModChannel::SetInstrumentPan(int32 pan, const CSoundFile &sndFile)
} }
void ModChannel::RestorePanAndFilter()
{
if(nRestorePanOnNewNote > 0)
{
nPan = (nRestorePanOnNewNote & 0x7FFF) - 1;
if(nRestorePanOnNewNote & 0x8000)
dwFlags.set(CHN_SURROUND);
nRestorePanOnNewNote = 0;
}
if(nRestoreResonanceOnNewNote > 0)
{
nResonance = nRestoreResonanceOnNewNote - 1;
nRestoreResonanceOnNewNote = 0;
}
if(nRestoreCutoffOnNewNote > 0)
{
nCutOff = nRestoreCutoffOnNewNote - 1;
nRestoreCutoffOnNewNote = 0;
}
}
void ModChannel::RecalcTuningFreq(Tuning::RATIOTYPE vibratoFactor, Tuning::NOTEINDEXTYPE arpeggioSteps, const CSoundFile &sndFile) void ModChannel::RecalcTuningFreq(Tuning::RATIOTYPE vibratoFactor, Tuning::NOTEINDEXTYPE arpeggioSteps, const CSoundFile &sndFile)
{ {
if(!HasCustomTuning()) if(!HasCustomTuning())

View file

@ -200,6 +200,7 @@ struct ModChannel
void UpdateInstrumentVolume(const ModSample *smp, const ModInstrument *ins); void UpdateInstrumentVolume(const ModSample *smp, const ModInstrument *ins);
void SetInstrumentPan(int32 pan, const CSoundFile &sndFile); void SetInstrumentPan(int32 pan, const CSoundFile &sndFile);
void RestorePanAndFilter();
void RecalcTuningFreq(Tuning::RATIOTYPE vibratoFactor, Tuning::NOTEINDEXTYPE arpeggioSteps, const CSoundFile &sndFile); void RecalcTuningFreq(Tuning::RATIOTYPE vibratoFactor, Tuning::NOTEINDEXTYPE arpeggioSteps, const CSoundFile &sndFile);

View file

@ -1163,8 +1163,7 @@ bool CSoundFile::ReadS3ISample(SAMPLEINDEX nSample, FileReader &file)
bool CSoundFile::SaveS3ISample(SAMPLEINDEX smp, std::ostream &f) const bool CSoundFile::SaveS3ISample(SAMPLEINDEX smp, std::ostream &f) const
{ {
const ModSample &sample = Samples[smp]; const ModSample &sample = Samples[smp];
S3MSampleHeader sampleHeader; S3MSampleHeader sampleHeader{};
MemsetZero(sampleHeader);
SmpLength length = sampleHeader.ConvertToS3M(sample); SmpLength length = sampleHeader.ConvertToS3M(sample);
mpt::String::WriteBuf(mpt::String::nullTerminated, sampleHeader.name) = m_szNames[smp]; mpt::String::WriteBuf(mpt::String::nullTerminated, sampleHeader.name) = m_szNames[smp];
mpt::String::WriteBuf(mpt::String::maybeNullTerminated, sampleHeader.reserved2) = mpt::ToCharset(mpt::Charset::UTF8, Version::Current().GetOpenMPTVersionString()); mpt::String::WriteBuf(mpt::String::maybeNullTerminated, sampleHeader.reserved2) = mpt::ToCharset(mpt::Charset::UTF8, Version::Current().GetOpenMPTVersionString());
@ -1186,9 +1185,10 @@ bool CSoundFile::SaveS3ISample(SAMPLEINDEX smp, std::ostream &f) const
bool CSoundFile::ReadSBISample(SAMPLEINDEX sample, FileReader &file) bool CSoundFile::ReadSBISample(SAMPLEINDEX sample, FileReader &file)
{ {
file.Rewind(); file.Rewind();
if(!file.ReadMagic("SBI\x1A") const auto magic = file.ReadArray<char, 4>();
|| !file.CanRead(32 + sizeof(OPLPatch)) if((memcmp(magic.data(), "SBI\x1A", 4) && memcmp(magic.data(), "SBI\x1D", 4)) // 1D = broken JuceOPLVSTi files
|| file.CanRead(64)) // Arbitrary threshold to reject files that are unlikely to be SBI files || !file.CanRead(32 + sizeof(OPLPatch))
|| file.CanRead(64)) // Arbitrary threshold to reject files that are unlikely to be SBI files
return false; return false;
if(!SupportsOPL()) if(!SupportsOPL())
@ -1751,7 +1751,6 @@ bool CSoundFile::ReadCAFSample(SAMPLEINDEX nSample, FileReader &file, bool mayNo
} }
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
// AIFF File I/O // AIFF File I/O

View file

@ -545,7 +545,10 @@ std::vector<GetLengthType> CSoundFile::GetLength(enmGetLengthResetMode adjustMod
memory.chnSettings[nChn].vol = 0xFF; memory.chnSettings[nChn].vol = 0xFF;
} }
if(chn.rowCommand.IsNote()) if(chn.rowCommand.IsNote())
{
chn.nLastNote = note; chn.nLastNote = note;
chn.RestorePanAndFilter();
}
// Update channel panning // Update channel panning
if(chn.rowCommand.IsNote() || chn.rowCommand.instr) if(chn.rowCommand.IsNote() || chn.rowCommand.instr)
@ -2806,23 +2809,7 @@ bool CSoundFile::ProcessEffects()
CheckNNA(nChn, instr, note, false); CheckNNA(nChn, instr, note, false);
} }
if(chn.nRestorePanOnNewNote > 0) chn.RestorePanAndFilter();
{
chn.nPan = (chn.nRestorePanOnNewNote & 0x7FFF) - 1;
if(chn.nRestorePanOnNewNote & 0x8000)
chn.dwFlags.set(CHN_SURROUND);
chn.nRestorePanOnNewNote = 0;
}
if(chn.nRestoreResonanceOnNewNote > 0)
{
chn.nResonance = chn.nRestoreResonanceOnNewNote - 1;
chn.nRestoreResonanceOnNewNote = 0;
}
if(chn.nRestoreCutoffOnNewNote > 0)
{
chn.nCutOff = chn.nRestoreCutoffOnNewNote - 1;
chn.nRestoreCutoffOnNewNote = 0;
}
} }
// Instrument Change ? // Instrument Change ?

View file

@ -12,6 +12,7 @@
#include <limits> #include <limits>
#include <cstddef> #include <cstddef>
#include <cstdint>
namespace mpt { namespace mpt {

View file

@ -20,7 +20,7 @@ inline namespace MPT_INLINE_NS {
namespace tests { namespace tests {
namespace string_convert { namespace string_transcode {
#if MPT_COMPILER_CLANG #if MPT_COMPILER_CLANG
#pragma clang diagnostic push #pragma clang diagnostic push
@ -233,7 +233,7 @@ MPT_TEST_GROUP_INLINE("mpt/string_transcode")
#endif // !MPT_COMPILER_QUIRK_NO_WCHAR #endif // !MPT_COMPILER_QUIRK_NO_WCHAR
} }
} // namespace string_convert } // namespace string_transcode
} // namespace tests } // namespace tests

View file

@ -2329,7 +2329,6 @@
83E5EFC61FFEF7CC00659F0F /* Debug */ = { 83E5EFC61FFEF7CC00659F0F /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
@ -2352,7 +2351,6 @@
83E5EFC71FFEF7CC00659F0F /* Release */ = { 83E5EFC71FFEF7CC00659F0F /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;