X-Git-Url: https://ruin.nu/git/?p=moosique.git;a=blobdiff_plain;f=MooTrackTitle.java;h=c2f1c0fa20097364e509b16493e548ec7916f250;hp=d3b9a8a754ce06c328d59570b316f2366fd64725;hb=c3a31c2aa833e2197f0929655c69a2090e8bbecc;hpb=e49990e17bff158ad638a16ba4aa616673b94627 diff --git a/MooTrackTitle.java b/MooTrackTitle.java index d3b9a8a..c2f1c0f 100644 --- a/MooTrackTitle.java +++ b/MooTrackTitle.java @@ -23,15 +23,15 @@ public class MooTrackTitle extends JPanel { private JCheckBox solo; private String trackName = ""; - private int trackNum, channel = 0; + private int channel = 0; /** * Creates the title bar. + * @param aTrack the track that this tracktitle is operating on. */ - public MooTrackTitle (Track aTrack, int aTrackNum) { + public MooTrackTitle (Track aTrack) { setDoubleBuffered(true); track = aTrack; - this.trackNum = aTrackNum; // Finds track name, program change and channel. MidiMessage msg; @@ -60,8 +60,11 @@ public class MooTrackTitle extends JPanel { title.addFocusListener(new TitleFocusListener()); add(title); - instruments = new MooInstrumentList(channel); - // instruments = new MooInstrumentList(channel, programChangeMessage); + int type; + if (channel == 9) type = MooInstrumentList.DRUMS; + else type = MooInstrumentList.INSTRUMENTS; + instruments = new MooInstrumentList(channel, type); + // instruments = new MooInstrumentList(channel, type, programChangeMessage); add(instruments); channelBox = new JComboBox(); @@ -90,22 +93,22 @@ public class MooTrackTitle extends JPanel { checkboxes.setLayout(new GridLayout(1,3)); mute = new JCheckBox("Mute"); - mute.setSelected(Moosique.getSequencer().getTrackMute(trackNum)); + mute.setSelected(Moosique.getChannel(channel).getMute()); mute.setFont(Moosique.getGUI().FONT); mute.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ boolean selected = mute.isSelected(); if (selected){ solo.setSelected(false); - Moosique.getSequencer().setTrackSolo(trackNum, false); + Moosique.getChannel(channel).setSolo(false); } - Moosique.getSequencer().setTrackMute(trackNum, selected); + Moosique.getChannel(channel).setMute(selected); }}); checkboxes.add(mute); solo = new JCheckBox("Solo"); - solo.setSelected(Moosique.getSequencer().getTrackSolo(trackNum)); + solo.setSelected(Moosique.getChannel(channel).getSolo()); solo.setFont(Moosique.getGUI().FONT); solo.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ @@ -113,14 +116,25 @@ public class MooTrackTitle extends JPanel { boolean selected = solo.isSelected(); if (selected){ mute.setSelected(false); - Moosique.getSequencer().setTrackMute(trackNum, false); + Moosique.getChannel(channel).setMute(false); } - Moosique.getSequencer().setTrackSolo(trackNum, selected); + Moosique.getChannel(channel).setSolo(selected); }}); checkboxes.add(solo); add(checkboxes); } + + /** + * Returns the channel of the track that the view is visualising. + * @return the chanel of the visualised track + */ + public int getChannel() { + return channel; + } + /** + * Checks if the focus is lost. + */ class TitleFocusListener extends FocusAdapter { public void focusLost(FocusEvent e) { // Update the MidiEvent containing the title of this track