]> ruin.nu Git - moosique.git/blobdiff - MooTrackTitle.java
no division by zero anymore..
[moosique.git] / MooTrackTitle.java
index 74e7a1e8ae2c1ae64a85d158ee555b808344456a..a97844b2f208fc755c7f7e89b10cfb307e6dd480 100644 (file)
@@ -50,7 +50,10 @@ public class MooTrackTitle extends JPanel {
                MidiEvent event;
                for (int i = 0; i < track.size(); i++) {
                        event = track.get(i);
-                       if (event instanceof MooNote) channel = ((MooNote)event).getChannel();
+                       if (event instanceof MooNote) {
+                               channel = ((MooNote)event).getChannel();
+                               break;
+                       }
                }
                
                // Creates and places components.
@@ -72,14 +75,7 @@ public class MooTrackTitle extends JPanel {
                for (int i = 1; i <= 16; i++)
                        channelBox.addItem(new Integer(i));
 
-               for (int j = 0; j < track.size(); j++) {
-                       MidiEvent me = track.get(j);
-               if (me instanceof MooNote){
-                               MooNote mn = (MooNote)me;
-                               channelBox.setSelectedIndex(mn.getChannel());
-                               break;
-                       }
-        }
+               channelBox.setSelectedIndex(channel);
 
                instruments = new MooInstrumentList(channelBox.getSelectedIndex());