diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-12 15:10:17 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-12 15:10:17 +0100 |
| commit | 8b30cadfc19647487986d14dba9ddba7908dd1d0 (patch) | |
| tree | f865b42945f72bfc480e2c2a6849127bf56d1a59 /src/test_demo.cc | |
| parent | 1effb125973ac0948de3015be1d53ae72463858b (diff) | |
test_demo: Add beat-synchronized CNN post-processing with version selection
- Add --cnn-version <1|2> flag to select between CNN v1 and v2
- Implement beat_phase modulation for dynamic blend in both CNN effects
- Fix CNN v2 per-layer uniform buffer sharing (each layer needs own buffer)
- Fix CNN v2 y-axis orientation to match render pass convention
- Add Scene1Effect as base visual layer to test_demo timeline
- Reorganize CNN v2 shaders into cnn_v2/ subdirectory
- Update asset paths and documentation for new shader organization
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/test_demo.cc')
| -rw-r--r-- | src/test_demo.cc | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/test_demo.cc b/src/test_demo.cc index 9cbeae2..7f10c3b 100644 --- a/src/test_demo.cc +++ b/src/test_demo.cc @@ -22,6 +22,8 @@ extern void LoadTimeline(MainSequence& main_seq, const GpuContext& ctx); // Inline peak meter effect for debugging audio-visual sync #include "gpu/effects/post_process_helper.h" #include "gpu/effects/shader_composer.h" +#include "gpu/effects/cnn_effect.h" +#include "gpu/effects/cnn_v2_effect.h" class PeakMeterEffect : public PostProcessEffect { public: @@ -98,6 +100,8 @@ class PeakMeterEffect : public PostProcessEffect { } }; +static int g_cnn_version = 2; // Default to v2 + #if !defined(STRIP_ALL) static void print_usage(const char* prog_name) { printf("Usage: %s [OPTIONS]\n", prog_name); @@ -107,6 +111,7 @@ static void print_usage(const char* prog_name) { printf(" --help Show this help message and exit\n"); printf(" --fullscreen Run in fullscreen mode\n"); printf(" --resolution WxH Set window resolution (e.g., 1024x768)\n"); + printf(" --cnn-version <1|2> Select CNN version (1=v1, 2=v2, default=2)\n"); printf(" --tempo Enable tempo variation test mode\n"); printf( " (alternates between acceleration and " @@ -123,6 +128,7 @@ static void print_usage(const char* prog_name) { printf("\nExamples:\n"); printf(" %s --fullscreen\n", prog_name); printf(" %s --resolution 1024x768 --tempo\n", prog_name); + printf(" %s --cnn-version 1\n", prog_name); printf(" %s --log-peaks peaks.txt\n", prog_name); printf(" %s --log-peaks peaks.txt --log-peaks-fine\n", prog_name); printf("\nControls:\n"); @@ -184,6 +190,21 @@ int main(int argc, char** argv) { log_peaks_file = argv[++i]; } else if (strcmp(argv[i], "--log-peaks-fine") == 0) { log_peaks_fine = true; + } else if (strcmp(argv[i], "--cnn-version") == 0) { + if (i + 1 < argc) { + int version = atoi(argv[++i]); + if (version == 1 || version == 2) { + g_cnn_version = version; + } else { + fprintf(stderr, "Error: --cnn-version must be 1 or 2\n\n"); + print_usage(argv[0]); + return 1; + } + } else { + fprintf(stderr, "Error: --cnn-version requires argument\n\n"); + print_usage(argv[0]); + return 1; + } } else { CHECK_RETURN_BEGIN(true, 1) print_usage(argv[0]); @@ -205,9 +226,25 @@ int main(int argc, char** argv) { // Load timeline from test_demo.seq LoadTimeline(*gpu_get_main_sequence(), *gpu_get_context()); - // Add peak meter visualization effect (renders as final post-process) #if !defined(STRIP_ALL) const GpuContext* gpu_ctx = gpu_get_context(); + + // Add CNN post-processing effect based on version flag + if (g_cnn_version == 1) { + CNNEffectParams params; + params.blend_amount = 1.0f; + auto* cnn = new CNNEffect(*gpu_ctx, params); + cnn->set_beat_modulation(true, 1.0f); + gpu_add_custom_effect(cnn, 0.0f, 99999.0f, 10); + } else if (g_cnn_version == 2) { + CNNv2EffectParams params; + params.blend_amount = 1.0f; + auto* cnn = new CNNv2Effect(*gpu_ctx, params); + cnn->set_beat_modulation(true, 1.0f); + gpu_add_custom_effect(cnn, 0.0f, 99999.0f, 10); + } + + // Add peak meter visualization effect (renders as final post-process) auto* peak_meter = new PeakMeterEffect(*gpu_ctx); gpu_add_custom_effect(peak_meter, 0.0f, 99999.0f, 999); // High priority = renders last |
