summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-07 08:22:12 +0100
committerskal <pascal.massimino@gmail.com>2026-02-07 08:22:12 +0100
commit91e3215b09c458c46eba4cccce602d6917e34923 (patch)
tree2194ef37f54c7da633962abf0f32c73c6f1e2092 /CMakeLists.txt
parent036114d12d024273e752ffbb68a95a04ee34d4fa (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 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt60
1 files changed, 60 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2bf4d4a..4fc00b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -307,6 +307,66 @@ if (DEMO_SIZE_OPT)
endif()
endif()
+# ==============================================================================
+# Test Demo (Audio/Visual Sync Tool)
+# ==============================================================================
+
+# Timeline generation
+set(TEST_DEMO_SEQ_PATH ${CMAKE_CURRENT_SOURCE_DIR}/assets/test_demo.seq)
+set(GENERATED_TEST_DEMO_TIMELINE_CC ${CMAKE_CURRENT_SOURCE_DIR}/src/generated/test_demo_timeline.cc)
+add_custom_command(
+ OUTPUT ${GENERATED_TEST_DEMO_TIMELINE_CC}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/src/generated
+ COMMAND ${SEQ_COMPILER_CMD} ${TEST_DEMO_SEQ_PATH} ${GENERATED_TEST_DEMO_TIMELINE_CC}
+ DEPENDS ${SEQ_COMPILER_DEPENDS} ${TEST_DEMO_SEQ_PATH} src/gpu/demo_effects.h
+ COMMENT "Compiling test_demo sequence..."
+)
+add_custom_target(generate_test_demo_timeline ALL DEPENDS ${GENERATED_TEST_DEMO_TIMELINE_CC})
+
+# Music generation
+set(TEST_DEMO_TRACK_PATH ${CMAKE_CURRENT_SOURCE_DIR}/assets/test_demo.track)
+set(GENERATED_TEST_DEMO_MUSIC_CC ${CMAKE_CURRENT_SOURCE_DIR}/src/generated/test_demo_music.cc)
+add_custom_command(
+ OUTPUT ${GENERATED_TEST_DEMO_MUSIC_CC}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/src/generated
+ COMMAND ${TRACKER_COMPILER_FINAL_CMD} ${TEST_DEMO_TRACK_PATH} ${GENERATED_TEST_DEMO_MUSIC_CC}
+ DEPENDS ${TRACKER_COMPILER_FINAL_DEPENDS} ${TEST_DEMO_TRACK_PATH} tracker_compiler_host
+ COMMENT "Compiling test_demo music..."
+)
+add_custom_target(generate_test_demo_music ALL DEPENDS ${GENERATED_TEST_DEMO_MUSIC_CC})
+
+# Build executable (uses main demo assets)
+add_demo_executable(
+ test_demo
+ src/test_demo.cc
+ ${PLATFORM_SOURCES}
+ ${GEN_DEMO_CC}
+ ${GENERATED_TEST_DEMO_TIMELINE_CC}
+ ${GENERATED_TEST_DEMO_MUSIC_CC}
+)
+
+add_dependencies(test_demo generate_demo_assets generate_test_demo_timeline generate_test_demo_music)
+
+if (APPLE)
+ target_link_libraries(test_demo PRIVATE 3d gpu audio procedural util ${DEMO_LIBS})
+else()
+ target_link_libraries(test_demo PRIVATE -Wl,--start-group 3d gpu audio procedural util -Wl,--end-group ${DEMO_LIBS})
+endif()
+
+# Size optimizations
+if (DEMO_SIZE_OPT)
+ if (MSVC)
+ target_compile_options(test_demo PRIVATE /Os /GS-)
+ target_link_options(test_demo PRIVATE /OPT:REF /OPT:ICF /INCREMENTAL:NO)
+ elseif (APPLE)
+ target_compile_options(test_demo PRIVATE -Os)
+ target_link_options(test_demo PRIVATE -Wl,-dead_strip)
+ else ()
+ target_compile_options(test_demo PRIVATE -Os -ffunction-sections -fdata-sections)
+ target_link_options(test_demo PRIVATE -Wl,--gc-sections -s)
+ endif()
+endif()
+
#-- - Tests -- -
enable_testing()
if(DEMO_BUILD_TESTS)