Skip to content

Commit

Permalink
Fluid: fixed Let Ring / Pedal playback for voices
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPudashkin committed Dec 20, 2024
1 parent daef7d8 commit 78eabbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ void FluidSequencer::updatePlaybackEvents(EventSequenceMap& destination, const m

for (const auto& pair : noteEvent.expressionCtx().articulations) {
if (muse::contains(PEDAL_CC_SUPPORTED_TYPES, pair.first)) {
appendControlSwitch(destination, noteEvent, pair.second.meta, midi::SUSTAIN_PEDAL_CONTROLLER);
} else if (muse::contains(BEND_SUPPORTED_TYPES, pair.first))
appendControlSwitch(destination, noteEvent, pair.second.meta, midi::SUSTAIN_PEDAL_CONTROLLER, channelIdx);
} else if (muse::contains(BEND_SUPPORTED_TYPES, pair.first)) {
appendPitchBend(destination, noteEvent, pair.second.meta, channelIdx);
}
}
Expand All @@ -155,16 +155,19 @@ void FluidSequencer::updateDynamicEvents(EventSequenceMap& destination, const mp
}

void FluidSequencer::appendControlSwitch(EventSequenceMap& destination, const mpe::NoteEvent& noteEvent,
const mpe::ArticulationMeta& artMeta, const int midiControlIdx)
const mpe::ArticulationMeta& artMeta,
const int midiControlIdx, const channel_t channelIdx)
{
midi::Event start(Event::Opcode::ControlChange, Event::MessageType::ChannelVoice10);
start.setIndex(midiControlIdx);
start.setChannel(channelIdx);
start.setData(127);

destination[noteEvent.arrangementCtx().actualTimestamp].emplace(std::move(start));

midi::Event end(Event::Opcode::ControlChange, Event::MessageType::ChannelVoice10);
end.setIndex(midiControlIdx);
end.setChannel(channelIdx);
end.setData(0);

destination[artMeta.timestamp + artMeta.overallDuration].emplace(std::move(end));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class FluidSequencer : public AbstractEventSequencer<midi::Event>
void updateDynamicEvents(EventSequenceMap& destination, const mpe::DynamicLevelLayers& changes);

void appendControlSwitch(EventSequenceMap& destination, const mpe::NoteEvent& noteEvent, const mpe::ArticulationMeta& artMeta,
const int midiControlIdx);
const int midiControlIdx, const midi::channel_t channelIdx);

void appendPitchBend(EventSequenceMap& destination, const mpe::NoteEvent& noteEvent, const mpe::ArticulationMeta& artMeta,
const midi::channel_t channelIdx);
Expand Down

0 comments on commit 78eabbc

Please sign in to comment.