]> ruin.nu Git - moosique.git/commitdiff
FIXED THE LAST MAJOR BUG!!!
authorEinar Pehrson <einarp@itstud.chalmers.se>
Fri, 16 May 2003 19:54:59 +0000 (19:54 +0000)
committerEinar Pehrson <einarp@itstud.chalmers.se>
Fri, 16 May 2003 19:54:59 +0000 (19:54 +0000)
The setSequence method of the Sequencer class dereferences the sequence loaded into the sequencer.
Therefore, setSequence(seq) must be called on play. IDIOTIQUE!!!

MooGUI.java
MooNote.java
MooTrackView.java
MooView.java
Moosique.java
report.txt

index e1ee025a60476934fcabe2a2fc03836e4e891748..4c008f4d2e500504b09d2c11111deb3101488bb0 100644 (file)
@@ -30,6 +30,7 @@ public class MooGUI extends JFrame {
                super("Moosique");
 
                this.seq = seq;
+               advanceStatus();
                
                Container pane = getContentPane();
                pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
@@ -37,10 +38,12 @@ public class MooGUI extends JFrame {
                // Adds menu bar.
                menu = new MooMenu();
                setJMenuBar(menu);
+               advanceStatus();
 
                // Adds toolbar.
                toolbar = new MooToolbar();
                pane.add(toolbar, BorderLayout.NORTH);
+               advanceStatus();
 
                // Adds main view.
                view = new MooView(seq.getTracks());
@@ -90,6 +93,7 @@ public class MooGUI extends JFrame {
                im.put(octave4Key, "Octave change 4");
                im.put(octave6Key, "Octave change 6");
                im.put(octave8Key, "Octave change 8");
+               advanceStatus();
 
                // Configures window.
                addWindowListener(new MooGUICloser());
@@ -98,8 +102,8 @@ public class MooGUI extends JFrame {
                Dimension bounds = Toolkit.getDefaultToolkit().getScreenSize();
                setSize(bounds.width,bounds.height - 40);
                setLocation(0, 0);
-               // setResizable(false);
                setBackground(Color.white);
+               advanceStatus();
                setVisible(true);
                show();
        }
@@ -156,6 +160,10 @@ public class MooGUI extends JFrame {
                return octaveAction;
        }
 
+       private void advanceStatus() {
+               System.out.print(".");
+       }
+
        /**
         * Listener for closing the program
         */
index d49495fcaafb3693144612b97c9d8e05c5fdb8cb..fbc0668a4381b2b64d24bec2ac2d7ea9a499f793 100644 (file)
@@ -50,7 +50,7 @@ public class MooNote extends MidiEvent {
                try {
                        noteOnMsg.setMessage(ShortMessage.NOTE_ON, channel, pitch, velocity);
                        noteOffMsg.setMessage(ShortMessage.NOTE_OFF, channel, pitch, 0);
-               } catch (InvalidMidiDataException e) {}
+               } catch (InvalidMidiDataException e) {System.out.println("Invalid data!");}
        }
 
        /** 
index 6f1dca5e4be1b241dd734a9e461d91fdf321021f..4d58e1d2ddac24fd1e83141c7f153538c807af8b 100644 (file)
@@ -173,7 +173,6 @@ public class MooTrackView extends JPanel {
         */
        private void addStandardNote() {
                long timestamp = (long)(ticksPerSixteenth * (popupY - insets.top) / NOTE_HEIGHT);
-               System.out.println(ticksPerSixteenth + ", " + popupY + ", " + insets.top + ", " + timestamp);
                addNote(new MooNote(title.getChannel(), 60, 100, timestamp, Moosique.getSequence().getResolution() / 4));
        }
 
index 1b114b61e7f334ea2e0a66c4fd1b8892be598dc6..c97a4a46239b745124a0cdbafe8a023121879c2b 100644 (file)
@@ -76,8 +76,8 @@ public class MooView extends JScrollPane {
                                progressDialog.pack();
                                progressDialog.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - progressDialog.getWidth()) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - progressDialog.getHeight()) / 2);
                                progressDialog.setVisible(true);
