try {
noteOnMsg.setMessage(noteOnMsg.getCommand(), (byte)channel, noteOnMsg.getData1(), noteOnMsg.getData2());
noteOffMsg.setMessage(noteOffMsg.getCommand(), (byte)channel, noteOffMsg.getData1(), noteOffMsg.getData2());
- } catch (InvalidMidiDataException e) {}
+ } catch (Exception e) {}
+ //} catch (InvalidMidiDataException e) {}
}
/**
public boolean hasNoteOffEvent() {
return noteOffEvent != null;
}
-}
\ No newline at end of file
+}
private JComboBox channel;
private JCheckBox mute;
private JCheckBox solo;
+ private Track track;
/**
* Creates the title bar.
*/
- public MooTrackTitle (Track track) {
+ public MooTrackTitle (Track aTrack) {
+ track = aTrack;
setLayout(new GridLayout(4,1));
setBorder(BorderFactory.createLineBorder(Color.black));
channel.setFont(Moosique.getGUI().FONT);
for (int i = 1; i <= 16; i++)
channel.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;
+ channel.setSelectedIndex(mn.getChannel());
+ break;
+ }
+ }
+
channel.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent e){
Object ob = channel.getSelectedItem();
if (ob instanceof Integer){
+ int chan = ((Integer)ob).intValue();
//set channel
+ MidiEvent me;
+ MooNote mn;
+ for (int j = 0; j < track.size(); j++) {
+ me = track.get(j);
+ if (me instanceof MooNote){
+ mn = (MooNote)me;
+ mn.setChannel(chan);
+ System.out.println(ob);
+ }
+ }
}
}});
+
add(channel);