Skip to content

Commit

Permalink
[Ref] Enable constexpr ModInstrument again for compilers that have su…
Browse files Browse the repository at this point in the history
…fficient support.

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22644 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
manxorist committed Dec 30, 2024
1 parent 9c9120e commit cabb1fd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions soundlib/ModInstrument.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8, 128>([](std::size_t i){ return static_cast<uint8>(NOTE_MIN + i); })}
, Keyboard{mpt::init_array<SAMPLEINDEX, 128>(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<uint8>(NOTE_MIN));
}
Expand Down

0 comments on commit cabb1fd

Please sign in to comment.