[libOpenMPT] Updated to version 0.6.4

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-12 19:40:39 -07:00
parent b675ced77b
commit e84065ff5c
26 changed files with 268 additions and 45 deletions

View File

@ -218,7 +218,28 @@ LIBOPENMPT_SO_VERSION=$(LIBOPENMPT_LTVER_CURRENT)
# host setup
ifeq ($(OS),Windows_NT)
ifneq ($(MSYSTEM)x,x)
HOST=unix
HOST_FLAVOUR=
TOOLCHAIN_SUFFIX=
CPPCHECK = cppcheck
MKDIR_P = mkdir -p
RM = rm -f
RMTREE = rm -rf
INSTALL = install
INSTALL_MAKE_DIR = install -d
INSTALL_DIR = cp -r -v
FIXPATH = $1
HOST_FLAVOUR=MSYS2
NUMTHREADS:=$(shell nproc)
else ifeq ($(OS),Windows_NT)
HOST=windows
HOST_FLAVOUR=
@ -1662,7 +1683,7 @@ endif
svn export ./libopenmpt/doc/xmp-openmpt.txt bin/dist-retro-win9x/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/XMPlay/xmp-openmpt.txt --native-eol CRLF
cp bin/xmp-openmpt.dll bin/dist-retro-win9x/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/XMPlay/xmp-openmpt.dll
mkdir -p bin/dist-retro-win9x/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/Winamp
svn export ./libopenmpt/doc/xmp-openmpt.txt bin/dist-retro-win9x/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/Winamp/in_openmpt.txt --native-eol CRLF
svn export ./libopenmpt/doc/in_openmpt.txt bin/dist-retro-win9x/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/Winamp/in_openmpt.txt --native-eol CRLF
cp bin/in_openmpt.dll bin/dist-retro-win9x/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/Winamp/in_openmpt.dll
cd bin/dist-retro-win9x/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/ && ../../../build/tools/7zip/7z a -tzip -mx=9 ../libopenmpt-$(DIST_LIBOPENMPT_VERSION).bin.retro.win9x.zip *

View File

@ -1,4 +1,4 @@
MPT_SVNVERSION=17274
MPT_SVNURL=https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.3
MPT_SVNDATE=2022-04-24T13:18:24.140099Z
MPT_SVNVERSION=17506
MPT_SVNURL=https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.4
MPT_SVNDATE=2022-06-12T13:42:37.263635Z

View File

@ -9,6 +9,26 @@ include build/make/config-clang.mk
DYNLINK=0
SHARED_SONAME=0
else ifeq ($(HOST_FLAVOUR),MSYS2)
ifeq ($(MSYSTEM),MINGW64)
WINDOWS_ARCH=amd64
include build/make/config-mingw-w64.mk
else ifeq ($(MSYSTEM),MINGW32)
WINDOWS_ARCH=x86
include build/make/config-mingw-w64.mk
else ifeq ($(MSYSTEM),UCRT64)
WINDOWS_ARCH=amd64
include build/make/config-mingw-w64.mk
else ifeq ($(MSYSTEM),CLANG64)
WINDOWS_ARCH=amd64
MINGW_COMPILER=clang
include build/make/config-mingw-w64.mk
else
WINDOWS_ARCH=x86
include build/make/config-mingw-w64.mk
endif
else ifeq ($(HOST_FLAVOUR),LINUX)
include build/make/config-gcc.mk

View File

