/**
* Creates the title bar.
- * @param aTrack the track that this tracktitle is operating on.
+ * @param aTrack the track that this track title is operating on.
*/
public MooTrackTitle (Track aTrack) {
setDoubleBuffered(true);
trackNameMessage = (MetaMessage)msg;
trackName = new String(trackNameMessage.getData());
}
- } else if (status >= 192 && status <= 207) {
+ } else if (status >= 192 && status < 208) {
programChangeMessage = (ShortMessage)msg;
- channel = status - 192;
+ channel = programChangeMessage.getChannel();
}
}
int type;
if (channel == 9) type = MooInstrumentList.DRUMS;
else type = MooInstrumentList.INSTRUMENTS;
- instruments = new MooInstrumentList(channel, type);
- // instruments = new MooInstrumentList(channel, type, programChangeMessage);
+ instruments = new MooInstrumentList(channel, type, programChangeMessage);
add(instruments);
channelBox = new JComboBox();
}
/**
- * Checks if the focus is lost.
+ * When the title field loses focus, updates the corresponding MidiEvent.
*/
class TitleFocusListener extends FocusAdapter {
public void focusLost(FocusEvent e) {
- // Update the MidiEvent containing the title of this track
+ try {
+ trackNameMessage.setMessage(3, title.getText().getBytes(), title.getText().length());
+ } catch (InvalidMidiDataException ex) {}
}
}
MidiEvent me;
MooNote mn;
instruments.setChannel(channel);
- // Query the user before rechannelling???
+ // Prompt the user before rechannelling???
for (int j = 0; j < track.size(); j++) {
me = track.get(j);
if (me instanceof MooNote){
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);
mtv.disableKeyboardRecording();
sequencer.stopRecording();
sequencer.recordDisable(track);
- mtv.placeNoteElements();
+ java.util.List newNotes = Moosique.convertTrack(track, quantize);
+ mtv.placeNewNotes(newNotes);
}
}
}