async functioning now
This commit is contained in:
parent
29e8d550dd
commit
2801adbd6e
@ -23,7 +23,7 @@ import javazoom.jl.decoder.Header;
|
||||
import javazoom.jl.decoder.MP3Decoder;
|
||||
import javazoom.jl.decoder.OutputBuffer;
|
||||
|
||||
public class Mp3AudioData implements MusicManager {
|
||||
public class Mp3Manager implements MusicManager {
|
||||
private int readWindowSize = 1024;
|
||||
|
||||
private int currentReadWindowIndex;
|
||||
@ -41,7 +41,6 @@ public class Mp3AudioData implements MusicManager {
|
||||
private byte[] workset;
|
||||
private int indexHead = -1;
|
||||
|
||||
<<<<<<< HEAD:core/src/zero1hd/rhythmbullet/audio/Mp3Manager.java
|
||||
private ExecutorService exec;
|
||||
private boolean loadComplete;
|
||||
|
||||
@ -59,17 +58,6 @@ public class Mp3AudioData implements MusicManager {
|
||||
|
||||
loadComplete = true;
|
||||
});
|
||||
=======
|
||||
public Mp3AudioData(FileHandle audioFile) {
|
||||
try {
|
||||
MP3File mp3File = new MP3File(audioFile.file());
|
||||
sampleCount = MathUtils.round((float) (mp3File.getAudioHeader().getSampleRateAsNumber()*mp3File.getMP3AudioHeader().getPreciseTrackLength()));
|
||||
durationInSeconds = mp3File.getMP3AudioHeader().getNumberOfFrames()/readWindowSize;
|
||||
sampleRate = mp3File.getMP3AudioHeader().getSampleRateAsNumber();
|
||||
} catch (IOException | TagException | ReadOnlyFileException | InvalidAudioFrameException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
>>>>>>> parent of 23df4f8... smooth rise of bars:core/src/zero1hd/rhythmbullet/audio/Mp3AudioData.java
|
||||
|
||||
bitstream = new Bitstream(audioFile.read());
|
||||
decoder = new MP3Decoder();
|
@ -28,9 +28,9 @@ public class SongList {
|
||||
|
||||
public MusicManager getAudioData(FileHandle file) {
|
||||
if (file.extension().equalsIgnoreCase("wav")) {
|
||||
return new WavAudioData(file);
|
||||
return new WAVManager(file);
|
||||
} else if (file.extension().equalsIgnoreCase("mp3")) {
|
||||
return new Mp3AudioData(file);
|
||||
return new Mp3Manager(file);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -12,19 +12,15 @@ import com.badlogic.gdx.files.FileHandle;
|
||||
|
||||
import zero1hd.rhythmbullet.audio.wavedecoder.WavDecoder;
|
||||
|
||||
public class WavAudioData implements MusicManager {
|
||||
public class WAVManager implements MusicManager {
|
||||
private int readWindowSize = 1024;
|
||||
private AudioFormat format;
|
||||
private int readIndex;
|
||||
private int currentReadWindowIndex;
|
||||
private Music playbackMusic;
|
||||
WavDecoder decoder;
|
||||
<<<<<<< HEAD:core/src/zero1hd/rhythmbullet/audio/WAVManager.java
|
||||
public WAVManager(FileHandle file) {
|
||||
=======
|
||||
|
||||
public WavAudioData(FileHandle file) {
|
||||
>>>>>>> parent of 23df4f8... smooth rise of bars:core/src/zero1hd/rhythmbullet/audio/WavAudioData.java
|
||||
public WAVManager(FileHandle file) {
|
||||
try {
|
||||
decoder = new WavDecoder(file);
|
||||
} catch (InvalidParameterException | IOException e) {
|
@ -24,6 +24,10 @@ public class Visualizer extends Widget {
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
if (mm != null && mm.isFinishedLoading() && !mmSet) {
|
||||
vis.setMM(mm);
|
||||
mmSet = true;
|
||||
}
|
||||
vis.modify(delta);
|
||||
vis.setHeight(getHeight());
|
||||
vis.setWidth(getWidth());
|
||||
@ -34,11 +38,6 @@ public class Visualizer extends Widget {
|
||||
vis.updatePositionInfo();
|
||||
}
|
||||
vis.calculate();
|
||||
|
||||
if (mm != null && mm.isFinishedLoading() && !mmSet) {
|
||||
vis.setMM(mm);
|
||||
mmSet = true;
|
||||
}
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user