X-Git-Url: https://ruin.nu/git/?p=moosique.git;a=blobdiff_plain;f=Moosique.java;h=89669d37e972d197ffdba584062477e2c6ae5c84;hp=795772f46e9b04742b81fb4dffc72d65b3f43769;hb=83ec11f99e143607d057db2a68c262ca9672e524;hpb=cf968519ee77ab329c3e739c6340a9d688a31508 diff --git a/Moosique.java b/Moosique.java index 795772f..89669d3 100644 --- a/Moosique.java +++ b/Moosique.java @@ -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; }