From c521b7864c53586c6593c47f5c68981a3f155b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Wed, 19 Jun 2024 14:44:20 +0200 Subject: [PATCH] Introduce project-wide MAX_CHANNELS in CMakeLists.txt The current value of 64 is taken from ebur128. Having the same value across the entire project reduces user surprise. --- CMakeLists.txt | 5 +++++ src/modules/core/filter_audiomap.c | 2 -- src/modules/core/transition_mix.c | 1 - src/modules/plus/ebur128/ebur128.c | 3 +-- src/modules/rubberband/filter_rbpitch.cpp | 2 -- src/modules/spatialaudio/filter_ambisonic-decoder.cpp | 1 - 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7f105dfa..4f920098b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,8 @@ option(SWIG_PYTHON "Enable SWIG Python bindings" OFF) option(SWIG_RUBY "Enable SWIG Ruby bindings" OFF) option(SWIG_TCL "Enable SWIG Tcl bindings" OFF) +set(MAX_CHANNELS 64) + if(WIN32) option(WINDOWS_DEPLOY "Install exes/libs directly to prefix (no subdir /bin)" ON) else() @@ -484,6 +486,9 @@ if(SWIG_TCL) find_package(TCL REQUIRED) endif() +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMAX_CHANNELS=${MAX_CHANNELS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAX_CHANNELS=${MAX_CHANNELS}") + if(BUILD_DOCS) find_package(Doxygen REQUIRED) diff --git a/src/modules/core/filter_audiomap.c b/src/modules/core/filter_audiomap.c index 1657ffb49..9a5a268a6 100644 --- a/src/modules/core/filter_audiomap.c +++ b/src/modules/core/filter_audiomap.c @@ -24,8 +24,6 @@ #include #include -#define MAX_CHANNELS 32 - static int filter_get_audio(mlt_frame frame, void **buffer, mlt_audio_format *format, diff --git a/src/modules/core/transition_mix.c b/src/modules/core/transition_mix.c index 453257b71..098b2ba6e 100644 --- a/src/modules/core/transition_mix.c +++ b/src/modules/core/transition_mix.c @@ -26,7 +26,6 @@ #include #include -#define MAX_CHANNELS (6) #define MAX_SAMPLES (192000) #define SAMPLE_BYTES(samples, channels) ((samples) * (channels) * sizeof(float)) #define MAX_BYTES SAMPLE_BYTES(MAX_SAMPLES, MAX_CHANNELS) diff --git a/src/modules/plus/ebur128/ebur128.c b/src/modules/plus/ebur128/ebur128.c index cdf417fe5..994d7de21 100644 --- a/src/modules/plus/ebur128/ebur128.c +++ b/src/modules/plus/ebur128/ebur128.c @@ -398,12 +398,11 @@ void ebur128_get_version(int* major, int* minor, int* patch) { *patch = EBUR128_VERSION_PATCH; } -#define VALIDATE_MAX_CHANNELS (64) #define VALIDATE_MAX_SAMPLERATE (2822400) #define VALIDATE_CHANNELS_AND_SAMPLERATE(err) \ do { \ - if (channels == 0 || channels > VALIDATE_MAX_CHANNELS) { \ + if (channels == 0 || channels > MAX_CHANNELS) { \ return (err); \ } \ \ diff --git a/src/modules/rubberband/filter_rbpitch.cpp b/src/modules/rubberband/filter_rbpitch.cpp index 767d99da6..98b1b71d7 100644 --- a/src/modules/rubberband/filter_rbpitch.cpp +++ b/src/modules/rubberband/filter_rbpitch.cpp @@ -38,8 +38,6 @@ typedef struct uint64_t out_samples; } private_data; -static const size_t MAX_CHANNELS = 10; - static int rbpitch_get_audio(mlt_frame frame, void **buffer, mlt_audio_format *format, diff --git a/src/modules/spatialaudio/filter_ambisonic-decoder.cpp b/src/modules/spatialaudio/filter_ambisonic-decoder.cpp index e7d3f925a..ff5f78d46 100644 --- a/src/modules/spatialaudio/filter_ambisonic-decoder.cpp +++ b/src/modules/spatialaudio/filter_ambisonic-decoder.cpp @@ -20,7 +20,6 @@ #include #include -static const auto MAX_CHANNELS = 6; static const auto AMBISONICS_BLOCK_SIZE = 1024; static const auto AMBISONICS_ORDER = 1; static const auto AMBISONICS_1_CHANNELS = 4;