Add in seeking
This commit is contained in:
parent
e87126e851
commit
f916963a84
@ -48,7 +48,7 @@ public class LLSIG implements KeyListener{
|
|||||||
final static Dimension WINDOW_SIZE = new Dimension(1280,1050);
|
final static Dimension WINDOW_SIZE = new Dimension(1280,1050);
|
||||||
|
|
||||||
public boolean EDITMODE = false;
|
public boolean EDITMODE = false;
|
||||||
public boolean METRONOME = true;
|
public boolean METRONOME = false;
|
||||||
public boolean BPM_MEASURE = false;
|
public boolean BPM_MEASURE = false;
|
||||||
public boolean PLAYING = true; //Whether or not a song is loaded and playing.
|
public boolean PLAYING = true; //Whether or not a song is loaded and playing.
|
||||||
public static int beatNumber = 0;
|
public static int beatNumber = 0;
|
||||||
@ -111,7 +111,7 @@ public class LLSIG implements KeyListener{
|
|||||||
PLAYING = new File("music/"+song+".mp3").exists();
|
PLAYING = new File("music/"+song+".mp3").exists();
|
||||||
if (PLAYING) {
|
if (PLAYING) {
|
||||||
this.musicPlayer = new Player(Paths.get("music/"+song+".mp3").toUri().toString());
|
this.musicPlayer = new Player(Paths.get("music/"+song+".mp3").toUri().toString());
|
||||||
musicPlayer.play(148900l);
|
musicPlayer.play();
|
||||||
|
|
||||||
LoadSongData(song,lanes);
|
LoadSongData(song,lanes);
|
||||||
}
|
}
|
||||||
@ -263,6 +263,7 @@ public class LLSIG implements KeyListener{
|
|||||||
testOffset=musicPlayer.getPlayPosition();
|
testOffset=musicPlayer.getPlayPosition();
|
||||||
beatNumber=0;
|
beatNumber=0;
|
||||||
}
|
}
|
||||||
|
musicPlayer.seek(148900);
|
||||||
}break;
|
}break;
|
||||||
case KeyEvent.VK_S:{lane=1;}break;
|
case KeyEvent.VK_S:{lane=1;}break;
|
||||||
case KeyEvent.VK_D:{lane=2;}break;
|
case KeyEvent.VK_D:{lane=2;}break;
|
||||||
|
|||||||
@ -12,21 +12,17 @@ public class Player {
|
|||||||
jlpp = new MediaPlayer(this.song);
|
jlpp = new MediaPlayer(this.song);
|
||||||
}
|
}
|
||||||
public void play() {
|
public void play() {
|
||||||
new Thread() {
|
jlpp.stop();
|
||||||
public void run() {
|
jlpp.play();
|
||||||
jlpp.stop();
|
|
||||||
jlpp.play();
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
}
|
}
|
||||||
public void play(long frame) {
|
public void play(long frame) {
|
||||||
new Thread() {
|
jlpp.play();
|
||||||
public void run() {
|
try {
|
||||||
jlpp.stop();
|
Thread.sleep(1000);
|
||||||
jlpp.play();
|
} catch (InterruptedException e) {
|
||||||
jlpp.seek(new Duration(frame));
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}.start();
|
this.seek(frame);
|
||||||
}
|
}
|
||||||
public void pause() {
|
public void pause() {
|
||||||
jlpp.pause();
|
jlpp.pause();
|
||||||
@ -47,4 +43,7 @@ public class Player {
|
|||||||
public double getPlayPosition() {
|
public double getPlayPosition() {
|
||||||
return jlpp.getCurrentTime().toMillis();
|
return jlpp.getCurrentTime().toMillis();
|
||||||
}
|
}
|
||||||
|
public void seek(long frame) {
|
||||||
|
jlpp.seek(new Duration(frame));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user