fix crash when opening a session created before the midnam-channel GUI property existed

This commit is contained in:
Paul Davis 2023-08-20 09:18:25 -06:00
parent 511c3ef048
commit 776d8590f9

View File

@ -471,16 +471,20 @@ PianoRollHeader::get_note_name (int note)
if (mtv) { if (mtv) {
string chn = mtv->gui_property (X_("midnam-channel")); string chn = mtv->gui_property (X_("midnam-channel"));
int midnam_channel;
sscanf (chn.c_str(), "%*s %d", &midnam_channel); if (!chn.empty()) {
midnam_channel--;
name = mtv->route()->instrument_info ().get_note_name ( int midnam_channel;
0, //bank
0, //program sscanf (chn.c_str(), "%*s %d", &midnam_channel);
midnam_channel, //channel midnam_channel--;
note); //note
name = mtv->route()->instrument_info ().get_note_name (
0, //bank
0, //program
midnam_channel, //channel
note); //note
}
} }
int oct_rel = note % 12; int oct_rel = note % 12;