Skip to content

Commit

Permalink
Merge pull request #25275 from alexpavlov96/midi_channel_string
Browse files Browse the repository at this point in the history
midi: calculating string for getting channel when string isn't not set
  • Loading branch information
alexpavlov96 authored Oct 22, 2024
2 parents adac8ca + c8c3c96 commit 4cf9dfd
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/engraving/compat/midi/compatmidirenderinternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,20 @@ uint32_t getChannel(const Instrument* instr, const Note* note, MidiInstrumentEff
}

if (context.eachStringHasChannel && instr->hasStrings()) {
lookupData.string = note->string();
if (note->string() >= 0) {
lookupData.string = note->string();
} else {
int string = 0;
int fret = 0;
const StringData* stringData = instr->stringData();
IF_ASSERT_FAILED(stringData && stringData->convertPitch(note->pitch(), note->staff(), &string, &fret)) {
LOGE() << "channel isn't calculated for instrument " << instr->nameAsPlainText();
return channel;
}

lookupData.string = string;
}

lookupData.staffIdx = note->staffIdx();
}

Expand Down

0 comments on commit 4cf9dfd

Please sign in to comment.