minor file location refactor, openAL sourceID reflected correctly now
This commit is contained in:
parent
0d2b48f0c2
commit
4a7f4962e2
1
core/src/zero1hd/rhythmbullet/audio/visualizer/PCMSystem.java
Normal file → Executable file
1
core/src/zero1hd/rhythmbullet/audio/visualizer/PCMSystem.java
Normal file → Executable file
@ -5,5 +5,4 @@ public interface PCMSystem {
|
||||
float[] getFrequencyBins();
|
||||
|
||||
int getWindowSize();
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.desktop.audio.visualizer;
|
||||
package zero1hd.rhythmbullet.desktop.audio;
|
||||
|
||||
import static org.lwjgl.openal.AL10.alGetSourcef;
|
||||
|
||||
@ -112,13 +112,7 @@ public class PCMObtainer implements Observer, Disposable, PCMSystem {
|
||||
|
||||
private void setMusic() {
|
||||
Gdx.app.debug("PCMObtainer", "music set.");
|
||||
try {
|
||||
Field sourceIDField = ClassReflection.getDeclaredField(OpenALMusic.class, "sourceID");
|
||||
sourceIDField.setAccessible(true);
|
||||
sourceID = (int) sourceIDField.get(mc.getCurrentMusic());
|
||||
} catch (ReflectionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
sourceID = -1;
|
||||
|
||||
channelCount = mc.getCurrentMusicHeader().getChannelCount();
|
||||
sampleRate = mc.getCurrentMusicHeader().getSampleRate();
|
||||
@ -215,6 +209,15 @@ public class PCMObtainer implements Observer, Disposable, PCMSystem {
|
||||
if (arg == mc.states.LOADED) {
|
||||
setMusic();
|
||||
} else if (arg == mc.states.PLAYING) {
|
||||
if (sourceID == -1) {
|
||||
try {
|
||||
Field sourceIDField = ClassReflection.getDeclaredField(OpenALMusic.class, "sourceID");
|
||||
sourceIDField.setAccessible(true);
|
||||
sourceID = (int) sourceIDField.get(mc.getCurrentMusic());
|
||||
} catch (ReflectionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
streamReadThread.start();
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ import com.badlogic.gdx.utils.viewport.ExtendViewport;
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.audio.MusicController;
|
||||
import zero1hd.rhythmbullet.audio.visualizer.CircularVisualizer;
|
||||
import zero1hd.rhythmbullet.desktop.audio.visualizer.PCMObtainer;
|
||||
import zero1hd.rhythmbullet.desktop.audio.PCMObtainer;
|
||||
import zero1hd.rhythmbullet.game.GameController;
|
||||
|
||||
public class GameScreen extends ScreenAdapter {
|
||||
|
@ -19,7 +19,7 @@ import com.badlogic.gdx.utils.Align;
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.audio.MusicController;
|
||||
import zero1hd.rhythmbullet.audio.visualizer.DoubleHorizontalVisualizer;
|
||||
import zero1hd.rhythmbullet.desktop.audio.visualizer.PCMObtainer;
|
||||
import zero1hd.rhythmbullet.desktop.audio.PCMObtainer;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.components.MusicControls;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.Page;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.ScrollText;
|
||||
|
Loading…
x
Reference in New Issue
Block a user