X-Git-Url: https://ruin.nu/git/?p=moosique.git;a=blobdiff_plain;f=MooTrackTitle.java;h=9cffb14570bbd48633e380441963e0865188b78b;hp=6c629d90522651f4743fa765e1fb114b9083dc98;hb=HEAD;hpb=c31857b9fcb119f0d4c12b96222f66340b3dcc56 diff --git a/MooTrackTitle.java b/MooTrackTitle.java index 6c629d9..9cffb14 100644 --- a/MooTrackTitle.java +++ b/MooTrackTitle.java @@ -22,7 +22,6 @@ public class MooTrackTitle extends JPanel { private JComboBox channelBox; private JCheckBox mute; private JCheckBox solo; - private JButton record; private String trackName = ""; private int channel = 0; @@ -39,7 +38,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); @@ -56,9 +55,9 @@ public class MooTrackTitle extends JPanel { 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(); } } @@ -76,8 +75,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(); @@ -107,11 +105,6 @@ public class MooTrackTitle extends JPanel { solo.addActionListener(tl); checkboxes.add(solo); - record = new JButton("Record"); - record.setFont(Moosique.getGUI().FONT); - record.addActionListener(tl); - checkboxes.add(record); - add(checkboxes); } @@ -132,11 +125,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) {} } } @@ -151,7 +146,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){ @@ -173,20 +168,6 @@ public class MooTrackTitle extends JPanel { Moosique.setTrackMute(track, false); } Moosique.setTrackSolo(track, selected); - } else if (source == record) { - Sequencer sequencer = Moosique.getSequencer(); - if (record.getText() == "Record") { - record.setText("Stop"); - mtv.enableKeyboardRecording(); - sequencer.recordEnable(track, channel); - sequencer.startRecording(); - } else { - record.setText("Record"); - mtv.disableKeyboardRecording(); - sequencer.stopRecording(); - sequencer.recordDisable(track); - mtv.placeNoteElements(); - } } } }