summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gpu/effect.cc5
-rw-r--r--src/gpu/effect.h2
-rw-r--r--src/gpu/gpu.cc4
-rw-r--r--src/gpu/gpu.h2
-rw-r--r--src/main.cc2
-rw-r--r--src/test_demo.cc3
6 files changed, 10 insertions, 8 deletions
diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc
index a1b45f1..df8ef2d 100644
--- a/src/gpu/effect.cc
+++ b/src/gpu/effect.cc
@@ -2,6 +2,7 @@
// It implements the Sequence management logic.
#include "effect.h"
+#include "audio/tracker.h"
#include "gpu/demo_effects.h"
#include "gpu/gpu.h"
#include <algorithm>
@@ -383,8 +384,8 @@ void MainSequence::shutdown() {
}
#if !defined(STRIP_ALL)
-void MainSequence::simulate_until(float target_time, float step_rate) {
- const float bpm = 128.0f;
+void MainSequence::simulate_until(float target_time, float step_rate,
+ float bpm) {
const float aspect_ratio = 16.0f / 9.0f;
for (float t = 0.0f; t < target_time; t += step_rate) {
WGPUCommandEncoder encoder =
diff --git a/src/gpu/effect.h b/src/gpu/effect.h
index 19b8118..6ed2c55 100644
--- a/src/gpu/effect.h
+++ b/src/gpu/effect.h
@@ -113,7 +113,7 @@ class MainSequence {
void shutdown();
#if !defined(STRIP_ALL)
- void simulate_until(float target_time, float step_rate);
+ void simulate_until(float target_time, float step_rate, float bpm = 120.0f);
#endif /* !defined(STRIP_ALL) */
private:
diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc
index 9776eac..025ea99 100644
--- a/src/gpu/gpu.cc
+++ b/src/gpu/gpu.cc
@@ -391,8 +391,8 @@ void gpu_resize(int width, int height) {
}
#if !defined(STRIP_ALL)
-void gpu_simulate_until(float time) {
- g_main_sequence.simulate_until(time, 1.0f / 60.0f);
+void gpu_simulate_until(float time, float bpm) {
+ g_main_sequence.simulate_until(time, 1.0f / 60.0f, bpm);
}
void gpu_add_custom_effect(Effect* effect, float start_time, float end_time,
diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h
index 36ee662..7e2ff47 100644
--- a/src/gpu/gpu.h
+++ b/src/gpu/gpu.h
@@ -43,7 +43,7 @@ void gpu_init(PlatformState* platform_state);
void gpu_draw(float audio_peak, float aspect_ratio, float time, float beat);
void gpu_resize(int width, int height);
#if !defined(STRIP_ALL)
-void gpu_simulate_until(float time);
+void gpu_simulate_until(float time, float bpm = 120.0f);
void gpu_add_custom_effect(Effect* effect, float start_time, float end_time,
int priority);
diff --git a/src/main.cc b/src/main.cc
index b2b62a8..ba12df5 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -153,7 +153,7 @@ int main(int argc, char** argv) {
}
// Simulate Visuals
- gpu_simulate_until((float)seek_time);
+ gpu_simulate_until((float)seek_time, g_tracker_score.bpm);
}
#endif /* !defined(STRIP_ALL) */
diff --git a/src/test_demo.cc b/src/test_demo.cc
index 4ec8d70..2e6e340 100644
--- a/src/test_demo.cc
+++ b/src/test_demo.cc
@@ -4,6 +4,7 @@
#include "audio/audio.h"
#include "audio/audio_engine.h"
#include "audio/synth.h"
+#include "audio/tracker.h"
#include "generated/assets.h" // Note: uses main demo asset bundle
#include "gpu/demo_effects.h"
#include "gpu/gpu.h"
@@ -335,7 +336,7 @@ int main(int argc, char** argv) {
// Beat calculation should use audio time to align with audio events.
// The graphics loop time (current_physical_time) is used for frame rate.
- const float beat_time = current_audio_time * 120.0f / 60.0f;
+ const float beat_time = current_audio_time * g_tracker_score.bpm / 60.0f;
const int beat_number = (int)beat_time;
const float beat = fmodf(beat_time, 1.0f); // Fractional part (0.0 to 1.0)