@@ -35,8 +35,8 @@ struct EnvelopeNode
3535 tick_t tick = 0 ; // Envelope node position (x axis)
3636 value_t value = 0 ; // Envelope node value (y axis)
3737
38- EnvelopeNode () { }
39- EnvelopeNode (tick_t tick, value_t value) : tick( tick) , value( value) { }
38+ constexpr EnvelopeNode () = default;
39+ constexpr EnvelopeNode (tick_t tick, value_t value) : tick{ tick} , value{ value} { }
4040
4141 bool operator == (const EnvelopeNode &other) const { return tick == other.tick && value == other.value ; }
4242};
@@ -128,16 +128,20 @@ struct ModInstrument
128128 // WHEN adding new members here, ALSO update InstrumentExtensions.cpp
129129 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
130130
131- explicit ModInstrument (SAMPLEINDEX sample = 0 );
131+ MPT_CONSTEXPR20_FUN explicit ModInstrument (SAMPLEINDEX sample = 0 )
132+ {
133+ AssignSample (sample);
134+ ResetNoteMap ();
135+ }
132136
133137 // Assign all notes to a given sample.
134- void AssignSample (SAMPLEINDEX sample)
138+ MPT_CONSTEXPR20_FUN void AssignSample (SAMPLEINDEX sample)
135139 {
136140 Keyboard.fill (sample);
137141 }
138142
139143 // Reset note mapping (i.e. every note is mapped to itself)
140- void ResetNoteMap ()
144+ MPT_CONSTEXPR20_FUN void ResetNoteMap ()
141145 {
142146 std::iota (NoteMap.begin (), NoteMap.end (), static_cast <uint8>(NOTE_MIN));
143147 }
@@ -149,23 +153,23 @@ struct ModInstrument
149153 // Transpose entire note mapping by given number of semitones
150154 void Transpose (int8 amount);
151155
152- bool IsCutoffEnabled () const { return (nIFC & 0x80 ) != 0 ; }
153- bool IsResonanceEnabled () const { return (nIFR & 0x80 ) != 0 ; }
154- uint8 GetCutoff () const { return (nIFC & 0x7F ); }
155- uint8 GetResonance () const { return (nIFR & 0x7F ); }
156- void SetCutoff (uint8 cutoff, bool enable) { nIFC = std::min (cutoff, uint8 (0x7F )) | (enable ? 0x80 : 0x00 ); }
157- void SetResonance (uint8 resonance, bool enable) { nIFR = std::min (resonance, uint8 (0x7F )) | (enable ? 0x80 : 0x00 ); }
156+ MPT_CONSTEXPRINLINE bool IsCutoffEnabled () const { return (nIFC & 0x80 ) != 0 ; }
157+ MPT_CONSTEXPRINLINE bool IsResonanceEnabled () const { return (nIFR & 0x80 ) != 0 ; }
158+ MPT_CONSTEXPRINLINE uint8 GetCutoff () const { return (nIFC & 0x7F ); }
159+ MPT_CONSTEXPRINLINE uint8 GetResonance () const { return (nIFR & 0x7F ); }
160+ MPT_CONSTEXPRINLINE void SetCutoff (uint8 cutoff, bool enable) { nIFC = std::min (cutoff, uint8 (0x7F )) | (enable ? 0x80 : 0x00 ); }
161+ MPT_CONSTEXPRINLINE void SetResonance (uint8 resonance, bool enable) { nIFR = std::min (resonance, uint8 (0x7F )) | (enable ? 0x80 : 0x00 ); }
158162
159- bool HasValidMIDIChannel () const { return (nMidiChannel >= 1 && nMidiChannel <= 17 ); }
163+ MPT_CONSTEXPRINLINE bool HasValidMIDIChannel () const { return (nMidiChannel >= 1 && nMidiChannel <= 17 ); }
160164 uint8 GetMIDIChannel (const ModChannel &channel, CHANNELINDEX chn) const ;
161165
162- void SetTuning (CTuning *pT)
166+ MPT_CONSTEXPRINLINE void SetTuning (CTuning *pT)
163167 {
164168 pTuning = pT;
165169 }
166170
167171 // Get a reference to a specific envelope of this instrument
168- const InstrumentEnvelope &GetEnvelope (EnvelopeType envType) const
172+ MPT_CONSTEXPRINLINE const InstrumentEnvelope &GetEnvelope (EnvelopeType envType) const
169173 {
170174 switch (envType)
171175 {
0 commit comments