diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-07 08:22:12 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-07 08:22:12 +0100 |
| commit | 91e3215b09c458c46eba4cccce602d6917e34923 (patch) | |
| tree | 2194ef37f54c7da633962abf0f32c73c6f1e2092 /src/generated | |
| parent | 036114d12d024273e752ffbb68a95a04ee34d4fa (diff) | |
feat(test_demo): Add audio/visual sync debug tool with tempo testing
Implements minimal standalone executable for debugging audio/visual
synchronization and variable tempo system without full demo complexity.
Key Features:
- Simple drum beat (kick-snare) with crash landmarks at bars 3 and 7
- NOTE_A4 (440 Hz) reference tone at start of each bar for testing
- Screen flash effect synchronized to audio peaks
- 16 second duration (8 bars at 120 BPM)
- Variable tempo mode (--tempo) alternating acceleration/deceleration
- Peak logging (--log-peaks) for gnuplot visualization
Command-line options:
- --help: Show usage information
- --fullscreen: Run in fullscreen mode
- --resolution WxH: Set window resolution
- --tempo: Enable tempo variation test (1.0x ↔ 1.5x and 1.0x ↔ 0.66x)
- --log-peaks FILE: Export audio peaks with beat timing for analysis
Files:
- src/test_demo.cc: Main executable (~220 lines)
- assets/test_demo.track: Drum pattern with NOTE_A4
- assets/test_demo.seq: Visual timeline (FlashEffect)
- test_demo_README.md: Comprehensive documentation
Build: cmake --build build --target test_demo
Usage: build/test_demo [--help] [--tempo] [--log-peaks peaks.txt]
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/generated')
| -rw-r--r-- | src/generated/test_demo_music.cc | 77 | ||||
| -rw-r--r-- | src/generated/test_demo_timeline.cc | 15 |
2 files changed, 92 insertions, 0 deletions
diff --git a/src/generated/test_demo_music.cc b/src/generated/test_demo_music.cc new file mode 100644 index 0000000..3fdd2a1 --- /dev/null +++ b/src/generated/test_demo_music.cc @@ -0,0 +1,77 @@ +// Generated by tracker_compiler. Do not edit. + +#include "audio/tracker.h" + +#include "generated/assets.h" + +const NoteParams g_tracker_samples[] = { + { 0 }, // ASSET_KICK_1 (ASSET) + { 0 }, // ASSET_SNARE_1 (ASSET) + { 0 }, // ASSET_CRASH_1 (ASSET) + { 440.0f, 0.50f, 1.0f, 0.01f, 0.0f, 0.0f, 0.0f, 3, 0.6f, 0.0f, 0.0f }, // NOTE_A4 +}; +const uint32_t g_tracker_samples_count = 4; + +const AssetId g_tracker_sample_assets[] = { + AssetId::ASSET_KICK_1, + AssetId::ASSET_SNARE_1, + AssetId::ASSET_CRASH_1, + AssetId::ASSET_LAST_ID, +}; + +static const TrackerEvent PATTERN_EVENTS_drums_basic[] = { + { 0.0f, 0, 1.0f, 0.0f }, + { 0.0f, 3, 0.5f, 0.0f }, + { 1.0f, 1, 0.9f, 0.0f }, + { 2.0f, 0, 1.0f, 0.0f }, + { 3.0f, 1, 0.9f, 0.0f }, +}; +static const TrackerEvent PATTERN_EVENTS_drums_with_crash[] = { + { 0.0f, 0, 1.0f, 0.0f }, + { 0.0f, 2, 0.9f, 0.0f }, + { 0.0f, 3, 0.5f, 0.0f }, + { 1.0f, 1, 0.9f, 0.0f }, + { 2.0f, 0, 1.0f, 0.0f }, + { 3.0f, 1, 0.9f, 0.0f }, +}; + +const TrackerPattern g_tracker_patterns[] = { + { PATTERN_EVENTS_drums_basic, 5, 4.0f }, // drums_basic + { PATTERN_EVENTS_drums_with_crash, 6, 4.0f }, // drums_with_crash +}; +const uint32_t g_tracker_patterns_count = 2; + +static const TrackerPatternTrigger SCORE_TRIGGERS[] = { + { 0.0f, 0 }, + { 2.0f, 0 }, + { 4.0f, 1 }, + { 6.0f, 0 }, + { 8.0f, 0 }, + { 10.0f, 0 }, + { 12.0f, 1 }, + { 14.0f, 0 }, +}; + +const TrackerScore g_tracker_score = { + SCORE_TRIGGERS, 8, 120.0f +}; + +// ============================================================ +// RESOURCE USAGE ANALYSIS (for synth.h configuration) +// ============================================================ +// Total samples: 4 (3 assets + 1 generated notes) +// Max simultaneous pattern triggers: 1 +// Estimated max polyphony: 5 voices +// +// REQUIRED (minimum to avoid pool exhaustion): +// MAX_VOICES: 5 +// MAX_SPECTROGRAMS: 8 (no caching) +// +// RECOMMENDED (with 50% safety margin): +// MAX_VOICES: 10 +// MAX_SPECTROGRAMS: 12 (no caching) +// +// NOTE: With spectrogram caching by note parameters, +// MAX_SPECTROGRAMS could be reduced to ~4 +// ============================================================ + diff --git a/src/generated/test_demo_timeline.cc b/src/generated/test_demo_timeline.cc new file mode 100644 index 0000000..75c5fe6 --- /dev/null +++ b/src/generated/test_demo_timeline.cc @@ -0,0 +1,15 @@ +// Auto-generated by seq_compiler. Do not edit. +#include "gpu/demo_effects.h" +#include "gpu/effect.h" + +float GetDemoDuration() { + return 16.000000f; +} + +void LoadTimeline(MainSequence& main_seq, WGPUDevice device, WGPUQueue queue, WGPUTextureFormat format) { + { + auto seq = std::make_shared<Sequence>(); + seq->add_effect(std::make_shared<FlashEffect>(device, queue, format), 0.0f, 16.0f, 0); + main_seq.add_sequence(seq, 0.0f, 0); + } +} |
