From f7ada4b3233c9c68cc27714ce310068d4adbb07e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 20 Jan 2013 02:41:27 +0000 Subject: [PATCH] Add General MIDI drum note names and patch names. Support loading note names per ChannelNameSet (like GM) in addition to per Patch (like DM5). git-svn-id: svn://localhost/ardour2/branches/3.0@13913 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/midi++2/midi++/midnam_patch.h | 3 ++ libs/midi++2/midnam_patch.cc | 12 +++++ patchfiles/MIDI.midnam | 76 +++++++++++++++++++++++++++++- 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/libs/midi++2/midi++/midnam_patch.h b/libs/midi++2/midi++/midnam_patch.h index 54d36735e5..338642025e 100644 --- a/libs/midi++2/midi++/midnam_patch.h +++ b/libs/midi++2/midi++/midnam_patch.h @@ -197,6 +197,8 @@ public: return boost::shared_ptr(); } + const std::string& note_list_name() const { return _note_list_name; } + XMLNode& get_state (void); int set_state (const XMLTree&, const XMLNode&); @@ -211,6 +213,7 @@ private: PatchMap _patch_map; PatchList _patch_list; std::string _patch_list_name; + std::string _note_list_name; }; std::ostream& operator<< (std::ostream&, const ChannelNameSet&); diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index 83f701777b..624e1605b5 100644 --- a/libs/midi++2/midnam_patch.cc +++ b/libs/midi++2/midnam_patch.cc @@ -435,6 +435,10 @@ ChannelNameSet::set_state (const XMLTree& tree, const XMLNode& node) _patch_list.push_back((*patch)->patch_primary_key()); } } + + if (node->name() == "UsesNoteNameList") { + _note_list_name = node->property ("Name")->value(); + } } return 0; @@ -536,6 +540,14 @@ MasterDeviceNames::note_name(const std::string& mode_name, boost::shared_ptr 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 chan_names = channel_name_set_by_device_mode_and_channel( + mode_name, channel); + if (chan_names) { + note_names = note_name_list(chan_names->note_list_name()); + } + } if (!note_names) { return ""; } diff --git a/patchfiles/MIDI.midnam b/patchfiles/MIDI.midnam index b00db7460d..bb6edc9f97 100644 --- a/patchfiles/MIDI.midnam +++ b/patchfiles/MIDI.midnam @@ -38,7 +38,7 @@ - + @@ -97,6 +97,19 @@ + + + + + + + + + + + + + @@ -357,6 +370,18 @@ + + + + + + + + + + + + @@ -487,5 +512,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.30.2