visualizer tested and improved
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
@ -217,8 +217,8 @@ public class RhythmBullet extends Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void defineSkinStyles() {
|
public void defineSkinStyles() {
|
||||||
getDefaultSkin().add("default", Color.BLACK);
|
getDefaultSkin().add("default", Color.WHITE);
|
||||||
getDefaultSkin().add("inverse", Color.WHITE);
|
getDefaultSkin().add("inverse", Color.BLACK);
|
||||||
|
|
||||||
TextButtonStyle defaultTextButton = new TextButtonStyle();
|
TextButtonStyle defaultTextButton = new TextButtonStyle();
|
||||||
defaultTextButton.up = getDefaultSkin().getDrawable("default-round");
|
defaultTextButton.up = getDefaultSkin().getDrawable("default-round");
|
||||||
|
@ -12,7 +12,7 @@ import zero1hd.rhythmbullet.util.MiniSender;
|
|||||||
|
|
||||||
public class AudioAnalyzer {
|
public class AudioAnalyzer {
|
||||||
private boolean containsData;
|
private boolean containsData;
|
||||||
private CoreMusicInfo musicInfo;
|
private MusicDataPack musicInfo;
|
||||||
|
|
||||||
float[] audioPCM;
|
float[] audioPCM;
|
||||||
float[] spectrum;
|
float[] spectrum;
|
||||||
@ -56,7 +56,7 @@ public class AudioAnalyzer {
|
|||||||
private float secondsPerWindow;
|
private float secondsPerWindow;
|
||||||
|
|
||||||
private AudioDataPackage pack;
|
private AudioDataPackage pack;
|
||||||
public AudioAnalyzer(CoreMusicInfo audiofile) {
|
public AudioAnalyzer(MusicDataPack audiofile) {
|
||||||
sender = new MiniSender();
|
sender = new MiniSender();
|
||||||
|
|
||||||
analysisAlgorithm = () -> {
|
analysisAlgorithm = () -> {
|
||||||
|
@ -9,7 +9,7 @@ public class AudioDataPackage {
|
|||||||
private FloatArray mPeaks;
|
private FloatArray mPeaks;
|
||||||
private FloatArray umPeaks;
|
private FloatArray umPeaks;
|
||||||
|
|
||||||
private CoreMusicInfo musicInfo;
|
private MusicDataPack musicInfo;
|
||||||
|
|
||||||
private float bassMaxVal, bassAvg;
|
private float bassMaxVal, bassAvg;
|
||||||
private float mMaxVal, mAvg;
|
private float mMaxVal, mAvg;
|
||||||
@ -64,7 +64,7 @@ public class AudioDataPackage {
|
|||||||
this.uMAvg = uMAvg;
|
this.uMAvg = uMAvg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMusicInfo(CoreMusicInfo musicInfo) {
|
public void setMusicInfo(MusicDataPack musicInfo) {
|
||||||
if (this.musicInfo != null) {
|
if (this.musicInfo != null) {
|
||||||
throw new InvalidParameterException("There is already music information in this package.");
|
throw new InvalidParameterException("There is already music information in this package.");
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ public class AudioDataPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreMusicInfo getMusicInfo() {
|
public MusicDataPack getMusicInfo() {
|
||||||
if (musicInfo == null) {
|
if (musicInfo == null) {
|
||||||
throw new NullPointerException("Music info hasn't been baked in...");
|
throw new NullPointerException("Music info hasn't been baked in...");
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import javazoom.jl.decoder.Header;
|
|||||||
import javazoom.jl.decoder.MP3Decoder;
|
import javazoom.jl.decoder.MP3Decoder;
|
||||||
import javazoom.jl.decoder.OutputBuffer;
|
import javazoom.jl.decoder.OutputBuffer;
|
||||||
|
|
||||||
public class Mp3AudioData implements CoreMusicInfo {
|
public class Mp3AudioData implements MusicDataPack {
|
||||||
private int readWindowSize = 1024;
|
private int readWindowSize = 1024;
|
||||||
|
|
||||||
private int currentReadWindowIndex;
|
private int currentReadWindowIndex;
|
||||||
|
@ -4,7 +4,7 @@ package zero1hd.rhythmbullet.audio;
|
|||||||
import com.badlogic.gdx.audio.Music;
|
import com.badlogic.gdx.audio.Music;
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
|
||||||
public interface CoreMusicInfo extends Disposable {
|
public interface MusicDataPack extends Disposable {
|
||||||
/**
|
/**
|
||||||
* sets a integer variable to the current window of audio data the playback is at.
|
* sets a integer variable to the current window of audio data the playback is at.
|
||||||
* Useful for efficiency because we compute once for that frame then get the values everytime it is required instead of calculating every time we get the index.
|
* Useful for efficiency because we compute once for that frame then get the values everytime it is required instead of calculating every time we get the index.
|
123
core/src/zero1hd/rhythmbullet/audio/SongController.java
Executable file
@ -0,0 +1,123 @@
|
|||||||
|
package zero1hd.rhythmbullet.audio;
|
||||||
|
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.audio.Music;
|
||||||
|
import com.badlogic.gdx.audio.Music.OnCompletionListener;
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
|
import zero1hd.rhythmbullet.events.OnDifferentSongListener;
|
||||||
|
|
||||||
|
public class SongController implements OnCompletionListener {
|
||||||
|
private SongList songList;
|
||||||
|
private MusicDataPack mdp;
|
||||||
|
private int currentPlaybackID;
|
||||||
|
private boolean autoPlay;
|
||||||
|
private boolean shuffle;
|
||||||
|
private Random rand;
|
||||||
|
|
||||||
|
private Array<OnDifferentSongListener> listeners;
|
||||||
|
|
||||||
|
public SongController(SongList songList) {
|
||||||
|
if (songList == null) throw new NullPointerException("song list is null...");
|
||||||
|
if (!songList.isSearched()) throw new InvalidParameterException("Song list has to be searched already.");
|
||||||
|
listeners = new Array<>();
|
||||||
|
this.songList = songList;
|
||||||
|
updateSong();
|
||||||
|
rand = new Random();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void play() {
|
||||||
|
mdp.getPlaybackMusic().play();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSongByIndex(int index) {
|
||||||
|
this.currentPlaybackID = index;
|
||||||
|
updateSong();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void skip() {
|
||||||
|
currentPlaybackID++;
|
||||||
|
updateSong();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void previous() {
|
||||||
|
currentPlaybackID--;
|
||||||
|
updateSong();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCompletion(Music music) {
|
||||||
|
if (autoPlay) {
|
||||||
|
if (shuffle) {
|
||||||
|
currentPlaybackID = rand.nextInt(songList.getAmountOfSongs());
|
||||||
|
} else {
|
||||||
|
currentPlaybackID++;
|
||||||
|
if (currentPlaybackID > songList.getAmountOfSongs()) {
|
||||||
|
currentPlaybackID = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateSong();
|
||||||
|
play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shuffle() {
|
||||||
|
currentPlaybackID = rand.nextInt(songList.getAmountOfSongs());
|
||||||
|
updateSong();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoPlay(boolean autoPlay) {
|
||||||
|
this.autoPlay = autoPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShuffle(boolean shuffle) {
|
||||||
|
this.shuffle = shuffle;
|
||||||
|
shuffle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isShuffle() {
|
||||||
|
return shuffle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoPlay() {
|
||||||
|
return autoPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSong() {
|
||||||
|
if (mdp != null) {
|
||||||
|
mdp.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mdp = songList.getMusicInfoFromIndex(currentPlaybackID);
|
||||||
|
if (mdp == null) {
|
||||||
|
mdp = songList.getAudioData(Gdx.files.internal("music/default.mp3"));
|
||||||
|
}
|
||||||
|
mdp.getPlaybackMusic().setOnCompletionListener(this);
|
||||||
|
sendEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SongList getSongList() {
|
||||||
|
return songList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendEvent() {
|
||||||
|
for (int i = 0; i < listeners.size; i++) {
|
||||||
|
listeners.get(i).onDifferentSong(mdp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOnDifferentSongListener(OnDifferentSongListener listener) {
|
||||||
|
listeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeListener(OnDifferentSongListener listener) {
|
||||||
|
listeners.removeValue(listener, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MusicDataPack getCurrentSong() {
|
||||||
|
return mdp;
|
||||||
|
}
|
||||||
|
}
|
@ -7,12 +7,13 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
public class SongList {
|
public class SongList {
|
||||||
private Array<FileHandle> songList;
|
private Array<FileHandle> songList;
|
||||||
private String searchPath;
|
private String searchPath;
|
||||||
|
private boolean searched;
|
||||||
public SongList() {
|
public SongList() {
|
||||||
songList = new Array<>();
|
songList = new Array<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
|
searched = true;
|
||||||
songList.addAll(Gdx.files.absolute(searchPath).list((dir, name) -> {
|
songList.addAll(Gdx.files.absolute(searchPath).list((dir, name) -> {
|
||||||
if (name.endsWith("mp3") || name.endsWith("wav")) {
|
if (name.endsWith("mp3") || name.endsWith("wav")) {
|
||||||
return true;
|
return true;
|
||||||
@ -25,7 +26,7 @@ public class SongList {
|
|||||||
this.searchPath = searchPath;
|
this.searchPath = searchPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreMusicInfo getAudioData(FileHandle file) {
|
public MusicDataPack getAudioData(FileHandle file) {
|
||||||
if (file.extension().equalsIgnoreCase("wav")) {
|
if (file.extension().equalsIgnoreCase("wav")) {
|
||||||
return new WavAudioData(file);
|
return new WavAudioData(file);
|
||||||
} else if (file.extension().equalsIgnoreCase("mp3")) {
|
} else if (file.extension().equalsIgnoreCase("mp3")) {
|
||||||
@ -34,15 +35,30 @@ public class SongList {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreMusicInfo getMusicInfoFromIndex(int index) {
|
public MusicDataPack getMusicInfoFromIndex(int index) {
|
||||||
|
if (index > songList.size) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return getAudioData(songList.get(index));
|
return getAudioData(songList.get(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAmountOfSongs() {
|
||||||
|
return songList.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileHandle getSongFileHandleFromIndex(int index) {
|
||||||
|
if (!searched) Gdx.app.debug("SongList", "Warning, this list hasn't even searched yet...");
|
||||||
|
if (index > songList.size) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return songList.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
public Array<FileHandle> getSongList() {
|
public Array<FileHandle> getSongList() {
|
||||||
return songList;
|
return songList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAmountOfSongs() {
|
public boolean isSearched() {
|
||||||
return songList.size;
|
return searched;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import com.badlogic.gdx.files.FileHandle;
|
|||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.wavedecoder.WavDecoder;
|
import zero1hd.rhythmbullet.audio.wavedecoder.WavDecoder;
|
||||||
|
|
||||||
public class WavAudioData implements CoreMusicInfo {
|
public class WavAudioData implements MusicDataPack {
|
||||||
private int readWindowSize = 1024;
|
private int readWindowSize = 1024;
|
||||||
private AudioFormat format;
|
private AudioFormat format;
|
||||||
private int readIndex;
|
private int readIndex;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package zero1hd.rhythmbullet.audio.map;
|
package zero1hd.rhythmbullet.audio.map;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
import zero1hd.rhythmbullet.entity.Entity;
|
import zero1hd.rhythmbullet.entity.Entity;
|
||||||
import zero1hd.rhythmbullet.entity.EntityFrame;
|
import zero1hd.rhythmbullet.entity.EntityFrame;
|
||||||
import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
|
import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
|
||||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
|
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
|
||||||
|
|
||||||
public class GamePlayMap {
|
public class GamePlayMap {
|
||||||
private CoreMusicInfo musicData;
|
private MusicDataPack musicData;
|
||||||
private MapWindowData[] spawnList;
|
private MapWindowData[] spawnList;
|
||||||
private boolean building;
|
private boolean building;
|
||||||
private int index;
|
private int index;
|
||||||
@ -17,7 +17,7 @@ public class GamePlayMap {
|
|||||||
* GamePlayMap is what the game area will use to generate entities and judge current audio data
|
* GamePlayMap is what the game area will use to generate entities and judge current audio data
|
||||||
* @param audioData audio data
|
* @param audioData audio data
|
||||||
*/
|
*/
|
||||||
public GamePlayMap(CoreMusicInfo audioData, int totalWindows) {
|
public GamePlayMap(MusicDataPack audioData, int totalWindows) {
|
||||||
this.musicData = audioData;
|
this.musicData = audioData;
|
||||||
spawnList = new MapWindowData[totalWindows];
|
spawnList = new MapWindowData[totalWindows];
|
||||||
hudType = new byte[totalWindows];
|
hudType = new byte[totalWindows];
|
||||||
@ -68,7 +68,7 @@ public class GamePlayMap {
|
|||||||
index = spawnList.length-1;
|
index = spawnList.length-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreMusicInfo getMusicData() {
|
public MusicDataPack getMusicData() {
|
||||||
return musicData;
|
return musicData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,9 @@ import com.badlogic.gdx.graphics.Pixmap;
|
|||||||
import com.badlogic.gdx.graphics.Pixmap.Format;
|
import com.badlogic.gdx.graphics.Pixmap.Format;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
|
|
||||||
public class HorizontalVisualizer extends VisualizerCore {
|
public class HorizontalVisualizer extends VisualizerCore {
|
||||||
private Pixmap pixmap;
|
private Pixmap pixmap;
|
||||||
@ -24,31 +25,34 @@ public class HorizontalVisualizer extends VisualizerCore {
|
|||||||
pixmap.fill();
|
pixmap.fill();
|
||||||
bar = new Texture(pixmap);
|
bar = new Texture(pixmap);
|
||||||
pixmap.dispose();
|
pixmap.dispose();
|
||||||
barCount = 64;
|
barCount = 70;
|
||||||
|
|
||||||
barWidth = width/barCount;
|
barWidth = width/barCount;
|
||||||
|
spaceBetweenBars = 10;
|
||||||
|
barWidth -= spaceBetweenBars;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Batch batch, float parentAlpha) {
|
public void render(Batch batch, float parentAlpha) {
|
||||||
if (cmi != null) {
|
if (cmi != null) {
|
||||||
for (int i = 0; i < barCount; i++) {
|
for (int i = 0; i < barCount; i++) {
|
||||||
int currentBinAvg = 0;
|
float currentBinAvg = 0;
|
||||||
for (int j = i; j < binsPerBar; j++) {
|
for (int j = 0; j < binsPerBar+4; j++) {
|
||||||
currentBinAvg += audioPCM[j];
|
currentBinAvg += audioPCM[j+i*binsPerBar];
|
||||||
}
|
}
|
||||||
currentBinAvg /= binsPerBar;
|
currentBinAvg /= binsPerBar;
|
||||||
|
// currentBinAvg = (int) audioPCM[i];
|
||||||
batch.draw(bar, xPos + i*(barWidth+spaceBetweenBars), yPos, barWidth, currentBinAvg*height);
|
batch.draw(bar, xPos + i*(barWidth+spaceBetweenBars), yPos, barWidth, currentBinAvg*2 +1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.render(batch, parentAlpha);
|
super.render(batch, parentAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCmi(CoreMusicInfo cmi) {
|
public void setMDP(MusicDataPack mdp) {
|
||||||
binsPerBar = audioPCM.length/barCount;
|
super.setMDP(mdp);
|
||||||
super.setCmi(cmi);
|
float validBins = (5000/((mdp.getSampleRate()/2)/((audioPCM.length/2)+1)));
|
||||||
|
Gdx.app.debug("Visualizer", "valid frequency bins " + validBins);
|
||||||
|
binsPerBar = MathUtils.round((validBins/barCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package zero1hd.rhythmbullet.audio.visualizer;
|
package zero1hd.rhythmbullet.audio.visualizer;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
|
||||||
import edu.emory.mathcs.jtransforms.fft.FloatFFT_1D;
|
import edu.emory.mathcs.jtransforms.fft.FloatFFT_1D;
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
|
|
||||||
public class VisualizerCore implements Disposable {
|
public class VisualizerCore implements Disposable {
|
||||||
protected CoreMusicInfo cmi;
|
protected MusicDataPack cmi;
|
||||||
private FloatFFT_1D fft;
|
private FloatFFT_1D fft;
|
||||||
float[] audioPCM;
|
float[] audioPCM;
|
||||||
protected int width, height;
|
protected int width, height;
|
||||||
@ -16,6 +15,10 @@ public class VisualizerCore implements Disposable {
|
|||||||
protected int barCount;
|
protected int barCount;
|
||||||
|
|
||||||
public VisualizerCore(int width, int height, int x, int y) {
|
public VisualizerCore(int width, int height, int x, int y) {
|
||||||
|
this.height = height;
|
||||||
|
this.width = width;
|
||||||
|
this.xPos = x;
|
||||||
|
this.yPos = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
@ -23,27 +26,25 @@ public class VisualizerCore implements Disposable {
|
|||||||
if (cmi.getPlaybackIndexPosition() > cmi.getCurrentReadWindowIndex()) {
|
if (cmi.getPlaybackIndexPosition() > cmi.getCurrentReadWindowIndex()) {
|
||||||
cmi.readSamples(audioPCM);
|
cmi.readSamples(audioPCM);
|
||||||
fft.realForward(audioPCM);
|
fft.realForward(audioPCM);
|
||||||
Gdx.app.debug("Visualizer", "Skipping a frame to catch up to music.");
|
// Gdx.app.debug("Visualizer", "Proper read");
|
||||||
} else {
|
} else {
|
||||||
Gdx.app.debug("Visualizer", "Not reading so music can catch up.");
|
// System.out.println(audioPCM[16]);
|
||||||
|
// Gdx.app.debug("Visualizer", "Not reading so music can catch up.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCmi(CoreMusicInfo cmi) {
|
public void setMDP(MusicDataPack cmi) {
|
||||||
this.cmi = cmi;
|
this.cmi = cmi;
|
||||||
fft = new FloatFFT_1D(cmi.getReadWindowSize());
|
fft = new FloatFFT_1D(cmi.getReadWindowSize());
|
||||||
audioPCM = new float[cmi.getReadWindowSize()];
|
audioPCM = new float[cmi.getReadWindowSize()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Batch batch, float parentAlpha) {
|
public void render(Batch batch, float parentAlpha) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
12
core/src/zero1hd/rhythmbullet/events/OnDifferentSongListener.java
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
package zero1hd.rhythmbullet.events;
|
||||||
|
|
||||||
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
|
|
||||||
|
public interface OnDifferentSongListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called whenever the Song Controller moves to a different song.
|
||||||
|
* @param mdp contains the next songs basic music system.
|
||||||
|
*/
|
||||||
|
public void onDifferentSong(MusicDataPack mdp);
|
||||||
|
}
|
@ -14,7 +14,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
import zero1hd.rhythmbullet.audio.map.GamePlayMap;
|
import zero1hd.rhythmbullet.audio.map.GamePlayMap;
|
||||||
import zero1hd.rhythmbullet.stages.GameHUD;
|
import zero1hd.rhythmbullet.stages.GameHUD;
|
||||||
import zero1hd.rhythmbullet.stages.GamePlayArea;
|
import zero1hd.rhythmbullet.stages.GamePlayArea;
|
||||||
@ -27,7 +27,7 @@ public class GameScreen extends ScreenAdapter {
|
|||||||
protected InputMultiplexer inputs;
|
protected InputMultiplexer inputs;
|
||||||
public RhythmBullet core;
|
public RhythmBullet core;
|
||||||
|
|
||||||
private CoreMusicInfo music;
|
private MusicDataPack music;
|
||||||
|
|
||||||
private ShaderProgram gaussianBlurShader;
|
private ShaderProgram gaussianBlurShader;
|
||||||
private ShaderProgram brightFilterShader;
|
private ShaderProgram brightFilterShader;
|
||||||
|
@ -12,6 +12,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
|||||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
|
import zero1hd.rhythmbullet.audio.SongController;
|
||||||
import zero1hd.rhythmbullet.audio.SongList;
|
import zero1hd.rhythmbullet.audio.SongList;
|
||||||
import zero1hd.rhythmbullet.ui.pages.CreditsPage;
|
import zero1hd.rhythmbullet.ui.pages.CreditsPage;
|
||||||
import zero1hd.rhythmbullet.ui.pages.MainPage;
|
import zero1hd.rhythmbullet.ui.pages.MainPage;
|
||||||
@ -30,16 +31,22 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
|
|
||||||
private RhythmBullet core;
|
private RhythmBullet core;
|
||||||
|
|
||||||
private SongList songList;
|
private SongController sc;
|
||||||
private float lerpAlpha;
|
private float lerpAlpha;
|
||||||
public MainMenu(final RhythmBullet core) {
|
public MainMenu(final RhythmBullet core) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
stage = new Stage(new ScreenViewport());
|
stage = new Stage(new ScreenViewport());
|
||||||
targetPosition = new Vector3(stage.getCamera().position);
|
targetPosition = new Vector3(stage.getCamera().position);
|
||||||
|
|
||||||
songList = new SongList();
|
SongList songList = new SongList();
|
||||||
songList.setSearchPath(core.getPrefs().getString("music dir"));
|
songList.setSearchPath(core.getPrefs().getString("music dir"));
|
||||||
songList.refresh();
|
songList.refresh();
|
||||||
|
|
||||||
|
sc = new SongController(songList);
|
||||||
|
sc.setAutoPlay(true);
|
||||||
|
sc.setShuffle(true);
|
||||||
|
sc.play();
|
||||||
|
|
||||||
postTransition();
|
postTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,14 +61,14 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postTransition() {
|
public void postTransition() {
|
||||||
mainPage = new MainPage(core, targetPosition, songList);
|
mainPage = new MainPage(core, targetPosition, sc);
|
||||||
mainPage.setPosition(0, 0);
|
mainPage.setPosition(0, 0);
|
||||||
stage.addActor(mainPage);
|
stage.addActor(mainPage);
|
||||||
|
|
||||||
//End main menu
|
//End main menu
|
||||||
moreOptionsPage = new MoreOptionsPage(core, targetPosition);
|
moreOptionsPage = new MoreOptionsPage(core, targetPosition);
|
||||||
|
|
||||||
optionsPage = new OptionsPage(core, targetPosition, moreOptionsPage, songList);
|
optionsPage = new OptionsPage(core, targetPosition, moreOptionsPage, sc.getSongList());
|
||||||
optionsPage.setPosition(Gdx.graphics.getWidth(), 0);
|
optionsPage.setPosition(Gdx.graphics.getWidth(), 0);
|
||||||
stage.addActor(optionsPage);
|
stage.addActor(optionsPage);
|
||||||
|
|
||||||
@ -131,7 +138,9 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
if (stage.getCamera().position.x != targetPosition.x || stage.getCamera().position.y != targetPosition.y) {
|
if (stage.getCamera().position.x != targetPosition.x || stage.getCamera().position.y != targetPosition.y) {
|
||||||
stage.getCamera().position.lerp(targetPosition, lerpAlpha);
|
stage.getCamera().position.lerp(targetPosition, lerpAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sc.getCurrentSong().playbackIndexUpdate();
|
||||||
|
|
||||||
super.render(delta);
|
super.render(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@ import com.badlogic.gdx.math.MathUtils;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.utils.FloatArray;
|
import com.badlogic.gdx.utils.FloatArray;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
|
|
||||||
public class AudioGraph extends Actor {
|
public class AudioGraph extends Actor {
|
||||||
private CoreMusicInfo audioData;
|
private MusicDataPack audioData;
|
||||||
ShapeRenderer shapeRender;
|
ShapeRenderer shapeRender;
|
||||||
FloatArray mainGraph;
|
FloatArray mainGraph;
|
||||||
FloatArray overlayGraph;
|
FloatArray overlayGraph;
|
||||||
@ -134,7 +134,7 @@ public class AudioGraph extends Actor {
|
|||||||
* @param dataSet2 overlay graph. This one can be null.
|
* @param dataSet2 overlay graph. This one can be null.
|
||||||
* @param audioData actual basic audio information for index position
|
* @param audioData actual basic audio information for index position
|
||||||
*/
|
*/
|
||||||
public void setGraphingData(FloatArray dataSet1, FloatArray dataSet2, CoreMusicInfo audioData) {
|
public void setGraphingData(FloatArray dataSet1, FloatArray dataSet2, MusicDataPack audioData) {
|
||||||
this.mainGraph = dataSet1;
|
this.mainGraph = dataSet1;
|
||||||
this.overlayGraph = dataSet2;
|
this.overlayGraph = dataSet2;
|
||||||
if (dataSet2 == null) {
|
if (dataSet2 == null) {
|
||||||
|
@ -9,10 +9,10 @@ import com.badlogic.gdx.math.MathUtils;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.utils.FloatArray;
|
import com.badlogic.gdx.utils.FloatArray;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
|
|
||||||
public class AudioGraphRelation extends Actor {
|
public class AudioGraphRelation extends Actor {
|
||||||
private CoreMusicInfo audioData;
|
private MusicDataPack audioData;
|
||||||
ShapeRenderer shapeRender;
|
ShapeRenderer shapeRender;
|
||||||
FloatArray mainGraph;
|
FloatArray mainGraph;
|
||||||
FloatArray overlayGraph;
|
FloatArray overlayGraph;
|
||||||
@ -134,7 +134,7 @@ public class AudioGraphRelation extends Actor {
|
|||||||
* @param dataSet2 overlay graph. This one can be null.
|
* @param dataSet2 overlay graph. This one can be null.
|
||||||
* @param audioData actual basic audio information for index position
|
* @param audioData actual basic audio information for index position
|
||||||
*/
|
*/
|
||||||
public void setGraphingData(FloatArray dataSet1, FloatArray dataSet2, CoreMusicInfo audioData) {
|
public void setGraphingData(FloatArray dataSet1, FloatArray dataSet2, MusicDataPack audioData) {
|
||||||
this.mainGraph = dataSet1;
|
this.mainGraph = dataSet1;
|
||||||
this.overlayGraph = dataSet2;
|
this.overlayGraph = dataSet2;
|
||||||
if (dataSet2 == null) {
|
if (dataSet2 == null) {
|
||||||
|
@ -19,7 +19,7 @@ import com.badlogic.gdx.utils.Disposable;
|
|||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
import zero1hd.rhythmbullet.audio.AudioAnalyzer;
|
import zero1hd.rhythmbullet.audio.AudioAnalyzer;
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
import zero1hd.rhythmbullet.audio.SongInfo;
|
import zero1hd.rhythmbullet.audio.SongInfo;
|
||||||
import zero1hd.rhythmbullet.audio.map.GamePlayMap;
|
import zero1hd.rhythmbullet.audio.map.GamePlayMap;
|
||||||
import zero1hd.rhythmbullet.audio.map.RhythmMapAlgorithm;
|
import zero1hd.rhythmbullet.audio.map.RhythmMapAlgorithm;
|
||||||
@ -32,7 +32,7 @@ public class AnalyzePage extends Page implements MiniListener, Disposable {
|
|||||||
private AnalyzePage ap = this;
|
private AnalyzePage ap = this;
|
||||||
|
|
||||||
AudioAnalyzer audioAnalyzer;
|
AudioAnalyzer audioAnalyzer;
|
||||||
CoreMusicInfo music;
|
MusicDataPack music;
|
||||||
RhythmMapAlgorithm mapGenAlgorithm;
|
RhythmMapAlgorithm mapGenAlgorithm;
|
||||||
|
|
||||||
private Table songInfo;
|
private Table songInfo;
|
||||||
@ -186,7 +186,7 @@ public class AnalyzePage extends Page implements MiniListener, Disposable {
|
|||||||
addActor(back);
|
addActor(back);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSong(CoreMusicInfo music, SongInfo audioInfo, MiniListener listener) {
|
public void setSong(MusicDataPack music, SongInfo audioInfo, MiniListener listener) {
|
||||||
confirmed = false;
|
confirmed = false;
|
||||||
confirmDiffButton.setDisabled(false);
|
confirmDiffButton.setDisabled(false);
|
||||||
sensitivityRating.setDisabled(false);
|
sensitivityRating.setDisabled(false);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package zero1hd.rhythmbullet.ui.pages;
|
package zero1hd.rhythmbullet.ui.pages;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
@ -17,12 +15,13 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
import zero1hd.rhythmbullet.audio.SongList;
|
import zero1hd.rhythmbullet.audio.SongController;
|
||||||
import zero1hd.rhythmbullet.audio.visualizer.HorizontalVisualizer;
|
import zero1hd.rhythmbullet.audio.visualizer.HorizontalVisualizer;
|
||||||
|
import zero1hd.rhythmbullet.events.OnDifferentSongListener;
|
||||||
import zero1hd.rhythmbullet.screens.PreGameScreen;
|
import zero1hd.rhythmbullet.screens.PreGameScreen;
|
||||||
|
|
||||||
public class MainPage extends Page {
|
public class MainPage extends Page implements OnDifferentSongListener {
|
||||||
private Image title;
|
private Image title;
|
||||||
private Label versionLabel;
|
private Label versionLabel;
|
||||||
private TextButton options;
|
private TextButton options;
|
||||||
@ -32,17 +31,13 @@ public class MainPage extends Page {
|
|||||||
private TextButton credits;
|
private TextButton credits;
|
||||||
private WidgetGroup playButton;
|
private WidgetGroup playButton;
|
||||||
|
|
||||||
|
private SongController sc;
|
||||||
private HorizontalVisualizer hvisual;
|
private HorizontalVisualizer hvisual;
|
||||||
private CoreMusicInfo cmi;
|
public MainPage(RhythmBullet core, Vector3 targetPosition, SongController sc) {
|
||||||
private SongList songList;
|
|
||||||
private Random rand;
|
|
||||||
public MainPage(RhythmBullet core, Vector3 targetPosition, SongList sl) {
|
|
||||||
hvisual = new HorizontalVisualizer();
|
hvisual = new HorizontalVisualizer();
|
||||||
this.songList = sl;
|
this.sc = sc;
|
||||||
rand = new Random();
|
sc.addOnDifferentSongListener(this);
|
||||||
|
hvisual.setMDP(sc.getCurrentSong());
|
||||||
cmi = songList.getMusicInfoFromIndex(rand.nextInt(songList.getAmountOfSongs()));
|
|
||||||
hvisual.setCmi(cmi);
|
|
||||||
|
|
||||||
title = new Image(core.getAssetManager().get("title.png", Texture.class));
|
title = new Image(core.getAssetManager().get("title.png", Texture.class));
|
||||||
title.setPosition(10, getHeight() - title.getHeight()-30);
|
title.setPosition(10, getHeight() - title.getHeight()-30);
|
||||||
@ -115,7 +110,7 @@ public class MainPage extends Page {
|
|||||||
Actions.run(new Runnable() {
|
Actions.run(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
core.setScreen(new PreGameScreen(core, songList));
|
core.setScreen(new PreGameScreen(core, sc.getSongList()));
|
||||||
}
|
}
|
||||||
}), Actions.parallel(Actions.scaleTo(1, 1), Actions.alpha(0.6f))));
|
}), Actions.parallel(Actions.scaleTo(1, 1), Actions.alpha(0.6f))));
|
||||||
}
|
}
|
||||||
@ -132,4 +127,9 @@ public class MainPage extends Page {
|
|||||||
hvisual.render(batch, parentAlpha);
|
hvisual.render(batch, parentAlpha);
|
||||||
super.draw(batch, parentAlpha);
|
super.draw(batch, parentAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDifferentSong(MusicDataPack mdp) {
|
||||||
|
hvisual.setMDP(mdp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public class MusicSelectionPage extends Page {
|
|||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
for (int i = 0; i < songList.getAmountOfSongs(); i++) {
|
for (int i = 0; i < songList.getAmountOfSongs(); i++) {
|
||||||
MusicSelectable selectable = new MusicSelectable(songList.getSongList().get(i), musicFileAnnotation, skin, assets.get("defaultCover.png", Texture.class));
|
MusicSelectable selectable = new MusicSelectable(songList.getSongFileHandleFromIndex(i), musicFileAnnotation, skin, assets.get("defaultCover.png", Texture.class));
|
||||||
selectables.add(selectable);
|
selectables.add(selectable);
|
||||||
songTable.add(selectable);
|
songTable.add(selectable);
|
||||||
songTable.row();
|
songTable.row();
|
||||||
|
@ -10,12 +10,12 @@ import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.AudioDataPackage;
|
import zero1hd.rhythmbullet.audio.AudioDataPackage;
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
|
|
||||||
public class BeatViewer extends Window {
|
public class BeatViewer extends Window {
|
||||||
Pixmap lights;
|
Pixmap lights;
|
||||||
int songIndex;
|
int songIndex;
|
||||||
CoreMusicInfo music;
|
MusicDataPack music;
|
||||||
Texture lightOn;
|
Texture lightOn;
|
||||||
private AudioDataPackage data;
|
private AudioDataPackage data;
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ public class BeatViewer extends Window {
|
|||||||
super.act(delta);
|
super.act(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMusic(CoreMusicInfo audioData, AudioDataPackage adp) {
|
public void setMusic(MusicDataPack audioData, AudioDataPackage adp) {
|
||||||
this.music = audioData;
|
this.music = audioData;
|
||||||
this.data = adp;
|
this.data = adp;
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,13 @@ import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
|
|
||||||
public class MusicController extends Window implements OnCompletionListener {
|
public class MusicController extends Window implements OnCompletionListener {
|
||||||
Skin skin;
|
Skin skin;
|
||||||
private Image togglePlay;
|
private Image togglePlay;
|
||||||
private TextField info;
|
private TextField info;
|
||||||
private CoreMusicInfo audiofile;
|
private MusicDataPack audiofile;
|
||||||
|
|
||||||
public MusicController(final Skin skin) {
|
public MusicController(final Skin skin) {
|
||||||
super("Playback Controller", skin, "tinted");
|
super("Playback Controller", skin, "tinted");
|
||||||
@ -110,7 +110,7 @@ public class MusicController extends Window implements OnCompletionListener {
|
|||||||
setSize(260, 75);
|
setSize(260, 75);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAudiofile(CoreMusicInfo audiofile) {
|
public void setAudiofile(MusicDataPack audiofile) {
|
||||||
this.audiofile = audiofile;
|
this.audiofile = audiofile;
|
||||||
if (audiofile == null) {
|
if (audiofile == null) {
|
||||||
togglePlay.setDrawable(skin.getDrawable("loading"));
|
togglePlay.setDrawable(skin.getDrawable("loading"));
|
||||||
@ -125,7 +125,7 @@ public class MusicController extends Window implements OnCompletionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreMusicInfo getAudiofile() {
|
public MusicDataPack getAudiofile() {
|
||||||
return audiofile;
|
return audiofile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
import zero1hd.rhythmbullet.audio.SongList;
|
import zero1hd.rhythmbullet.audio.SongList;
|
||||||
import zero1hd.rhythmbullet.util.MiniEvents;
|
import zero1hd.rhythmbullet.util.MiniEvents;
|
||||||
import zero1hd.rhythmbullet.util.MiniSender;
|
import zero1hd.rhythmbullet.util.MiniSender;
|
||||||
@ -88,7 +88,7 @@ public class MusicSelector extends Window {
|
|||||||
return isBack;
|
return isBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreMusicInfo getSelectedMusic() {
|
public MusicDataPack getSelectedMusic() {
|
||||||
if (selectedMusic != null) {
|
if (selectedMusic != null) {
|
||||||
return songList.getAudioData(selectedMusic);
|
return songList.getAudioData(selectedMusic);
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,7 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Slider;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.CoreMusicInfo;
|
import zero1hd.rhythmbullet.audio.MusicDataPack;
|
||||||
|
|
||||||
public class VolumeWindow extends Window {
|
public class VolumeWindow extends Window {
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class VolumeWindow extends Window {
|
|||||||
private Slider musicVolSlider;
|
private Slider musicVolSlider;
|
||||||
private Preferences prefs;
|
private Preferences prefs;
|
||||||
|
|
||||||
private CoreMusicInfo music;
|
private MusicDataPack music;
|
||||||
public VolumeWindow(String title, Skin skin, Preferences prefs) {
|
public VolumeWindow(String title, Skin skin, Preferences prefs) {
|
||||||
super(title, skin, "tinted");
|
super(title, skin, "tinted");
|
||||||
this.prefs = prefs;
|
this.prefs = prefs;
|
||||||
@ -67,7 +67,7 @@ public class VolumeWindow extends Window {
|
|||||||
prefs.flush();
|
prefs.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMusic(CoreMusicInfo music) {
|
public void setMusic(MusicDataPack music) {
|
||||||
this.music = music;
|
this.music = music;
|
||||||
if (music != null) {
|
if (music != null) {
|
||||||
music.getPlaybackMusic().setVolume(prefs.getFloat("music vol")/100f);
|
music.getPlaybackMusic().setVolume(prefs.getFloat("music vol")/100f);
|
||||||
|