qRevert "smooth rise of bars"
This reverts commit 23df4f887c24325ea39d0bb9a3f2695366ec0c80.
This commit is contained in:
parent
8962ab97eb
commit
29e8d550dd
@ -23,7 +23,7 @@ import javazoom.jl.decoder.Header;
|
||||
import javazoom.jl.decoder.MP3Decoder;
|
||||
import javazoom.jl.decoder.OutputBuffer;
|
||||
|
||||
public class Mp3Manager implements MusicManager {
|
||||
public class Mp3AudioData implements MusicManager {
|
||||
private int readWindowSize = 1024;
|
||||
|
||||
private int currentReadWindowIndex;
|
||||
@ -41,6 +41,7 @@ public class Mp3Manager implements MusicManager {
|
||||
private byte[] workset;
|
||||
private int indexHead = -1;
|
||||
|
||||
<<<<<<< HEAD:core/src/zero1hd/rhythmbullet/audio/Mp3Manager.java
|
||||
private ExecutorService exec;
|
||||
private boolean loadComplete;
|
||||
|
||||
@ -58,6 +59,17 @@ public class Mp3Manager 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();
|
@ -27,11 +27,10 @@ public class SongList {
|
||||
}
|
||||
|
||||
public MusicManager getAudioData(FileHandle file) {
|
||||
Gdx.app.debug("SongList", "retrieving proper music manager...");
|
||||
if (file.extension().equalsIgnoreCase("wav")) {
|
||||
return new WAVManager(file);
|
||||
return new WavAudioData(file);
|
||||
} else if (file.extension().equalsIgnoreCase("mp3")) {
|
||||
return new Mp3Manager(file);
|
||||
return new Mp3AudioData(file);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -40,7 +39,6 @@ public class SongList {
|
||||
if (index > songList.size) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return getAudioData(songList.get(index));
|
||||
}
|
||||
|
||||
|
@ -30,17 +30,13 @@ public class SongListController implements OnCompletionListener {
|
||||
this.prefs = prefs;
|
||||
listeners = new Array<>();
|
||||
this.songList = songList;
|
||||
changeSong();
|
||||
rand = new Random();
|
||||
}
|
||||
|
||||
public void play() {
|
||||
Gdx.app.debug("SongListController", "playing current song.");
|
||||
if (mdp != null) {
|
||||
mdp.play();
|
||||
mdp.setVolume(prefs.getFloat("music vol"));
|
||||
} else {
|
||||
changeSong();
|
||||
}
|
||||
mdp.play();
|
||||
mdp.setVolume(prefs.getFloat("music vol"));
|
||||
}
|
||||
|
||||
public void setSongByIndex(int index) {
|
||||
@ -60,7 +56,6 @@ public class SongListController implements OnCompletionListener {
|
||||
|
||||
@Override
|
||||
public void onCompletion(Music music) {
|
||||
Gdx.app.debug("SongListController", "Song complete.");
|
||||
if (autoPlay) {
|
||||
if (shuffle) {
|
||||
currentPlaybackID = rand.nextInt(songList.getAmountOfSongs());
|
||||
@ -101,7 +96,7 @@ public class SongListController implements OnCompletionListener {
|
||||
if (mdp != null) {
|
||||
mdp.dispose();
|
||||
}
|
||||
Gdx.app.debug("SongListController", "Changing songs...");
|
||||
|
||||
this.mdp = songList.getMusicInfoFromIndex(currentPlaybackID);
|
||||
if (mdp == null) {
|
||||
mdp = songList.getAudioData(Gdx.files.internal("music/default.mp3"));
|
||||
|
@ -12,14 +12,19 @@ import com.badlogic.gdx.files.FileHandle;
|
||||
|
||||
import zero1hd.rhythmbullet.audio.wavedecoder.WavDecoder;
|
||||
|
||||
public class WAVManager implements MusicManager {
|
||||
public class WavAudioData 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
|
||||
try {
|
||||
decoder = new WavDecoder(file);
|
||||
} catch (InvalidParameterException | IOException e) {
|
@ -66,6 +66,8 @@ public class BasicVisualizer extends VisualizerCore {
|
||||
}
|
||||
|
||||
public void modify(float delta) {
|
||||
|
||||
|
||||
//Averaging bins together
|
||||
for (int i = 0; i < barCount; i++) {
|
||||
float barHeight = 2;
|
||||
@ -90,7 +92,7 @@ public class BasicVisualizer extends VisualizerCore {
|
||||
avg /= smoothRange*2;
|
||||
barHeights[i] = avg;
|
||||
|
||||
bars[i].setSize(barWidth, bars[i].getHeight() <= barHeights[i] ? bars[i].getHeight() + 0.5f*barHeights[i] : bars[i].getHeight() - 0.8f*Gdx.graphics.getHeight()*delta);
|
||||
bars[i].setSize(barWidth, bars[i].getHeight() <= barHeights[i] ? barHeights[i] : bars[i].getHeight() - 1.1f*Gdx.graphics.getHeight()*delta);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user