Skip to content

Commit 632cb0a

Browse files
committed
set midi channel range
1 parent 0fdc1c2 commit 632cb0a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/percussion_state.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,18 @@ void PercussionState::setChannel(size_t channel)
166166
{
167167
outputChannel = std::clamp(channel,
168168
static_cast<size_t>(0),
169-
GeonkickApi::numberOfChannels() - 1);
169+
GeonkickApi::numberOfChannels() - 2);
170170
}
171171

172172
void PercussionState::setMidiChannel(signed char channel)
173173
{
174-
outputMidiChannel = std::clamp(channel,
175-
static_cast<size_t>(0),
176-
GeonkickApi::numberOfMidiChannels() - 1);
174+
if (GeonkickTypes::geonkickAnyMidiChannel == static_cast<int>(channel)) {
175+
outputMidiChannel = channel;
176+
} else {
177+
outputMidiChannel = std::clamp(channel,
178+
static_cast<decltype(channel)>(0),
179+
static_cast<decltype(channel)>(GeonkickApi::numberOfMidiChannels() - 1));
180+
}
177181
}
178182

179183
void PercussionState::setMute(bool b)

0 commit comments

Comments
 (0)