From cabb1fd89ac3659ae288997f02e0af3ad584340e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Heusipp?= Date: Mon, 30 Dec 2024 16:47:23 +0000 Subject: [PATCH] [Ref] Enable constexpr ModInstrument again for compilers that have sufficient support. git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22644 56274372-70c3-4bfc-bfc3-4c3a0b034d27 --- soundlib/ModInstrument.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/soundlib/ModInstrument.h b/soundlib/ModInstrument.h index c6328758ef7..4a136b66d7f 100644 --- a/soundlib/ModInstrument.h +++ b/soundlib/ModInstrument.h @@ -128,20 +128,21 @@ struct ModInstrument // WHEN adding new members here, ALSO update InstrumentExtensions.cpp // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - explicit ModInstrument(SAMPLEINDEX sample = 0) + MPT_CONSTEXPR20_CONTAINER_FUN explicit ModInstrument(SAMPLEINDEX sample = 0) + : NoteMap{mpt::generate_array([](std::size_t i){ return static_cast(NOTE_MIN + i); })} + , Keyboard{mpt::init_array(sample)} { - AssignSample(sample); - ResetNoteMap(); + return; } // Assign all notes to a given sample. - void AssignSample(SAMPLEINDEX sample) + MPT_CONSTEXPR20_ALGORITHM_FUN void AssignSample(SAMPLEINDEX sample) { Keyboard.fill(sample); } // Reset note mapping (i.e. every note is mapped to itself) - void ResetNoteMap() + MPT_CONSTEXPR20_ALGORITHM_FUN void ResetNoteMap() { std::iota(NoteMap.begin(), NoteMap.end(), static_cast(NOTE_MIN)); }