1 import javax.sound.midi.*;
4 import java.awt.event.*;
7 * A Combo Box where the instrument of the currently active channel can be selected.
9 * @author Einar Pehrson, Michael Andreen
12 public class MooInstrumentList extends JComboBox implements ActionListener {
14 protected int channel;
15 public MooInstrumentList(int chan) {
18 setFont(new Font("Helvetica", Font.PLAIN, 10));
19 addActionListener(this);
22 public void setChannel(int chan){
24 System.out.println(chan);
25 setSelectedIndex(Moosique.getChannel(channel).getProgram());
26 System.out.println(Moosique.getChannel(channel).getProgram());
29 public void actionPerformed(ActionEvent e) {
30 JComboBox box = (JComboBox)e.getSource();
31 int instrument = box.getSelectedIndex();
32 Moosique.getChannel(channel).programChange(instrument);
35 public static final String[] instruments = {
36 " 0 Acoustic Grand Piano",
37 " 1 Bright Acoustic Piano",
38 " 2 Electric Grand Piano",
39 " 3 Honky-Tonk Piano",
53 " 17 Percussive Organ",
59 " 23 Tango Accordion",
60 " 24 Acoustic Nylon Guitar",
61 " 25 Acoustic Steel Guitar",
62 " 26 Electric Jazz Guitar",
63 " 27 Electric Clean Guitar",
64 " 28 Electric Muted Guitar",
65 " 29 Overdriven Guitar",
66 " 30 Distortion Guitar",
67 " 31 Guitar Harmonics",
69 " 33 Electric Bass Fingered",
70 " 34 Electric Bass Picked",
80 " 44 Tremolo Strings",
81 " 45 Pizzicato Strings",
82 " 46 Orchestral Harp",
84 " 48 String Ensemble 1",
85 " 49 String Ensemble 2",
86 " 50 Synth Strings 1",
87 " 51 Synth Strings 2",
116 " 80 Synth Lead 1 Square Wave Lead",
117 " 81 Synth Lead 2 Sawtooth Wave Lead",
118 " 82 Synth Lead 3 Caliope Lead",
119 " 83 Synth Lead 4 Chiff Lead",
120 " 84 Synth Lead 5 Charang",
121 " 85 Synth Lead 6 Solo Synth Voice",
122 " 86 Synth Lead 7 Bright Saw Wave",
123 " 87 Synth Lead 8 Brass and Lead",
124 " 88 Synth Pad 1 Fantasia Pad",
125 " 89 Synth Pad 2 Warm Pad",
126 " 90 Synth Pad 3 Poly Synth Pad",
127 " 91 Synth Pad 4 Space Voice Pad",
128 " 92 Synth Pad 5 Bowed Glass Pad",
129 " 93 Synth Pad 6 Metal Pad",
130 " 94 Synth Pad 7 Halo Pad",
131 " 95 Synth Pad 8 Sweep Pad",
132 " 96 Synth SFX 1 Ice Rain",
133 " 97 Synth SFX 2 Sound Track",
134 " 98 Synth SFX 3 Crystal",
135 " 99 Synth SFX 4 Atmosphere",
136 " 100 Synth SFX 5 Brightness",
137 " 101 Synth SFX 6 Goblin",
138 " 102 Synth SFX 7 Echo Drops",
139 " 103 Synth SFX 8 Star Theme",
155 " 119 Reverse Cymbal",
156 " 120 Guitar Fret Noise",
160 " 124 Telephone Ring",