Add General MIDI drum note names and patch names.
authorDavid Robillard <d@drobilla.net>
Sun, 20 Jan 2013 02:41:27 +0000 (02:41 +0000)
committerDavid Robillard <d@drobilla.net>
Sun, 20 Jan 2013 02:41:27 +0000 (02:41 +0000)
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
libs/midi++2/midnam_patch.cc
patchfiles/MIDI.midnam

index 54d36735e50ead83f192ec011f45138f71921f20..338642025e7d68b593d3c1b54cb6a718d9a1468e 100644 (file)
@@ -197,6 +197,8 @@ public:
                return boost::shared_ptr<Patch>();
        }
 
+       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&);
index 83f701777ba9ba6d2b12def30cd0903daa0d0cfe..624e1605b5a250c1aec16854dae55343a2d5627e 100644 (file)
@@ -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<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_device_mode_and_channel(
+                       mode_name, channel);
+               if (chan_names) {
+                       note_names = note_name_list(chan_names->note_list_name());
+               }
+       }
        if (!note_names) {
                return "";
        }
index b00db7460dba18c4db8204bea6356e51b563bc0c..bb6edc9f97583727e0b11a09600da7383315284b 100644 (file)
@@ -38,7 +38,7 @@
         <ChannelNameSetAssign Channel="7" NameSet="General MIDI Voices"/>
         <ChannelNameSetAssign Channel="8" NameSet="General MIDI Voices"/>
         <ChannelNameSetAssign Channel="9" NameSet="General MIDI Voices"/>
-        <ChannelNameSetAssign Channel="10" NameSet="General MIDI Voices"/>
+        <ChannelNameSetAssign Channel="10" NameSet="General MIDI Drums"/>
         <ChannelNameSetAssign Channel="11" NameSet="General MIDI Voices"/>
         <ChannelNameSetAssign Channel="12" NameSet="General MIDI Voices"/>
         <ChannelNameSetAssign Channel="13" NameSet="General MIDI Voices"/>
         <UsesPatchNameList Name="General MIDI Patches"/>
       </PatchBank>
     </ChannelNameSet>
+    <ChannelNameSet Name="General MIDI Drums">
+      <AvailableForChannels>
+        <AvailableChannel Channel="10" Available="true"/>
+      </AvailableForChannels>
+      <UsesNoteNameList Name="General MIDI Drums"/>
+      <PatchBank Name="Patches" ROM="false">
+        <MIDICommands>
+          <ControlChange Control="120" Value="120"/>
+          <ControlChange Control="32" Value="0"/>
+        </MIDICommands>
+        <UsesPatchNameList Name="General MIDI Drum Patches"/>
+      </PatchBank>
+    </ChannelNameSet>
     <PatchNameList Name="Unnamed Patches">
       <Patch Number="1" Name="Patch 1" ProgramChange="0"/>
       <Patch Number="2" Name="Patch 2" ProgramChange="1"/>
       <Patch Number="126" Name="Applause" ProgramChange="126"/>
       <Patch Number="127" Name="Gunshot" ProgramChange="127"/>
     </PatchNameList>
+    <PatchNameList Name="General MIDI Drum Patches">
+      <Patch Number="1" Name="Standard Kit" ProgramChange="1"/>
+      <Patch Number="9" Name="Room Kit" ProgramChange="9"/>
+      <Patch Number="17" Name="Power Kit" ProgramChange="17"/>
+      <Patch Number="25" Name="Electronic Kit" ProgramChange="25"/>
+      <Patch Number="26" Name="TR-808 Kit" ProgramChange="26"/>
+      <Patch Number="33" Name="Jazz Kit" ProgramChange="33"/>
+      <Patch Number="41" Name="Brush Kit" ProgramChange="41"/>
+      <Patch Number="49" Name="Orchestra Kit" ProgramChange="49"/>
+      <Patch Number="57" Name="Sound FX Kit" ProgramChange="57"/>
+      <Patch Number="128" Name="CM-64/CM-32L" ProgramChange="128"/>
+    </PatchNameList>
     <ControlNameList Name="Controls">
       <Control Type="7bit" Number="0" Name="Bank Select"/>
       <Control Type="7bit" Number="1" Name="Modulation Wheel or Lever"/>
       <Control Type="7bit" Number="126" Name="[Channel Mode Message] Mono Mode On (+ poly off, + all notes off)"/>
       <Control Type="7bit" Number="127" Name="[Channel Mode Message] Poly Mode On (+ mono off, +all notes off) 0"/>
     </ControlNameList>
+    <NoteNameList Name="General MIDI Drums">
+      <Note Number="35" Name="Bass Drum 2"/>
+      <Note Number="36" Name="Bass Drum 1"/>
+      <Note Number="37" Name="Side Stick/Rimshot"/>
+      <Note Number="38" Name="Snare Drum 1"/>
+      <Note Number="39" Name="Hand Clap"/>
+      <Note Number="40" Name="Snare Drum 2"/>
+      <Note Number="41" Name="Low Tom 2"/>
+      <Note Number="42" Name="Closed Hi-hat"/>
+      <Note Number="43" Name="Low Tom 1"/>
+      <Note Number="44" Name="Pedal Hi-hat"/>
+      <Note Number="45" Name="Mid Tom 2"/>
+      <Note Number="46" Name="Open Hi-hat"/>
+      <Note Number="47" Name="Mid Tom 1"/>
+      <Note Number="48" Name="High Tom 2"/>
+      <Note Number="49" Name="Crash Cymbal 1"/>
+      <Note Number="50" Name="High Tom 1"/>
+      <Note Number="51" Name="Ride Cymbal 1"/>
+      <Note Number="52" Name="Chinese Cymbal"/>
+      <Note Number="53" Name="Ride Bell"/>
+      <Note Number="54" Name="Tambourine"/>
+      <Note Number="55" Name="Splash Cymbal"/>
+      <Note Number="56" Name="Cowbell"/>
+      <Note Number="57" Name="Crash Cymbal 2"/>
+      <Note Number="58" Name="Vibra Slap"/>
+      <Note Number="59" Name="Ride Cymbal 2"/>
+      <Note Number="60" Name="High Bongo"/>
+      <Note Number="61" Name="Low Bongo"/>
+      <Note Number="62" Name="Mute High Conga"/>
+      <Note Number="63" Name="Open High Conga"/>
+      <Note Number="64" Name="Low Conga"/>
+      <Note Number="65" Name="High Timbale"/>
+      <Note Number="66" Name="Low Timbale"/>
+      <Note Number="67" Name="High Agogô"/>
+      <Note Number="68" Name="Low Agogô"/>
+      <Note Number="69" Name="Cabasa"/>
+      <Note Number="70" Name="Maracas"/>
+      <Note Number="71" Name="Short Whistle"/>
+      <Note Number="72" Name="Long Whistle"/>
+      <Note Number="73" Name="Short Güiro"/>
+      <Note Number="74" Name="Long Güiro"/>
+      <Note Number="75" Name="Claves"/>
+      <Note Number="76" Name="High Wood Block"/>
+      <Note Number="77" Name="Low Wood Block"/>
+      <Note Number="78" Name="Mute Cuíca"/>
+      <Note Number="79" Name="Open Cuíca"/>
+      <Note Number="80" Name="Mute Triangle"/>
+      <Note Number="81" Name="Open Triangle"/>
+    </NoteNameList>
   </MasterDeviceNames>
 </MIDINameDocument>