Skip to content

Commit

Permalink
set midi channel range
Browse files Browse the repository at this point in the history
  • Loading branch information
iurienistor committed Dec 10, 2024
1 parent 0fdc1c2 commit 632cb0a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/percussion_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,18 @@ void PercussionState::setChannel(size_t channel)
{
outputChannel = std::clamp(channel,
static_cast<size_t>(0),
GeonkickApi::numberOfChannels() - 1);
GeonkickApi::numberOfChannels() - 2);
}

void PercussionState::setMidiChannel(signed char channel)
{
outputMidiChannel = std::clamp(channel,
static_cast<size_t>(0),
GeonkickApi::numberOfMidiChannels() - 1);
if (GeonkickTypes::geonkickAnyMidiChannel == static_cast<int>(channel)) {
outputMidiChannel = channel;
} else {
outputMidiChannel = std::clamp(channel,
static_cast<decltype(channel)>(0),
static_cast<decltype(channel)>(GeonkickApi::numberOfMidiChannels() - 1));
}
}

void PercussionState::setMute(bool b)
Expand Down

0 comments on commit 632cb0a

Please sign in to comment.