summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main.cc b/src/main.cc
index 0bd0580..aa24152 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -43,8 +43,8 @@ int register_spec_asset(AssetId id) {
return synth_register_spectrogram(&spec);
}
-static float *g_spec_buffer_a[SPEC_FRAMES * DCT_SIZE] = { 0 };
-static float *g_spec_buffer_b[SPEC_FRAMES * DCT_SIZE] = { 0 };
+static float *g_spec_buffer_a[SPEC_FRAMES * DCT_SIZE] = {0};
+static float *g_spec_buffer_b[SPEC_FRAMES * DCT_SIZE] = {0};
// Global storage for the melody to ensure it persists
std::vector<float> g_melody_data;
@@ -110,9 +110,9 @@ int generate_melody() {
return synth_register_spectrogram(&spec);
}
-float* generate_tone(float *buffer, float freq) {
+float *generate_tone(float *buffer, float freq) {
if (buffer == nullptr) {
- buffer = (float*)calloc(SPEC_FRAMES * DCT_SIZE, sizeof(float));
+ buffer = (float *)calloc(SPEC_FRAMES * DCT_SIZE, sizeof(float));
} else {
memset(buffer, 0, SPEC_FRAMES * DCT_SIZE * sizeof(float));
}
@@ -159,8 +159,8 @@ int main(int argc, char **argv) {
int hihat_id = register_spec_asset(AssetId::ASSET_HIHAT_1);
// Still keep the dynamic tone for bass
- const float* g_spec_buffer_a = generate_tone(nullptr, 110.0f); // A2
- const float* g_spec_buffer_b = generate_tone(nullptr, 110.0f);
+ const float *g_spec_buffer_a = generate_tone(nullptr, 110.0f); // A2
+ const float *g_spec_buffer_b = generate_tone(nullptr, 110.0f);
const Spectrogram bass_spec = {g_spec_buffer_a, g_spec_buffer_b, SPEC_FRAMES};
int bass_id = synth_register_spectrogram(&bass_spec);
@@ -173,7 +173,7 @@ int main(int argc, char **argv) {
auto update_game_logic = [&](double t) {
if (t - last_beat_time > SECONDS_PER_BEAT / 2.0) { // 8th notes
- last_beat_time = t; // Sync to t
+ last_beat_time = t; // Sync to t
const int step = beat_count % 16;
@@ -210,15 +210,15 @@ int main(int argc, char **argv) {
#ifndef STRIP_ALL
if (seek_time > 0.0) {
printf("Seeking to %.2f seconds...\n", seek_time);
-
+
// Simulate audio/game logic
// We step at ~60hz
- const double step = 1.0/60.0;
+ const double step = 1.0 / 60.0;
for (double t = 0.0; t < seek_time; t += step) {
update_game_logic(t);
audio_render_silent((float)step);
}
-
+
// Simulate Visuals
gpu_simulate_until((float)seek_time);
}
@@ -231,7 +231,7 @@ int main(int argc, char **argv) {
platform_poll();
double current_time = platform_get_time() + seek_time; // Offset logic time
-
+
update_game_logic(current_time);
int width, height;