@ -0,0 +1,118 @@
ifeq ($(WINDOWS_ARCH),)
MINGW_ARCH = i686
else ifeq ($(WINDOWS_ARCH),x86)
MINGW_ARCH = i686
else ifeq ($(WINDOWS_ARCH),amd64)
MINGW_ARCH = x86_64
#else ifeq ($(WINDOWS_ARCH),arm)
#MINGW_ARCH =
#else ifeq ($(WINDOWS_ARCH),arm64)
#MINGW_ARCH =
else
$(error unknown WINDOWS_ARCH)
endif
CC = $(MINGW_ARCH)-w64-mingw32-gcc$(MINGW_FLAVOUR)
CXX = $(MINGW_ARCH)-w64-mingw32-g++$(MINGW_FLAVOUR)
LD = $(MINGW_ARCH)-w64-mingw32-g++$(MINGW_FLAVOUR)
AR = $(MINGW_ARCH)-w64-mingw32-ar$(MINGW_FLAVOUR)
CXXFLAGS_STDCXX = -std=c++17 -fexceptions -frtti
CFLAGS_STDC = -std=c99
CXXFLAGS += $(CXXFLAGS_STDCXX)
CFLAGS += $(CFLAGS_STDC)
CPPFLAGS +=
CXXFLAGS += -municode -mconsole -mthreads
CFLAGS += -municode -mconsole -mthreads
LDFLAGS +=
LDLIBS += -lm -lole32 -lrpcrt4 -lwinmm
ARFLAGS := rcs
PC_LIBS_PRIVATE += -lole32 -lrpcrt4
ifeq ($(WINDOWS_FAMILY),)
# nothing
else ifeq ($(WINDOWS_FAMILY),desktop-app)
# nothing
else ifeq ($(WINDOWS_FAMILY),app)
CPPFLAGS += -DWINAPI_FAMILY=2
OPENMPT123=0
else ifeq ($(WINDOWS_FAMILY),phone-app)
CPPFLAGS += -DWINAPI_FAMILY=3
OPENMPT123=0
else ifeq ($(WINDOWS_FAMILY),pc-app)
CPPFLAGS += -DWINAPI_FAMILY=2
OPENMPT123=0
else
$(error unknown WINDOWS_FAMILY)
endif
ifeq ($(WINDOWS_VERSION),)
# nothing
else ifeq ($(WINDOWS_VERSION),win95)
CPPFLAGS += -D_WIN32_WINDOWS=0x0400
else ifeq ($(WINDOWS_VERSION),win98)
CPPFLAGS += -D_WIN32_WINDOWS=0x0410
else ifeq ($(WINDOWS_VERSION),winme)
CPPFLAGS += -D_WIN32_WINDOWS=0x0490
else ifeq ($(WINDOWS_VERSION),winnt4)
CPPFLAGS += -D_WIN32_WINNT=0x0400
else ifeq ($(WINDOWS_VERSION),win2000)
CPPFLAGS += -D_WIN32_WINNT=0x0500
else ifeq ($(WINDOWS_VERSION),winxp)
CPPFLAGS += -D_WIN32_WINNT=0x0501
else ifeq ($(WINDOWS_VERSION),winxp64)
CPPFLAGS += -D_WIN32_WINNT=0x0502
else ifeq ($(WINDOWS_VERSION),winvista)
CPPFLAGS += -DNTDDI_VERSION=0x06000000
else ifeq ($(WINDOWS_VERSION),win7)
CPPFLAGS += -DNTDDI_VERSION=0x06010000
else ifeq ($(WINDOWS_VERSION),win8)
CPPFLAGS += -DNTDDI_VERSION=0x06020000
else ifeq ($(WINDOWS_VERSION),win8.1)
CPPFLAGS += -DNTDDI_VERSION=0x06030000
else ifeq ($(WINDOWS_VERSION),win10)
CPPFLAGS += -DNTDDI_VERSION=0x0A000000
else
$(error unknown WINDOWS_VERSION)
endif
ifeq ($(MINGW_COMPILER),clang)
include build/make/warnings-clang.mk
else
include build/make/warnings-gcc.mk
endif
EXESUFFIX=.exe
SOSUFFIX=.dll
SOSUFFIXWINDOWS=1
DYNLINK=0
SHARED_LIB=1
STATIC_LIB=0
SHARED_SONAME=0
ifeq ($(HOST_FLAVOUR),MSYS2)
else
IS_CROSS=1
NO_ZLIB=1
NO_LTDL=1
NO_DL=1
NO_MPG123=1
NO_OGG=1
NO_VORBIS=1
NO_VORBISFILE=1
NO_PORTAUDIO=1
NO_PORTAUDIOCPP=1
NO_PULSEAUDIO=1
NO_SDL=1
NO_SDL2=1
NO_SNDFILE=1
NO_FLAC=1
endif

