From aa28b2beb169ebe91b37dae64e1c69ffaf86b0c6 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Mon, 14 Mar 2022 04:34:25 -0700 Subject: [PATCH] libOpenMPT: Updated to version 0.6.2 Signed-off-by: Christopher Snowhill --- Frameworks/OpenMPT/OpenMPT/.clang-format | 152 ++++++++++++++ Frameworks/OpenMPT/OpenMPT/build/dist.mk | 6 +- .../OpenMPT/build/svn_version/svn_version.h | 8 +- .../OpenMPT/OpenMPT/common/BuildSettings.h | 2 - .../OpenMPT/OpenMPT/common/mptString.cpp | 50 +++-- Frameworks/OpenMPT/OpenMPT/common/mptString.h | 7 + .../OpenMPT/OpenMPT/common/versionNumber.h | 2 +- .../OpenMPT/OpenMPT/examples/.clang-format | 178 ++++++++++++---- .../examples/libopenmpt_example_cxx.cpp | 3 +- .../OpenMPT/OpenMPT/libopenmpt/.clang-format | 32 ++- .../bindings/freebasic/libopenmpt_ext.bi | 4 +- .../OpenMPT/libopenmpt/dox/changelog.md | 20 ++ .../OpenMPT/OpenMPT/libopenmpt/libopenmpt.hpp | 8 +- .../OpenMPT/libopenmpt/libopenmpt_config.h | 16 ++ .../OpenMPT/libopenmpt/libopenmpt_ext.hpp | 20 +- .../libopenmpt/libopenmpt_ext_impl.cpp | 2 +- .../OpenMPT/libopenmpt/libopenmpt_impl.cpp | 10 +- .../OpenMPT/libopenmpt/libopenmpt_version.h | 2 +- .../OpenMPT/libopenmpt/libopenmpt_version.mk | 4 +- .../OpenMPT/OpenMPT/openmpt123/.clang-format | 30 ++- .../OpenMPT/OpenMPT/soundlib/ContainerUMX.cpp | 2 +- .../OpenMPT/OpenMPT/soundlib/Dlsbank.cpp | 2 +- .../OpenMPT/OpenMPT/soundlib/FloatMixer.h | 42 ++-- .../OpenMPT/OpenMPT/soundlib/IntMixer.h | 87 ++++---- .../OpenMPT/OpenMPT/soundlib/Load_dbm.cpp | 4 +- .../OpenMPT/OpenMPT/soundlib/Load_digi.cpp | 2 +- .../OpenMPT/OpenMPT/soundlib/Load_dsym.cpp | 2 +- .../OpenMPT/OpenMPT/soundlib/Load_dtm.cpp | 2 +- .../OpenMPT/OpenMPT/soundlib/Load_med.cpp | 6 +- .../OpenMPT/OpenMPT/soundlib/Load_mo3.cpp | 5 +- .../OpenMPT/OpenMPT/soundlib/Load_mod.cpp | 12 +- .../OpenMPT/OpenMPT/soundlib/Load_okt.cpp | 2 +- .../OpenMPT/OpenMPT/soundlib/Load_sfx.cpp | 2 +- .../OpenMPT/OpenMPT/soundlib/Load_stp.cpp | 2 +- .../OpenMPT/OpenMPT/soundlib/Load_symmod.cpp | 4 +- .../OpenMPT/OpenMPT/soundlib/MIDIMacros.cpp | 4 +- .../OpenMPT/OpenMPT/soundlib/MIDIMacros.h | 2 +- .../OpenMPT/OpenMPT/soundlib/MixerInterface.h | 18 +- .../OpenMPT/OpenMPT/soundlib/Snd_fx.cpp | 44 ++-- Frameworks/OpenMPT/OpenMPT/soundlib/Sndfile.h | 5 +- .../OpenMPT/OpenMPT/soundlib/Sndmix.cpp | 4 +- .../OpenMPT/OpenMPT/soundlib/modcommand.cpp | 2 +- .../OpenMPT/soundlib/plugins/LFOPlugin.h | 4 +- .../soundlib/plugins/PlugInterface.cpp | 10 +- .../OpenMPT/soundlib/plugins/PlugInterface.h | 2 +- .../soundlib/plugins/PluginManager.cpp | 3 - .../OpenMPT/soundlib/plugins/PluginStructs.h | 24 +-- .../OpenMPT/soundlib/plugins/dmo/Chorus.h | 2 +- .../OpenMPT/soundlib/plugins/dmo/Compressor.h | 2 +- .../soundlib/plugins/dmo/Distortion.cpp | 19 +- .../OpenMPT/soundlib/plugins/dmo/Distortion.h | 2 +- .../OpenMPT/soundlib/plugins/dmo/Gargle.cpp | 4 +- .../OpenMPT/soundlib/plugins/dmo/Gargle.h | 6 +- .../soundlib/plugins/dmo/I3DL2Reverb.cpp | 2 +- .../soundlib/plugins/dmo/I3DL2Reverb.h | 2 +- .../OpenMPT/soundlib/plugins/dmo/ParamEq.h | 2 +- .../soundlib/plugins/dmo/WavesReverb.cpp | 4 +- .../soundlib/plugins/dmo/WavesReverb.h | 10 +- .../OpenMPT/OpenMPT/src/mpt/.clang-format | 27 ++- .../OpenMPT/OpenMPT/src/mpt/audio/span.hpp | 5 +- .../OpenMPT/OpenMPT/src/mpt/base/bit.hpp | 11 +- .../OpenMPT/src/mpt/base/detect_compiler.hpp | 4 +- .../OpenMPT/src/mpt/base/semantic_version.hpp | 5 +- .../src/mpt/base/tests/tests_base_bit.hpp | 8 +- .../OpenMPT/OpenMPT/src/mpt/binary/base64.hpp | 3 +- .../OpenMPT/src/mpt/binary/base64url.hpp | 3 +- .../OpenMPT/OpenMPT/src/mpt/binary/hex.hpp | 3 +- .../OpenMPT/src/mpt/endian/floatingpoint.hpp | 24 +-- .../OpenMPT/OpenMPT/src/mpt/endian/int24.hpp | 20 +- .../OpenMPT/src/mpt/endian/integer.hpp | 68 +++--- .../OpenMPT/src/mpt/format/message.hpp | 6 +- .../OpenMPT/src/mpt/format/simple_spec.hpp | 3 +- .../src/mpt/io_read/callbackstream.hpp | 3 +- .../mpt/io_read/filedata_base_buffered.hpp | 6 +- .../mpt/io_read/filedata_base_unseekable.hpp | 3 +- .../OpenMPT/OpenMPT/src/mpt/osinfo/class.hpp | 3 +- .../src/mpt/osinfo/windows_version.hpp | 100 ++++++--- .../OpenMPT/OpenMPT/src/mpt/random/engine.hpp | 18 +- .../OpenMPT/OpenMPT/src/mpt/string/types.hpp | 11 +- .../src/mpt/string_transcode/transcode.hpp | 197 ++++++++++++++++-- .../OpenMPT/OpenMPT/src/mpt/uuid/uuid.hpp | 42 ++-- .../OpenMPT/src/openmpt/soundbase/CopyMix.hpp | 8 +- .../src/openmpt/soundbase/SampleDecode.hpp | 2 +- .../src/openmpt/soundbase/SampleFormat.hpp | 36 ++-- 84 files changed, 1031 insertions(+), 497 deletions(-) create mode 100644 Frameworks/OpenMPT/OpenMPT/.clang-format diff --git a/Frameworks/OpenMPT/OpenMPT/.clang-format b/Frameworks/OpenMPT/OpenMPT/.clang-format new file mode 100644 index 000000000..054b59870 --- /dev/null +++ b/Frameworks/OpenMPT/OpenMPT/.clang-format @@ -0,0 +1,152 @@ +# clang-format 13 + +Language: Cpp +Standard: c++20 + +AccessModifierOffset: -4 #? +AlignAfterOpenBracket: AlwaysBreak +AlignArrayOfStructures: Left +AlignConsecutiveAssignments: false +AlignConsecutiveBitFields: false +AlignConsecutiveDeclarations: false +AlignConsecutiveMacros: true +AlignEscapedNewlines: DontAlign +AlignOperands: AlignAfterOperator +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Always +AllowShortCaseLabelsOnASingleLine: true +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLambdasOnASingleLine: Inline +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BinPackParameters: false +BitFieldColonSpacing: Both +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterFunction: true + AfterNamespace: true + #AfterObjCDeclaration + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: true + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +#BreakAfterJavaFieldAnnotations +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Custom +BreakBeforeConceptDeclarations: true +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeComma +BreakInheritanceList: BeforeComma +BreakStringLiterals: false +ColumnLimit: 0 +CommentPragmas: '' #? +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 #? +ContinuationIndentWidth: 4 #? +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +EmptyLineAfterAccessModifier: Leave +EmptyLineBeforeAccessModifier: Leave +FixNamespaceComments: true +ForEachMacros: [] +IfMacros: ['MPT_MAYBE_CONSTANT_IF'] +IncludeBlocks: Preserve +IncludeCategories: [] #? +IncludeIsMainRegex: '' #? +IncludeIsMainSourceRegex: '' #? +IndentAccessModifiers: false +IndentCaseBlocks: true +IndentCaseLabels: true +IndentExternBlock: NoIndent +IndentGotoLabels: false +IndentPPDirectives: None +#IndentRequiresClause: true +#BeforeHash +IndentWidth: 4 +IndentWrappedFunctionNames: true +InsertTrailingCommas: None +#JavaImportGroups +#JavaScriptQuotes +#JavaScriptWrapImports +KeepEmptyLinesAtTheStartOfBlocks: true +LambdaBodyIndentation: OuterScope +MacroBlockBegin: '^MPT_TEST_GROUP_BEGIN|BEGIN_MESSAGE_MAP$' #? +MacroBlockEnd: '^MPT_TEST_GROUP_END|END_MESSAGE_MAP$' #? +MaxEmptyLinesToKeep: 5 +NamespaceIndentation: None +NamespaceMacros: [] #? +#ObjCBinPackProtocolList +#ObjCBlockIndentWidth +#ObjCBreakBeforeNestedBlockParam +#ObjCSpaceAfterProperty +#ObjCSpaceBeforeProtocolList +#PenaltyBreakAssignment +#PenaltyBreakBeforeFirstCallParameter +#PenaltyBreakComment +#PenaltyBreakFirstLessLess +#PenaltyBreakString +#PenaltyBreakTemplateDeclaration +#PenaltyExcessCharacter +#PenaltyIndentedWhitespace +#PenaltyReturnTypeOnItsOwnLine +PointerAlignment: Right +PPIndentWidth: -1 +#RawStringFormats +ReferenceAlignment: Pointer +ReflowComments: false +ShortNamespaceLines: 1 +SortIncludes: false +#SortJavaStaticImport +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: Never +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParentheses: false +SpacesInSquareBrackets: false +StatementAttributeLikeMacros: [] +StatementMacros: [ 'OPENMPT_NAMESPACE_BEGIN', 'OPENMPT_NAMESPACE_END', 'MPT_MSVC_WORKAROUND_LNK4221', 'MPT_WARNING', 'MPT_TEST_GROUP_INLINE_IDENTIFIER', 'MPT_TEST_GROUP_INLINE', 'MPT_TEST_GROUP_STATIC' ] #? +TabWidth: 4 +TypenameMacros: [] #? +UseCRLF: false +UseTab: ForContinuationAndIndentation +WhitespaceSensitiveMacros: + - MPT_PP_STRINGIFY diff --git a/Frameworks/OpenMPT/OpenMPT/build/dist.mk b/Frameworks/OpenMPT/OpenMPT/build/dist.mk index d7d177228..170b2a5a2 100644 --- a/Frameworks/OpenMPT/OpenMPT/build/dist.mk +++ b/Frameworks/OpenMPT/OpenMPT/build/dist.mk @@ -1,4 +1,4 @@ -MPT_SVNVERSION=16764 -MPT_SVNURL=https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.1 -MPT_SVNDATE=2022-01-30T16:49:19.812343Z +MPT_SVNVERSION=17108 +MPT_SVNURL=https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.2 +MPT_SVNDATE=2022-03-13T14:50:28.374505Z diff --git a/Frameworks/OpenMPT/OpenMPT/build/svn_version/svn_version.h b/Frameworks/OpenMPT/OpenMPT/build/svn_version/svn_version.h index 32b444bcc..6e0cb8951 100644 --- a/Frameworks/OpenMPT/OpenMPT/build/svn_version/svn_version.h +++ b/Frameworks/OpenMPT/OpenMPT/build/svn_version/svn_version.h @@ -1,10 +1,10 @@ #pragma once -#define OPENMPT_VERSION_SVNVERSION "16764" -#define OPENMPT_VERSION_REVISION 16764 +#define OPENMPT_VERSION_SVNVERSION "17108" +#define OPENMPT_VERSION_REVISION 17108 #define OPENMPT_VERSION_DIRTY 0 #define OPENMPT_VERSION_MIXEDREVISIONS 0 -#define OPENMPT_VERSION_URL "https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.1" -#define OPENMPT_VERSION_DATE "2022-01-30T16:49:19.812343Z" +#define OPENMPT_VERSION_URL "https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.6.2" +#define OPENMPT_VERSION_DATE "2022-03-13T14:50:28.374505Z" #define OPENMPT_VERSION_IS_PACKAGE 1 diff --git a/Frameworks/OpenMPT/OpenMPT/common/BuildSettings.h b/Frameworks/OpenMPT/OpenMPT/common/BuildSettings.h index 698065116..d0081b9d6 100644 --- a/Frameworks/OpenMPT/OpenMPT/common/BuildSettings.h +++ b/Frameworks/OpenMPT/OpenMPT/common/BuildSettings.h @@ -210,8 +210,6 @@ #if defined(MODPLUG_TRACKER) -#define MPT_UPDATE_LEGACY 1 - // Enable built-in test suite. #if defined(MPT_BUILD_DEBUG) || defined(MPT_BUILD_CHECKED) #define ENABLE_TESTS diff --git a/Frameworks/OpenMPT/OpenMPT/common/mptString.cpp b/Frameworks/OpenMPT/OpenMPT/common/mptString.cpp index 97a05c5df..4da6ab97a 100644 --- a/Frameworks/OpenMPT/OpenMPT/common/mptString.cpp +++ b/Frameworks/OpenMPT/OpenMPT/common/mptString.cpp @@ -357,17 +357,22 @@ static Tdststring EncodeImpl(Charset charset, const mpt::widestring &src) switch(charset) { #if defined(MPT_ENABLE_CHARSET_LOCALE) - case Charset::Locale: return mpt::encode(mpt::logical_encoding::locale, src); break; + case Charset::Locale: return mpt::encode(mpt::logical_encoding::locale, src); break; #endif - case Charset::UTF8: return mpt::encode(mpt::common_encoding::utf8, src); break; - case Charset::ASCII: return mpt::encode(mpt::common_encoding::ascii, src); break; - case Charset::ISO8859_1: return mpt::encode(mpt::common_encoding::iso8859_1, src); break; - case Charset::ISO8859_15: return mpt::encode(mpt::common_encoding::iso8859_15, src); break; - case Charset::CP850: return mpt::encode(mpt::common_encoding::cp850, src); break; - case Charset::CP437: return mpt::encode(mpt::common_encoding::cp437, src); break; - case Charset::CP437AMS: return mpt::encode(CharsetTableCP437AMS, src); break; - case Charset::CP437AMS2: return mpt::encode(CharsetTableCP437AMS2, src); break; - case Charset::Windows1252: return mpt::encode(mpt::common_encoding::windows1252, src); break; + case Charset::UTF8: return mpt::encode(mpt::common_encoding::utf8, src); break; + case Charset::ASCII: return mpt::encode(mpt::common_encoding::ascii, src); break; + case Charset::ISO8859_1: return mpt::encode(mpt::common_encoding::iso8859_1, src); break; + case Charset::ISO8859_15: return mpt::encode(mpt::common_encoding::iso8859_15, src); break; + case Charset::CP850: return mpt::encode(mpt::common_encoding::cp850, src); break; + case Charset::CP437: return mpt::encode(mpt::common_encoding::cp437, src); break; + case Charset::CP437AMS: return mpt::encode(CharsetTableCP437AMS, src); break; + case Charset::CP437AMS2: return mpt::encode(CharsetTableCP437AMS2, src); break; + case Charset::Windows1252: return mpt::encode(mpt::common_encoding::windows1252, src); break; + case Charset::Amiga: return mpt::encode(mpt::common_encoding::amiga, src); break; + case Charset::RISC_OS: return mpt::encode(mpt::common_encoding::riscos, src); break; + case Charset::ISO8859_1_no_C1: return mpt::encode(mpt::common_encoding::iso8859_1_no_c1, src); break; + case Charset::ISO8859_15_no_C1: return mpt::encode(mpt::common_encoding::iso8859_15_no_c1, src); break; + case Charset::Amiga_no_C1: return mpt::encode(mpt::common_encoding::amiga_no_c1, src); break; } return Tdststring(); } @@ -382,17 +387,22 @@ static mpt::widestring DecodeImpl(Charset charset, const Tsrcstring &src) switch(charset) { #if defined(MPT_ENABLE_CHARSET_LOCALE) - case Charset::Locale: return mpt::decode(mpt::logical_encoding::locale, src); break; + case Charset::Locale: return mpt::decode(mpt::logical_encoding::locale, src); break; #endif - case Charset::UTF8: return mpt::decode(mpt::common_encoding::utf8, src); break; - case Charset::ASCII: return mpt::decode(mpt::common_encoding::ascii, src); break; - case Charset::ISO8859_1: return mpt::decode(mpt::common_encoding::iso8859_1, src); break; - case Charset::ISO8859_15: return mpt::decode(mpt::common_encoding::iso8859_15, src); break; - case Charset::CP850: return mpt::decode(mpt::common_encoding::cp850, src); break; - case Charset::CP437: return mpt::decode(mpt::common_encoding::cp437, src); break; - case Charset::CP437AMS: return mpt::decode(CharsetTableCP437AMS, src); break; - case Charset::CP437AMS2: return mpt::decode(CharsetTableCP437AMS2, src); break; - case Charset::Windows1252: return mpt::decode(mpt::common_encoding::windows1252, src); break; + case Charset::UTF8: return mpt::decode(mpt::common_encoding::utf8, src); break; + case Charset::ASCII: return mpt::decode(mpt::common_encoding::ascii, src); break; + case Charset::ISO8859_1: return mpt::decode(mpt::common_encoding::iso8859_1, src); break; + case Charset::ISO8859_15: return mpt::decode(mpt::common_encoding::iso8859_15, src); break; + case Charset::CP850: return mpt::decode(mpt::common_encoding::cp850, src); break; + case Charset::CP437: return mpt::decode(mpt::common_encoding::cp437, src); break; + case Charset::CP437AMS: return mpt::decode(CharsetTableCP437AMS, src); break; + case Charset::CP437AMS2: return mpt::decode(CharsetTableCP437AMS2, src); break; + case Charset::Windows1252: return mpt::decode(mpt::common_encoding::windows1252, src); break; + case Charset::Amiga: return mpt::decode(mpt::common_encoding::amiga, src); break; + case Charset::RISC_OS: return mpt::decode(mpt::common_encoding::riscos, src); break; + case Charset::ISO8859_1_no_C1: return mpt::decode(mpt::common_encoding::iso8859_1_no_c1, src); break; + case Charset::ISO8859_15_no_C1: return mpt::decode(mpt::common_encoding::iso8859_15_no_c1, src); break; + case Charset::Amiga_no_C1: return mpt::decode(mpt::common_encoding::amiga_no_c1, src); break; } return mpt::widestring(); } diff --git a/Frameworks/OpenMPT/OpenMPT/common/mptString.h b/Frameworks/OpenMPT/OpenMPT/common/mptString.h index 1d487b880..c308eef94 100644 --- a/Frameworks/OpenMPT/OpenMPT/common/mptString.h +++ b/Frameworks/OpenMPT/OpenMPT/common/mptString.h @@ -66,6 +66,13 @@ enum class Charset { Windows1252, + Amiga, + RISC_OS, + + ISO8859_1_no_C1, + ISO8859_15_no_C1, + Amiga_no_C1, + #if defined(MPT_ENABLE_CHARSET_LOCALE) Locale, // CP_ACP on windows, current C locale otherwise #endif // MPT_ENABLE_CHARSET_LOCALE diff --git a/Frameworks/OpenMPT/OpenMPT/common/versionNumber.h b/Frameworks/OpenMPT/OpenMPT/common/versionNumber.h index e1b312228..a1f28eb52 100644 --- a/Frameworks/OpenMPT/OpenMPT/common/versionNumber.h +++ b/Frameworks/OpenMPT/OpenMPT/common/versionNumber.h @@ -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 02 +#define VER_MINOR 03 #define VER_MINORMINOR 00 OPENMPT_NAMESPACE_END diff --git a/Frameworks/OpenMPT/OpenMPT/examples/.clang-format b/Frameworks/OpenMPT/OpenMPT/examples/.clang-format index ac4d62f02..0278edcaf 100644 --- a/Frameworks/OpenMPT/OpenMPT/examples/.clang-format +++ b/Frameworks/OpenMPT/OpenMPT/examples/.clang-format @@ -1,65 +1,153 @@ -# clang-format 10 -Language: Cpp -Standard: c++17 -AccessModifierOffset: -2 -AlignAfterOpenBracket: true +# clang-format 13 + +Language: Cpp +Standard: c++20 + +AccessModifierOffset: -2 #? +AlignAfterOpenBracket: AlwaysBreak +AlignArrayOfStructures: Left AlignConsecutiveAssignments: false +AlignConsecutiveBitFields: false +AlignConsecutiveDeclarations: false AlignConsecutiveMacros: true -AlignEscapedNewlinesLeft: true -AlignOperands: true -AlignTrailingComments: false -AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: false +AlignEscapedNewlines: DontAlign +AlignOperands: AlignAfterOperator +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: All +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: false +AllowShortLambdasOnASingleLine: Inline AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: false -BinPackArguments: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: [] +BinPackArguments: true BinPackParameters: false -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Attach -BreakBeforeTernaryOperators: false -BreakConstructorInitializersBeforeComma: true -ColumnLimit: 0 -CommentPragmas: '^ IWYU pragma:' +BitFieldColonSpacing: Both +BraceWrapping: + AfterCaseLabel: true + AfterClass: false + AfterControlStatement: MultiLine + AfterEnum: false + AfterFunction: false + AfterNamespace: false + #AfterObjCDeclaration + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: true + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: false + SplitEmptyNamespace: true +#BreakAfterJavaFieldAnnotations +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Custom +BreakBeforeConceptDeclarations: true +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeComma +BreakInheritanceList: BeforeComma +BreakStringLiterals: false +ColumnLimit: 0 +CommentPragmas: '' #? +CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: true -ConstructorInitializerIndentWidth: 2 -ContinuationIndentWidth: 2 -Cpp11BracedListStyle: false +ConstructorInitializerIndentWidth: 2 #? +ContinuationIndentWidth: 2 #? +Cpp11BracedListStyle: true +DeriveLineEnding: true DerivePointerAlignment: false -DisableFormat: false -ExperimentalAutoDetectBinPacking: false -ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +EmptyLineAfterAccessModifier: Leave +EmptyLineBeforeAccessModifier: Leave +FixNamespaceComments: true +ForEachMacros: [] +IfMacros: ['MPT_MAYBE_CONSTANT_IF'] +IncludeBlocks: Preserve +IncludeCategories: [] #? +IncludeIsMainRegex: '' #? +IncludeIsMainSourceRegex: '' #? +IndentAccessModifiers: false +IndentCaseBlocks: true IndentCaseLabels: true -IndentWidth: 2 -IndentWrappedFunctionNames: false +IndentExternBlock: NoIndent +IndentGotoLabels: false +IndentPPDirectives: None +#IndentRequiresClause: true +#BeforeHash +IndentWidth: 2 +IndentWrappedFunctionNames: true +InsertTrailingCommas: None +#JavaImportGroups +#JavaScriptQuotes +#JavaScriptWrapImports KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' +LambdaBodyIndentation: OuterScope +MacroBlockBegin: '' #? +MacroBlockEnd: '' #? MaxEmptyLinesToKeep: 3 NamespaceIndentation: None -ObjCBlockIndentWidth: 2 -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PenaltyBreakBeforeFirstCallParameter: 1 -PenaltyBreakComment: 60 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 200 +NamespaceMacros: [] #? +#ObjCBinPackProtocolList +#ObjCBlockIndentWidth +#ObjCBreakBeforeNestedBlockParam +#ObjCSpaceAfterProperty +#ObjCSpaceBeforeProtocolList +#PenaltyBreakAssignment +#PenaltyBreakBeforeFirstCallParameter +#PenaltyBreakComment +#PenaltyBreakFirstLessLess +#PenaltyBreakString +#PenaltyBreakTemplateDeclaration +#PenaltyExcessCharacter +#PenaltyIndentedWhitespace +#PenaltyReturnTypeOnItsOwnLine PointerAlignment: Middle +PPIndentWidth: -1 +#RawStringFormats +ReferenceAlignment: Pointer +ReflowComments: false +ShortNamespaceLines: 1 +SortIncludes: false +#SortJavaStaticImport +SortUsingDeclarations: true SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: true SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInContainerLiterals: true +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: true +SpacesInContainerLiterals: true +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 SpacesInParentheses: true SpacesInSquareBrackets: false -TabWidth: 2 -UseTab: ForIndentation +StatementAttributeLikeMacros: [] +StatementMacros: [ 'MPT_WARNING', 'MPT_TEST_GROUP_INLINE_IDENTIFIER', 'MPT_TEST_GROUP_INLINE', 'MPT_TEST_GROUP_STATIC' ] #? +TabWidth: 2 +TypenameMacros: [] #? +UseCRLF: false +UseTab: ForContinuationAndIndentation +WhitespaceSensitiveMacros: + - MPT_PP_STRINGIFY diff --git a/Frameworks/OpenMPT/OpenMPT/examples/libopenmpt_example_cxx.cpp b/Frameworks/OpenMPT/OpenMPT/examples/libopenmpt_example_cxx.cpp index ad082485e..c00051f1d 100644 --- a/Frameworks/OpenMPT/OpenMPT/examples/libopenmpt_example_cxx.cpp +++ b/Frameworks/OpenMPT/OpenMPT/examples/libopenmpt_example_cxx.cpp @@ -64,7 +64,8 @@ int main( int argc, char * argv[] ) { portaudio::StreamParameters stream_parameters( portaudio::DirectionSpecificStreamParameters::null(), outputstream_parameters, samplerate, paFramesPerBufferUnspecified, paNoFlag ); portaudio::BlockingStream stream( stream_parameters ); #else - portaudio::BlockingStream stream = [&]() { + portaudio::BlockingStream stream = [&]() + { try { is_interleaved = false; portaudio::DirectionSpecificStreamParameters outputstream_parameters( portaudio.defaultOutputDevice(), 2, portaudio::FLOAT32, false, portaudio.defaultOutputDevice().defaultHighOutputLatency(), 0 ); diff --git a/Frameworks/OpenMPT/OpenMPT/libopenmpt/.clang-format b/Frameworks/OpenMPT/OpenMPT/libopenmpt/.clang-format index b75d910d0..0278edcaf 100644 --- a/Frameworks/OpenMPT/OpenMPT/libopenmpt/.clang-format +++ b/Frameworks/OpenMPT/OpenMPT/libopenmpt/.clang-format @@ -1,15 +1,17 @@ -# clang-format 11 +# clang-format 13 + Language: Cpp -Standard: c++17 +Standard: c++20 AccessModifierOffset: -2 #? AlignAfterOpenBracket: AlwaysBreak +AlignArrayOfStructures: Left AlignConsecutiveAssignments: false AlignConsecutiveBitFields: false AlignConsecutiveDeclarations: false AlignConsecutiveMacros: true AlignEscapedNewlines: DontAlign -AlignOperands: DontAlign +AlignOperands: AlignAfterOperator AlignTrailingComments: true AllowAllArgumentsOnNextLine: true AllowAllConstructorInitializersOnNextLine: true @@ -24,8 +26,10 @@ AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: [] BinPackArguments: true BinPackParameters: false +BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: true AfterClass: false @@ -48,6 +52,7 @@ BraceWrapping: #BreakAfterJavaFieldAnnotations BreakBeforeBinaryOperators: NonAssignment BreakBeforeBraces: Custom +BreakBeforeConceptDeclarations: true BreakBeforeTernaryOperators: true BreakConstructorInitializers: BeforeComma BreakInheritanceList: BeforeComma @@ -61,17 +66,22 @@ ContinuationIndentWidth: 2 #? Cpp11BracedListStyle: true DeriveLineEnding: true DerivePointerAlignment: false +EmptyLineAfterAccessModifier: Leave +EmptyLineBeforeAccessModifier: Leave FixNamespaceComments: true ForEachMacros: [] +IfMacros: ['MPT_MAYBE_CONSTANT_IF'] IncludeBlocks: Preserve IncludeCategories: [] #? IncludeIsMainRegex: '' #? IncludeIsMainSourceRegex: '' #? +IndentAccessModifiers: false IndentCaseBlocks: true IndentCaseLabels: true IndentExternBlock: NoIndent IndentGotoLabels: false IndentPPDirectives: None +#IndentRequiresClause: true #BeforeHash IndentWidth: 2 IndentWrappedFunctionNames: true @@ -80,8 +90,9 @@ InsertTrailingCommas: None #JavaScriptQuotes #JavaScriptWrapImports KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '^BEGIN_MESSAGE_MAP$' #? -MacroBlockEnd: '^END_MESSAGE_MAP$' #? +LambdaBodyIndentation: OuterScope +MacroBlockBegin: '' #? +MacroBlockEnd: '' #? MaxEmptyLinesToKeep: 3 NamespaceIndentation: None NamespaceMacros: [] #? @@ -97,16 +108,23 @@ NamespaceMacros: [] #? #PenaltyBreakString #PenaltyBreakTemplateDeclaration #PenaltyExcessCharacter +#PenaltyIndentedWhitespace #PenaltyReturnTypeOnItsOwnLine PointerAlignment: Middle +PPIndentWidth: -1 #RawStringFormats +ReferenceAlignment: Pointer ReflowComments: false +ShortNamespaceLines: 1 SortIncludes: false +#SortJavaStaticImport SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true @@ -120,8 +138,12 @@ SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInConditionalStatement: true SpacesInContainerLiterals: true +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 SpacesInParentheses: true SpacesInSquareBrackets: false +StatementAttributeLikeMacros: [] StatementMacros: [ 'MPT_WARNING', 'MPT_TEST_GROUP_INLINE_IDENTIFIER', 'MPT_TEST_GROUP_INLINE', 'MPT_TEST_GROUP_STATIC' ] #? TabWidth: 2 TypenameMacros: [] #? diff --git a/Frameworks/OpenMPT/OpenMPT/libopenmpt/bindings/freebasic/libopenmpt_ext.bi b/Frameworks/OpenMPT/OpenMPT/libopenmpt/bindings/freebasic/libopenmpt_ext.bi index eb535c884..07d869fc7 100644 --- a/Frameworks/OpenMPT/OpenMPT/libopenmpt/bindings/freebasic/libopenmpt_ext.bi +++ b/Frameworks/OpenMPT/OpenMPT/libopenmpt/bindings/freebasic/libopenmpt_ext.bi @@ -123,7 +123,7 @@ Type openmpt_module_ext_interface_interactive \param speed The new tick count in range [1, 65535]. \throws openmpt::exception Throws an exception derived from openmpt::exception if the speed is outside the specified range. \return 1 on success, 0 on failure. - \sa openmpt_module_ext_interface_interactive.openmpt_module_get_current_speed + \sa openmpt_module_get_current_speed '/ set_current_speed As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal speed As Long) As Long @@ -133,7 +133,7 @@ Type openmpt_module_ext_interface_interactive \param tempo The new tempo in range [32, 512]. The exact meaning of the value depends on the tempo mode used by the module. \return 1 on success, 0 on failure. \remarks The tempo may be reset by pattern commands at any time. Use set_tempo_factor to apply a tempo factor that is independent of pattern commands. - \sa openmpt_module_ext_interface_interactive.openmpt_module_get_current_tempo + \sa openmpt_module_get_current_tempo '/ set_current_tempo As Function(ByVal mod_ext As openmpt_module_ext Ptr, ByVal tempo As Long) As Long diff --git a/Frameworks/OpenMPT/OpenMPT/libopenmpt/dox/changelog.md b/Frameworks/OpenMPT/OpenMPT/libopenmpt/dox/changelog.md index 87a87a611..9a970320c 100644 --- a/Frameworks/OpenMPT/OpenMPT/libopenmpt/dox/changelog.md +++ b/Frameworks/OpenMPT/OpenMPT/libopenmpt/dox/changelog.md @@ -5,6 +5,25 @@ Changelog {#changelog} For fully detailed change log, please see the source repository directly. This is just a high-level summary. +### libopenmpt 0.6.2 (2022-03-13) + + * [**Sec**] Possible out-of-bounds write in malformed IT / XM / MPTM files + using the internal LFO plugin. (r17076) + * [**Sec**] Possible out-of-bounds read when using Amiga BLEP interpolation + with extremely high-pitched notes. (r17078, r17079) + + * ISO-8859-1-related charsets from Amiga OS and RISC OS are now handled more + accurately, thus avoiding some unwanted control characters. + * MO3: Pattern indices 254 / 255 were not treated as playable patterns even if + the original file was a MOD / XM. + * Correctly apply ST3-style effect memory when seeking in S3M files. + * Command S (S3M / IT style) effect memory was not applied when seeking. + * Initial channel mute status was not reported correctly in `get_channel_mute_status` + since libopenmpt 0.6.0. + + * FLAC: Update to v1.3.4 (2022-02-21). + * pugixml: Update to v1.12.1 (2022-02-16). + ### libopenmpt 0.6.1 (2022-01-30) * [**Bug**] Linking libmpg123 no longer fails on OpenBSD. @@ -13,6 +32,7 @@ is just a high-level summary. * [**Bug**] Avoid NaNs and infinite values with custom tunings and in the I3DL2Reverb plugin. + * MIDI macros are now evaluated when seeking. * The letter "z" is now evaluated in fixed MIDI macros (Z80...ZFF) the same way as in Impulse Tracker. * MOD: Loosened VBlank timing heuristics so that "frame of mind" by Dascon diff --git a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt.hpp b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt.hpp index 8d2f922d4..0bfda29a1 100644 --- a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt.hpp +++ b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt.hpp @@ -127,12 +127,12 @@ /*! \defgroup libopenmpt_cpp libopenmpt C++ */ +namespace openmpt { + /*! \addtogroup libopenmpt_cpp @{ */ -namespace openmpt { - #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable:4275) @@ -1176,10 +1176,10 @@ public: }; // class module -} // namespace openmpt - /*! @} */ +} // namespace openmpt + #endif // LIBOPENMPT_HPP diff --git a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_config.h b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_config.h index 32568a2b3..01ec4793f 100644 --- a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_config.h +++ b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_config.h @@ -24,6 +24,14 @@ #define LIBOPENMPT_CXX_API #undef LIBOPENMPT_CXX_API +/*! + @} +*/ + +/*! \addtogroup libopenmpt_c + @{ +*/ + /*! \brief Defined if libopenmpt/libopenmpt_stream_callbacks_buffer.h exists. */ #define LIBOPENMPT_STREAM_CALLBACKS_BUFFER @@ -53,6 +61,14 @@ */ #define LIBOPENMPT_STREAM_CALLBACKS_FILE +/*! + @} +*/ + +/*! \addtogroup libopenmpt + @{ +*/ + #if defined(__DOXYGEN__) #define LIBOPENMPT_API_HELPER_EXPORT diff --git a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_ext.hpp b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_ext.hpp index 829e86e94..85577d95b 100644 --- a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_ext.hpp +++ b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_ext.hpp @@ -26,12 +26,12 @@ /*! \defgroup libopenmpt_ext_cpp libopenmpt_ext C++ */ +namespace openmpt { + /*! \addtogroup libopenmpt_ext_cpp @{ */ -namespace openmpt { - class module_ext_impl; class LIBOPENMPT_CXX_API module_ext : public module { @@ -77,8 +77,16 @@ public: }; // class module_ext +/*! + @} +*/ + namespace ext { +/*! \addtogroup libopenmpt_ext_cpp + @{ +*/ + #define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name) \ static const char name ## _id [] = # name ; \ class name; \ @@ -385,12 +393,12 @@ class interactive2 { #undef LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE #undef LIBOPENMPT_EXT_CXX_INTERFACE -} // namespace ext - -} // namespace openmpt - /*! @} */ +} // namespace ext + +} // namespace openmpt + #endif // LIBOPENMPT_EXT_HPP diff --git a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_ext_impl.cpp b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_ext_impl.cpp index ecfa41482..1de804bb8 100644 --- a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_ext_impl.cpp +++ b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_ext_impl.cpp @@ -212,7 +212,7 @@ namespace openmpt { if ( channel < 0 || channel >= get_num_channels() ) { throw openmpt::exception("invalid channel"); } - return m_sndFile->m_PlayState.Chn[channel].dwFlags[OpenMPT::CHN_MUTE]; + return m_sndFile->m_PlayState.Chn[channel].dwFlags[OpenMPT::CHN_MUTE | OpenMPT::CHN_SYNCMUTE]; } void module_ext_impl::set_instrument_mute_status( std::int32_t instrument, bool mute ) { diff --git a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_impl.cpp b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_impl.cpp index 099cd5b9a..82d99b5ce 100644 --- a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_impl.cpp +++ b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_impl.cpp @@ -51,12 +51,20 @@ #include "soundlib/mod_specifications.h" #include "soundlib/AudioReadTarget.h" +#if MPT_OS_WINDOWS && MPT_OS_WINDOWS_WINRT +#include +#endif // MPT_OS_WINDOWS && MPT_OS_WINDOWS_WINRT + OPENMPT_NAMESPACE_BEGIN #if !defined(MPT_BUILD_SILENCE_LIBOPENMPT_CONFIGURATION_WARNINGS) #if MPT_OS_WINDOWS && MPT_OS_WINDOWS_WINRT -#if defined(_WIN32_WINNT) +#if defined(NTDDI_VERSION) +#if (NTDDI_VERSION < 0x06020000) +MPT_WARNING("Warning: libopenmpt for WinRT is built with reduced functionality. Please #define NTDDI_VERSION 0x0602000.") +#endif +#elif defined(_WIN32_WINNT) #if (_WIN32_WINNT < 0x0602) MPT_WARNING("Warning: libopenmpt for WinRT is built with reduced functionality. Please #define _WIN32_WINNT 0x0602.") #endif // _WIN32_WINNT diff --git a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_version.h b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_version.h index 09acb1aad..d59b1b139 100644 --- a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_version.h +++ b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_version.h @@ -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 1 +#define OPENMPT_API_VERSION_PATCH 2 /*! \brief libopenmpt pre-release tag */ #define OPENMPT_API_VERSION_PREREL "" /*! \brief libopenmpt pre-release flag */ diff --git a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_version.mk b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_version.mk index a627eeeff..951541c79 100644 --- a/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_version.mk +++ b/Frameworks/OpenMPT/OpenMPT/libopenmpt/libopenmpt_version.mk @@ -1,8 +1,8 @@ LIBOPENMPT_VERSION_MAJOR=0 LIBOPENMPT_VERSION_MINOR=6 -LIBOPENMPT_VERSION_PATCH=1 +LIBOPENMPT_VERSION_PATCH=2 LIBOPENMPT_VERSION_PREREL= LIBOPENMPT_LTVER_CURRENT=3 -LIBOPENMPT_LTVER_REVISION=1 +LIBOPENMPT_LTVER_REVISION=2 LIBOPENMPT_LTVER_AGE=3 diff --git a/Frameworks/OpenMPT/OpenMPT/openmpt123/.clang-format b/Frameworks/OpenMPT/OpenMPT/openmpt123/.clang-format index 730790144..0278edcaf 100644 --- a/Frameworks/OpenMPT/OpenMPT/openmpt123/.clang-format +++ b/Frameworks/OpenMPT/OpenMPT/openmpt123/.clang-format @@ -1,15 +1,17 @@ -# clang-format 11 +# clang-format 13 + Language: Cpp -Standard: c++17 +Standard: c++20 AccessModifierOffset: -2 #? AlignAfterOpenBracket: AlwaysBreak +AlignArrayOfStructures: Left AlignConsecutiveAssignments: false AlignConsecutiveBitFields: false AlignConsecutiveDeclarations: false AlignConsecutiveMacros: true AlignEscapedNewlines: DontAlign -AlignOperands: DontAlign +AlignOperands: AlignAfterOperator AlignTrailingComments: true AllowAllArgumentsOnNextLine: true AllowAllConstructorInitializersOnNextLine: true @@ -24,8 +26,10 @@ AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: [] BinPackArguments: true BinPackParameters: false +BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: true AfterClass: false @@ -48,6 +52,7 @@ BraceWrapping: #BreakAfterJavaFieldAnnotations BreakBeforeBinaryOperators: NonAssignment BreakBeforeBraces: Custom +BreakBeforeConceptDeclarations: true BreakBeforeTernaryOperators: true BreakConstructorInitializers: BeforeComma BreakInheritanceList: BeforeComma @@ -61,25 +66,31 @@ ContinuationIndentWidth: 2 #? Cpp11BracedListStyle: true DeriveLineEnding: true DerivePointerAlignment: false +EmptyLineAfterAccessModifier: Leave +EmptyLineBeforeAccessModifier: Leave FixNamespaceComments: true ForEachMacros: [] +IfMacros: ['MPT_MAYBE_CONSTANT_IF'] IncludeBlocks: Preserve IncludeCategories: [] #? IncludeIsMainRegex: '' #? IncludeIsMainSourceRegex: '' #? +IndentAccessModifiers: false IndentCaseBlocks: true IndentCaseLabels: true IndentExternBlock: NoIndent IndentGotoLabels: false IndentPPDirectives: None +#IndentRequiresClause: true #BeforeHash IndentWidth: 2 -InsertTrailingCommas: None IndentWrappedFunctionNames: true +InsertTrailingCommas: None #JavaImportGroups #JavaScriptQuotes #JavaScriptWrapImports KeepEmptyLinesAtTheStartOfBlocks: true +LambdaBodyIndentation: OuterScope MacroBlockBegin: '' #? MacroBlockEnd: '' #? MaxEmptyLinesToKeep: 3 @@ -97,16 +108,23 @@ NamespaceMacros: [] #? #PenaltyBreakString #PenaltyBreakTemplateDeclaration #PenaltyExcessCharacter +#PenaltyIndentedWhitespace #PenaltyReturnTypeOnItsOwnLine PointerAlignment: Middle +PPIndentWidth: -1 #RawStringFormats +ReferenceAlignment: Pointer ReflowComments: false +ShortNamespaceLines: 1 SortIncludes: false +#SortJavaStaticImport SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true @@ -120,8 +138,12 @@ SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInConditionalStatement: true SpacesInContainerLiterals: true +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 SpacesInParentheses: true SpacesInSquareBrackets: false +StatementAttributeLikeMacros: [] StatementMacros: [ 'MPT_WARNING', 'MPT_TEST_GROUP_INLINE_IDENTIFIER', 'MPT_TEST_GROUP_INLINE', 'MPT_TEST_GROUP_STATIC' ] #? TabWidth: 2 TypenameMacros: [] #? diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/ContainerUMX.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/ContainerUMX.cpp index af6c35a46..828bee6c5 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/ContainerUMX.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/ContainerUMX.cpp @@ -58,7 +58,7 @@ bool UnpackUMX(std::vector &containerItems, FileReader &file, Con if(objName >= 0 && static_cast(objName) < names.size()) { - item.name = mpt::ToUnicode(mpt::Charset::ISO8859_1, names[objName]); + item.name = mpt::ToUnicode(mpt::Charset::Windows1252, names[objName]); } item.file = fileChunk; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Dlsbank.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Dlsbank.cpp index 4df9c208d..f90b7b732 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Dlsbank.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Dlsbank.cpp @@ -1123,7 +1123,7 @@ bool CDLSBank::ConvertSF2ToDLS(SF2LoaderInfo &sf2info) } // Load Instrument Bags dlsIns.Regions.clear(); - for(const auto [nInstrNdx, keyRange] : instruments) + for(const auto & [nInstrNdx, keyRange] : instruments) { if(nInstrNdx >= numInsts) continue; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/FloatMixer.h b/Frameworks/OpenMPT/OpenMPT/soundlib/FloatMixer.h index 5aa5ebec3..d53fbabc6 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/FloatMixer.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/FloatMixer.h @@ -41,9 +41,7 @@ typedef IntToFloatTraits<2, 2, mixsample_t, int16, -int16_min> Int16SToFloatS; template struct LinearInterpolation { - MPT_FORCEINLINE void Start(const ModChannel &, const CResampler &) { } - - MPT_FORCEINLINE void End(const ModChannel &) { } + MPT_FORCEINLINE LinearInterpolation(const ModChannel &, const CResampler &, unsigned int) { } MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const typename Traits::input_t * const inBuffer, const uint32 posLo) { @@ -64,8 +62,7 @@ struct LinearInterpolation template struct FastSincInterpolation { - MPT_FORCEINLINE void Start(const ModChannel &, const CResampler &) { } - MPT_FORCEINLINE void End(const ModChannel &) { } + MPT_FORCEINLINE FastSincInterpolation(const ModChannel &, const CResampler &, unsigned int) { } MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const typename Traits::input_t * const inBuffer, const uint32 posLo) { @@ -89,14 +86,12 @@ struct PolyphaseInterpolation { const typename Traits::output_t *sinc; - MPT_FORCEINLINE void Start(const ModChannel &chn, const CResampler &resampler) + MPT_FORCEINLINE PolyphaseInterpolation(const ModChannel &chn, const CResampler &resampler, unsigned int) { sinc = (((chn.increment > SamplePosition(0x130000000ll)) || (chn.increment < -SamplePosition(-0x130000000ll))) ? (((chn.increment > SamplePosition(0x180000000ll)) || (chn.increment < SamplePosition(-0x180000000ll))) ? resampler.gDownsample2x : resampler.gDownsample13x) : resampler.gKaiserSinc); } - MPT_FORCEINLINE void End(const ModChannel &) { } - MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const typename Traits::input_t * const inBuffer, const uint32 posLo) { static_assert(static_cast(Traits::numChannelsIn) <= static_cast(Traits::numChannelsOut), "Too many input channels"); @@ -123,13 +118,11 @@ struct FIRFilterInterpolation { const typename Traits::output_t *WFIRlut; - MPT_FORCEINLINE void Start(const ModChannel &, const CResampler &resampler) + MPT_FORCEINLINE FIRFilterInterpolation(const ModChannel &, const CResampler &resampler, unsigned int) { WFIRlut = resampler.m_WindowedFIR.lut; } - MPT_FORCEINLINE void End(const ModChannel &) { } - MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const typename Traits::input_t * const inBuffer, const uint32 posLo) { static_assert(static_cast(Traits::numChannelsIn) <= static_cast(Traits::numChannelsOut), "Too many input channels"); @@ -159,30 +152,30 @@ struct NoRamp { typename Traits::output_t lVol, rVol; - MPT_FORCEINLINE void Start(const ModChannel &chn) + MPT_FORCEINLINE NoRamp(const ModChannel &chn) { lVol = static_cast(chn.leftVol) * (1.0f / 4096.0f); rVol = static_cast(chn.rightVol) * (1.0f / 4096.0f); } - - MPT_FORCEINLINE void End(const ModChannel &) { } }; struct Ramp { + ModChannel &channel; int32 lRamp, rRamp; - MPT_FORCEINLINE void Start(const ModChannel &chn) + MPT_FORCEINLINE Ramp(ModChannel &chn) + : channel{chn} { lRamp = chn.rampLeftVol; rRamp = chn.rampRightVol; } - MPT_FORCEINLINE void End(ModChannel &chn) + MPT_FORCEINLINE ~Ramp() { - chn.rampLeftVol = lRamp; chn.leftVol = lRamp >> VOLUMERAMPPRECISION; - chn.rampRightVol = rRamp; chn.rightVol = rRamp >> VOLUMERAMPPRECISION; + channel.rampLeftVol = lRamp; channel.leftVol = lRamp >> VOLUMERAMPPRECISION; + channel.rampRightVol = rRamp; channel.rightVol = rRamp >> VOLUMERAMPPRECISION; } }; @@ -259,8 +252,7 @@ struct MixStereoRamp : public Ramp template struct NoFilter { - MPT_FORCEINLINE void Start(const ModChannel &) { } - MPT_FORCEINLINE void End(const ModChannel &) { } + MPT_FORCEINLINE NoFilter(const ModChannel &) { } MPT_FORCEINLINE void operator() (const typename Traits::outbuf_t &, const ModChannel &) { } }; @@ -270,10 +262,12 @@ struct NoFilter template struct ResonantFilter { + ModChannel &channel; // Filter history typename Traits::output_t fy[Traits::numChannelsIn][2]; - MPT_FORCEINLINE void Start(const ModChannel &chn) + MPT_FORCEINLINE ResonantFilter(ModChannel &chn) + : channel{chn} { for(int i = 0; i < Traits::numChannelsIn; i++) { @@ -282,12 +276,12 @@ struct ResonantFilter } } - MPT_FORCEINLINE void End(ModChannel &chn) + MPT_FORCEINLINE ~ResonantFilter(ModChannel &chn) { for(int i = 0; i < Traits::numChannelsIn; i++) { - chn.nFilter_Y[i][0] = fy[i][0]; - chn.nFilter_Y[i][1] = fy[i][1]; + channel.nFilter_Y[i][0] = fy[i][0]; + channel.nFilter_Y[i][1] = fy[i][1]; } } diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/IntMixer.h b/Frameworks/OpenMPT/OpenMPT/soundlib/IntMixer.h index bfbfaf0d6..e13762194 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/IntMixer.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/IntMixer.h @@ -50,23 +50,34 @@ template struct AmigaBlepInterpolation { SamplePosition subIncrement; - Paula::State *paula; - const Paula::BlepArray *WinSincIntegral; - int numSteps; + Paula::State &paula; + const Paula::BlepArray &WinSincIntegral; + const int numSteps; + unsigned int remainingSamples = 0; - MPT_FORCEINLINE void Start(ModChannel &chn, const CResampler &resampler) + MPT_FORCEINLINE AmigaBlepInterpolation(ModChannel &chn, const CResampler &resampler, unsigned int numSamples) + : paula{chn.paulaState} + , WinSincIntegral{resampler.blepTables.GetAmigaTable(resampler.m_Settings.emulateAmiga, chn.dwFlags[CHN_AMIGAFILTER])} + , numSteps{chn.paulaState.numSteps} { - paula = &chn.paulaState; - numSteps = paula->numSteps; - WinSincIntegral = &resampler.blepTables.GetAmigaTable(resampler.m_Settings.emulateAmiga, chn.dwFlags[CHN_AMIGAFILTER]); if(numSteps) + { subIncrement = chn.increment / numSteps; + // May we read past the start or end of sample if we do partial sample increments? + // If that's the case, don't apply any sub increments on the source sample if we reached the last output sample + // Note that this should only happen with notes well outside the Amiga note range, e.g. in software-mixed formats like MED + const int32 targetPos = (chn.position + chn.increment * numSamples).GetInt(); + if(static_cast(targetPos) > chn.nLength) + remainingSamples = numSamples; + } + } - MPT_FORCEINLINE void End(const ModChannel &) { } - MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const typename Traits::input_t * const MPT_RESTRICT inBuffer, const uint32 posLo) { + if(--remainingSamples == 0) + subIncrement = {}; + SamplePosition pos(0, posLo); // First, process steps of full length (one Amiga clock interval) for(int step = numSteps; step > 0; step--) @@ -75,26 +86,26 @@ struct AmigaBlepInterpolation int32 posInt = pos.GetInt() * Traits::numChannelsIn; for(int32 i = 0; i < Traits::numChannelsIn; i++) inSample += Traits::Convert(inBuffer[posInt + i]); - paula->InputSample(static_cast(inSample / (4 * Traits::numChannelsIn))); - paula->Clock(Paula::MINIMUM_INTERVAL); + paula.InputSample(static_cast(inSample / (4 * Traits::numChannelsIn))); + paula.Clock(Paula::MINIMUM_INTERVAL); pos += subIncrement; } - paula->remainder += paula->stepRemainder; + paula.remainder += paula.stepRemainder; // Now, process any remaining integer clock amount < MINIMUM_INTERVAL - uint32 remainClocks = paula->remainder.GetInt(); + uint32 remainClocks = paula.remainder.GetInt(); if(remainClocks) { typename Traits::output_t inSample = 0; int32 posInt = pos.GetInt() * Traits::numChannelsIn; for(int32 i = 0; i < Traits::numChannelsIn; i++) inSample += Traits::Convert(inBuffer[posInt + i]); - paula->InputSample(static_cast(inSample / (4 * Traits::numChannelsIn))); - paula->Clock(remainClocks); - paula->remainder.RemoveInt(); + paula.InputSample(static_cast(inSample / (4 * Traits::numChannelsIn))); + paula.Clock(remainClocks); + paula.remainder.RemoveInt(); } - auto out = paula->OutputSample(*WinSincIntegral); + auto out = paula.OutputSample(WinSincIntegral); for(int i = 0; i < Traits::numChannelsOut; i++) outSample[i] = out; } @@ -104,9 +115,7 @@ struct AmigaBlepInterpolation template struct LinearInterpolation { - MPT_FORCEINLINE void Start(const ModChannel &, const CResampler &) { } - - MPT_FORCEINLINE void End(const ModChannel &) { } + MPT_FORCEINLINE LinearInterpolation(const ModChannel &, const CResampler &, unsigned int) { } MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const typename Traits::input_t * const MPT_RESTRICT inBuffer, const uint32 posLo) { @@ -127,8 +136,7 @@ struct LinearInterpolation template struct FastSincInterpolation { - MPT_FORCEINLINE void Start(const ModChannel &, const CResampler &) { } - MPT_FORCEINLINE void End(const ModChannel &) { } + MPT_FORCEINLINE FastSincInterpolation(const ModChannel &, const CResampler &, unsigned int) { } MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const typename Traits::input_t * const MPT_RESTRICT inBuffer, const uint32 posLo) { @@ -152,7 +160,7 @@ struct PolyphaseInterpolation { const SINC_TYPE *sinc; - MPT_FORCEINLINE void Start(const ModChannel &chn, const CResampler &resampler) + MPT_FORCEINLINE PolyphaseInterpolation(const ModChannel &chn, const CResampler &resampler, unsigned int) { #ifdef MODPLUG_TRACKER // Otherwise causes "warning C4100: 'resampler' : unreferenced formal parameter" @@ -164,8 +172,6 @@ struct PolyphaseInterpolation (((chn.increment > SamplePosition(0x180000000ll)) || (chn.increment < SamplePosition(-0x180000000ll))) ? resampler.gDownsample2x : resampler.gDownsample13x) : resampler.gKaiserSinc); } - MPT_FORCEINLINE void End(const ModChannel &) { } - MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const typename Traits::input_t * const MPT_RESTRICT inBuffer, const uint32 posLo) { static_assert(static_cast(Traits::numChannelsIn) <= static_cast(Traits::numChannelsOut), "Too many input channels"); @@ -192,13 +198,11 @@ struct FIRFilterInterpolation { const int16 *WFIRlut; - MPT_FORCEINLINE void Start(const ModChannel &, const CResampler &resampler) + MPT_FORCEINLINE FIRFilterInterpolation(const ModChannel &, const CResampler &resampler, unsigned int) { WFIRlut = resampler.m_WindowedFIR.lut; } - MPT_FORCEINLINE void End(const ModChannel &) { } - MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const typename Traits::input_t * const MPT_RESTRICT inBuffer, const uint32 posLo) { static_assert(static_cast(Traits::numChannelsIn) <= static_cast(Traits::numChannelsOut), "Too many input channels"); @@ -230,30 +234,30 @@ struct NoRamp { typename Traits::output_t lVol, rVol; - MPT_FORCEINLINE void Start(const ModChannel &chn) + MPT_FORCEINLINE NoRamp(const ModChannel &chn) { lVol = chn.leftVol; rVol = chn.rightVol; } - - MPT_FORCEINLINE void End(const ModChannel &) { } }; struct Ramp { + ModChannel &channel; int32 lRamp, rRamp; - MPT_FORCEINLINE void Start(const ModChannel &chn) + MPT_FORCEINLINE Ramp(ModChannel &chn) + : channel{chn} { lRamp = chn.rampLeftVol; rRamp = chn.rampRightVol; } - MPT_FORCEINLINE void End(ModChannel &chn) + MPT_FORCEINLINE ~Ramp() { - chn.rampLeftVol = lRamp; chn.leftVol = lRamp >> VOLUMERAMPPRECISION; - chn.rampRightVol = rRamp; chn.rightVol = rRamp >> VOLUMERAMPPRECISION; + channel.rampLeftVol = lRamp; channel.leftVol = lRamp >> VOLUMERAMPPRECISION; + channel.rampRightVol = rRamp; channel.rightVol = rRamp >> VOLUMERAMPPRECISION; } }; @@ -331,8 +335,7 @@ struct MixStereoRamp : public Ramp template struct NoFilter { - MPT_FORCEINLINE void Start(const ModChannel &) { } - MPT_FORCEINLINE void End(const ModChannel &) { } + MPT_FORCEINLINE NoFilter(const ModChannel &) { } MPT_FORCEINLINE void operator() (const typename Traits::outbuf_t &, const ModChannel &) { } }; @@ -342,10 +345,12 @@ struct NoFilter template struct ResonantFilter { + ModChannel &channel; // Filter history typename Traits::output_t fy[Traits::numChannelsIn][2]; - MPT_FORCEINLINE void Start(const ModChannel &chn) + MPT_FORCEINLINE ResonantFilter(ModChannel &chn) + : channel{chn} { for(int i = 0; i < Traits::numChannelsIn; i++) { @@ -354,12 +359,12 @@ struct ResonantFilter } } - MPT_FORCEINLINE void End(ModChannel &chn) + MPT_FORCEINLINE ~ResonantFilter() { for(int i = 0; i < Traits::numChannelsIn; i++) { - chn.nFilter_Y[i][0] = fy[i][0]; - chn.nFilter_Y[i][1] = fy[i][1]; + channel.nFilter_Y[i][0] = fy[i][0]; + channel.nFilter_Y[i][1] = fy[i][1]; } } diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dbm.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dbm.cpp index 1f2e3f333..dd90f296f 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dbm.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dbm.cpp @@ -353,7 +353,7 @@ bool CSoundFile::ReadDBM(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.formatName = U_("DigiBooster Pro"); m_modFormat.type = U_("dbm"); m_modFormat.madeWithTracker = MPT_UFORMAT("DigiBooster Pro {}.{}")(mpt::ufmt::hex(fileHeader.trkVerHi), mpt::ufmt::hex(fileHeader.trkVerLo)); - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; // Name chunk FileReader nameChunk = chunks.GetChunk(DBMChunk::idNAME); @@ -380,7 +380,7 @@ bool CSoundFile::ReadDBM(FileReader &file, ModLoadingFlags loadFlags) if(Order.AddSequence() == SEQUENCEINDEX_INVALID) break; } - Order().SetName(mpt::ToUnicode(mpt::Charset::ISO8859_1, name)); + Order().SetName(mpt::ToUnicode(mpt::Charset::Amiga_no_C1, name)); ReadOrderFromFile(Order(), songChunk, numOrders); #else const ORDERINDEX startIndex = Order().GetLength(); diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_digi.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_digi.cpp index 15ee8309e..a7048d9f8 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_digi.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_digi.cpp @@ -129,7 +129,7 @@ bool CSoundFile::ReadDIGI(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.formatName = U_("DigiBooster"); m_modFormat.type = U_("digi"); m_modFormat.madeWithTracker = MPT_UFORMAT("Digi Booster {}.{}")(fileHeader.versionInt >> 4, fileHeader.versionInt & 0x0F); - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; ReadOrderFromArray(Order(), fileHeader.orders, fileHeader.lastOrdIndex + 1); diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dsym.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dsym.cpp index 1ac1701c8..aabbea905 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dsym.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dsym.cpp @@ -604,7 +604,7 @@ bool CSoundFile::ReadDSym(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.formatName = MPT_UFORMAT("Digital Symphony v{}")(fileHeader.version); m_modFormat.type = U_("dsym"); // RISC OS doesn't use file extensions but this is a common abbreviation used for this tracker m_modFormat.madeWithTracker = U_("Digital Symphony"); - m_modFormat.charset = mpt::Charset::ISO8859_1; // Close enough (RISC OS uses slightly customized variant) + m_modFormat.charset = mpt::Charset::RISC_OS; return true; } diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dtm.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dtm.cpp index ffb36d279..6b8931400 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dtm.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_dtm.cpp @@ -599,7 +599,7 @@ bool CSoundFile::ReadDTM(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.formatName = U_("Digital Tracker"); m_modFormat.type = U_("dtm"); m_modFormat.madeWithTracker = std::move(tracker); - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; return true; } diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_med.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_med.cpp index 18fb120e0..74bfff125 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_med.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_med.cpp @@ -1145,7 +1145,7 @@ bool CSoundFile::ReadMED(FileReader &file, ModLoadingFlags loadFlags) } } if(playSeq.name[0]) - order.SetName(mpt::ToUnicode(mpt::Charset::ISO8859_1, mpt::String::ReadAutoBuf(playSeq.name))); + order.SetName(mpt::ToUnicode(mpt::Charset::Amiga_no_C1, mpt::String::ReadAutoBuf(playSeq.name))); // Play commands (jump / stop) if(playSeq.commandTableOffset > 0 && file.Seek(playSeq.commandTableOffset)) @@ -1193,7 +1193,7 @@ bool CSoundFile::ReadMED(FileReader &file, ModLoadingFlags loadFlags) { file.ReadString(m_songName, expData.songNameLength); if(numSongs > 1) - order.SetName(mpt::ToUnicode(mpt::Charset::ISO8859_1, m_songName)); + order.SetName(mpt::ToUnicode(mpt::Charset::Amiga_no_C1, m_songName)); } if(expData.annoLength > 1 && file.Seek(expData.annoText)) { @@ -1432,7 +1432,7 @@ bool CSoundFile::ReadMED(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.formatName = MPT_UFORMAT("OctaMED (MMD{})")(version); m_modFormat.type = MPT_USTRING("med"); m_modFormat.madeWithTracker = madeWithTracker; - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; return true; } diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_mo3.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_mo3.cpp index ea4ab724c..574adb0db 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_mo3.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_mo3.cpp @@ -921,7 +921,8 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags) } } - ReadOrderFromFile(Order(), musicChunk, fileHeader.numOrders, 0xFF, 0xFE); + const bool hasOrderSeparators = !(m_nType & (MOD_TYPE_MOD | MOD_TYPE_XM)); + ReadOrderFromFile(Order(), musicChunk, fileHeader.numOrders, hasOrderSeparators ? 0xFF : uint16_max, hasOrderSeparators ? 0xFE : uint16_max); // Track assignments for all patterns FileReader trackChunk = musicChunk.ReadChunk(fileHeader.numPatterns * fileHeader.numChannels * sizeof(uint16)); @@ -1967,7 +1968,7 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags) if(m_dwLastSavedWithVersion) m_modFormat.charset = mpt::Charset::Windows1252; else if(GetType() == MOD_TYPE_MOD) - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; else m_modFormat.charset = mpt::Charset::CP437; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_mod.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_mod.cpp index b1f47c70f..6c36408af 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_mod.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_mod.cpp @@ -1318,7 +1318,7 @@ bool CSoundFile::ReadMOD(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.type = U_("mod"); if(modMagicResult.madeWithTracker) m_modFormat.madeWithTracker = modMagicResult.madeWithTracker; - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; return true; } @@ -1819,7 +1819,7 @@ bool CSoundFile::ReadM15(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.formatName = U_("Soundtracker"); m_modFormat.type = U_("stk"); m_modFormat.madeWithTracker = madeWithTracker; - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; // Reading samples if(loadFlags & loadSampleData) @@ -1908,13 +1908,13 @@ bool CSoundFile::ReadICE(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.formatName = U_("MnemoTroN SoundTracker"); m_modFormat.type = U_("st26"); m_modFormat.madeWithTracker = U_("SoundTracker 2.6"); - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; } else if(IsMagic(magic, "IT10")) { m_modFormat.formatName = U_("Ice Tracker"); m_modFormat.type = U_("ice"); m_modFormat.madeWithTracker = U_("Ice Tracker 1.0 / 1.1"); - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; } else { return false; @@ -2148,7 +2148,7 @@ bool CSoundFile::ReadPT36(FileReader &file, ModLoadingFlags loadFlags) chunk.Skip(4); if(chunk.ReadMagic("PT") && iffHead.chunksize > 6) { - chunk.ReadString(version, mpt::Charset::ISO8859_1, iffHead.chunksize - 6); + chunk.ReadString(version, mpt::Charset::Amiga_no_C1, iffHead.chunksize - 6); } break; @@ -2204,7 +2204,7 @@ bool CSoundFile::ReadPT36(FileReader &file, ModLoadingFlags loadFlags) std::string author; commentChunk.ReadString(author, 32); if(author != "UNNAMED AUTHOR") - m_songArtist = mpt::ToUnicode(mpt::Charset::ISO8859_1, author); + m_songArtist = mpt::ToUnicode(mpt::Charset::Amiga_no_C1, author); if(!commentChunk.NoBytesLeft()) { m_songMessage.ReadFixedLineLength(commentChunk, commentChunk.BytesLeft(), 40, 0); diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_okt.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_okt.cpp index 1e844cae4..e0b33ee60 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_okt.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_okt.cpp @@ -342,7 +342,7 @@ bool CSoundFile::ReadOKT(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.formatName = U_("Oktalyzer"); m_modFormat.type = U_("okt"); - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; // Go through IFF chunks... while(file.CanRead(sizeof(OktIffChunk))) diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_sfx.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_sfx.cpp index 8db8d1957..8afe67787 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_sfx.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_sfx.cpp @@ -475,7 +475,7 @@ bool CSoundFile::ReadSFX(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.formatName = m_nSamples == 15 ? MPT_UFORMAT("SoundFX 1.{}")(version) : U_("SoundFX 2.0 / MultiMedia Sound"); m_modFormat.type = m_nSamples == 15 ? UL_("sfx") : UL_("sfx2"); - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; return true; } diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_stp.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_stp.cpp index 17ed76f89..a9e0fbf10 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_stp.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_stp.cpp @@ -258,7 +258,7 @@ bool CSoundFile::ReadSTP(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.formatName = MPT_UFORMAT("Soundtracker Pro II v{}")(fileHeader.version); m_modFormat.type = U_("stp"); - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; m_nChannels = 4; m_nSamples = 0; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_symmod.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_symmod.cpp index b232a5b6f..25084acf2 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Load_symmod.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Load_symmod.cpp @@ -1231,7 +1231,7 @@ bool CSoundFile::ReadSymMOD(FileReader &file, ModLoadingFlags loadFlags) if(symInst.IsEmpty() || symInst.IsVirtual()) continue; - auto filename = mpt::PathString::FromUnicode(mpt::ToUnicode(mpt::Charset::ISO8859_1, symInst.GetName())); + auto filename = mpt::PathString::FromUnicode(mpt::ToUnicode(mpt::Charset::Amiga_no_C1, symInst.GetName())); if(file.GetOptionalFileName()) filename = file.GetOptionalFileName()->GetPath() + filename.GetFullFileName(); @@ -1939,7 +1939,7 @@ bool CSoundFile::ReadSymMOD(FileReader &file, ModLoadingFlags loadFlags) m_modFormat.madeWithTracker = U_("Symphonie Pro"); else m_modFormat.madeWithTracker = U_("Symphonie Pro 256"); - m_modFormat.charset = mpt::Charset::ISO8859_1; + m_modFormat.charset = mpt::Charset::Amiga_no_C1; return true; } diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/MIDIMacros.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/MIDIMacros.cpp index 6869eb2a4..150e1416a 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/MIDIMacros.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/MIDIMacros.cpp @@ -245,11 +245,11 @@ CString MIDIMacroConfig::GetFixedMacroName(FixedMacro macroType) const } -int MIDIMacroConfig::MacroToPlugParam(uint32 macroIndex) const +PlugParamIndex MIDIMacroConfig::MacroToPlugParam(uint32 macroIndex) const { const std::string macro = SFx[macroIndex].NormalizedString(); - int code = 0; + PlugParamIndex code = 0; const char *param = macro.c_str(); param += 4; if ((param[0] >= '0') && (param[0] <= '9')) code = (param[0] - '0') << 4; else diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/MIDIMacros.h b/Frameworks/OpenMPT/OpenMPT/soundlib/MIDIMacros.h index efbe26891..935660a96 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/MIDIMacros.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/MIDIMacros.h @@ -198,7 +198,7 @@ public: CString GetFixedMacroName(FixedMacro macroType) const; // Extract information from a parametered macro string. - int MacroToPlugParam(uint32 macroIndex) const; + PlugParamIndex MacroToPlugParam(uint32 macroIndex) const; int MacroToMidiCC(uint32 macroIndex) const; // Check if any macro can automate a given plugin parameter diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/MixerInterface.h b/Frameworks/OpenMPT/OpenMPT/soundlib/MixerInterface.h index 283f221aa..43d2f6777 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/MixerInterface.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/MixerInterface.h @@ -41,8 +41,7 @@ struct MixerTraits template struct NoInterpolation { - MPT_FORCEINLINE void Start(const ModChannel &, const CResampler &) { } - MPT_FORCEINLINE void End(const ModChannel &) { } + MPT_FORCEINLINE NoInterpolation(const ModChannel &, const CResampler &, unsigned int) { } MPT_FORCEINLINE void operator() (typename Traits::outbuf_t &outSample, const typename Traits::input_t * const inBuffer, const int32) { @@ -72,14 +71,9 @@ static void SampleLoop(ModChannel &chn, const CResampler &resampler, typename Tr ModChannel &c = chn; const typename Traits::input_t * MPT_RESTRICT inSample = static_cast(c.pCurrentSample); - InterpolationFunc interpolate; - FilterFunc filter; - MixFunc mix; - - // Do initialisation if necessary - interpolate.Start(c, resampler); - filter.Start(c); - mix.Start(c); + InterpolationFunc interpolate{c, resampler, numSamples}; + FilterFunc filter{c}; + MixFunc mix{c}; unsigned int samples = numSamples; SamplePosition smpPos = c.position; // Fixed-point sample position @@ -96,10 +90,6 @@ static void SampleLoop(ModChannel &chn, const CResampler &resampler, typename Tr smpPos += increment; } - mix.End(c); - filter.End(c); - interpolate.End(c); - c.position = smpPos; } diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Snd_fx.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Snd_fx.cpp index bc6232b55..02a0af446 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Snd_fx.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Snd_fx.cpp @@ -491,6 +491,10 @@ std::vector CSoundFile::GetLength(enmGetLengthResetMode adjustMod break; case CMD_S3MCMDEX: + if(!chn.rowCommand.param && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT))) + chn.rowCommand.param = chn.nOldCmdEx; + else + chn.nOldCmdEx = static_cast(chn.rowCommand.param); if((p->param & 0xF0) == 0x60) { // Fine Pattern Delay @@ -885,6 +889,11 @@ std::vector CSoundFile::GetLength(enmGetLengthResetMode adjustMod } break; } + + if(m_playBehaviour[kST3EffectMemory] && param != 0) + { + UpdateS3MEffectMemory(chn, param); + } } // Interpret F00 effect in XM files as "stop song" @@ -3303,10 +3312,6 @@ bool CSoundFile::ProcessEffects() // S3M/IT Sxx Extended Commands case CMD_S3MCMDEX: - if(m_playBehaviour[kST3EffectMemory] && param == 0) - { - param = chn.nArpeggio; // S00 uses the last non-zero effect parameter as memory, like other effects including Arpeggio, so we "borrow" our memory there. - } ExtendedS3MCommands(nChn, static_cast(param)); break; @@ -3578,9 +3583,9 @@ void CSoundFile::UpdateS3MEffectMemory(ModChannel &chn, ModCommand::PARAM param) chn.nTremorParam = param; // Ixy chn.nArpeggio = param; // Jxy chn.nRetrigParam = param; // Qxy - chn.nTremoloDepth = (param & 0x0F) << 2; // Rxy - chn.nTremoloSpeed = (param >> 4) & 0x0F; // Rxy - // Sxy is not handled here. + chn.nTremoloDepth = (param & 0x0F) << 2; // Rxy + chn.nTremoloSpeed = (param >> 4) & 0x0F; // Rxy + chn.nOldCmdEx = param; // Sxy } @@ -5144,13 +5149,16 @@ void CSoundFile::SendMIDIData(PlayState &playState, CHANNELINDEX nChn, bool isSm if(plug > 0 && plug <= MAX_MIXPLUGINS && param < 0x80) { plug--; - const float newRatio = (127 - param) / 127.0f; - if(localOnly) - playState.m_midiMacroEvaluationResults->pluginDryWetRatio[plug] = newRatio; - else if(!isSmooth) - m_MixPlugins[plug].fDryRatio = newRatio; - else - m_MixPlugins[plug].fDryRatio = CalculateSmoothParamChange(playState, m_MixPlugins[plug].fDryRatio, newRatio); + if(IMixPlugin* pPlugin = m_MixPlugins[plug].pMixPlugin; pPlugin) + { + const float newRatio = (127 - param) / 127.0f; + if(localOnly) + playState.m_midiMacroEvaluationResults->pluginDryWetRatio[plug] = newRatio; + else if(!isSmooth) + pPlugin->SetDryRatio(newRatio); + else + pPlugin->SetDryRatio(CalculateSmoothParamChange(playState, m_MixPlugins[plug].fDryRatio, newRatio)); + } } } else if((macroCode & 0x80) || isExtended) { @@ -5159,8 +5167,7 @@ void CSoundFile::SendMIDIData(PlayState &playState, CHANNELINDEX nChn, bool isSm if(plug > 0 && plug <= MAX_MIXPLUGINS && param < 0x80) { plug--; - IMixPlugin *pPlugin = m_MixPlugins[plug].pMixPlugin; - if(pPlugin) + if(IMixPlugin *pPlugin = m_MixPlugins[plug].pMixPlugin; pPlugin) { const PlugParamIndex plugParam = isExtended ? (0x80 + macroCode) : (macroCode & 0x7F); const PlugParamValue value = param / 127.0f; @@ -5189,8 +5196,7 @@ void CSoundFile::SendMIDIData(PlayState &playState, CHANNELINDEX nChn, bool isSm if(plug > 0 && plug <= MAX_MIXPLUGINS) { - IMixPlugin *pPlugin = m_MixPlugins[plug - 1].pMixPlugin; - if (pPlugin != nullptr) + if(IMixPlugin *pPlugin = m_MixPlugins[plug - 1].pMixPlugin; pPlugin != nullptr) { if(macro[0] == 0xF0) { @@ -5236,7 +5242,7 @@ void CSoundFile::SendMIDINote(CHANNELINDEX chn, uint16 note, uint16 volume) } -void CSoundFile::ProcessSampleOffset(ModChannel& chn, CHANNELINDEX nChn, const PlayState& playState) const +void CSoundFile::ProcessSampleOffset(ModChannel &chn, CHANNELINDEX nChn, const PlayState &playState) const { const ModCommand &m = chn.rowCommand; uint32 extendedRows = 0; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Sndfile.h b/Frameworks/OpenMPT/OpenMPT/soundlib/Sndfile.h index 01aacbc68..f40acc425 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Sndfile.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Sndfile.h @@ -618,9 +618,10 @@ protected: public: #ifdef MODPLUG_TRACKER std::bitset m_bChannelMuteTogglePending; + std::bitset m_pluginDryWetRatioChanged; // Dry/Wet ratio was changed by playback code (e.g. through MIDI macro), need to update UI - std::vector *m_PatternCuePoints = nullptr; // For WAV export (writing pattern positions to file) - std::vector *m_SamplePlayLengths = nullptr; // For storing the maximum play length of each sample for automatic sample trimming + std::vector *m_PatternCuePoints = nullptr; // For WAV export (writing pattern positions to file) + std::vector *m_SamplePlayLengths = nullptr; // For storing the maximum play length of each sample for automatic sample trimming #endif // MODPLUG_TRACKER std::unique_ptr m_opl; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/Sndmix.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/Sndmix.cpp index 6bf693d62..30d49faca 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/Sndmix.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/Sndmix.cpp @@ -2634,8 +2634,8 @@ void CSoundFile::ProcessMidiOut(CHANNELINDEX nChn) switch(pIns->pluginVolumeHandling) { case PLUGIN_VOLUMEHANDLING_DRYWET: - if(hasVolCommand) pPlugin->SetDryRatio(2 * vol); - else pPlugin->SetDryRatio(2 * defaultVolume); + if(hasVolCommand) pPlugin->SetDryRatio(1.0f - (2 * vol) / 127.0f); + else pPlugin->SetDryRatio(1.0f - (2 * defaultVolume) / 127.0f); break; case PLUGIN_VOLUMEHANDLING_MIDI: if(hasVolCommand) pPlugin->MidiCC(MIDIEvents::MIDICC_Volume_Coarse, std::min(uint8(127), static_cast(2 * vol)), nChn); diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/modcommand.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/modcommand.cpp index c99215c97..467e2e4c2 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/modcommand.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/modcommand.cpp @@ -84,7 +84,7 @@ void ModCommand::ExtendedMODtoS3MEffect() case 0x70: param = (param & 0x03) | 0x40; break; case 0x90: command = CMD_RETRIG; param = (param & 0x0F); break; case 0xA0: if(param & 0x0F) { command = CMD_VOLUMESLIDE; param = (param << 4) | 0x0F; } else command = CMD_NONE; break; - case 0xB0: if(param & 0x0F) { command = CMD_VOLUMESLIDE; param = 0xF0 | std::min(param, PARAM(0x0E)); } else command = CMD_NONE; break; + case 0xB0: if(param & 0x0F) { command = CMD_VOLUMESLIDE; param = 0xF0 | static_cast(std::min(param & 0x0F, 0x0E)); } else command = CMD_NONE; break; case 0xC0: if(param == 0xC0) { command = CMD_NONE; note = NOTE_NOTECUT; } break; // this does different things in IT and ST3 case 0xD0: if(param == 0xD0) { command = CMD_NONE; } break; // ditto // rest are the same or handled elsewhere diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/LFOPlugin.h b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/LFOPlugin.h index 4bb958a13..56b70e9a5 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/LFOPlugin.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/LFOPlugin.h @@ -51,10 +51,12 @@ protected: std::vector m_chunkData; + static constexpr PlugParamIndex INVALID_OUTPUT_PARAM = uint32_max; + // LFO parameters float m_amplitude = 0.5f, m_offset = 0.5f, m_frequency = 0.290241f; LFOWaveform m_waveForm = kSine; - PlugParamIndex m_outputParam = int32_max; + PlugParamIndex m_outputParam = INVALID_OUTPUT_PARAM; bool m_tempoSync = false, m_polarity = false, m_bypassed = false, m_outputToCC = false, m_oneshot = false; // LFO state diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PlugInterface.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PlugInterface.cpp index fd28e0830..d0e8534ff 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PlugInterface.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PlugInterface.cpp @@ -200,10 +200,12 @@ void IMixPlugin::RecalculateGain() } -void IMixPlugin::SetDryRatio(uint32 param) +void IMixPlugin::SetDryRatio(float dryRatio) { - param = std::min(param, uint32(127)); - m_pMixStruct->fDryRatio = 1.0f - (param / 127.0f); + m_pMixStruct->fDryRatio = std::clamp(dryRatio, 0.0f, 1.0f); +#ifdef MODPLUG_TRACKER + m_SndFile.m_pluginDryWetRatioChanged.set(m_nSlot); +#endif // MODPLUG_TRACKER } @@ -497,7 +499,7 @@ void IMixPlugin::SaveAllParameters() m_pMixStruct->defaultProgram = -1; // Default implementation: Save all parameter values - PlugParamIndex numParams = std::min(GetNumParameters(), static_cast((std::numeric_limits::max() - sizeof(uint32)) / sizeof(IEEE754binary32LE))); + PlugParamIndex numParams = std::min(GetNumParameters(), static_cast((std::numeric_limits::max() - sizeof(uint32)) / sizeof(IEEE754binary32LE))); uint32 nLen = numParams * sizeof(IEEE754binary32LE); if (!nLen) return; nLen += sizeof(uint32); diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PlugInterface.h b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PlugInterface.h index 8ee0aabe8..34cf31211 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PlugInterface.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PlugInterface.h @@ -109,7 +109,7 @@ public: // Returns the next instance of the same plugin inline IMixPlugin *GetNextInstance() const { return m_pNext; } - void SetDryRatio(uint32 param); + void SetDryRatio(float dryRatio); bool IsBypassed() const; void RecalculateGain(); // Query output latency from host (in seconds) diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PluginManager.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PluginManager.cpp index 5dd363fb6..ab4e4abe9 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PluginManager.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PluginManager.cpp @@ -643,9 +643,6 @@ bool CVstPluginManager::RemovePlugin(VSTPluginLib *pFactory) bool CVstPluginManager::CreateMixPlugin(SNDMIXPLUGIN &mixPlugin, CSoundFile &sndFile) { VSTPluginLib *pFound = nullptr; -#ifdef MODPLUG_TRACKER - mixPlugin.SetAutoSuspend(TrackerSettings::Instance().enableAutoSuspend); -#endif // MODPLUG_TRACKER // Find plugin in library enum PlugMatchQuality diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PluginStructs.h b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PluginStructs.h index 18ca43212..4dc58d30e 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PluginStructs.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/PluginStructs.h @@ -22,7 +22,7 @@ OPENMPT_NAMESPACE_BEGIN //////////////////////////////////////////////////////////////////// // Mix Plugins -using PlugParamIndex = int32; +using PlugParamIndex = uint32; using PlugParamValue = float; struct SNDMIXPLUGINSTATE; @@ -37,21 +37,21 @@ struct SNDMIXPLUGININFO // dwInputRouting flags enum RoutingFlags { - irApplyToMaster = 0x01, // Apply to master mix - irBypass = 0x02, // Bypass effect - irWetMix = 0x04, // Wet Mix (dry added) - irExpandMix = 0x08, // [0%,100%] -> [-200%,200%] - irAutoSuspend = 0x10, // Plugin will automatically suspend on silence + irApplyToMaster = 0x01, // Apply to master mix + irBypass = 0x02, // Bypass effect + irWetMix = 0x04, // Wet Mix (dry added) + irExpandMix = 0x08, // [0%,100%] -> [-200%,200%] + irAutoSuspend = 0x10, // Plugin will automatically suspend on silence }; - int32le dwPluginId1; // Plugin type (kEffectMagic, kDmoMagic, kBuzzMagic) - int32le dwPluginId2; // Plugin unique ID - uint8le routingFlags; // See RoutingFlags + int32le dwPluginId1; // Plugin type (kEffectMagic, kDmoMagic, kBuzzMagic) + int32le dwPluginId2; // Plugin unique ID + uint8le routingFlags; // See RoutingFlags uint8le mixMode; - uint8le gain; // Divide by 10 to get real gain + uint8le gain; // Divide by 10 to get real gain uint8le reserved; - uint32le dwOutputRouting; // 0 = send to master 0x80 + x = send to plugin x - uint32le dwReserved[4]; // Reserved for routing info + uint32le dwOutputRouting; // 0 = send to master 0x80 + x = send to plugin x + uint32le dwReserved[4]; // Reserved for routing info mpt::modecharbuf<32, mpt::String::nullTerminated> szName; // User-chosen plugin display name - this is locale ANSI! mpt::modecharbuf<64, mpt::String::nullTerminated> szLibraryName; // original DLL name - this is UTF-8! diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Chorus.h b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Chorus.h index 869e38c65..62c1db6de 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Chorus.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Chorus.h @@ -36,7 +36,7 @@ protected: kChorusNumParameters }; - float m_param[kChorusNumParameters]; + std::array m_param; // Calculated parameters float m_waveShapeMin, m_waveShapeMax, m_waveShapeVal; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Compressor.h b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Compressor.h index 2fae55a20..7fc60f5a2 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Compressor.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Compressor.h @@ -31,7 +31,7 @@ protected: kCompNumParameters }; - float m_param[kCompNumParameters]; + std::array m_param; // Calculated parameters and coefficients float m_gain; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Distortion.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Distortion.cpp index 2dcddc60d..cce385081 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Distortion.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Distortion.cpp @@ -141,9 +141,11 @@ CString Distortion::GetParamLabel(PlugParamIndex param) { switch(param) { - case kDistGain: return _T("dB"); + case kDistGain: + return _T("dB"); case kDistPreLowpassCutoff: case kDistPostEQCenterFrequency: + case kDistPostEQBandwidth: return _T("Hz"); } return CString(); @@ -183,19 +185,8 @@ void Distortion::RecalculateDistortionParams() // Distortion float edge = 2.0f + m_param[kDistEdge] * 29.0f; - m_edge = static_cast(edge); // 2...31 shifted bits - - // Work out the magical shift factor (= floor(log2(edge)) + 1 == index of highest bit + 1) - uint8 shift; - if(m_edge <= 3) - shift = 2; - else if(m_edge <= 7) - shift = 3; - else if(m_edge <= 15) - shift = 4; - else - shift = 5; - m_shift = shift; + m_edge = static_cast(edge); // 2...31 shifted bits + m_shift = mpt::bit_width(m_edge); static constexpr float LogNorm[32] = { diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Distortion.h b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Distortion.h index 39a700917..3c88e8e75 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Distortion.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Distortion.h @@ -30,7 +30,7 @@ protected: kDistNumParameters }; - float m_param[kDistNumParameters]; + std::array m_param; // Pre-EQ coefficients float m_preEQz1[2], m_preEQb1, m_preEQa0; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Gargle.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Gargle.cpp index b365de3fe..1f9115a66 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Gargle.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Gargle.cpp @@ -109,7 +109,7 @@ void Gargle::Process(float *pOutL, float *pOutR, uint32 numFrames) PlugParamValue Gargle::GetParameter(PlugParamIndex index) { - if(index < kEqNumParameters) + if(index < kGargleNumParameters) { return m_param[index]; } @@ -119,7 +119,7 @@ PlugParamValue Gargle::GetParameter(PlugParamIndex index) void Gargle::SetParameter(PlugParamIndex index, PlugParamValue value) { - if(index < kEqNumParameters) + if(index < kGargleNumParameters) { value = mpt::safe_clamp(value, 0.0f, 1.0f); if(index == kGargleWaveShape) diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Gargle.h b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Gargle.h index 6fa6b20f7..c4a721c54 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Gargle.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/Gargle.h @@ -24,10 +24,10 @@ protected: { kGargleRate = 0, kGargleWaveShape, - kEqNumParameters + kGargleNumParameters }; - float m_param[kEqNumParameters]; + std::array m_param; uint32 m_period, m_periodHalf, m_counter; // In frames @@ -49,7 +49,7 @@ public: int32 GetCurrentProgram() override { return 0; } void SetCurrentProgram(int32) override { } - PlugParamIndex GetNumParameters() const override { return kEqNumParameters; } + PlugParamIndex GetNumParameters() const override { return kGargleNumParameters; } PlugParamValue GetParameter(PlugParamIndex index) override; void SetParameter(PlugParamIndex index, PlugParamValue value) override; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/I3DL2Reverb.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/I3DL2Reverb.cpp index df1cfddc1..63f5b9c1c 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/I3DL2Reverb.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/I3DL2Reverb.cpp @@ -309,7 +309,7 @@ int32 I3DL2Reverb::GetNumPrograms() const void I3DL2Reverb::SetCurrentProgram(int32 program) { #ifdef MODPLUG_TRACKER - if(program < NUM_REVERBTYPES) + if(program < static_cast(NUM_REVERBTYPES)) { m_program = program; const auto &preset = *GetReverbPreset(m_program); diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/I3DL2Reverb.h b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/I3DL2Reverb.h index 94c60a7e3..ee3ea6907 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/I3DL2Reverb.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/I3DL2Reverb.h @@ -63,7 +63,7 @@ protected: float Get() const; }; - float m_param[kI3DL2ReverbNumParameters]; + std::array m_param; int32 m_program = 0; // Calculated parameters diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/ParamEq.h b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/ParamEq.h index 4326a09b6..6ad3e4f30 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/ParamEq.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/ParamEq.h @@ -28,7 +28,7 @@ protected: kEqNumParameters }; - float m_param[kEqNumParameters]; + std::array m_param; // Equalizer coefficients float b0DIVa0, b1DIVa0, b2DIVa0, a1DIVa0, a2DIVa0; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/WavesReverb.cpp b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/WavesReverb.cpp index 7e9d75dcf..3f8757a29 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/WavesReverb.cpp +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/WavesReverb.cpp @@ -122,7 +122,7 @@ void WavesReverb::Process(float *pOutL, float *pOutR, uint32 numFrames) PlugParamValue WavesReverb::GetParameter(PlugParamIndex index) { - if(index < kDistNumParameters) + if(index < kRvbNumParameters) { return m_param[index]; } @@ -132,7 +132,7 @@ PlugParamValue WavesReverb::GetParameter(PlugParamIndex index) void WavesReverb::SetParameter(PlugParamIndex index, PlugParamValue value) { - if(index < kDistNumParameters) + if(index < kRvbNumParameters) { value = mpt::safe_clamp(value, 0.0f, 1.0f); m_param[index] = value; diff --git a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/WavesReverb.h b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/WavesReverb.h index f6ef95518..13e9af1ed 100644 --- a/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/WavesReverb.h +++ b/Frameworks/OpenMPT/OpenMPT/soundlib/plugins/dmo/WavesReverb.h @@ -26,16 +26,16 @@ protected: kRvbReverbMix, kRvbReverbTime, kRvbHighFreqRTRatio, - kDistNumParameters + kRvbNumParameters }; - float m_param[kDistNumParameters]; + std::array m_param; // Parameters and coefficients float m_dryFactor; float m_wetFactor; - float m_coeffs[10]; - uint32 m_delay[6]; + std::array m_coeffs; + std::array m_delay; // State struct ReverbState @@ -64,7 +64,7 @@ public: int32 GetCurrentProgram() override { return 0; } void SetCurrentProgram(int32) override { } - PlugParamIndex GetNumParameters() const override { return kDistNumParameters; } + PlugParamIndex GetNumParameters() const override { return kRvbNumParameters; } PlugParamValue GetParameter(PlugParamIndex index) override; void SetParameter(PlugParamIndex index, PlugParamValue value) override; diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/.clang-format b/Frameworks/OpenMPT/OpenMPT/src/mpt/.clang-format index 626b6d039..01ba8d730 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/.clang-format +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/.clang-format @@ -1,14 +1,17 @@ +# clang-format 13 + Language: Cpp -Standard: c++17 +Standard: c++20 AccessModifierOffset: -4 #? AlignAfterOpenBracket: AlwaysBreak +AlignArrayOfStructures: Left AlignConsecutiveAssignments: false AlignConsecutiveBitFields: false AlignConsecutiveDeclarations: false AlignConsecutiveMacros: true AlignEscapedNewlines: DontAlign -AlignOperands: DontAlign +AlignOperands: AlignAfterOperator AlignTrailingComments: true AllowAllArgumentsOnNextLine: true AllowAllConstructorInitializersOnNextLine: true @@ -23,8 +26,10 @@ AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: [] BinPackArguments: true BinPackParameters: false +BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: false AfterClass: false @@ -47,6 +52,7 @@ BraceWrapping: #BreakAfterJavaFieldAnnotations BreakBeforeBinaryOperators: NonAssignment BreakBeforeBraces: Custom +BreakBeforeConceptDeclarations: true BreakBeforeTernaryOperators: true BreakConstructorInitializers: BeforeComma BreakInheritanceList: BeforeComma @@ -60,17 +66,22 @@ ContinuationIndentWidth: 4 #? Cpp11BracedListStyle: true DeriveLineEnding: true DerivePointerAlignment: false +EmptyLineAfterAccessModifier: Leave +EmptyLineBeforeAccessModifier: Leave FixNamespaceComments: true ForEachMacros: [] +IfMacros: ['MPT_MAYBE_CONSTANT_IF'] IncludeBlocks: Preserve IncludeCategories: [] #? IncludeIsMainRegex: '' #? IncludeIsMainSourceRegex: '' #? +IndentAccessModifiers: false IndentCaseLabels: true IndentCaseBlocks: true IndentExternBlock: NoIndent IndentGotoLabels: false IndentPPDirectives: None +#IndentRequiresClause: true InsertTrailingCommas: None #BeforeHash IndentWidth: 4 @@ -79,6 +90,7 @@ IndentWrappedFunctionNames: true #JavaScriptQuotes #JavaScriptWrapImports KeepEmptyLinesAtTheStartOfBlocks: true +LambdaBodyIndentation: OuterScope MacroBlockBegin: '^MPT_TEST_GROUP_BEGIN$' #? MacroBlockEnd: '^MPT_TEST_GROUP_END$' #? MaxEmptyLinesToKeep: 5 @@ -96,16 +108,23 @@ NamespaceMacros: [] #? #PenaltyBreakString #PenaltyBreakTemplateDeclaration #PenaltyExcessCharacter +#PenaltyIndentedWhitespace #PenaltyReturnTypeOnItsOwnLine PointerAlignment: Middle +PPIndentWidth: -1 #RawStringFormats +ReferenceAlignment: Pointer ReflowComments: false +ShortNamespaceLines: 1 SortIncludes: false +#SortJavaStaticImport SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true @@ -119,8 +138,12 @@ SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInConditionalStatement: false SpacesInContainerLiterals: true +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 SpacesInParentheses: false SpacesInSquareBrackets: false +StatementAttributeLikeMacros: [] StatementMacros: [ '_Pragma', '__pragma', 'MPT_WARNING', 'MPT_TEST_GROUP_INLINE_IDENTIFIER', 'MPT_TEST_GROUP_INLINE', 'MPT_TEST_GROUP_STATIC' ] #? TabWidth: 4 TypenameMacros: [] #? diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/audio/span.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/audio/span.hpp index 841315396..5d159f7ee 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/audio/span.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/audio/span.hpp @@ -352,14 +352,13 @@ private: std::size_t m_offset; public: - audio_span_with_offset(Taudio_span buffer, std::size_t offsetFrames) noexcept + constexpr audio_span_with_offset(Taudio_span buffer, std::size_t offsetFrames) noexcept : m_buffer(buffer) , m_offset(offsetFrames) { return; } sample_type * data() const noexcept { - if (!is_contiguous()) - { + if (!is_contiguous()) { return nullptr; } return m_buffer.data() + (size_channels() * m_offset); diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/base/bit.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/base/bit.hpp index 81418fc1a..3bfa98ebd 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/base/bit.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/base/bit.hpp @@ -112,8 +112,7 @@ constexpr bool endian_is_weird() noexcept { #endif // !MPT_COMPILER_GENERIC -enum class endian -{ +enum class endian { little = 0x78563412u, big = 0x12345678u, weird = 1u, @@ -135,7 +134,9 @@ MPT_FORCEINLINE mpt::endian endian_probe() noexcept { static_assert(sizeof(endian_probe_type) == 4); constexpr endian_probe_type endian_probe_big = 0x12345678u; constexpr endian_probe_type endian_probe_little = 0x78563412u; - const std::array probe{{std::byte{0x12}, std::byte{0x34}, std::byte{0x56}, std::byte{0x78}}}; + const std::array probe{ + {std::byte{0x12}, std::byte{0x34}, std::byte{0x56}, std::byte{0x78}} + }; const endian_probe_type test = mpt::bit_cast(probe); mpt::endian result = mpt::endian::native; switch (test) { @@ -183,9 +184,9 @@ MPT_FORCEINLINE bool endian_is_weird() noexcept { -#if MPT_CXX_AT_LEAST(20) && !MPT_COMPILER_MSVC && !MPT_CLANG_BEFORE(12, 0, 0) +#if MPT_CXX_AT_LEAST(20) && MPT_MSVC_AT_LEAST(2022, 1) && !MPT_CLANG_BEFORE(12, 0, 0) -// Disabled for VS2022 for now because of +// Disabled for VS2022.0 because of // // / with fix already queued // (). diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/base/detect_compiler.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/base/detect_compiler.hpp index 78b2c88b4..7424386dd 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/base/detect_compiler.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/base/detect_compiler.hpp @@ -50,7 +50,9 @@ #elif defined(_MSC_VER) #define MPT_COMPILER_MSVC 1 -#if (_MSC_VER >= 1930) +#if (_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) #elif (_MSC_VER >= 1929) #define MPT_COMPILER_MSVC_VERSION MPT_COMPILER_MAKE_VERSION2(2019, 10) diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/base/semantic_version.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/base/semantic_version.hpp index 898cab6b3..3315da330 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/base/semantic_version.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/base/semantic_version.hpp @@ -83,7 +83,10 @@ constexpr bool operator>=(version_info const a, version_info const b) noexcept { return a.as_tuple() >= b.as_tuple(); } -constexpr inline version_info Version = {{MPT_VERSION_MAJOR, MPT_VERSION_MINOR, MPT_VERSION_PATCH}, MPT_VERSION_BUILD}; +constexpr inline version_info Version = { + {MPT_VERSION_MAJOR, MPT_VERSION_MINOR, MPT_VERSION_PATCH}, + MPT_VERSION_BUILD +}; } // namespace MPT_INLINE_NS diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/base/tests/tests_base_bit.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/base/tests/tests_base_bit.hpp index 71676ad59..7aed082c8 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/base/tests/tests_base_bit.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/base/tests/tests_base_bit.hpp @@ -35,18 +35,18 @@ MPT_TEST_GROUP_INLINE("mpt/base/bit") #if MPT_CXX_BEFORE(20) MPT_TEST_EXPECT_EQUAL(mpt::get_endian(), mpt::endian_probe()); #endif - MPT_MAYBE_CONSTANT_IF(mpt::endian_is_little()) { + MPT_MAYBE_CONSTANT_IF (mpt::endian_is_little()) { MPT_TEST_EXPECT_EQUAL(mpt::get_endian(), mpt::endian::little); - MPT_MAYBE_CONSTANT_IF((mpt::endian::native == mpt::endian::little) || (mpt::endian::native == mpt::endian::big)) { + MPT_MAYBE_CONSTANT_IF ((mpt::endian::native == mpt::endian::little) || (mpt::endian::native == mpt::endian::big)) { MPT_TEST_EXPECT_EQUAL(mpt::endian::native, mpt::endian::little); } #if MPT_CXX_BEFORE(20) MPT_TEST_EXPECT_EQUAL(mpt::endian_probe(), mpt::endian::little); #endif } - MPT_MAYBE_CONSTANT_IF(mpt::endian_is_big()) { + MPT_MAYBE_CONSTANT_IF (mpt::endian_is_big()) { MPT_TEST_EXPECT_EQUAL(mpt::get_endian(), mpt::endian::big); - MPT_MAYBE_CONSTANT_IF((mpt::endian::native == mpt::endian::little) || (mpt::endian::native == mpt::endian::big)) { + MPT_MAYBE_CONSTANT_IF ((mpt::endian::native == mpt::endian::little) || (mpt::endian::native == mpt::endian::big)) { MPT_TEST_EXPECT_EQUAL(mpt::endian::native, mpt::endian::big); } #if MPT_CXX_BEFORE(20) diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/base64.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/base64.hpp index 10a1e4d0f..579f6710c 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/base64.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/base64.hpp @@ -35,7 +35,8 @@ inline constexpr std::array base64 = { {MPT_UCHAR('A'), MPT_UCHAR('B'), MPT_UCHAR('C'), MPT_UCHAR('D'), MPT_UCHAR('E'), MPT_UCHAR('F'), MPT_UCHAR('G'), MPT_UCHAR('H'), MPT_UCHAR('I'), MPT_UCHAR('J'), MPT_UCHAR('K'), MPT_UCHAR('L'), MPT_UCHAR('M'), MPT_UCHAR('N'), MPT_UCHAR('O'), MPT_UCHAR('P'), MPT_UCHAR('Q'), MPT_UCHAR('R'), MPT_UCHAR('S'), MPT_UCHAR('T'), MPT_UCHAR('U'), MPT_UCHAR('V'), MPT_UCHAR('W'), MPT_UCHAR('X'), MPT_UCHAR('Y'), MPT_UCHAR('Z'), MPT_UCHAR('a'), MPT_UCHAR('b'), MPT_UCHAR('c'), MPT_UCHAR('d'), MPT_UCHAR('e'), MPT_UCHAR('f'), MPT_UCHAR('g'), MPT_UCHAR('h'), MPT_UCHAR('i'), MPT_UCHAR('j'), MPT_UCHAR('k'), MPT_UCHAR('l'), MPT_UCHAR('m'), MPT_UCHAR('n'), MPT_UCHAR('o'), MPT_UCHAR('p'), MPT_UCHAR('q'), MPT_UCHAR('r'), MPT_UCHAR('s'), MPT_UCHAR('t'), MPT_UCHAR('u'), MPT_UCHAR('v'), - MPT_UCHAR('w'), MPT_UCHAR('x'), MPT_UCHAR('y'), MPT_UCHAR('z'), MPT_UCHAR('0'), MPT_UCHAR('1'), MPT_UCHAR('2'), MPT_UCHAR('3'), MPT_UCHAR('4'), MPT_UCHAR('5'), MPT_UCHAR('6'), MPT_UCHAR('7'), MPT_UCHAR('8'), MPT_UCHAR('9'), MPT_UCHAR('+'), MPT_UCHAR('/')}}; + MPT_UCHAR('w'), MPT_UCHAR('x'), MPT_UCHAR('y'), MPT_UCHAR('z'), MPT_UCHAR('0'), MPT_UCHAR('1'), MPT_UCHAR('2'), MPT_UCHAR('3'), MPT_UCHAR('4'), MPT_UCHAR('5'), MPT_UCHAR('6'), MPT_UCHAR('7'), MPT_UCHAR('8'), MPT_UCHAR('9'), MPT_UCHAR('+'), MPT_UCHAR('/')} +}; template diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/base64url.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/base64url.hpp index ef3de1436..04859f87b 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/base64url.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/base64url.hpp @@ -35,7 +35,8 @@ inline constexpr std::array base64url = { {MPT_UCHAR('A'), MPT_UCHAR('B'), MPT_UCHAR('C'), MPT_UCHAR('D'), MPT_UCHAR('E'), MPT_UCHAR('F'), MPT_UCHAR('G'), MPT_UCHAR('H'), MPT_UCHAR('I'), MPT_UCHAR('J'), MPT_UCHAR('K'), MPT_UCHAR('L'), MPT_UCHAR('M'), MPT_UCHAR('N'), MPT_UCHAR('O'), MPT_UCHAR('P'), MPT_UCHAR('Q'), MPT_UCHAR('R'), MPT_UCHAR('S'), MPT_UCHAR('T'), MPT_UCHAR('U'), MPT_UCHAR('V'), MPT_UCHAR('W'), MPT_UCHAR('X'), MPT_UCHAR('Y'), MPT_UCHAR('Z'), MPT_UCHAR('a'), MPT_UCHAR('b'), MPT_UCHAR('c'), MPT_UCHAR('d'), MPT_UCHAR('e'), MPT_UCHAR('f'), MPT_UCHAR('g'), MPT_UCHAR('h'), MPT_UCHAR('i'), MPT_UCHAR('j'), MPT_UCHAR('k'), MPT_UCHAR('l'), MPT_UCHAR('m'), MPT_UCHAR('n'), MPT_UCHAR('o'), MPT_UCHAR('p'), MPT_UCHAR('q'), MPT_UCHAR('r'), MPT_UCHAR('s'), MPT_UCHAR('t'), MPT_UCHAR('u'), MPT_UCHAR('v'), - MPT_UCHAR('w'), MPT_UCHAR('x'), MPT_UCHAR('y'), MPT_UCHAR('z'), MPT_UCHAR('0'), MPT_UCHAR('1'), MPT_UCHAR('2'), MPT_UCHAR('3'), MPT_UCHAR('4'), MPT_UCHAR('5'), MPT_UCHAR('6'), MPT_UCHAR('7'), MPT_UCHAR('8'), MPT_UCHAR('9'), MPT_UCHAR('-'), MPT_UCHAR('_')}}; + MPT_UCHAR('w'), MPT_UCHAR('x'), MPT_UCHAR('y'), MPT_UCHAR('z'), MPT_UCHAR('0'), MPT_UCHAR('1'), MPT_UCHAR('2'), MPT_UCHAR('3'), MPT_UCHAR('4'), MPT_UCHAR('5'), MPT_UCHAR('6'), MPT_UCHAR('7'), MPT_UCHAR('8'), MPT_UCHAR('9'), MPT_UCHAR('-'), MPT_UCHAR('_')} +}; template inline mpt::ustring encode_base64url(mpt::span src_) { diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/hex.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/hex.hpp index 9b41175ae..09a518b41 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/hex.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/binary/hex.hpp @@ -26,7 +26,8 @@ inline constexpr std::array encode_nibble = { {MPT_UCHAR('0'), MPT_UCHAR('1'), MPT_UCHAR('2'), MPT_UCHAR('3'), MPT_UCHAR('4'), MPT_UCHAR('5'), MPT_UCHAR('6'), MPT_UCHAR('7'), MPT_UCHAR('8'), MPT_UCHAR('9'), MPT_UCHAR('A'), MPT_UCHAR('B'), - MPT_UCHAR('C'), MPT_UCHAR('D'), MPT_UCHAR('E'), MPT_UCHAR('F')}}; + MPT_UCHAR('C'), MPT_UCHAR('D'), MPT_UCHAR('E'), MPT_UCHAR('F')} +}; inline bool decode_byte(uint8 & byte, mpt::uchar c1, mpt::uchar c2) { diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/floatingpoint.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/floatingpoint.hpp index f8ea81109..7eaff1593 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/floatingpoint.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/floatingpoint.hpp @@ -164,10 +164,10 @@ public: } MPT_FORCEINLINE uint32 GetInt32() const { return 0u - | (static_cast(bytes[hihi]) << 24) - | (static_cast(bytes[hilo]) << 16) - | (static_cast(bytes[lohi]) << 8) - | (static_cast(bytes[lolo]) << 0); + | (static_cast(bytes[hihi]) << 24) + | (static_cast(bytes[hilo]) << 16) + | (static_cast(bytes[lohi]) << 8) + | (static_cast(bytes[lolo]) << 0); } MPT_FORCEINLINE bool operator==(const self_t & cmp) const { return true @@ -220,14 +220,14 @@ public: } MPT_FORCEINLINE uint64 GetInt64() const { return 0u - | (static_cast(bytes[hihihi]) << 56) - | (static_cast(bytes[hihilo]) << 48) - | (static_cast(bytes[hilohi]) << 40) - | (static_cast(bytes[hilolo]) << 32) - | (static_cast(bytes[lohihi]) << 24) - | (static_cast(bytes[lohilo]) << 16) - | (static_cast(bytes[lolohi]) << 8) - | (static_cast(bytes[lololo]) << 0); + | (static_cast(bytes[hihihi]) << 56) + | (static_cast(bytes[hihilo]) << 48) + | (static_cast(bytes[hilohi]) << 40) + | (static_cast(bytes[hilolo]) << 32) + | (static_cast(bytes[lohihi]) << 24) + | (static_cast(bytes[lohilo]) << 16) + | (static_cast(bytes[lolohi]) << 8) + | (static_cast(bytes[lololo]) << 0); } MPT_FORCEINLINE bool operator==(const self_t & cmp) const { return true diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/int24.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/int24.hpp index f5c4da5f9..cdab86179 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/int24.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/int24.hpp @@ -29,22 +29,20 @@ struct uint24 { template ::value, bool>::type = true> explicit uint24(T other) noexcept { using Tunsigned = typename std::make_unsigned::type; - MPT_MAYBE_CONSTANT_IF(mpt::endian_is_big()) { + MPT_MAYBE_CONSTANT_IF (mpt::endian_is_big()) { bytes[0] = mpt::byte_cast(static_cast((static_cast(other) >> 16) & 0xff)); bytes[1] = mpt::byte_cast(static_cast((static_cast(other) >> 8) & 0xff)); bytes[2] = mpt::byte_cast(static_cast((static_cast(other) >> 0) & 0xff)); - } - else { + } else { bytes[0] = mpt::byte_cast(static_cast((static_cast(other) >> 0) & 0xff)); bytes[1] = mpt::byte_cast(static_cast((static_cast(other) >> 8) & 0xff)); bytes[2] = mpt::byte_cast(static_cast((static_cast(other) >> 16) & 0xff)); } } operator int() const noexcept { - MPT_MAYBE_CONSTANT_IF(mpt::endian_is_big()) { + MPT_MAYBE_CONSTANT_IF (mpt::endian_is_big()) { return (mpt::byte_cast(bytes[0]) * 65536) + (mpt::byte_cast(bytes[1]) * 256) + mpt::byte_cast(bytes[2]); - } - else { + } else { return (mpt::byte_cast(bytes[2]) * 65536) + (mpt::byte_cast(bytes[1]) * 256) + mpt::byte_cast(bytes[0]); } } @@ -59,22 +57,20 @@ struct int24 { template ::value, bool>::type = true> explicit int24(T other) noexcept { using Tunsigned = typename std::make_unsigned::type; - MPT_MAYBE_CONSTANT_IF(mpt::endian_is_big()) { + MPT_MAYBE_CONSTANT_IF (mpt::endian_is_big()) { bytes[0] = mpt::byte_cast(static_cast((static_cast(other) >> 16) & 0xff)); bytes[1] = mpt::byte_cast(static_cast((static_cast(other) >> 8) & 0xff)); bytes[2] = mpt::byte_cast(static_cast((static_cast(other) >> 0) & 0xff)); - } - else { + } else { bytes[0] = mpt::byte_cast(static_cast((static_cast(other) >> 0) & 0xff)); bytes[1] = mpt::byte_cast(static_cast((static_cast(other) >> 8) & 0xff)); bytes[2] = mpt::byte_cast(static_cast((static_cast(other) >> 16) & 0xff)); } } operator int() const noexcept { - MPT_MAYBE_CONSTANT_IF(mpt::endian_is_big()) { + MPT_MAYBE_CONSTANT_IF (mpt::endian_is_big()) { return (static_cast(mpt::byte_cast(bytes[0])) * 65536) + (mpt::byte_cast(bytes[1]) * 256) + mpt::byte_cast(bytes[2]); - } - else { + } else { return (static_cast(mpt::byte_cast(bytes[2])) * 65536) + (mpt::byte_cast(bytes[1]) * 256) + mpt::byte_cast(bytes[0]); } } diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/integer.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/integer.hpp index 6d67c306c..abc54b739 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/integer.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/endian/integer.hpp @@ -43,28 +43,28 @@ struct LittleEndian_tag { constexpr inline uint16 constexpr_bswap16(uint16 x) noexcept { return uint16(0) - | ((x >> 8) & 0x00FFu) - | ((x << 8) & 0xFF00u); + | ((x >> 8) & 0x00FFu) + | ((x << 8) & 0xFF00u); } constexpr inline uint32 constexpr_bswap32(uint32 x) noexcept { return uint32(0) - | ((x & 0x000000FFu) << 24) - | ((x & 0x0000FF00u) << 8) - | ((x & 0x00FF0000u) >> 8) - | ((x & 0xFF000000u) >> 24); + | ((x & 0x000000FFu) << 24) + | ((x & 0x0000FF00u) << 8) + | ((x & 0x00FF0000u) >> 8) + | ((x & 0xFF000000u) >> 24); } constexpr inline uint64 constexpr_bswap64(uint64 x) noexcept { return uint64(0) - | (((x >> 0) & 0xffull) << 56) - | (((x >> 8) & 0xffull) << 48) - | (((x >> 16) & 0xffull) << 40) - | (((x >> 24) & 0xffull) << 32) - | (((x >> 32) & 0xffull) << 24) - | (((x >> 40) & 0xffull) << 16) - | (((x >> 48) & 0xffull) << 8) - | (((x >> 56) & 0xffull) << 0); + | (((x >> 0) & 0xffull) << 56) + | (((x >> 8) & 0xffull) << 48) + | (((x >> 16) & 0xffull) << 40) + | (((x >> 24) & 0xffull) << 32) + | (((x >> 32) & 0xffull) << 24) + | (((x >> 40) & 0xffull) << 16) + | (((x >> 48) & 0xffull) << 8) + | (((x >> 56) & 0xffull) << 0); } #if MPT_COMPILER_GCC @@ -139,55 +139,49 @@ MPT_CONSTEXPRINLINE T EndianDecode(std::array data) noexcept { MPT_CONSTEXPR20_FUN uint64 SwapBytesImpl(uint64 value) noexcept { - MPT_MAYBE_CONSTANT_IF(MPT_IS_CONSTANT_EVALUATED20()) { + MPT_MAYBE_CONSTANT_IF (MPT_IS_CONSTANT_EVALUATED20()) { return mpt::constexpr_bswap64(value); - } - else { + } else { return MPT_bswap64(value); } } MPT_CONSTEXPR20_FUN uint32 SwapBytesImpl(uint32 value) noexcept { - MPT_MAYBE_CONSTANT_IF(MPT_IS_CONSTANT_EVALUATED20()) { + MPT_MAYBE_CONSTANT_IF (MPT_IS_CONSTANT_EVALUATED20()) { return mpt::constexpr_bswap32(value); - } - else { + } else { return MPT_bswap32(value); } } MPT_CONSTEXPR20_FUN uint16 SwapBytesImpl(uint16 value) noexcept { - MPT_MAYBE_CONSTANT_IF(MPT_IS_CONSTANT_EVALUATED20()) { + MPT_MAYBE_CONSTANT_IF (MPT_IS_CONSTANT_EVALUATED20()) { return mpt::constexpr_bswap16(value); - } - else { + } else { return MPT_bswap16(value); } } MPT_CONSTEXPR20_FUN int64 SwapBytesImpl(int64 value) noexcept { - MPT_MAYBE_CONSTANT_IF(MPT_IS_CONSTANT_EVALUATED20()) { + MPT_MAYBE_CONSTANT_IF (MPT_IS_CONSTANT_EVALUATED20()) { return mpt::constexpr_bswap64(value); - } - else { + } else { return MPT_bswap64(value); } } MPT_CONSTEXPR20_FUN int32 SwapBytesImpl(int32 value) noexcept { - MPT_MAYBE_CONSTANT_IF(MPT_IS_CONSTANT_EVALUATED20()) { + MPT_MAYBE_CONSTANT_IF (MPT_IS_CONSTANT_EVALUATED20()) { return mpt::constexpr_bswap32(value); - } - else { + } else { return MPT_bswap32(value); } } MPT_CONSTEXPR20_FUN int16 SwapBytesImpl(int16 value) noexcept { - MPT_MAYBE_CONSTANT_IF(MPT_IS_CONSTANT_EVALUATED20()) { + MPT_MAYBE_CONSTANT_IF (MPT_IS_CONSTANT_EVALUATED20()) { return mpt::constexpr_bswap16(value); - } - else { + } else { return MPT_bswap16(value); } } @@ -232,7 +226,7 @@ public: public: MPT_CONSTEXPR20_FUN void set(base_type val) noexcept { static_assert(std::numeric_limits::is_integer); - MPT_MAYBE_CONSTANT_IF(MPT_IS_CONSTANT_EVALUATED20()) { + MPT_MAYBE_CONSTANT_IF (MPT_IS_CONSTANT_EVALUATED20()) { if constexpr (endian_type::endian == mpt::endian::big) { typename std::make_unsigned::type uval = val; for (std::size_t i = 0; i < sizeof(base_type); ++i) { @@ -244,8 +238,7 @@ public: data[i] = static_cast((uval >> (8 * i)) & 0xffu); } } - } - else { + } else { if constexpr (mpt::endian::native == mpt::endian::little || mpt::endian::native == mpt::endian::big) { if constexpr (mpt::endian::native != endian_type::endian) { val = mpt::SwapBytesImpl(val); @@ -259,7 +252,7 @@ public: } MPT_CONSTEXPR20_FUN base_type get() const noexcept { static_assert(std::numeric_limits::is_integer); - MPT_MAYBE_CONSTANT_IF(MPT_IS_CONSTANT_EVALUATED20()) { + MPT_MAYBE_CONSTANT_IF (MPT_IS_CONSTANT_EVALUATED20()) { if constexpr (endian_type::endian == mpt::endian::big) { typename std::make_unsigned::type uval = 0; for (std::size_t i = 0; i < sizeof(base_type); ++i) { @@ -273,8 +266,7 @@ public: } return static_cast(uval); } - } - else { + } else { if constexpr (mpt::endian::native == mpt::endian::little || mpt::endian::native == mpt::endian::big) { base_type val = base_type(); std::memcpy(&val, data.data(), sizeof(val)); diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/format/message.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/format/message.hpp index 50ede6ac7..b4b0e9147 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/format/message.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/format/message.hpp @@ -53,8 +53,7 @@ private: std::size_t max_arg = 0; //std::size_t args = 0; bool success = true; - enum class state : int - { + enum class state : int { error = -1, text = 0, open_seen = 1, @@ -204,8 +203,7 @@ MPT_CONSTEXPRINLINE std::ptrdiff_t parse_format_string_argument_count_impl(const std::size_t max_arg = 0; std::size_t args = 0; bool success = true; - enum class state : int - { + enum class state : int { error = -1, text = 0, open_seen = 1, diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/format/simple_spec.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/format/simple_spec.hpp index 941840596..78ba576ee 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/format/simple_spec.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/format/simple_spec.hpp @@ -18,8 +18,7 @@ inline namespace MPT_INLINE_NS { struct format_simple_base { - enum FormatFlagsEnum - { + enum FormatFlagsEnum { BaseDec = 0x0001, // base 10 (integers only) // int+float BaseHex = 0x0002, // base 16 (integers only) // int+float CaseLow = 0x0010, // lower case hex digits // int+float diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/callbackstream.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/callbackstream.hpp index a86e440e0..330c2dab4 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/callbackstream.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/callbackstream.hpp @@ -24,8 +24,7 @@ namespace IO { template struct CallbackStreamTemplate { - enum : int - { + enum : int { SeekSet = 0, SeekCur = 1, SeekEnd = 2 diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/filedata_base_buffered.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/filedata_base_buffered.hpp index 3f49a4574..637be25c2 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/filedata_base_buffered.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/filedata_base_buffered.hpp @@ -31,13 +31,11 @@ namespace IO { class FileDataSeekableBuffered : public FileDataSeekable { private: - enum : std::size_t - { + enum : std::size_t { CHUNK_SIZE = mpt::IO::BUFFERSIZE_SMALL, BUFFER_SIZE = mpt::IO::BUFFERSIZE_NORMAL }; - enum : std::size_t - { + enum : std::size_t { NUM_CHUNKS = BUFFER_SIZE / CHUNK_SIZE }; struct chunk_info { diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/filedata_base_unseekable.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/filedata_base_unseekable.hpp index e65f775df..c7a7d0c1d 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/filedata_base_unseekable.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/io_read/filedata_base_unseekable.hpp @@ -43,8 +43,7 @@ protected: } private: - enum : std::size_t - { + enum : std::size_t { QUANTUM_SIZE = mpt::IO::BUFFERSIZE_SMALL, BUFFER_SIZE = mpt::IO::BUFFERSIZE_NORMAL }; diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/osinfo/class.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/osinfo/class.hpp index c089aa013..2c9979660 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/osinfo/class.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/osinfo/class.hpp @@ -26,8 +26,7 @@ inline namespace MPT_INLINE_NS { namespace osinfo { -enum class osclass -{ +enum class osclass { Unknown, Windows, Linux, diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/osinfo/windows_version.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/osinfo/windows_version.hpp index 3cc84a473..afcf6fec6 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/osinfo/windows_version.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/osinfo/windows_version.hpp @@ -29,8 +29,7 @@ namespace windows { class Version { public: - enum Number : uint64 - { + enum Number : uint64 { WinNT4 = 0x0000000400000000ull, Win2000 = 0x0000000500000000ull, WinXP = 0x0000000500000001ull, @@ -46,7 +45,10 @@ public: struct System { uint32 Major = 0; uint32 Minor = 0; - System() = default; + constexpr System() noexcept + : Major(0) + , Minor(0) { + } constexpr System(Number number) noexcept : Major(static_cast((static_cast(number) >> 32) & 0xffffffffu)) , Minor(static_cast((static_cast(number) >> 0) & 0xffffffffu)) { @@ -67,7 +69,10 @@ public: struct ServicePack { uint16 Major = 0; uint16 Minor = 0; - ServicePack() = default; + constexpr ServicePack() noexcept + : Major(0) + , Minor(0) { + } explicit constexpr ServicePack(uint16 major, uint16 minor) noexcept : Major(major) , Minor(minor) { @@ -84,7 +89,7 @@ public: typedef uint32 TypeId; -protected: +private: bool m_SystemIsWindows; System m_System; @@ -92,8 +97,8 @@ protected: Build m_Build; TypeId m_Type; -protected: - Version() noexcept +private: + constexpr Version() noexcept : m_SystemIsWindows(false) , m_System() , m_ServicePack() @@ -102,11 +107,11 @@ protected: } public: - static Version NoWindows() noexcept { + static constexpr Version NoWindows() noexcept { return Version(); } - Version(mpt::osinfo::windows::Version::System system, mpt::osinfo::windows::Version::ServicePack servicePack, mpt::osinfo::windows::Version::Build build, mpt::osinfo::windows::Version::TypeId type) noexcept + constexpr Version(mpt::osinfo::windows::Version::System system, mpt::osinfo::windows::Version::ServicePack servicePack, mpt::osinfo::windows::Version::Build build, mpt::osinfo::windows::Version::TypeId type) noexcept : m_SystemIsWindows(true) , m_System(system) , m_ServicePack(servicePack) @@ -114,46 +119,67 @@ public: , m_Type(type) { } -protected: +public: #if MPT_OS_WINDOWS - static mpt::osinfo::windows::Version VersionFromNTDDI_VERSION() noexcept { + static mpt::osinfo::windows::Version FromSDK() noexcept { // Initialize to used SDK version - mpt::osinfo::windows::Version::System System = -#if NTDDI_VERSION >= 0x0A000000 // NTDDI_WIN10 - mpt::osinfo::windows::Version::Win10 +#if defined(NTDDI_VERSION) +#if NTDDI_VERSION >= 0x0A00000B // NTDDI_WIN10_CO Win11 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 22000, 0); +#elif NTDDI_VERSION >= 0x0A00000A // NTDDI_WIN10_FE 21H2 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19044, 0); +//#elif // NTDDI_WIN10_FE 21H1 +// return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19043, 0); +//#elif // NTDDI_WIN10_FE 20H2 +// return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19042, 0); +#elif NTDDI_VERSION >= 0x0A000008 // NTDDI_WIN10_MN 2004/20H1 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 19041, 0); +//#elif // NTDDI_WIN10_VB 1909/19H2 +// return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 18363, 0); +#elif NTDDI_VERSION >= 0x0A000007 // NTDDI_WIN10_19H1 1903/19H1 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 18362, 0); +#elif NTDDI_VERSION >= 0x0A000006 // NTDDI_WIN10_RS5 1809 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 17763, 0); +#elif NTDDI_VERSION >= 0x0A000005 // NTDDI_WIN10_RS4 1803 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 17134, 0); +#elif NTDDI_VERSION >= 0x0A000004 // NTDDI_WIN10_RS3 1709 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 16299, 0); +#elif NTDDI_VERSION >= 0x0A000003 // NTDDI_WIN10_RS2 1703 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 15063, 0); +#elif NTDDI_VERSION >= 0x0A000002 // NTDDI_WIN10_RS1 1607 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 14393, 0); +#elif NTDDI_VERSION >= 0x0A000001 // NTDDI_WIN10_TH2 1511 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 10586, 0); +#elif NTDDI_VERSION >= 0x0A000000 // NTDDI_WIN10 1507 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win10, mpt::osinfo::windows::Version::ServicePack(0, 0), 10240, 0); #elif NTDDI_VERSION >= 0x06030000 // NTDDI_WINBLUE - mpt::osinfo::windows::Version::Win81 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win81, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0); #elif NTDDI_VERSION >= 0x06020000 // NTDDI_WIN8 - mpt::osinfo::windows::Version::Win8 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win8, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0); #elif NTDDI_VERSION >= 0x06010000 // NTDDI_WIN7 - mpt::osinfo::windows::Version::Win7 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win7, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0); #elif NTDDI_VERSION >= 0x06000000 // NTDDI_VISTA - mpt::osinfo::windows::Version::WinVista + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinVista, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0); #elif NTDDI_VERSION >= 0x05020000 // NTDDI_WS03 - mpt::osinfo::windows::Version::WinXP64 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinXP64, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0); #elif NTDDI_VERSION >= NTDDI_WINXP - mpt::osinfo::windows::Version::WinXP + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinXP, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0); #elif NTDDI_VERSION >= NTDDI_WIN2K - mpt::osinfo::windows::Version::Win2000 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::Win2000, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0); #else - mpt::osinfo::windows::Version::WinNT4 + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::WinNT4, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0); #endif - ; - return mpt::osinfo::windows::Version(System, mpt::osinfo::windows::Version::ServicePack(((NTDDI_VERSION & 0xffffu) >> 8) & 0xffu, ((NTDDI_VERSION & 0xffffu) >> 0) & 0xffu), 0, 0); - } - - static mpt::osinfo::windows::Version::System SystemVersionFrom_WIN32_WINNT() noexcept { -#if defined(_WIN32_WINNT) - return mpt::osinfo::windows::Version::System((static_cast(_WIN32_WINNT) & 0xff00u) >> 8, (static_cast(_WIN32_WINNT) & 0x00ffu) >> 0); +#elif defined(_WIN32_WINNT) + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::System((static_cast(_WIN32_WINNT) & 0xff00u) >> 8, (static_cast(_WIN32_WINNT) & 0x00ffu) >> 0), mpt::osinfo::windows::Version::ServicePack(0, 0), 0, 0); #else - return mpt::osinfo::windows::Version::System(); + return mpt::osinfo::windows::Version(mpt::osinfo::windows::Version::System(0, 0), mpt::osinfo::windows::Version::ServicePack(0, 0), 0, 0); #endif } static mpt::osinfo::windows::Version GatherWindowsVersion() noexcept { #if MPT_OS_WINDOWS_WINRT - return VersionFromNTDDI_VERSION(); + return mpt::osinfo::windows::Version::FromSDK(); #else // !MPT_OS_WINDOWS_WINRT OSVERSIONINFOEXW versioninfoex{}; versioninfoex.dwOSVersionInfoSize = sizeof(versioninfoex); @@ -167,7 +193,7 @@ protected: #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif // MPT_COMPILER_CLANG if (GetVersionExW((LPOSVERSIONINFOW)&versioninfoex) == FALSE) { - return VersionFromNTDDI_VERSION(); + return mpt::osinfo::windows::Version::FromSDK(); } #if MPT_COMPILER_MSVC #pragma warning(pop) @@ -176,7 +202,7 @@ protected: #pragma clang diagnostic pop #endif // MPT_COMPILER_CLANG if (versioninfoex.dwPlatformId != VER_PLATFORM_WIN32_NT) { - return VersionFromNTDDI_VERSION(); + return mpt::osinfo::windows::Version::FromSDK(); } DWORD dwProductType = 0; #if (_WIN32_WINNT >= 0x0600) // _WIN32_WINNT_VISTA @@ -261,6 +287,10 @@ public: return m_Build < build; } + bool IsBefore(mpt::osinfo::windows::Version version) const noexcept { + return IsBefore(version.GetSystem(), version.GetServicePack(), version.GetBuild()); + } + bool IsAtLeast(mpt::osinfo::windows::Version::System version) const noexcept { if (!m_SystemIsWindows) { return false; @@ -313,6 +343,10 @@ public: return m_Build >= build; } + bool IsAtLeast(mpt::osinfo::windows::Version version) const noexcept { + return IsAtLeast(version.GetSystem(), version.GetServicePack(), version.GetBuild()); + } + mpt::osinfo::windows::Version::System GetSystem() const noexcept { return m_System; } diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/random/engine.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/random/engine.hpp index cc1b69914..1fc36e159 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/random/engine.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/random/engine.hpp @@ -37,8 +37,7 @@ struct engine_traits { template <> struct engine_traits { - enum : std::size_t - { + enum : std::size_t { seed_bits = sizeof(std::mt19937::result_type) * 8 * std::mt19937::state_size }; typedef std::mt19937 rng_type; @@ -56,8 +55,7 @@ struct engine_traits { template <> struct engine_traits { - enum : std::size_t - { + enum : std::size_t { seed_bits = sizeof(std::mt19937_64::result_type) * 8 * std::mt19937_64::state_size }; typedef std::mt19937_64 rng_type; @@ -75,8 +73,7 @@ struct engine_traits { template <> struct engine_traits { - enum : std::size_t - { + enum : std::size_t { seed_bits = std::ranlux24_base::word_size }; typedef std::ranlux24_base rng_type; @@ -94,8 +91,7 @@ struct engine_traits { template <> struct engine_traits { - enum : std::size_t - { + enum : std::size_t { seed_bits = std::ranlux48_base::word_size }; typedef std::ranlux48_base rng_type; @@ -113,8 +109,7 @@ struct engine_traits { template <> struct engine_traits { - enum : std::size_t - { + enum : std::size_t { seed_bits = std::ranlux24_base::word_size }; typedef std::ranlux24 rng_type; @@ -132,8 +127,7 @@ struct engine_traits { template <> struct engine_traits { - enum : std::size_t - { + enum : std::size_t { seed_bits = std::ranlux48_base::word_size }; typedef std::ranlux48 rng_type; diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/string/types.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/string/types.hpp index 8e2a638e0..64df0c203 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/string/types.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/string/types.hpp @@ -27,8 +27,7 @@ inline namespace MPT_INLINE_NS { -enum class common_encoding -{ +enum class common_encoding { utf8, ascii, // strictly 7-bit ASCII iso8859_1, @@ -36,11 +35,15 @@ enum class common_encoding cp850, cp437, windows1252, + amiga, + riscos, + iso8859_1_no_c1, + iso8859_15_no_c1, + amiga_no_c1, }; -enum class logical_encoding -{ +enum class logical_encoding { locale, // CP_ACP on windows, system configured C locale otherwise active_locale, // active C/C++ global locale }; diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/string_transcode/transcode.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/string_transcode/transcode.hpp index dc2e947c6..cdb53b611 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/string_transcode/transcode.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/string_transcode/transcode.hpp @@ -43,27 +43,25 @@ inline namespace MPT_INLINE_NS { -/* -default 1:1 mapping + +// default 1:1 mapping inline constexpr char32_t CharsetTableISO8859_1[256] = { - 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f, - 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f, - 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f, - 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f, - 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f, - 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f, - 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f, - 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f, - 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008a,0x008b,0x008c,0x008d,0x008e,0x008f, - 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009a,0x009b,0x009c,0x009d,0x009e,0x009f, - 0x00a0,0x00a1,0x00a2,0x00a3,0x00a4,0x00a5,0x00a6,0x00a7,0x00a8,0x00a9,0x00aa,0x00ab,0x00ac,0x00ad,0x00ae,0x00af, - 0x00b0,0x00b1,0x00b2,0x00b3,0x00b4,0x00b5,0x00b6,0x00b7,0x00b8,0x00b9,0x00ba,0x00bb,0x00bc,0x00bd,0x00be,0x00bf, - 0x00c0,0x00c1,0x00c2,0x00c3,0x00c4,0x00c5,0x00c6,0x00c7,0x00c8,0x00c9,0x00ca,0x00cb,0x00cc,0x00cd,0x00ce,0x00cf, - 0x00d0,0x00d1,0x00d2,0x00d3,0x00d4,0x00d5,0x00d6,0x00d7,0x00d8,0x00d9,0x00da,0x00db,0x00dc,0x00dd,0x00de,0x00df, - 0x00e0,0x00e1,0x00e2,0x00e3,0x00e4,0x00e5,0x00e6,0x00e7,0x00e8,0x00e9,0x00ea,0x00eb,0x00ec,0x00ed,0x00ee,0x00ef, - 0x00f0,0x00f1,0x00f2,0x00f3,0x00f4,0x00f5,0x00f6,0x00f7,0x00f8,0x00f9,0x00fa,0x00fb,0x00fc,0x00fd,0x00fe,0x00ff -}; -*/ + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff}; inline constexpr char32_t CharsetTableISO8859_15[256] = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, @@ -137,6 +135,45 @@ inline constexpr char32_t CharsetTableCP437[256] = { 0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4, 0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229, 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248, 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0}; +// +inline constexpr char32_t CharsetTableAmiga[256] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x2592, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x2013, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff}; + +// Based on RISCOSI.TXT from , +// with gaps filled in from standard set at . +inline constexpr char32_t CharsetTableRISC_OS[256] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, + 0x20AC, 0x0174, 0x0175, 0x25f0, 0x1fbc0, 0x0176, 0x0177, 0xfffd, 0x21e6, 0x21e8, 0x21e9, 0x21e7, 0x2026, 0x2122, 0x2030, 0x2022, + 0x2018, 0x2019, 0x2039, 0x203A, 0x201C, 0x201D, 0x201E, 0x2013, 0x2014, 0x2212, 0x0152, 0x0153, 0x2020, 0x2021, 0xFB01, 0xFB02, + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff}; + template inline mpt::widestring decode_8bit(const Tsrcstring & str, const char32_t (&table)[256], mpt::widechar replacement = MPT_WIDECHAR('\uFFFD')) { mpt::widestring res; @@ -186,12 +223,66 @@ inline Tdststring encode_8bit(const mpt::widestring & str, const char32_t (&tabl return res; } +template +inline mpt::widestring decode_8bit_no_c1(const Tsrcstring & str, const char32_t (&table)[256], mpt::widechar replacement = MPT_WIDECHAR('\uFFFD')) { + mpt::widestring res; + res.reserve(str.length()); + for (std::size_t i = 0; i < str.length(); ++i) { + std::size_t c = static_cast(mpt::char_value(str[i])); + if ((0x80 <= c) && (c <= 0x9f)) { + res.push_back(replacement); + } else if (c < std::size(table)) { + res.push_back(static_cast(table[c])); + } else { + res.push_back(replacement); + } + } + return res; +} + +template +inline Tdststring encode_8bit_no_c1(const mpt::widestring & str, const char32_t (&table)[256], char replacement = '?') { + Tdststring res; + res.reserve(str.length()); + for (std::size_t i = 0; i < str.length(); ++i) { + char32_t c = static_cast(str[i]); + bool found = false; + // Try non-control characters first. + // In cases where there are actual characters mirrored in this range (like in AMS/AMS2 character sets), + // characters in the common range are preferred this way. + for (std::size_t x = 0x20; x < std::size(table); ++x) { + if ((0x80 <= c) && (c <= 0x9f)) { + continue; + } + if (c == table[x]) { + res.push_back(static_cast(static_cast(x))); + found = true; + break; + } + } + if (!found) { + // try control characters + for (std::size_t x = 0x00; x < std::size(table) && x < 0x20; ++x) { + if (c == table[x]) { + res.push_back(static_cast(static_cast(x))); + found = true; + break; + } + } + } + if (!found) { + res.push_back(replacement); + } + } + return res; +} + template inline mpt::widestring decode_ascii(const Tsrcstring & str, mpt::widechar replacement = MPT_WIDECHAR('\uFFFD')) { mpt::widestring res; res.reserve(str.length()); for (std::size_t i = 0; i < str.length(); ++i) { - uint8 c = str[i]; + uint8 c = mpt::char_value(str[i]); if (c <= 0x7f) { res.push_back(static_cast(static_cast(c))); } else { @@ -222,7 +313,7 @@ inline mpt::widestring decode_iso8859_1(const Tsrcstring & str, mpt::widechar re mpt::widestring res; res.reserve(str.length()); for (std::size_t i = 0; i < str.length(); ++i) { - uint8 c = str[i]; + uint8 c = mpt::char_value(str[i]); res.push_back(static_cast(static_cast(c))); } return res; @@ -471,6 +562,21 @@ inline bool windows_has_encoding(common_encoding encoding) { case common_encoding::windows1252: result = has_codepage(1252); break; + case common_encoding::amiga: + result = false; + break; + case common_encoding::riscos: + result = false; + break; + case common_encoding::iso8859_1_no_c1: + result = false; + break; + case common_encoding::iso8859_15_no_c1: + result = false; + break; + case common_encoding::amiga_no_c1: + result = false; + break; } return result; } @@ -495,7 +601,7 @@ inline UINT codepage_from_encoding(logical_encoding encoding) { result = CP_ACP; break; case logical_encoding::active_locale: - result = 0; + throw std::domain_error("unsupported encoding"); break; } return result; @@ -525,6 +631,21 @@ inline UINT codepage_from_encoding(common_encoding encoding) { case common_encoding::windows1252: result = 1252; break; + case common_encoding::amiga: + throw std::domain_error("unsupported encoding"); + break; + case common_encoding::riscos: + throw std::domain_error("unsupported encoding"); + break; + case common_encoding::iso8859_1_no_c1: + throw std::domain_error("unsupported encoding"); + break; + case common_encoding::iso8859_15_no_c1: + throw std::domain_error("unsupported encoding"); + break; + case common_encoding::amiga_no_c1: + throw std::domain_error("unsupported encoding"); + break; } return result; } @@ -828,6 +949,21 @@ inline Tdststring encode(common_encoding encoding, const mpt::widestring & src) case common_encoding::windows1252: return encode_8bit(src, CharsetTableWindows1252); break; + case common_encoding::amiga: + return encode_8bit(src, CharsetTableAmiga); + break; + case common_encoding::riscos: + return encode_8bit(src, CharsetTableRISC_OS); + break; + case common_encoding::iso8859_1_no_c1: + return encode_8bit_no_c1(src, CharsetTableISO8859_1); + break; + case common_encoding::iso8859_15_no_c1: + return encode_8bit_no_c1(src, CharsetTableISO8859_15); + break; + case common_encoding::amiga_no_c1: + return encode_8bit_no_c1(src, CharsetTableAmiga); + break; } throw std::domain_error("unsupported encoding"); } @@ -922,6 +1058,21 @@ inline mpt::widestring decode(common_encoding encoding, const Tsrcstring & src) case common_encoding::windows1252: return decode_8bit(src, CharsetTableWindows1252); break; + case common_encoding::amiga: + return decode_8bit(src, CharsetTableAmiga); + break; + case common_encoding::riscos: + return decode_8bit(src, CharsetTableRISC_OS); + break; + case common_encoding::iso8859_1_no_c1: + return decode_8bit_no_c1(src, CharsetTableISO8859_1); + break; + case common_encoding::iso8859_15_no_c1: + return decode_8bit_no_c1(src, CharsetTableISO8859_15); + break; + case common_encoding::amiga_no_c1: + return decode_8bit_no_c1(src, CharsetTableAmiga); + break; } throw std::domain_error("unsupported encoding"); } diff --git a/Frameworks/OpenMPT/OpenMPT/src/mpt/uuid/uuid.hpp b/Frameworks/OpenMPT/OpenMPT/src/mpt/uuid/uuid.hpp index dca5eab1a..3e56c06df 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/mpt/uuid/uuid.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/mpt/uuid/uuid.hpp @@ -160,7 +160,7 @@ public: private: static MPT_CONSTEXPRINLINE uint8 NibbleFromChar(char x) { return ('0' <= x && x <= '9') ? static_cast(x - '0' + 0) : ('a' <= x && x <= 'z') ? static_cast(x - 'a' + 10) - : ('A' <= x && x <= 'Z') ? static_cast(x - 'A' + 10) + : ('A' <= x && x <= 'Z') ? static_cast(x - 'A' + 10) : mpt::constexpr_throw(std::domain_error("")); } static MPT_CONSTEXPRINLINE uint8 ByteFromHex(char x, char y) { @@ -351,29 +351,29 @@ public: } std::string ToAString() const { return std::string() - + mpt::format::hex0<8>(GetData1()) - + std::string("-") - + mpt::format::hex0<4>(GetData2()) - + std::string("-") - + mpt::format::hex0<4>(GetData3()) - + std::string("-") - + mpt::format::hex0<4>(static_cast(GetData4() >> 48)) - + std::string("-") - + mpt::format::hex0<4>(static_cast(GetData4() >> 32)) - + mpt::format::hex0<8>(static_cast(GetData4() >> 0)); + + mpt::format::hex0<8>(GetData1()) + + std::string("-") + + mpt::format::hex0<4>(GetData2()) + + std::string("-") + + mpt::format::hex0<4>(GetData3()) + + std::string("-") + + mpt::format::hex0<4>(static_cast(GetData4() >> 48)) + + std::string("-") + + mpt::format::hex0<4>(static_cast(GetData4() >> 32)) + + mpt::format::hex0<8>(static_cast(GetData4() >> 0)); } mpt::ustring ToUString() const { return mpt::ustring() - + mpt::format::hex0<8>(GetData1()) - + MPT_USTRING("-") - + mpt::format::hex0<4>(GetData2()) - + MPT_USTRING("-") - + mpt::format::hex0<4>(GetData3()) - + MPT_USTRING("-") - + mpt::format::hex0<4>(static_cast(GetData4() >> 48)) - + MPT_USTRING("-") - + mpt::format::hex0<4>(static_cast(GetData4() >> 32)) - + mpt::format::hex0<8>(static_cast(GetData4() >> 0)); + + mpt::format::hex0<8>(GetData1()) + + MPT_USTRING("-") + + mpt::format::hex0<4>(GetData2()) + + MPT_USTRING("-") + + mpt::format::hex0<4>(GetData3()) + + MPT_USTRING("-") + + mpt::format::hex0<4>(static_cast(GetData4() >> 48)) + + MPT_USTRING("-") + + mpt::format::hex0<4>(static_cast(GetData4() >> 32)) + + mpt::format::hex0<8>(static_cast(GetData4() >> 0)); } }; diff --git a/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/CopyMix.hpp b/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/CopyMix.hpp index f3ae541d6..1dd8de37a 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/CopyMix.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/CopyMix.hpp @@ -35,8 +35,8 @@ void ConvertBufferMixInternalFixedToBuffer(TOutBuf outBuf, TInBuf inBuf, Tdither assert(inBuf.size_frames() >= count); assert(outBuf.size_frames() >= count); constexpr int ditherBits = SampleFormat(SampleFormatTraits::sampleFormat()).IsInt() - ? SampleFormat(SampleFormatTraits::sampleFormat()).GetBitsPerSample() - : 0; + ? SampleFormat(SampleFormatTraits::sampleFormat()).GetBitsPerSample() + : 0; SC::ClipFixed clip; SC::ConvertFixedPoint conv; for(std::size_t i = 0; i < count; ++i) @@ -79,8 +79,8 @@ void ConvertBufferMixInternalToBuffer(TOutBuf outBuf, TInBuf inBuf, Tdither &dit assert(inBuf.size_frames() >= count); assert(outBuf.size_frames() >= count); constexpr int ditherBits = SampleFormat(SampleFormatTraits::sampleFormat()).IsInt() - ? SampleFormat(SampleFormatTraits::sampleFormat()).GetBitsPerSample() - : 0; + ? SampleFormat(SampleFormatTraits::sampleFormat()).GetBitsPerSample() + : 0; SC::Clip clip; SC::Convert conv; for(std::size_t i = 0; i < count; ++i) diff --git a/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/SampleDecode.hpp b/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/SampleDecode.hpp index 8824eda0d..4d7585874 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/SampleDecode.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/SampleDecode.hpp @@ -264,7 +264,7 @@ struct DecodeInt64 | (static_cast(mpt::byte_cast(inBuf[b5])) << 40) | (static_cast(mpt::byte_cast(inBuf[b6])) << 48) | (static_cast(mpt::byte_cast(inBuf[b7])) << 56)) - - offset; + - offset; } }; diff --git a/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/SampleFormat.hpp b/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/SampleFormat.hpp index 3e8738ae4..2ba2b18ba 100644 --- a/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/SampleFormat.hpp +++ b/Frameworks/OpenMPT/OpenMPT/src/openmpt/soundbase/SampleFormat.hpp @@ -250,27 +250,27 @@ public: } MPT_CONSTEXPRINLINE uint8 GetSampleSize() const noexcept { - return !IsValid() ? 0 - : (value == SampleFormat::Unsigned8) ? 1 - : (value == SampleFormat::Int8) ? 1 - : (value == SampleFormat::Int16) ? 2 - : (value == SampleFormat::Int24) ? 3 - : (value == SampleFormat::Int32) ? 4 - : (value == SampleFormat::Float32) ? 4 - : (value == SampleFormat::Float64) ? 8 - : 0; + return !IsValid() ? 0 + : (value == SampleFormat::Unsigned8) ? 1 + : (value == SampleFormat::Int8) ? 1 + : (value == SampleFormat::Int16) ? 2 + : (value == SampleFormat::Int24) ? 3 + : (value == SampleFormat::Int32) ? 4 + : (value == SampleFormat::Float32) ? 4 + : (value == SampleFormat::Float64) ? 8 + : 0; } MPT_CONSTEXPRINLINE uint8 GetBitsPerSample() const noexcept { - return !IsValid() ? 0 - : (value == SampleFormat::Unsigned8) ? 8 - : (value == SampleFormat::Int8) ? 8 - : (value == SampleFormat::Int16) ? 16 - : (value == SampleFormat::Int24) ? 24 - : (value == SampleFormat::Int32) ? 32 - : (value == SampleFormat::Float32) ? 32 - : (value == SampleFormat::Float64) ? 64 - : 0; + return !IsValid() ? 0 + : (value == SampleFormat::Unsigned8) ? 8 + : (value == SampleFormat::Int8) ? 8 + : (value == SampleFormat::Int16) ? 16 + : (value == SampleFormat::Int24) ? 24 + : (value == SampleFormat::Int32) ? 32 + : (value == SampleFormat::Float32) ? 32 + : (value == SampleFormat::Float64) ? 64 + : 0; } MPT_CONSTEXPRINLINE operator SampleFormat::Enum() const noexcept