summaryrefslogtreecommitdiff
path: root/src/audio/tracker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/tracker.cc')
-rw-r--r--src/audio/tracker.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/audio/tracker.cc b/src/audio/tracker.cc
index 7ce96fc..93c279e 100644
--- a/src/audio/tracker.cc
+++ b/src/audio/tracker.cc
@@ -12,7 +12,7 @@
#include "audio/dct.h"
#include "audio/mp3_sample.h"
#include "audio/window.h"
-#endif // !defined(STRIP_ALL)
+#endif // !defined(STRIP_ALL)
static uint32_t g_last_trigger_idx = 0;
@@ -44,7 +44,6 @@ static bool g_cache_initialized = false;
// Forward declarations
static int get_free_pool_slot();
-
#if !defined(STRIP_ALL)
// Decode an in-memory MP3 blob to a heap-allocated spectrogram (caller owns).
// Uses OLA analysis: 512-sample Hann window, OLA_HOP_SIZE advance per frame.
@@ -53,7 +52,8 @@ static float* convert_mp3_to_spectrogram(const uint8_t* data, size_t size,
int* out_num_frames) {
*out_num_frames = 0;
Mp3Decoder* dec = mp3_open(data, size);
- if (!dec) return nullptr;
+ if (!dec)
+ return nullptr;
float window[DCT_SIZE];
hann_window_512(window);
@@ -82,11 +82,13 @@ static float* convert_mp3_to_spectrogram(const uint8_t* data, size_t size,
fdct_512(pcm_chunk, dct_chunk);
spec_data.insert(spec_data.end(), dct_chunk, dct_chunk + DCT_SIZE);
- if (decoded == 0) break;
+ if (decoded == 0)
+ break;
}
mp3_close(dec);
- if (spec_data.empty()) return nullptr;
+ if (spec_data.empty())
+ return nullptr;
const int num_frames = (int)(spec_data.size() / DCT_SIZE);
float* result = new float[spec_data.size()];
@@ -94,7 +96,7 @@ static float* convert_mp3_to_spectrogram(const uint8_t* data, size_t size,
*out_num_frames = num_frames;
return result;
}
-#endif // !defined(STRIP_ALL)
+#endif // !defined(STRIP_ALL)
void tracker_init() {
g_last_trigger_idx = 0;
@@ -159,7 +161,7 @@ void tracker_init() {
FATAL_CHECK(data == nullptr || GetAssetType(aid) != AssetType::MP3,
"MP3 assets not supported in STRIP_ALL builds\n");
#endif
- if (data && size >= sizeof(SpecHeader)) {
+ if (data && size >= sizeof(SpecHeader)) {
const SpecHeader* header = (const SpecHeader*)data;
const int note_frames = header->num_frames;
const float* spectral_data =