diff options
author | Aidan Ross <aross02@fairport.org> | 2023-05-31 08:32:57 -0400 |
---|---|---|
committer | Aidan Ross <aross02@fairport.org> | 2023-05-31 08:32:57 -0400 |
commit | b1f10378237ecdfe9153cd42af85bbe34b2e92dc (patch) | |
tree | 2c0e55378d6d35bffb61a46d2439b2a132a2ad0a /src/gameplay | |
parent | ab92e6573980b48ebd5de6fccba55381ab095aa7 (diff) | |
download | NPEhero-b1f10378237ecdfe9153cd42af85bbe34b2e92dc.tar.gz NPEhero-b1f10378237ecdfe9153cd42af85bbe34b2e92dc.tar.bz2 NPEhero-b1f10378237ecdfe9153cd42af85bbe34b2e92dc.zip |
The music is still out of syncccc
Diffstat (limited to 'src/gameplay')
-rw-r--r-- | src/gameplay/SongPlayer.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/gameplay/SongPlayer.java b/src/gameplay/SongPlayer.java index acf9d6b..f76f5e3 100644 --- a/src/gameplay/SongPlayer.java +++ b/src/gameplay/SongPlayer.java @@ -45,7 +45,8 @@ public class SongPlayer extends Pane { private int bpm; //initializes the bpm of the song, to be read in from a metadata file later private int songLength; //initializes the length of the song in terms of the song's bpm, to be read in later - sound.AudioFilePlayer music; + AudioFilePlayer music; + private main.Level level; private Difficulty difficulty; private Pane pane; @@ -110,13 +111,15 @@ public class SongPlayer extends Pane { public SongPlayer(main.Level lvl, Difficulty d, Pane p, ScoreController cntrl) { bpm = d.bpm; //Reads the song's bpm from a metadata file - level = lvl; difficulty = d; pane = p; + music = new AudioFilePlayer(difficulty.song.getPath()); - songLength = d.numBeats; - timer = new Timer(d.bpm); //Sets the timer's bpm to that of the song + System.out.println(d.bpm + " " + d.numBeats); + + songLength = 28; //PLACEHOLDER BPM AND TIMER + timer = new Timer(120); //Sets the timer's bpm to that of the song scoreCounter = cntrl; //Uses the song's designated scoreCounter try { @@ -174,10 +177,6 @@ public class SongPlayer extends Pane { root.getChildren().addAll(place); //aligns the components within the pane super.getChildren().addAll(root); //puts all of the combonents in the pane to be rendered - - gameLoop.start(); //starts the gameLoop, a periodic backround task runner that runs the methods within it 60 times every second - music = new AudioFilePlayer(d.song.getPath()); - music.play(); } /** @@ -257,8 +256,14 @@ public class SongPlayer extends Pane { } }; + //starts the gameLoop, a periodic backround task runner that runs the methods within it 60 times every second + public void start() { + music.play(); + gameLoop.start(); + } + /** - * Stops the gameloop and the music + * Stops the gameloop * @throws LineUnavailableException * @throws IOException * @throws UnsupportedAudioFileException |