]> ruin.nu Git - moosique.git/blobdiff - MooInstrumentList.java
Added MooInstrumentList - a subcomponent to MooToolbar -
[moosique.git] / MooInstrumentList.java
diff --git a/MooInstrumentList.java b/MooInstrumentList.java
new file mode 100644 (file)
index 0000000..3e538d4
--- /dev/null
@@ -0,0 +1,154 @@
+import javax.sound.midi.*;
+import javax.swing.*;
+import java.awt.event.*;
+
+/*
+ * A Combo Box where the instrument of the currently active channel can be selected.
+ * 
+ * @author  Einar Pehrson
+ */
+public class MooInstrumentList extends JComboBox implements ActionListener {
+
+       public MooInstrumentList() {
+               super(instruments);
+               addActionListener(this);
+       }
+
+       public void actionPerformed(ActionEvent e) {
+               JComboBox box = (JComboBox)e.getSource();
+               int instrument = box.getSelectedIndex();
+               Moosique.getActiveChannel().programChange(instrument);
+       }
+    
+       public static final String[] instruments = {
+               " 0 Acoustic Grand Piano",
+               " 1 Bright Acoustic Piano",
+               " 2 Electric Grand Piano",
+               " 3 Honky-Tonk Piano",
+               " 4 Rhodes Piano",
+               " 5 Chorused Piano",
+               " 6 Harpischord",
+               " 7 Clavinet",
+               " 8 Celesta",
+               " 9 Glockenspiel",
+               " 10 Music Box",
+               " 11 Vibraphone",
+               " 12 Marimba",
+               " 13 Xylophone",
+               " 14 Tubular Bells",
+               " 15 Dulcimer",
+               " 16 Hammond Organ",
+               " 17 Percussive Organ",
+               " 18 Rock Organ",
+               " 19 Church Organ",
+               " 20 Reed Organ",
+               " 21 Accordion",
+               " 22 Harmonica",
+               " 23 Tango Accordion",
+               " 24 Acoustic Nylon Guitar",
+               " 25 Acoustic Steel Guitar",
+               " 26 Electric Jazz Guitar",
+               " 27 Electric Clean Guitar",
+               " 28 Electric Muted Guitar",
+               " 29 Overdriven Guitar",
+               " 30 Distortion Guitar",
+               " 31 Guitar Harmonics",
+               " 32 Acoustic Bass",
+               " 33 Electric Bass Fingered",
+               " 34 Electric Bass Picked",
+               " 35 Fretless Bass",
+               " 36 Slap Bass 1",
+               " 37 Slap Bass 2",
+               " 38 Synth Bass 1",
+               " 39 Synth Bass 2",
+               " 40 Violin",
+               " 41 Viola",
+               " 42 Cello",
+               " 43 Contrabass",
+               " 44 Tremolo Strings",
+               " 45 Pizzicato Strings",
+               " 46 Orchestral Harp",
+               " 47 Timpani",
+               " 48 String Ensemble 1",
+               " 49 String Ensemble 2",
+               " 50 Synth Strings 1",
+               " 51 Synth Strings 2",
+               " 52 Choir Aahs",
+               " 53 Voice Oohs",
+               " 54 Synth Voice",
+               " 55 Orchestral Hit",
+               " 56 Trumpet",
+               " 57 Trombone",
+               " 58 Tuba",
+               " 59 Muted Trumpet",
+               " 60 French Horn",
+               " 61 Brass Section",
+               " 62 Synth Brass 1",
+               " 63 Synth Brass 2",
+               " 64 Soprano Sax",
+               " 65 Alto Sax",
+               " 66 Tenor Sax",
+               " 67 Baritone Sax",
+               " 68 Oboe",
+               " 69 English Horn",
+               " 70 Bassoon",
+               " 71 Clarinet",
+               " 72 Piccolo",
+               " 73 Flute",
+               " 74 Recorder",
+               " 75 Pan Flute",
+               " 76 Bottle Blow",
+               " 77 Shakuhachi",
+               " 78 Whistle",
+               " 79 Ocarina",
+               " 80 Synth Lead 1 Square Wave Lead",
+               " 81 Synth Lead 2 Sawtooth Wave Lead",
+               " 82 Synth Lead 3 Caliope Lead",
+               " 83 Synth Lead 4 Chiff Lead",
+               " 84 Synth Lead 5 Charang",
+               " 85 Synth Lead 6 Solo Synth Voice",
+               " 86 Synth Lead 7 Bright Saw Wave",
+               " 87 Synth Lead 8 Brass and Lead",
+               " 88 Synth Pad 1 Fantasia Pad",
+               " 89 Synth Pad 2 Warm Pad",
+               " 90 Synth Pad 3 Poly Synth Pad",
+               " 91 Synth Pad 4 Space Voice Pad",
+               " 92 Synth Pad 5 Bowed Glass Pad",
+               " 93 Synth Pad 6 Metal Pad",
+               " 94 Synth Pad 7 Halo Pad",
+               " 95 Synth Pad 8 Sweep Pad",
+               " 96 Synth SFX 1 Ice Rain",
+               " 97 Synth SFX 2 Sound Track",
+               " 98 Synth SFX 3 Crystal",
+               " 99 Synth SFX 4 Atmosphere",
+               " 100 Synth SFX 5 Brightness",
+               " 101 Synth SFX 6 Goblin",
+               " 102 Synth SFX 7 Echo Drops",
+               " 103 Synth SFX 8 Star Theme",
+               " 104 Sitar",
+               " 105 Banjo",
+               " 106 Shamisen",
+               " 107 Koto",
+               " 108 Kalimba",
+               " 109 Bagpipe",
+               " 110 Fiddle",
+               " 111 Shanai",
+               " 112 Tinkle Bells",
+               " 113 Agogo",
+               " 114 Steel Drums",
+               " 115 Woodblock",
+               " 116 Taiko Drum",
+               " 117 Melodic Tom",
+               " 118 Synth Drum",
+               " 119 Reverse Cymbal",
+               " 120 Guitar Fret Noise",
+               " 121 Breath Noise",
+               " 122 Seashore",
+               " 123 Bird Tweet",
+               " 124 Telephone Ring",
+               " 125 Helicopter",
+               " 126 Applause",
+               " 127 Gunshot"
+       };
+}
\ No newline at end of file