From 8cb2f4ac1b6766e62e66c8966f2012140fa5d72c Mon Sep 17 00:00:00 2001 From: Recrown Date: Thu, 13 Jul 2017 00:40:11 -0500 Subject: [PATCH] analyzer slightly better tuned --- core/src/zero1hd/polyjet/audio/AudioAnalyzer.java | 8 ++++---- core/src/zero1hd/polyjet/audio/WavAudioData.java | 2 +- core/src/zero1hd/polyjet/audio/map/GamePlayMap.java | 3 ++- .../src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java | 2 +- core/src/zero1hd/polyjet/ui/windows/VolumeWindow.java | 4 +++- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java b/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java index aad969b..1b58992 100755 --- a/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java +++ b/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java @@ -64,11 +64,11 @@ public class AudioAnalyzer { int tasksDone = 0; int totalTasks = audioData.getSampleCount()/audioData.getReadWindowSize(); - bassThresholdMultiplier = 1.5f; + bassThresholdMultiplier = 2.7f; umThresholdMultiplier = 2f; - bassBinBegin = 1; - bassBinEnd = 15; + bassBinBegin = 2; + bassBinEnd = 16; UMBinBegin = 300; UMBinEnd = 450; @@ -129,7 +129,7 @@ public class AudioAnalyzer { if (work) { Gdx.app.debug("Audio Analyzer", "Done getting spectral flux."); - + Gdx.app.debug("Audio Analyzer", "window count: " + bassSpectralFlux.size); shrinkData(); containsData = true; Gdx.app.debug("Audio Analyzer", "USING SEED: " + PUID); diff --git a/core/src/zero1hd/polyjet/audio/WavAudioData.java b/core/src/zero1hd/polyjet/audio/WavAudioData.java index ce9ef87..37c2c74 100755 --- a/core/src/zero1hd/polyjet/audio/WavAudioData.java +++ b/core/src/zero1hd/polyjet/audio/WavAudioData.java @@ -34,7 +34,7 @@ public class WavAudioData implements AudioData { @Override public void readIndexUpdate() { - readIndex = (int) (playbackMusic.getPosition() * decoder.getSampleRate() / (float)readWindowSize); + readIndex = (int) (playbackMusic.getPosition() * decoder.getSampleRate() / readWindowSize); } @Override diff --git a/core/src/zero1hd/polyjet/audio/map/GamePlayMap.java b/core/src/zero1hd/polyjet/audio/map/GamePlayMap.java index a004de0..422d06d 100755 --- a/core/src/zero1hd/polyjet/audio/map/GamePlayMap.java +++ b/core/src/zero1hd/polyjet/audio/map/GamePlayMap.java @@ -2,6 +2,7 @@ package zero1hd.polyjet.audio.map; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; +import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import zero1hd.polyjet.audio.AudioData; @@ -94,7 +95,7 @@ public class GamePlayMap { public EntitySpawnInfo safeNextEntity() { playableClip.readIndexUpdate(); if (index != playableClip.getReadIndex()) { - index = playableClip.getReadIndex(); + index = Math.max(0, playableClip.getReadIndex()-1); return nextEntity(false); } else { return null; diff --git a/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java b/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java index 9c53330..15f624c 100755 --- a/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java +++ b/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java @@ -69,7 +69,7 @@ public class RhythmMapAlgorithm implements Runnable { map.addToMap(Entities.BAR, MathUtils.round(3), - (1.5f/avgBPS)*speedMod); + (8f/avgBPS)*speedMod); } else { if (UMPeaks.get(index) != 0) { // map.addToMap(Entities.BAR, diff --git a/core/src/zero1hd/polyjet/ui/windows/VolumeWindow.java b/core/src/zero1hd/polyjet/ui/windows/VolumeWindow.java index 374f431..6175f3c 100755 --- a/core/src/zero1hd/polyjet/ui/windows/VolumeWindow.java +++ b/core/src/zero1hd/polyjet/ui/windows/VolumeWindow.java @@ -69,6 +69,8 @@ public class VolumeWindow extends Window { public void setMusic(AudioData music) { this.music = music; - music.getPlaybackMusic().setVolume(prefs.getFloat("music vol")/100f); + if (music != null) { + music.getPlaybackMusic().setVolume(prefs.getFloat("music vol")/100f); + } } }