Support midnam files with a channel (not patch) NoteNameList.
authorDavid Robillard <d@drobilla.net>
Mon, 14 Jul 2014 03:36:45 +0000 (23:36 -0400)
committerDavid Robillard <d@drobilla.net>
Mon, 14 Jul 2014 03:36:45 +0000 (23:36 -0400)
libs/midi++2/midnam_patch.cc

index 0b8f1ffcb23221318db84ac7976106f6c9ca2609..7c116f15d6f35820d781fee40af29178abb12613 100644 (file)
@@ -724,14 +724,13 @@ MasterDeviceNames::note_name(const std::string& mode_name,
                return "";
        }
 
+       boost::shared_ptr<const NoteNameList> note_names;
        boost::shared_ptr<const Patch> patch(
                find_patch(mode_name, channel, PatchPrimaryKey(program, bank)));
-       if (!patch) {
-               return "";
+       if (patch) {
+               note_names = note_name_list(patch->note_list_name());
        }
 
-       boost::shared_ptr<const NoteNameList> note_names(
-               note_name_list(patch->note_list_name()));
        if (!note_names) {
                /* No note names specific to this patch, check the ChannelNameSet */
                boost::shared_ptr<ChannelNameSet> chan_names = channel_name_set_by_channel(