View File

@ -1,10 +1,10 @@
#pragma once
#define OPENMPT_VERSION_SVNVERSION "17274"
#define OPENMPT_VERSION_REVISION 17274
#define OPENMPT_VERSION_SVNVERSION "17506"
#define OPENMPT_VERSION_REVISION 17506
#define OPENMPT_VERSION_DIRTY 0
#define OPENMPT_VERSION_MIXEDREVISIONS 0
#define OPENMPT_VERSION_URL "https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.3"
#define OPENMPT_VERSION_DATE "2022-04-24T13:18:24.140099Z"
#define OPENMPT_VERSION_URL "https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.4"
#define OPENMPT_VERSION_DATE "2022-06-12T13:42:37.263635Z"
#define OPENMPT_VERSION_IS_PACKAGE 1

View File

@ -500,7 +500,9 @@
// windows.h excludes
#define NOMEMMGR // GMEM_*, LMEM_*, GHND, LHND, associated routines
#ifndef NOMINMAX
#define NOMINMAX // Macros min(a,b) and max(a,b)
#endif
#define NOSERVICE // All Service Controller routines, SERVICE_ equates, etc.
#define NOCOMM // COMM driver routines
#define NOKANJI // Kanji support stuff.

View File

@ -17,7 +17,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 30
#define VER_MINOR 04
#define VER_MINOR 05
#define VER_MINORMINOR 00
OPENMPT_NAMESPACE_END

View File

