diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-28 09:31:13 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-28 09:31:13 +0100 |
| commit | 302d883f34864bc66a5e04532ae27d7e89fd94e8 (patch) | |
| tree | 8f813865d5dc5b70ee8bf9ee4866546116859825 /src/audio/synth.h | |
| parent | f804dcb9740540b3735628ebf8c006235cc56fca (diff) | |
style: Add 3-line descriptive headers to all source files
This commit applies a new project-wide rule that every source file must begin with a concise 3-line comment header describing its purpose.
- Updated CONTRIBUTING.md with the new rule.
- Applied headers to all .cc and .h files in src/ and tools/.
- Fixed various minor compilation errors and missing includes discovered during the header update process.
Diffstat (limited to 'src/audio/synth.h')
| -rw-r--r-- | src/audio/synth.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/audio/synth.h b/src/audio/synth.h index fe28e8d..9000891 100644 --- a/src/audio/synth.h +++ b/src/audio/synth.h @@ -1,26 +1,34 @@ +// This file is part of the 64k demo project. +// It defines the public interface and data structures for the synth. +// Supports spectrogram registration, voice triggering, and real-time rendering. + #pragma once #include "dct.h" +#include <cstdint> -#define MAX_SPECTROGRAMS 16 #define MAX_VOICES 16 +#define MAX_SPECTROGRAMS 8 struct Spectrogram { - float *spectral_data_a; - float *spectral_data_b; + const float *spectral_data_a; // Front buffer + const float *spectral_data_b; // Back buffer (for double-buffering) int num_frames; }; void synth_init(); void synth_shutdown(); +// Register a spectrogram for playback. Returns an ID or -1. int synth_register_spectrogram(const Spectrogram *spec); void synth_unregister_spectrogram(int spectrogram_id); +// Double-buffering API for thread-safe updates float *synth_begin_update(int spectrogram_id); 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(); -float synth_get_output_peak(); +float synth_get_output_peak();
\ No newline at end of file |
