Add audio spectrum listener.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
Nic0Nic0Nii 2021-10-12 02:00:50 +00:00
parent 43c62688c6
commit 55179d8d0a
2 changed files with 5 additions and 0 deletions

View File

@ -118,6 +118,7 @@ public class LLSIG implements KeyListener{
LoadSongData(song,lanes); LoadSongData(song,lanes);
} }
Canvas canvas = new Canvas(f.getSize()); Canvas canvas = new Canvas(f.getSize());
musicPlayer.setAudioSpectrumListener(canvas);
window.add(canvas); window.add(canvas);
window.setVisible(true); window.setVisible(true);
window.addKeyListener(this); window.addKeyListener(this);

View File

@ -1,4 +1,5 @@
package main.java.LLSIG; package main.java.LLSIG;
import javafx.scene.media.AudioSpectrumListener;
import javafx.scene.media.Media; import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaPlayer.Status; import javafx.scene.media.MediaPlayer.Status;
@ -46,4 +47,7 @@ public class Player {
public void seek(long frame) { public void seek(long frame) {
jlpp.seek(new Duration(frame)); jlpp.seek(new Duration(frame));
} }
public void setAudioSpectrumListener(AudioSpectrumListener listener) {
jlpp.setAudioSpectrumListener(listener);
}
} }