+ try {
+ trackNameMessage.setMessage(3, title.getText().getBytes(), title.getText().length());
+ } catch (InvalidMidiDataException ex) {}
+ }
+ }
+
+ /**
+ * Takes the appropriate action when a user selects an item on the popup menu.
+ */
+ class TitleListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ Object source = e.getSource();
+ if (source == channelBox) {
+ channel = channelBox.getSelectedIndex();
+ MidiEvent me;
+ MooNote mn;
+ instruments.setChannel(channel);
+ // Prompt the user before rechannelling???
+ for (int j = 0; j < track.size(); j++) {
+ me = track.get(j);
+ if (me instanceof MooNote){
+ mn = (MooNote)me;
+ mn.setChannel(channel);
+ }
+ }
+ } else if (source == solo) {
+ boolean selected = mute.isSelected();
+ if (selected){
+ solo.setSelected(false);
+ Moosique.setTrackSolo(track, false);
+ }
+ Moosique.setTrackMute(track, selected);
+ } else if (source == mute) {
+ boolean selected = solo.isSelected();
+ if (selected){
+ mute.setSelected(false);
+ Moosique.setTrackMute(track, false);
+ }
+ Moosique.setTrackSolo(track, selected);
+ } else if (source == record) {
+ Sequencer sequencer = Moosique.getSequencer();
+ boolean quantize = false;
+ if (record.getText() == "Record") {
+ /* Show a dialog with:
+ "Track" combo box,
+ "Channel" combo box (disabled?,
+ "Quantize" checkbox and
+ "Start Recording" button.
+ */
+ record.setText("Stop");
+ mtv.enableKeyboardRecording();
+ sequencer.recordEnable(track, channel);
+ sequencer.startRecording();
+ Moosique.setEdited();
+ } else {
+ record.setText("Record");
+ mtv.disableKeyboardRecording();
+ sequencer.stopRecording();
+ sequencer.recordDisable(track);
+ java.util.List newNotes = Moosique.convertTrack(track, quantize);
+ mtv.placeNewNotes(newNotes);
+ }
+ }