cleaning up and preparing for reflection visuals and music synchronization
This commit is contained in:
@@ -32,11 +32,7 @@ public class VisualizerCore implements Disposable {
|
||||
if (mm != null && calc && mm.isPlaying()) {
|
||||
updateTimer += delta;
|
||||
if (updateTimer >= updateRate) {
|
||||
mm.playbackIndexUpdate();
|
||||
System.out.println(mm.getPlaybackIndexPosition() + "vs" + mm.getReadIndex());
|
||||
while (mm.getPlaybackIndexPosition() > mm.getReadIndex()) {
|
||||
mm.skipReadWindow();
|
||||
}
|
||||
//TODO use current buffer being played
|
||||
lock.lock();
|
||||
mm.readSamples(audioPCM);
|
||||
fft.realForward(audioPCM);
|
||||
|
@@ -4,14 +4,14 @@ import java.io.IOException;
|
||||
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
|
||||
public class AudioSampleReader {
|
||||
public class WAVSampleReader {
|
||||
private int channels;
|
||||
private double sampleRate;
|
||||
private byte[] buffer;
|
||||
private AudioInputStream audioInputStream;
|
||||
private boolean mergeChannels;
|
||||
|
||||
public AudioSampleReader(AudioInputStream ais) throws IOException {
|
||||
public WAVSampleReader(AudioInputStream ais) throws IOException {
|
||||
audioInputStream = ais;
|
||||
buffer = new byte[audioInputStream.getFormat().getFrameSize()];
|
||||
|
@@ -83,14 +83,8 @@ public interface MusicManager extends Disposable {
|
||||
public FileHandle getMusicFile();
|
||||
|
||||
/**
|
||||
* Synchronizes the playback and read threads
|
||||
* @return the amount of windows that have been read.
|
||||
*/
|
||||
public void synchronize();
|
||||
public int framesRead();
|
||||
|
||||
/**
|
||||
* @return the window that the current read index is on
|
||||
*/
|
||||
public int getReadIndex();
|
||||
|
||||
public void skipReadWindow();
|
||||
}
|
||||
|
Reference in New Issue
Block a user