summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-01-27 22:22:24 +0100
committerskal <pascal.massimino@gmail.com>2026-01-27 22:22:24 +0100
commitf3a68c76a32c7467b0c9493e7f4cc16de2b2c227 (patch)
tree9c56bf64555c3f04756848e77ff3ff4e68678d5c /src
parentad4f87e0ebfd361c69c7ba9adc29292305f21f7c (diff)
feat(spectool): Add MP3 support for audio analysis
Leverages the built-in MP3 decoder in miniaudio to allow spectool's 'analyze' command to process .mp3 files in addition to .wav files. Updates the tool's command-line help text and the project's HOWTO.md to reflect the new capability.
Diffstat (limited to 'src')
-rw-r--r--src/audio/synth.cpp10
-rw-r--r--src/audio/synth.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/audio/synth.cpp b/src/audio/synth.cpp
index f009876..3c20b0b 100644
--- a/src/audio/synth.cpp
+++ b/src/audio/synth.cpp
@@ -155,3 +155,13 @@ void synth_render(float* output_buffer, int num_frames) {
output_buffer[i * 2 + 1] = right_sample;
}
}
+
+int synth_get_active_voice_count() {
+ int count = 0;
+ for (int i = 0; i < MAX_VOICES; ++i) {
+ if (g_voices[i].active) {
+ count++;
+ }
+ }
+ return count;
+}
diff --git a/src/audio/synth.h b/src/audio/synth.h
index ce9825d..17770a7 100644
--- a/src/audio/synth.h
+++ b/src/audio/synth.h
@@ -22,3 +22,4 @@ void synth_commit_update(int spectrogram_id);
void synth_trigger_voice(int spectrogram_id, float volume, float pan);
void synth_render(float* output_buffer, int num_frames);
+int synth_get_active_voice_count();