X-Git-Url: https://ruin.nu/git/index.pl?a=blobdiff_plain;f=MooTrackTitle.java;h=4822dca5ced2a90e409c49feebb5c008747b5594;hb=22067aec9dd544828d90ff39a3a6d40cdfc7ea9f;hp=8bec94bc2495c2a65d5f730b03b910f986cd999b;hpb=f7097bc07b6688d1629e6894c1c42dc06485dc12;p=moosique.git diff --git a/MooTrackTitle.java b/MooTrackTitle.java index 8bec94b..4822dca 100644 --- a/MooTrackTitle.java +++ b/MooTrackTitle.java @@ -39,7 +39,7 @@ public class MooTrackTitle extends JPanel { /** * 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); @@ -58,8 +58,7 @@ public class MooTrackTitle extends JPanel { } } else if (status >= 192 && status < 208) { programChangeMessage = (ShortMessage)msg; - // System.out.println("Program change " + programChangeMessage.getData1()); - channel = status - 192; + channel = programChangeMessage.getChannel(); } } @@ -77,8 +76,7 @@ public class MooTrackTitle extends JPanel { 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(); @@ -133,11 +131,13 @@ public class MooTrackTitle extends JPanel { } /** - * 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) {} } } @@ -152,7 +152,7 @@ public class MooTrackTitle extends JPanel { 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){ @@ -194,8 +194,8 @@ public class MooTrackTitle extends JPanel { mtv.disableKeyboardRecording(); sequencer.stopRecording(); sequencer.recordDisable(track); - Moosique.convertTrack(track, quantize); - mtv.placeNoteElements(); + java.util.List newNotes = Moosique.convertTrack(track, quantize); + mtv.placeNewNotes(newNotes); } } }