]> ruin.nu Git - moosique.git/blobdiff - Moosique.java
Updated the project report,
[moosique.git] / Moosique.java
index 795772f46e9b04742b81fb4dffc72d65b3f43769..89669d37e972d197ffdba584062477e2c6ae5c84 100644 (file)
@@ -185,17 +185,24 @@ public class Moosique {
                // Disables input to volatile components
                // gui.disable();
 
-               // Creates the visualization thread and starts it.
+               System.out.println("Ticks/16: " + seq.getResolution()/4);
+
+               // Creates the visualisation thread and starts it.
                player = new Thread () {
                        public void run() {
+                               long position = sequencer.getTickPosition();
                                while(sequencer.isRunning()) {
+                                       long pos = sequencer.getTickPosition();
+                                       System.out.print(" ... " + (pos - position));
+                                       position = pos;
+
                                        // Updates the GUI with the current tick position.
                                        gui.update(sequencer.getTickPosition());
 
                                        // Puts the thread to sleep for as long as it takes
                                        // the sequencer to reach the next sixteenth.
                                        try {
-                                               sleep((long)((1000 * 60 * 1) / (getTempo() * 4)));
+                                               sleep((long)(15000 / getTempo()));
                                        } catch (InterruptedException e) {
                                                Moosique.stop();
                                        }
@@ -222,7 +229,7 @@ public class Moosique {
         * Returns the current editing position of the sequencer.
         * @return the tick position
         */
-       public static long getPosition() {
+       public static long getEditPosition() {
                return editPosition;
        }
 
@@ -230,7 +237,7 @@ public class Moosique {
         * Sets the current editing position of the sequencer.
         * @param ticks         the tick position
         */
-       public static void setPosition(long ticks) {
+       public static void setEditPosition(long ticks) {
                editPosition = ticks;
        }