Skip to content

Commit 9993b4b

Browse files
committed
Prevent playing the same note on 2 channels
1 parent 6df88ac commit 9993b4b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

shared-module/synthio/__init__.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ STATIC int find_channel_with_note(const synthio_midi_span_t *span, uint8_t note)
160160
}
161161

162162
bool synthio_span_change_note(synthio_midi_span_t *span, uint8_t old_note, uint8_t new_note) {
163+
if (new_note != SYNTHIO_SILENCE && find_channel_with_note(span, new_note) != -1) {
164+
return false; // note already pressed, do nothing
165+
}
163166
int channel = find_channel_with_note(span, old_note);
164167
if (channel != -1) {
165168
span->note[channel] = new_note;

0 commit comments

Comments
 (0)