visualizer bars properly rendered; removed overlapping play calls; +
minor fixes and changes
This commit is contained in:
@@ -45,7 +45,7 @@ public class MusicController extends Observable implements OnCompletionListener,
|
||||
*/
|
||||
public void play() {
|
||||
if (music != null) {
|
||||
Gdx.app.debug("MusicListController", "Playing from MLC.");
|
||||
Gdx.app.debug("MusicController", "Playing from MLC.");
|
||||
music.play();
|
||||
music.setVolume(prefs.getFloat("music vol", 1f));
|
||||
notifyObservers(states.PLAYING);
|
||||
@@ -193,9 +193,6 @@ public class MusicController extends Observable implements OnCompletionListener,
|
||||
public void update(Observable o, Object arg) {
|
||||
if (o == musicList) {
|
||||
loadMusic();
|
||||
if (autoPlay) {
|
||||
play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,8 @@ package zero1hd.rhythmbullet.audio;
|
||||
|
||||
import java.util.Observable;
|
||||
|
||||
import javax.activity.InvalidActivityException;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
@@ -69,13 +71,19 @@ public class MusicList extends Observable {
|
||||
}
|
||||
|
||||
public AudioProcessor newAudioProcessorFromIndex(int index) {
|
||||
if (!searched) Gdx.app.debug("SongList", "Warning, this list hasn't even searched yet...");
|
||||
if (!searched) {
|
||||
Gdx.app.debug("MusicList", "Warning, this list has not completed it's search...");
|
||||
Thread.dumpStack();
|
||||
}
|
||||
return newAudioProcessor(musicList.get(index));
|
||||
}
|
||||
|
||||
|
||||
public FileHandle getSongFileHandleFromIndex(int index) {
|
||||
if (!searched) Gdx.app.debug("SongList", "Warning, this list hasn't even searched yet...");
|
||||
if (!searched) {
|
||||
Gdx.app.debug("MusicList", "Warning, this list has not completed it's search...");
|
||||
Thread.dumpStack();
|
||||
}
|
||||
return musicList.get(index);
|
||||
}
|
||||
|
||||
@@ -115,8 +123,11 @@ public class MusicList extends Observable {
|
||||
if (work) {
|
||||
musicList = obtainedAudioFiles;
|
||||
musicList.add(Gdx.files.internal("music/Alan Walker - Spectre.mp3"));
|
||||
notifyObservers();
|
||||
searched = true;
|
||||
if (work) {
|
||||
searched = true;
|
||||
Gdx.app.debug("MusicList", "recursive async search completed.");
|
||||
notifyObservers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -69,15 +69,20 @@ public class DoubleHorizontalVisualizer {
|
||||
}
|
||||
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
batch.end();
|
||||
shapeRenderer.begin(ShapeType.Filled);
|
||||
shapeRenderer.rect(x, y-2, width, y);
|
||||
shapeRenderer.rect(x, y+height, width, y+height+2);
|
||||
int beginX = x + spaceBetweenBars/2, beginY = y;
|
||||
shapeRenderer.setColor(1f, 1f, 1f, 1f);
|
||||
shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
|
||||
shapeRenderer.setTransformMatrix(batch.getTransformMatrix());
|
||||
shapeRenderer.rect(x, y, width, 2);
|
||||
shapeRenderer.rect(x, y+height-2, width, 2);
|
||||
int beginX = x + spaceBetweenBars/2, beginY = y;
|
||||
for (int bar = 0; bar < barCount; bar++) {
|
||||
shapeRenderer.rect(beginX + spaceBetweenBars*bar, beginY+height, beginX+barWidth, beginY+barHeights[bar]+height);
|
||||
shapeRenderer.rect(beginX + spaceBetweenBars*bar, beginY, beginX+barWidth, beginY+barHeights[barHeights.length - 1 - bar]);
|
||||
shapeRenderer.rect(beginX + (spaceBetweenBars+barWidth)*bar, beginY+height, barWidth, barHeights[bar]);
|
||||
shapeRenderer.rect(beginX + (spaceBetweenBars+barWidth)*bar, beginY-barHeights[barHeights.length - 1 - bar], barWidth, barHeights[barHeights.length - 1 - bar]);
|
||||
}
|
||||
shapeRenderer.end();
|
||||
batch.begin();
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
|
Reference in New Issue
Block a user