@ -5,6 +5,21 @@ Changelog {#changelog}
For fully detailed change log, please see the source repository directly. This
is just a high-level summary.
### libopenmpt 0.6.4 (2022-06-12)
* [**Bug**] openmpt123: Linking failed when using Autotools build system
targeting MinGW.
* [**Bug**] tests: Linking failed when using Autotools build system targeting
MinGW.
* [**Bug**] examples: Linking failed when using Autotools build system
targeting MinGW.
* [**Change**] Support for mingw-std-threads when building for MinGW targets
is now deprecated because this is not supported for GCC 11 or later (see
<https://github.com/meganz/mingw-std-threads/issues/79>).
* Ping-pong sample loops sometimes stopped playing at the end of the loop.
### libopenmpt 0.6.3 (2022-04-24)
* Pitch / Pan Separation and Random Variation instrument properties were not

View File

@ -23,8 +23,7 @@ Dependencies
* **GCC 8.1** or higher
* **Clang 7** or higher
* **MinGW-W64 8.1** or higher (it is recommended to preferably use
posix threading model as opposed to win32 threading model, or at least
have mingw-std-threads available otherwise)
posix threading model as opposed to win32 threading model)
* **emscripten 1.39.1** or higher
* **DJGPP GCC 8.1** or higher
* any other **C++17 compliant** compiler

View File

@ -34,7 +34,9 @@
#if defined(MPT_WITH_MFC)
#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS // Avoid binary bloat from linking unused MFC controls
#endif // MPT_WITH_MFC
#ifndef NOMINMAX
#define NOMINMAX
#endif
#if defined(MPT_WITH_MFC)
#include <afxwin.h>
#include <afxcmn.h>

View File

@ -87,8 +87,12 @@ MPT_WARNING("Warning: libopenmpt for WinRT is built with reduced functionality.
MPT_WARNING("Warning: libopenmpt built in non thread-safe mode because mutexes are not supported by the C++ standard library available.")
#endif // MPT_MUTEX_NONE
#if (defined(__MINGW32__) || defined(__MINGW64__)) && !defined(_GLIBCXX_HAS_GTHREADS) && !defined(MPT_WITH_MINGWSTDTHREADS)
MPT_WARNING("Warning: Building libopenmpt with MinGW-w64 without std::thread support is not recommended and is deprecated. Please use MinGW-w64 with posix threading model (as opposed to win32 threading model), or build with mingw-std-threads.")
#if (defined(__MINGW32__) || defined(__MINGW64__)) && !defined(_GLIBCXX_HAS_GTHREADS)
#if defined(MPT_WITH_MINGWSTDTHREADS)
MPT_WARNING("Warning: Building with mingw-std-threads is deprecated because this is not supported with GCC 11 or later.")
#else // !MINGWSTDTHREADS
MPT_WARNING("Warning: Platform (Windows) supports multi-threading, however the toolchain (MinGW/GCC) does not. The resulting libopenmpt may not be thread-safe. This is a MinGW/GCC issue. You can avoid this warning by using a MinGW toolchain built with posix threading model as opposed to win32 threading model.")
#endif // MINGWSTDTHREADS
#endif // MINGW
#if MPT_CLANG_AT_LEAST(5,0,0) && MPT_CLANG_BEFORE(11,0,0) && defined(__powerpc__) && !defined(__powerpc64__)
@ -99,8 +103,7 @@ MPT_WARNING("Warning: libopenmpt is known to trigger bad code generation with Cl
#if defined(MPT_ASSERT_HANDLER_NEEDED) && !defined(ENABLE_TESTS)
MPT_NOINLINE void AssertHandler(const mpt::source_location &loc, const char *expr, const char *msg)
{
MPT_NOINLINE void AssertHandler(const mpt::source_location &loc, const char *expr, const char *msg) {
if(msg) {
mpt::log::GlobalLogger().SendLogMessage(loc, LogError, "ASSERT",
MPT_USTRING("ASSERTION FAILED: ") + mpt::ToUnicode(mpt::CharsetSource, msg) + MPT_USTRING(" (") + mpt::ToUnicode(mpt::CharsetSource, expr) + MPT_USTRING(")")

View File

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

View File

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

View File

@ -1057,6 +1057,7 @@ void render_loop( commandlineflags & flags, Tmod & mod, double & duration, texto
if ( multiline ) {
lines += 1;
// cppcheck-suppress identicalInnerCondition
if ( flags.show_ui ) {
lines += 1;
}
@ -1174,7 +1175,7 @@ void render_loop( commandlineflags & flags, Tmod & mod, double & duration, texto
cpu /= ( static_cast<double>( count ) ) / static_cast<double>( flags.samplerate );
double mix = ( static_cast<double>( count ) ) / static_cast<double>( flags.samplerate );
cpu_smooth = ( 1.0 - mix ) * cpu_smooth + mix * cpu;
sprintf( cpu_str, "%.2f%%", cpu_smooth * 100.0 );
std::snprintf( cpu_str, 64, "%.2f%%", cpu_smooth * 100.0 );
}
}

View File

@ -30,7 +30,7 @@ namespace openmpt123 {
struct allegro42_exception : public exception {
static std::string error_to_string() {
try {
return allegro_error ? std::string( allegro_error ) : std::string();
return std::string( allegro_error );
} catch ( const std::bad_alloc & ) {
return std::string();
}

View File

@ -190,12 +190,21 @@ struct MixLoopState
// Part 2: Compute how many samples we can render until we reach the end of sample / loop boundary / etc.
SamplePosition nPos = chn.position;
// too big increment, and/or too small loop length
if (nPos.GetInt() < nLoopStart)
const SmpLength nPosInt = nPos.GetUInt();
if(nPos.GetInt() < nLoopStart)
{
if (nPos.IsNegative() || nInc.IsNegative()) return 0;
// too big increment, and/or too small loop length
if(nPos.IsNegative() || nInc.IsNegative())
return 0;
} else
{
// Not testing for equality since we might be going backwards from the very end of the sample
if(nPosInt > chn.nLength)
return 0;
// If going forwards and we're preceisely at the end, there's no point in going further
if(nPosInt == chn.nLength && nInc.IsPositive())
return 0;
}
if (nPos.IsNegative() || nPos.GetUInt() >= chn.nLength) return 0;
uint32 nSmpCount = nSamples;
SamplePosition nInv = nInc;
if (nInc.IsNegative())
@ -206,7 +215,6 @@ struct MixLoopState
SamplePosition incSamples = nInc * (nSamples - 1);
int32 nPosDest = (nPos + incSamples).GetInt();
const SmpLength nPosInt = nPos.GetUInt();
const bool isAtLoopStart = (nPosInt >= chn.nLoopStart && nPosInt < chn.nLoopStart + InterpolationLookaheadBufferSize);
if(!isAtLoopStart)
{
@ -217,7 +225,7 @@ struct MixLoopState
bool checkDest = true;
if(lookaheadPointer != nullptr)
{
if(nPos.GetUInt() >= lookaheadStart)
if(nPosInt >= lookaheadStart)
{
#if 0
const uint32 oldCount = nSmpCount;

View File

@ -245,7 +245,7 @@ bool CSoundFile::ReadDSym(FileReader &file, ModLoadingFlags loadFlags)
ChnSettings[chn].nPan = (((chn & 3) == 1) || ((chn & 3) == 2)) ? 64 : 192;
}
uint8 sampleNameLength[64];
uint8 sampleNameLength[64] = {};
for(SAMPLEINDEX smp = 1; smp <= m_nSamples; smp++)
{
Samples[smp].Initialize(MOD_TYPE_MOD);

View File

@ -371,12 +371,10 @@ static bool ImportMDLCommands(ModCommand &m, uint8 vol, uint8 e1, uint8 e2, uint
// Almost as easy
e2 = e1;
p2 = p1;
e1 = CMD_NONE;
} else if(e1 == e2 && e1 != CMD_S3MCMDEX)
{
// Digitrakker processes the effects left-to-right, so if both effects are the same, the
// second essentially overrides the first.
e1 = CMD_NONE;
} else if(!vol)
{
lostCommand |= (ModCommand::TwoRegularCommandsToMPT(e1, p1, e2, p2).first != CMD_NONE);
@ -389,6 +387,7 @@ static bool ImportMDLCommands(ModCommand &m, uint8 vol, uint8 e1, uint8 e2, uint
std::swap(e1, e2);
std::swap(p1, p2);
}
lostCommand = true;
}
m.command = e2;

View File

@ -305,6 +305,25 @@ void ModInstrument::Sanitize(MODTYPE modType)
}
std::map<SAMPLEINDEX, int8> ModInstrument::CanConvertToDefaultNoteMap() const
{
std::map<SAMPLEINDEX, int8> transposeMap;
for(size_t i = 0; i < std::size(NoteMap); i++)
{
if(Keyboard[i] == 0)
continue;
if(!NoteMap[i] || NoteMap[i] == (i + 1))
continue;
const int8 relativeNote = static_cast<int8>(NoteMap[i] - (i + NOTE_MIN));
if(transposeMap.count(Keyboard[i]) && transposeMap[Keyboard[i]] != relativeNote)
return {};
transposeMap[Keyboard[i]] = relativeNote;
}
return transposeMap;
}
void ModInstrument::Transpose(int8 amount)
{
for(auto &note : NoteMap)

View File

@ -17,6 +17,7 @@
#include "Snd_defs.h"
#include "openmpt/base/FlagSet.hpp"
#include "../common/misc_util.h"
#include <map>
#include <set>
OPENMPT_NAMESPACE_BEGIN
@ -26,7 +27,7 @@ struct ModChannel;
// Instrument Nodes
struct EnvelopeNode
{
using tick_t = uint16 ;
using tick_t = uint16;
using value_t = uint8;
tick_t tick = 0; // Envelope node position (x axis)
@ -133,12 +134,13 @@ struct ModInstrument
// Reset note mapping (i.e. every note is mapped to itself)
void ResetNoteMap()
{
for(size_t n = 0; n < std::size(NoteMap); n++)
{
NoteMap[n] = static_cast<uint8>(n + 1);
}
std::iota(NoteMap.begin(), NoteMap.end(), static_cast<uint8>(NOTE_MIN));
}
// If the instrument has a non-default note mapping and can be simplified to use the default note mapping by transposing samples,
// the list of samples that would need to be transposed and the corresponding transpose values are returned - otherwise an empty map.
std::map<SAMPLEINDEX, int8> CanConvertToDefaultNoteMap() const;
// Transpose entire note mapping by given number of semitones
void Transpose(int8 amount);

View File

@ -2045,6 +2045,7 @@ void TempoSwing::Normalize()
sum += i;
}
sum /= size();
MPT_ASSERT(sum > 0); // clang-analyzer false-positive
int64 remain = Unity * size();
for(auto &i : *this)
{

View File

@ -558,16 +558,26 @@ void ModCommand::Convert(MODTYPE fromType, MODTYPE toType, const CSoundFile &snd
switch(command)
{
case CMD_TONEPORTAVOL: // lacks memory -> 500 is the same as 300
if(param == 0x00) command = CMD_TONEPORTAMENTO;
if(param == 0x00)
command = CMD_TONEPORTAMENTO;
break;
case CMD_VIBRATOVOL: // lacks memory -> 600 is the same as 400
if(param == 0x00) command = CMD_VIBRATO;
if(param == 0x00)
command = CMD_VIBRATO;
break;
case CMD_PORTAMENTOUP: // lacks memory -> remove
case CMD_PORTAMENTODOWN:
case CMD_VOLUMESLIDE:
if(param == 0x00)
command = CMD_NONE;
break;
case CMD_MODCMDEX: // This would turn into "Set Active Macro", so let's better remove it
case CMD_S3MCMDEX:
if((param & 0xF0) == 0xF0) command = CMD_NONE;
if((param & 0xF0) == 0xF0)
command = CMD_NONE;
break;
}
} // End if(oldTypeIsMOD && newTypeIsXM)

View File

@ -180,7 +180,7 @@ CString Gargle::GetParamDisplay(PlugParamIndex param)
uint32 Gargle::RateInHertz() const
{
return mpt::saturate_round<uint32>(m_param[kGargleRate] * 999.0f) + 1;
return static_cast<uint32>(mpt::round(std::clamp(m_param[kGargleRate], 0.0f, 1.0f) * 999.0f)) + 1;
}

View File

@ -5,10 +5,9 @@
#include "mpt/base/macros.hpp"
#include "mpt/base/namespace.hpp"
#include <type_traits>
#include <cassert>
#include <cstddef>

View File

@ -8,6 +8,8 @@
#include "mpt/base/detect.hpp"
#include "mpt/base/namespace.hpp"
#include <utility>
namespace mpt {

View File

@ -50,7 +50,9 @@
#elif defined(_MSC_VER)
#define MPT_COMPILER_MSVC 1
#if (_MSC_VER >= 1931)
#if (_MSC_VER >= 1932)
#define MPT_COMPILER_MSVC_VERSION MPT_COMPILER_MAKE_VERSION2(2022, 2)
#elif (_MSC_VER >= 1931)
#define MPT_COMPILER_MSVC_VERSION MPT_COMPILER_MAKE_VERSION2(2022, 1)
#elif (_MSC_VER >= 1930)
#define MPT_COMPILER_MSVC_VERSION MPT_COMPILER_MAKE_VERSION2(2022, 0)