MidiEvent event;
for (int i = 0; i < track.size(); i++) {
event = track.get(i);
- if (event instanceof MooNote) channel = ((MooNote)event).getChannel();
+ if (event instanceof MooNote) {
+ channel = ((MooNote)event).getChannel();
+ break;
+ }
}
// Creates and places components.
title.addFocusListener(new TitleFocusListener());
add(title);
- instruments = new MooInstrumentList(programChange);
- add(instruments);
JPanel checkboxes = new JPanel();
checkboxes.setLayout(new GridLayout(1,3));
for (int i = 1; i <= 16; i++)
channelBox.addItem(new Integer(i));
- for (int j = 0; j < track.size(); j++) {
- MidiEvent me = track.get(j);
- if (me instanceof MooNote){
- MooNote mn = (MooNote)me;
- channelBox.setSelectedIndex(mn.getChannel());
- break;
- }
- }
+ channelBox.setSelectedIndex(channel);
+
+ instruments = new MooInstrumentList(channelBox.getSelectedIndex());
instruments = new MooInstrumentList(channelBox.getSelectedIndex());
}
}}});
channelBox.setSelectedIndex(channel);
+
+ add(instruments);
add(channelBox);
mute = new JCheckBox("Mute");