X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=blobdiff_plain;f=lily%2Fmidi-item.cc;h=b358e1843359de320537accbd7e5a50d1a3723b8;hb=d6048913c2c793a6298a3e16a1a25c76711463b1;hp=ccb0a5ae90bef25ddb078e5c8b4d2105a9309c74;hpb=42ab6ff971c06253b34f96ed122836ab88d09cc0;p=lilypond.git diff --git a/lily/midi-item.cc b/lily/midi-item.cc index ccb0a5ae90..b358e18433 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -293,13 +293,19 @@ String Midi_instrument::str () const { Byte program_byte = 0; - for (int i = 0; instrument_name_sz_a_[i]; i++) + bool found = false; + for (int i = 0; !found && instrument_name_sz_a_[i]; i++) if (instrument_str_ == String (instrument_name_sz_a_[ i ])) { program_byte = (Byte)i; - break; + found = true; } + if (!found) + { + warning (_f("No such instrument: `%s'", instrument_str_.ch_C ())); + } + String str = to_str ((char) (0xc0 + channel_i_)); str += to_str ((char)program_byte); return str;