Preliminary support for named MIDI controllers via midname files.
[ardour.git] / libs / midi++2 / midnam_patch.cc
1 /*
2     Copyright (C) 2008 Hans Baier
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18     $Id$
19 */
20
21 #include <algorithm>
22 #include <iostream>
23
24 #include "midi++/midnam_patch.h"
25 #include "pbd/compose.h"
26 #include "pbd/convert.h"
27 #include "pbd/error.h"
28 #include "pbd/failed_constructor.h"
29
30 using namespace std;
31 using PBD::error;
32
33 namespace MIDI
34 {
35
36 namespace Name
37 {
38         
39 Patch::Patch (std::string name, uint8_t p_number, uint16_t b_number)
40         : _name (name)
41         , _id (p_number, b_number)
42 {
43 }
44
45 int initialize_primary_key_from_commands (PatchPrimaryKey& id, const XMLNode* node)
46 {
47         id.bank_number = 0;
48
49         const XMLNodeList events = node->children();
50         for (XMLNodeList::const_iterator i = events.begin(); i != events.end(); ++i) {
51
52                 XMLNode* node = *i;
53                 if (node->name() == "ControlChange") {
54                         string control = node->property("Control")->value();
55                         assert(control != "");
56                         string value = node->property("Value")->value();
57                         assert(value != "");
58
59                         if (control == "0") {
60                                 id.bank_number |= (PBD::atoi (value)) << 7;
61                         } else if (control == "32") {
62                                 id.bank_number |= PBD::atoi (value);
63                         }
64
65                 } else if (node->name() == "ProgramChange") {
66                         string number = node->property("Number")->value();
67                         assert(number != "");
68                         id.program_number = PBD::atoi(number);
69                 }
70         }
71
72         return 0;
73 }
74
75 XMLNode&
76 Patch::get_state (void)
77 {
78         XMLNode* node = new XMLNode("Patch");
79
80         /* XXX this is totally wrong */
81
82         node->add_property("Number", string_compose ("%1", _id.program_number));
83         node->add_property("Name",   _name);
84
85         /*
86         typedef std::list< boost::shared_ptr< Evoral::MIDIEvent<double> > > PatchMidiCommands;
87         XMLNode* commands = node->add_child("PatchMIDICommands");
88         for (PatchMidiCommands::const_iterator event = _patch_midi_commands.begin();
89             event != _patch_midi_commands.end();
90             ++event) {
91                 commands->add_child_copy(*((((Evoral::MIDIEvent&)*event)).to_xml()));
92         }
93         */
94
95         return *node;
96 }
97
98 int
99 Patch::set_state (const XMLTree&, const XMLNode& node)
100 {
101         if (node.name() != "Patch") {
102                 cerr << "Incorrect node " << node.name() << " handed to Patch" << endl;
103                 return -1;
104         }
105
106         const XMLProperty* prop = node.property ("Number");
107
108         if (!prop) {
109                 return -1;
110         }
111         _id.program_number = PBD::atoi (prop->value());
112
113         prop = node.property ("Name");
114
115         if (!prop) {
116                 return -1;
117         }
118         _name   = prop->value();
119
120         XMLNode* commands = node.child("PatchMIDICommands");
121
122         if (commands) {
123                 if (initialize_primary_key_from_commands(_id, commands)) {
124                         return -1;
125                 }
126         } else {
127                 string program_change = node.property("ProgramChange")->value();
128                 assert(program_change.length());
129                 _id.program_number = PBD::atoi(program_change);
130         }
131
132         return 0;
133 }
134
135 XMLNode&
136 Note::get_state (void)
137 {
138         XMLNode* node = new XMLNode("Note");
139         node->add_property("Number", _number);
140         node->add_property("Name",   _name);
141
142         return *node;
143 }
144
145 int
146 Note::set_state (const XMLTree&, const XMLNode& node)
147 {
148         assert(node.name() == "Note");
149         _number = node.property("Number")->value();
150         _name   = node.property("Name")->value();
151
152         return 0;
153 }
154
155 XMLNode&
156 NoteNameList::get_state (void)
157 {
158         XMLNode* node = new XMLNode("NoteNameList");
159         node->add_property("Name",   _name);
160
161         return *node;
162 }
163
164 int
165 NoteNameList::set_state (const XMLTree& tree, const XMLNode& node)
166 {
167         assert(node.name() == "NoteNameList");
168         _name   = node.property("Name")->value();
169
170         boost::shared_ptr<XMLSharedNodeList> notes = tree.find("//Note");
171         for (XMLSharedNodeList::const_iterator i = notes->begin(); i != notes->end(); ++i) {
172                 boost::shared_ptr<Note> note(new Note());
173                 note->set_state (tree, *(*i));
174                 _notes.push_back(note);
175         }
176
177         return 0;
178 }
179
180 XMLNode&
181 Control::get_state (void)
182 {
183         XMLNode* node = new XMLNode("Control");
184         node->add_property("Type",   _type);
185         node->add_property("Number", _number);
186         node->add_property("Name",   _name);
187
188         return *node;
189 }
190
191 int
192 Control::set_state (const XMLTree&, const XMLNode& node)
193 {
194         assert(node.name() == "Control");
195         _type   = node.property("Type")->value();
196         _number = node.property("Number")->value();
197         _name   = node.property("Name")->value();
198
199         return 0;
200 }
201
202 XMLNode&
203 ControlNameList::get_state (void)
204 {
205         XMLNode* node = new XMLNode("ControlNameList");
206         node->add_property("Name", _name);
207
208         return *node;
209 }
210
211 int
212 ControlNameList::set_state (const XMLTree& tree, const XMLNode& node)
213 {
214         assert(node.name() == "ControlNameList");
215         _name = node.property("Name")->value();
216
217         for (XMLNodeList::const_iterator i = node.children().begin();
218              i != node.children().end(); ++i) {
219                 boost::shared_ptr<Control> control(new Control());
220                 control->set_state (tree, *(*i));
221                 _controls.push_back(control);
222         }
223
224         return 0;
225 }
226
227 XMLNode&
228 PatchBank::get_state (void)
229 {
230         XMLNode* node = new XMLNode("PatchBank");
231         node->add_property("Name",   _name);
232         XMLNode* patch_name_list = node->add_child("PatchNameList");
233         for (PatchNameList::iterator patch = _patch_name_list.begin();
234             patch != _patch_name_list.end();
235             ++patch) {
236                 patch_name_list->add_child_nocopy((*patch)->get_state());
237         }
238
239         return *node;
240 }
241
242 int
243 PatchBank::set_state (const XMLTree& tree, const XMLNode& node)
244 {
245         assert(node.name() == "PatchBank");
246         _name   = node.property("Name")->value();
247
248         XMLNode* commands = node.child("MIDICommands");
249         if (commands) {
250                 PatchPrimaryKey id (0, 0);
251                 if (initialize_primary_key_from_commands (id, commands)) {
252                         return -1;
253                 }
254                 _number = id.bank_number;
255         }
256
257         XMLNode* patch_name_list = node.child("PatchNameList");
258
259         if (patch_name_list) {
260                 const XMLNodeList patches = patch_name_list->children();
261                 for (XMLNodeList::const_iterator i = patches.begin(); i != patches.end(); ++i) {
262                         boost::shared_ptr<Patch> patch (new Patch (string(), 0, _number));
263                         patch->set_state(tree, *(*i));
264                         _patch_name_list.push_back(patch);
265                 }
266         } else {
267                 XMLNode* use_patch_name_list = node.child ("UsesPatchNameList");
268                 if (use_patch_name_list) {
269                         _patch_list_name = use_patch_name_list->property ("Name")->value();
270                 } else {
271                         error << "Patch without patch name list - patchfile will be ignored" << endmsg;
272                         return -1;
273                 }
274         }
275
276         return 0;
277 }
278
279 int
280 PatchBank::set_patch_name_list (const PatchNameList& pnl)
281 {
282         _patch_name_list = pnl;
283         _patch_list_name = "";
284
285         for (PatchNameList::iterator p = _patch_name_list.begin(); p != _patch_name_list.end(); p++) {
286                 (*p)->set_bank_number (_number);
287         }
288
289         return 0;
290 }
291
292 std::ostream&
293 operator<< (std::ostream& os, const ChannelNameSet& cns)
294 {
295         os << "Channel Name Set: name = " << cns._name << endl
296            << "Map size " << cns._patch_map.size () << endl
297            << "List size " << cns._patch_list.size() << endl
298            << "Patch list name = [" << cns._patch_list_name << ']' << endl
299            << "Available channels : ";
300         for (set<uint8_t>::iterator x = cns._available_for_channels.begin(); x != cns._available_for_channels.end(); ++x) {
301                 os << (int) (*x) << ' ';
302         }
303         os << endl;
304         
305         for (ChannelNameSet::PatchBanks::const_iterator pbi = cns._patch_banks.begin(); pbi != cns._patch_banks.end(); ++pbi) {
306                 os << "\tPatch Bank " << (*pbi)->name() << " with " << (*pbi)->patch_name_list().size() << " patches\n";
307                 for (PatchBank::PatchNameList::const_iterator pni = (*pbi)->patch_name_list().begin(); pni != (*pbi)->patch_name_list().end(); ++pni) {
308                         os << "\t\tPatch name " << (*pni)->name() << " prog " << (int) (*pni)->program_number() << " bank " << (*pni)->bank_number() << endl;
309                 }
310         }
311
312         return os;
313 }
314
315 void
316 ChannelNameSet::set_patch_banks (const ChannelNameSet::PatchBanks& pb)
317 {
318         _patch_banks = pb;
319         
320         _patch_map.clear ();
321         _patch_list.clear ();
322         _patch_list_name = "";
323         _available_for_channels.clear ();
324         
325         for (PatchBanks::const_iterator pbi = _patch_banks.begin(); pbi != _patch_banks.end(); ++pbi) {
326                 for (PatchBank::PatchNameList::const_iterator pni = (*pbi)->patch_name_list().begin(); pni != (*pbi)->patch_name_list().end(); ++pni) {
327                         _patch_map[(*pni)->patch_primary_key()] = (*pni);
328                         _patch_list.push_back ((*pni)->patch_primary_key());
329                 }
330         }
331
332         for (uint8_t n = 0; n < 16; ++n) {
333                 _available_for_channels.insert (n);
334         }
335 }
336
337 void
338 ChannelNameSet::use_patch_name_list (const PatchBank::PatchNameList& pnl)
339 {
340         for (PatchBank::PatchNameList::const_iterator p = pnl.begin(); p != pnl.end(); ++p) {
341                 _patch_map[(*p)->patch_primary_key()] = (*p);
342                 _patch_list.push_back ((*p)->patch_primary_key());
343         }
344 }
345
346 XMLNode&
347 ChannelNameSet::get_state (void)
348 {
349         XMLNode* node = new XMLNode("ChannelNameSet");
350         node->add_property("Name",   _name);
351
352         XMLNode* available_for_channels = node->add_child("AvailableForChannels");
353         assert(available_for_channels);
354
355         for (uint8_t channel = 0; channel < 16; ++channel) {
356                 XMLNode* available_channel = available_for_channels->add_child("AvailableChannel");
357                 assert(available_channel);
358
359                 available_channel->add_property("Channel", (long) channel);
360
361                 if (_available_for_channels.find(channel) != _available_for_channels.end()) {
362                         available_channel->add_property("Available", "true");
363                 } else {
364                         available_channel->add_property("Available", "false");
365                 }
366         }
367
368         for (PatchBanks::iterator patch_bank = _patch_banks.begin();
369             patch_bank != _patch_banks.end();
370             ++patch_bank) {
371                 node->add_child_nocopy((*patch_bank)->get_state());
372         }
373
374         return *node;
375 }
376
377 int
378 ChannelNameSet::set_state (const XMLTree& tree, const XMLNode& node)
379 {
380         assert(node.name() == "ChannelNameSet");
381         _name   = node.property("Name")->value();
382
383         const XMLNodeList children = node.children();
384         for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
385                 XMLNode* node = *i;
386                 assert(node);
387                 if (node->name() == "AvailableForChannels") {
388                         boost::shared_ptr<XMLSharedNodeList> channels =
389                                 tree.find("//AvailableChannel[@Available = 'true']/@Channel", node);
390                         for(XMLSharedNodeList::const_iterator i = channels->begin();
391                             i != channels->end();
392                             ++i) {
393                                 _available_for_channels.insert(atoi((*i)->attribute_value().c_str()));
394                         }
395                 }
396
397                 if (node->name() == "PatchBank") {
398                         boost::shared_ptr<PatchBank> bank (new PatchBank ());
399                         bank->set_state(tree, *node);
400                         _patch_banks.push_back(bank);
401                         const PatchBank::PatchNameList& patches = bank->patch_name_list();
402                         for (PatchBank::PatchNameList::const_iterator patch = patches.begin();
403                              patch != patches.end();
404                              ++patch) {
405                                 _patch_map[(*patch)->patch_primary_key()] = *patch;
406                                 _patch_list.push_back((*patch)->patch_primary_key());
407                         }
408                 }
409         }
410
411         return 0;
412 }
413
414 int
415 CustomDeviceMode::set_state(const XMLTree& tree, const XMLNode& a_node)
416 {
417         assert(a_node.name() == "CustomDeviceMode");
418
419         _name = a_node.property("Name")->value();
420
421         boost::shared_ptr<XMLSharedNodeList> channel_name_set_assignments =
422                 tree.find("//ChannelNameSetAssign", const_cast<XMLNode *>(&a_node));
423         for(XMLSharedNodeList::const_iterator i = channel_name_set_assignments->begin();
424             i != channel_name_set_assignments->end();
425             ++i) {
426                 int channel = atoi((*i)->property("Channel")->value().c_str());
427                 string name_set = (*i)->property("NameSet")->value();
428                 assert( 1 <= channel && channel <= 16 );
429                 _channel_name_set_assignments[channel - 1] = name_set;
430         }
431         return 0;
432 }
433
434 XMLNode&
435 CustomDeviceMode::get_state(void)
436 {
437         XMLNode* custom_device_mode = new XMLNode("CustomDeviceMode");
438         custom_device_mode->add_property("Name",   _name);
439         XMLNode* channel_name_set_assignments =
440                 custom_device_mode->add_child("ChannelNameSetAssignments");
441         for (int i = 0; i < 15 && !_channel_name_set_assignments[i].empty(); i++) {
442                 XMLNode* channel_name_set_assign =
443                         channel_name_set_assignments->add_child("ChannelNameSetAssign");
444                 channel_name_set_assign->add_property("Channel", i + 1);
445                 channel_name_set_assign->add_property("NameSet", _channel_name_set_assignments[i]);
446         }
447
448         return *custom_device_mode;
449 }
450
451 boost::shared_ptr<CustomDeviceMode> 
452 MasterDeviceNames::custom_device_mode_by_name(std::string mode_name)
453 {
454         // can't assert this, since in many of the patch files the mode name is empty
455         //assert(mode_name != "");
456         return _custom_device_modes[mode_name];
457 }
458
459 boost::shared_ptr<ChannelNameSet> 
460 MasterDeviceNames::channel_name_set_by_device_mode_and_channel(std::string mode, uint8_t channel)
461 {
462         boost::shared_ptr<CustomDeviceMode> cdm = custom_device_mode_by_name(mode);
463         boost::shared_ptr<ChannelNameSet> cns =  _channel_name_sets[cdm->channel_name_set_name_by_channel(channel)];
464         return cns;
465 }
466
467 boost::shared_ptr<Patch> 
468 MasterDeviceNames::find_patch(std::string mode, uint8_t channel, PatchPrimaryKey& key) 
469 {
470         return channel_name_set_by_device_mode_and_channel(mode, channel)->find_patch(key);
471 }
472
473 int
474 MasterDeviceNames::set_state(const XMLTree& tree, const XMLNode&)
475 {
476         // Manufacturer
477         boost::shared_ptr<XMLSharedNodeList> manufacturer = tree.find("//Manufacturer");
478         assert(manufacturer->size() == 1);
479         _manufacturer = manufacturer->front()->children().front()->content();
480
481         // Models
482         boost::shared_ptr<XMLSharedNodeList> models = tree.find("//Model");
483         assert(models->size() >= 1);
484         for (XMLSharedNodeList::iterator i = models->begin();
485              i != models->end();
486              ++i) {
487                 const XMLNodeList& contents = (*i)->children();
488                 assert(contents.size() == 1);
489                 XMLNode * content = *(contents.begin());
490                 assert(content->is_content());
491                 _models.push_back(content->content());
492         }
493
494         // CustomDeviceModes
495         boost::shared_ptr<XMLSharedNodeList> custom_device_modes = tree.find("//CustomDeviceMode");
496         for (XMLSharedNodeList::iterator i = custom_device_modes->begin();
497              i != custom_device_modes->end();
498              ++i) {
499                 boost::shared_ptr<CustomDeviceMode> custom_device_mode(new CustomDeviceMode());
500                 custom_device_mode->set_state(tree, *(*i));
501
502                 _custom_device_modes[custom_device_mode->name()] = custom_device_mode;
503                 _custom_device_mode_names.push_back(custom_device_mode->name());
504         }
505
506         // ChannelNameSets
507         boost::shared_ptr<XMLSharedNodeList> channel_name_sets = tree.find("//ChannelNameSet");
508         for (XMLSharedNodeList::iterator i = channel_name_sets->begin();
509              i != channel_name_sets->end();
510              ++i) {
511                 boost::shared_ptr<ChannelNameSet> channel_name_set(new ChannelNameSet());
512                 channel_name_set->set_state(tree, *(*i));
513                 _channel_name_sets[channel_name_set->name()] = channel_name_set;
514         }
515
516         // NoteNameLists
517         boost::shared_ptr<XMLSharedNodeList> note_name_lists = tree.find("//NoteNameList");
518         for (XMLSharedNodeList::iterator i = note_name_lists->begin();
519              i != note_name_lists->end();
520              ++i) {
521                 boost::shared_ptr<NoteNameList> note_name_list(new NoteNameList());
522                 note_name_list->set_state (tree, *(*i));
523                 _note_name_lists.push_back(note_name_list);
524         }
525
526         // ControlNameLists
527         boost::shared_ptr<XMLSharedNodeList> control_name_lists = tree.find("//ControlNameList");
528         for (XMLSharedNodeList::iterator i = control_name_lists->begin();
529              i != control_name_lists->end();
530              ++i) {
531                 boost::shared_ptr<ControlNameList> control_name_list(new ControlNameList());
532                 control_name_list->set_state (tree, *(*i));
533                 _control_name_lists.push_back(control_name_list);
534         }
535
536         // global/post-facto PatchNameLists
537         boost::shared_ptr<XMLSharedNodeList> patch_name_lists = tree.find("/child::MIDINameDocument/child::MasterDeviceNames/child::PatchNameList");
538         for (XMLSharedNodeList::iterator i = patch_name_lists->begin();
539              i != patch_name_lists->end();
540              ++i) {
541
542                 PatchBank::PatchNameList patch_name_list;
543                 const XMLNodeList patches = (*i)->children();
544
545                 for (XMLNodeList::const_iterator p = patches.begin(); p != patches.end(); ++p) {
546                         boost::shared_ptr<Patch> patch (new Patch ());
547                         patch->set_state(tree, *(*p));
548                         patch_name_list.push_back(patch);
549                 }
550
551                 if (!patch_name_list.empty()) {
552                         _patch_name_lists[(*i)->property ("Name")->value()] = patch_name_list;
553                 }
554         }
555
556         /* now traverse patches and hook up anything that used UsePatchNameList
557          * to the right patch list
558          */
559
560         for (ChannelNameSets::iterator cns = _channel_name_sets.begin(); cns != _channel_name_sets.end(); ++cns) {
561                 ChannelNameSet::PatchBanks pbs = cns->second->patch_banks();
562                 PatchNameLists::iterator p;
563
564                 for (ChannelNameSet::PatchBanks::iterator pb = pbs.begin(); pb != pbs.end(); ++pb) {
565                         std::string pln = (*pb)->patch_list_name();
566                         if (!pln.empty()) {
567                                 if ((p = _patch_name_lists.find (pln)) != _patch_name_lists.end()) {
568                                         if ((*pb)->set_patch_name_list (p->second)) {
569                                                 return -1;
570                                         }
571                                         cns->second->use_patch_name_list (p->second);
572                                 } else {
573                                         error << string_compose ("Patch list name %1 was not found - patch file ignored", pln) << endmsg;
574                                         return -1;
575                                 }
576                         }
577                 }
578
579         }
580
581         return 0;
582 }
583
584 XMLNode&
585 MasterDeviceNames::get_state(void)
586 {
587         static XMLNode nothing("<nothing>");
588         return nothing;
589 }
590
591 MIDINameDocument::MIDINameDocument (const string& filename)
592 {
593         if (!_document.read (filename)) {
594                 throw failed_constructor ();
595         }
596
597         set_state (_document, *_document.root());
598 }
599
600 int
601 MIDINameDocument::set_state (const XMLTree& tree, const XMLNode&)
602 {
603         // Author
604
605         boost::shared_ptr<XMLSharedNodeList> author = tree.find("//Author");
606         if (author->size() < 1) {
607                 error << "No author information in MIDNAM file" << endmsg;
608                 return -1;
609         }
610         
611         if (author->front()->children().size() > 0) {
612                 _author = author->front()->children().front()->content();
613         }
614
615         // MasterDeviceNames
616
617         boost::shared_ptr<XMLSharedNodeList> master_device_names_list = tree.find ("//MasterDeviceNames");
618
619         for (XMLSharedNodeList::iterator i = master_device_names_list->begin();
620              i != master_device_names_list->end();
621              ++i) {
622                 boost::shared_ptr<MasterDeviceNames> master_device_names(new MasterDeviceNames());
623
624                 if (master_device_names->set_state(tree, *(*i))) {
625                         return -1;
626                 }
627
628                 for (MasterDeviceNames::Models::const_iterator model = master_device_names->models().begin();
629                      model != master_device_names->models().end();
630                      ++model) {
631                         _master_device_names_list.insert(
632                                 std::pair<std::string, boost::shared_ptr<MasterDeviceNames> >
633                                 (*model,      master_device_names));
634                         
635                         _all_models.push_back(*model);
636                 }
637         }
638
639         return 0;
640 }
641
642 XMLNode&
643 MIDINameDocument::get_state(void)
644 {
645         static XMLNode nothing("<nothing>");
646         return nothing;
647 }
648
649 const char* general_midi_program_names[128] = {
650         "Acoustic Grand Piano",
651         "Bright Acoustic Piano",
652         "Electric Grand Piano",
653         "Honky-tonk Piano",
654         "Rhodes Piano",
655         "Chorused Piano",
656         "Harpsichord",
657         "Clavinet",
658         "Celesta",
659         "Glockenspiel",
660         "Music Box",
661         "Vibraphone",
662         "Marimba",
663         "Xylophone",
664         "Tubular Bells",
665         "Dulcimer",
666         "Hammond Organ",
667         "Percussive Organ",
668         "Rock Organ",
669         "Church Organ",
670         "Reed Organ",
671         "Accordion",
672         "Harmonica",
673         "Tango Accordion",
674         "Acoustic Guitar (nylon)",
675         "Acoustic Guitar (steel)",
676         "Electric Guitar (jazz)",
677         "Electric Guitar (clean)",
678         "Electric Guitar (muted)",
679         "Overdriven Guitar",
680         "Distortion Guitar",
681         "Guitar Harmonics",
682         "Acoustic Bass",
683         "Electric Bass (finger)",
684         "Electric Bass (pick)",
685         "Fretless Bass",
686         "Slap Bass 1",
687         "Slap Bass 2",
688         "Synth Bass 1",
689         "Synth Bass 2",
690         "Violin",
691         "Viola",
692         "Cello",
693         "Contrabass",
694         "Tremolo Strings",
695         "Pizzicato Strings",
696         "Orchestral Harp",
697         "Timpani",
698         "String Ensemble 1",
699         "String Ensemble 2",
700         "SynthStrings 1",
701         "SynthStrings 2",
702         "Choir Aahs",
703         "Voice Oohs",
704         "Synth Voice",
705         "Orchestra Hit",
706         "Trumpet",
707         "Trombone",
708         "Tuba",
709         "Muted Trumpet",
710         "French Horn",
711         "Brass Section",
712         "Synth Brass 1",
713         "Synth Brass 2",
714         "Soprano Sax",
715         "Alto Sax",
716         "Tenor Sax",
717         "Baritone Sax",
718         "Oboe",
719         "English Horn",
720         "Bassoon",
721         "Clarinet",
722         "Piccolo",
723         "Flute",
724         "Recorder",
725         "Pan Flute",
726         "Bottle Blow",
727         "Shakuhachi",
728         "Whistle",
729         "Ocarina",
730         "Lead 1 (square)",
731         "Lead 2 (sawtooth)",
732         "Lead 3 (calliope lead)",
733         "Lead 4 (chiff lead)",
734         "Lead 5 (charang)",
735         "Lead 6 (voice)",
736         "Lead 7 (fifths)",
737         "Lead 8 (bass + lead)",
738         "Pad 1 (new age)",
739         "Pad 2 (warm)",
740         "Pad 3 (polysynth)",
741         "Pad 4 (choir)",
742         "Pad 5 (bowed)",
743         "Pad 6 (metallic)",
744         "Pad 7 (halo)",
745         "Pad 8 (sweep)",
746         "FX 1 (rain)",
747         "FX 2 (soundtrack)",
748         "FX 3 (crystal)",
749         "FX 4 (atmosphere)",
750         "FX 5 (brightness)",
751         "FX 6 (goblins)",
752         "FX 7 (echoes)",
753         "FX 8 (sci-fi)",
754         "Sitar",
755         "Banjo",
756         "Shamisen",
757         "Koto",
758         "Kalimba",
759         "Bagpipe",
760         "Fiddle",
761         "Shanai",
762         "Tinkle Bell",
763         "Agogo",
764         "Steel Drums",
765         "Woodblock",
766         "Taiko Drum",
767         "Melodic Tom",
768         "Synth Drum",
769         "Reverse Cymbal",
770         "Guitar Fret Noise",
771         "Breath Noise",
772         "Seashore",
773         "Bird Tweet",
774         "Telephone Ring",
775         "Helicopter",
776         "Applause",
777         "Gunshot",
778 };
779
780 } //namespace Name
781
782 } //namespace MIDI
783