channelBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
- int chan = channelBox.getSelectedIndex();
+ channel = channelBox.getSelectedIndex();
MidiEvent me;
MooNote mn;
- instruments.setChannel(channelBox.getSelectedIndex());
+ instruments.setChannel(channel);
for (int j = 0; j < track.size(); j++) {
me = track.get(j);
if (me instanceof MooNote){
mn = (MooNote)me;
- mn.setChannel(chan);
+ mn.setChannel(channel);
}
}}});
add(channelBox);
checkboxes.setLayout(new GridLayout(1,3));
mute = new JCheckBox("Mute");
- mute.setSelected(Moosique.getChannel(channel).getMute());
+ mute.setSelected(Moosique.getSequencer().getTrackMute(getTrackNum()));
mute.setFont(Moosique.getGUI().FONT);
mute.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
boolean selected = mute.isSelected();
+ int trackNum = getTrackNum();
if (selected){
solo.setSelected(false);
- Moosique.getChannel(channel).setSolo(false);
+ Moosique.getSequencer().setTrackSolo(trackNum, false);
}
- Moosique.getChannel(channel).setMute(selected);
+ Moosique.getSequencer().setTrackMute(trackNum, selected);
}});
checkboxes.add(mute);
solo = new JCheckBox("Solo");
- solo.setSelected(Moosique.getChannel(channel).getSolo());
+ solo.setSelected(Moosique.getSequencer().getTrackSolo(getTrackNum()));
solo.setFont(Moosique.getGUI().FONT);
solo.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
//setSolo
boolean selected = solo.isSelected();
+ int trackNum = getTrackNum();
if (selected){
mute.setSelected(false);
- Moosique.getChannel(channel).setMute(false);
+ Moosique.getSequencer().setTrackMute(trackNum, false);
}
- Moosique.getChannel(channel).setSolo(selected);
+ Moosique.getSequencer().setTrackSolo(trackNum, selected);
}});
checkboxes.add(solo);
add(checkboxes);
return channel;
}
+ protected int getTrackNum() {
+ Track[] tracks = Moosique.getSequence().getTracks();
+
+ for (int i = 0; i < tracks.length; i++) {
+ if (tracks[i] == track)
+ return i;
+ }
+ System.out.println("Couldn't find track");
+ return 0;
+ }
/**
* Checks if the focus is lost.
*/