-                       } else System.out.println("Creating track views");
-       
+                       }
+
                        // Starts filling the track panel with track views, while updating the progress bar.
                        GridLayout gL = new GridLayout(1,numberOfTracks);
                        trackPanel.setLayout(gL);
@@ -94,7 +94,6 @@ public class MooView extends JScrollPane {
                                }
                        }
                        if (showProgress) progressDialog.dispose();
-                       else System.out.print("Done");
                }
 /*             JPanel filler = new JPanel();
                int totalViewLength = trackPanel.getComponents().length * MooTrackView.VIEW_WIDTH;
index 01b6b7664345685d633f6585aeaace8c8d011fad..9b4349c9acbb9db040a1f8bd0d1b1c6d75225853 100644 (file)
@@ -74,7 +74,7 @@ public class Moosique {
 
                // Builds GUI, unless n-flag is set.
                if (makeGUI) {
-                       System.out.print("Building GUI...");
+                       System.out.print("Building GUI.");
                        try {
                                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                        } catch (Exception e) {}
@@ -182,6 +182,9 @@ public class Moosique {
         */
        public static void resume() {
                gui.update(0);
+               try {
+                       sequencer.setSequence(seq);
+               } catch (InvalidMidiDataException e) {}
                sequencer.start();
 
                // Disables input to volatile components
@@ -391,7 +394,7 @@ public class Moosique {
                        Collections.sort(noteOns, c);
                        Collections.sort(noteOffs, c);
 
-                       // For each NoteOn event, finds its NoteOff event and replaces it with a MooNote.
+                       // Replaces each NoteOn event it with a MooNote containing a reference to the NoteOff event.
                        Iterator iOn = noteOns.iterator(), iOff;
                        MidiEvent on, off = null, nextOff;
                        ShortMessage onMsg, nextOffMsg;
@@ -420,7 +423,6 @@ public class Moosique {
                                iOn.remove();
                        }
                }
-
                // Sends sequence to GUI and sequencer, then returns
                if (gui != null) gui.setSequence(seq);
                try {
index 8718d89039a619cbc94f351d8cc966fbe7fd89a5..914ffed6b00ba80a8d2afc422df4f1885a2b0d86 100644 (file)
@@ -70,6 +70,8 @@ This problem was especially unfortunate since it was the only performance aspect
 
 However, as we recently discovered, the Sun developers were also aware of this issue and, in trying to find a remedy for it, implemented some additional methods for controlling the viewport's visualisation during scrolling. This allowed us to reduce the time lag to a fraction.
 
+Another issue, that could be resolved only through trial-and-error, was the application's interaction with the setSequence method of the Sequencer class. The method employs, as opposed to what is customary in Java, dereferencing of its argument. This means that the MIDI sequence passed to the method is somehow cloned before it is sent to the sequencer, and therefore when the data of the sequence is updated, the changes are not reflected in the sequence currently loaded into the sequencer. In the Programmer's Guide, this method is described as "[tying] together an existing Sequence with the Sequencer, which is somewhat analogous to loading a tape onto a tape recorder". However, the actual implementation of the method (which may be vendor specific) does not work that way, since the "tape recorder" reads the contents of the "tape", but then does not respond to any changes in the "tape" unless the tape is reinserted. This incomprehensible implementation, which is not even hinted at in the API or the Programmer's Guide, didn't cause us a lot of extra work (since we could not understand where the problem was), but postponed a vital step in our implementation to the very last stage of the project.
+
 During our project some time has also been wasted when wrestling with Java Swing components showing up at the wrong position whith the wrong size. No matter how much we studied the API we could not find the answer of this problem. In the end we found out that rebooting our FreeBSD machines was the only cure to this problem. We suspect there is some kind of bug, either in the FreeBSD OS, or the windomaker application we use. After all, we never ran into this problem those rare times we were working on a Windows-platform
 
 The major changes and that not enough work design of the graphical classes resulted in that the different graphical classes couldn't be implemented on their own. Instead changes often had to take place in many different classes when some feature was added. This made the implementation slow, especially in the beginning, since there where many different ideas on how things should be implemented. This got better through time though, when the basic foundation was implemented it got easier to add the rest of the features.