From 65f6e4d438e477d8b5d8be3ea7a261e5036fb460 Mon Sep 17 00:00:00 2001 From: menda Date: Thu, 9 Mar 2023 17:40:01 +0100 Subject: [PATCH 01/11] New reset curve option: constant-median --- source/blender/blenkernel/intern/colortools.c | 7 +++++++ source/blender/makesdna/DNA_color_types.h | 1 + 2 files changed, 8 insertions(+) diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 882abe6cc8d..838fdc21fde 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -261,6 +261,7 @@ void BKE_curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope switch (preset) { case CURVE_PRESET_LINE: + case CURVE_PRESET_CONSTANT_MEDIAN: cuma->totpoint = 2; break; case CURVE_PRESET_SHARP: @@ -302,6 +303,12 @@ void BKE_curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope cuma->curve[1].flag |= CUMA_HANDLE_VECTOR; } break; + case CURVE_PRESET_CONSTANT_MEDIAN: + cuma->curve[0].x = clipr->xmin; + cuma->curve[0].y = (clipr->ymin + clipr->ymax) / 2.0f; + cuma->curve[1].x = clipr->xmax; + cuma->curve[1].y = (clipr->ymin + clipr->ymax) / 2.0f; + break; case CURVE_PRESET_SHARP: cuma->curve[0].x = 0; cuma->curve[0].y = 1; diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h index d3b7c37ab0e..8dd405acdf9 100644 --- a/source/blender/makesdna/DNA_color_types.h +++ b/source/blender/makesdna/DNA_color_types.h @@ -106,6 +106,7 @@ typedef enum eCurveMappingPreset { CURVE_PRESET_ROOT = 6, CURVE_PRESET_GAUSS = 7, CURVE_PRESET_BELL = 8, + CURVE_PRESET_CONSTANT_MEDIAN = 9, } eCurveMappingPreset; /** #CurveMapping.tone */ -- 2.30.2 From 135e27e7ef629ff0492d3c90a072d4cacc7cfd14 Mon Sep 17 00:00:00 2001 From: menda Date: Thu, 9 Mar 2023 17:53:32 +0100 Subject: [PATCH 02/11] Initial patch --- extern/audaspace/CMakeLists.txt | 17 +- extern/audaspace/bindings/C/AUD_Sound.cpp | 11 + extern/audaspace/bindings/C/AUD_Sound.h | 20 +- extern/audaspace/blender_config.cmake | 2 +- extern/audaspace/config/Audaspace.h.in | 10 + extern/audaspace/include/util/FFTPlan.h | 13 ++ .../audaspace/src/sequence/SequenceEntry.cpp | 2 +- .../audaspace/src/sequence/SequenceHandle.cpp | 27 ++- .../audaspace/src/sequence/SequenceHandle.h | 7 + extern/audaspace/src/util/FFTPlan.cpp | 110 ++++++++-- scripts/startup/bl_ui/space_sequencer.py | 118 ++++++---- source/blender/blenkernel/BKE_colortools.h | 9 +- source/blender/blenkernel/BKE_sound.h | 7 + source/blender/blenkernel/intern/brush.cc | 10 +- source/blender/blenkernel/intern/colortools.c | 30 ++- source/blender/blenkernel/intern/scene.cc | 2 +- source/blender/blenkernel/intern/sound.c | 5 + .../blenloader/intern/versioning_270.c | 2 +- .../space_sequencer/sequencer_intern.h | 1 + .../space_sequencer/sequencer_modifier.c | 151 ++++++++++--- .../editors/space_sequencer/sequencer_ops.c | 1 + source/blender/makesdna/DNA_color_types.h | 2 + source/blender/makesdna/DNA_sequence_types.h | 18 ++ source/blender/makesrna/RNA_enum_items.h | 2 + .../blender/makesrna/intern/rna_sequencer.c | 129 ++++++++++- source/blender/sequencer/SEQ_sound.h | 39 ++++ source/blender/sequencer/intern/modifier.c | 29 ++- source/blender/sequencer/intern/sequencer.c | 11 + source/blender/sequencer/intern/sound.c | 201 ++++++++++++++++++ 29 files changed, 863 insertions(+), 123 deletions(-) diff --git a/extern/audaspace/CMakeLists.txt b/extern/audaspace/CMakeLists.txt index 1ae2fbfba10..a4600aa4e10 100644 --- a/extern/audaspace/CMakeLists.txt +++ b/extern/audaspace/CMakeLists.txt @@ -34,6 +34,11 @@ if(NOT DEFINED AUDASPACE_STANDALONE) set(AUDASPACE_STANDALONE TRUE) endif() + +if(DEFINED FFTW3_INCLUDE_DIRS) + set(FFTW_FOUND TRUE) +endif() + # sources set(SRC @@ -62,6 +67,7 @@ set(SRC src/fx/Effect.cpp src/fx/EffectReader.cpp src/fx/Envelope.cpp + src/fx/Equalizer.cpp src/fx/Fader.cpp src/fx/FaderReader.cpp src/fx/HighpassCalculator.cpp @@ -174,6 +180,7 @@ set(PUBLIC_HDR include/fx/Effect.h include/fx/EffectReader.h include/fx/Envelope.h + include/fx/Equalizer.h include/fx/Fader.h include/fx/FaderReader.h include/fx/HighpassCalculator.h @@ -500,6 +507,7 @@ if(WITH_FFMPEG) endif() endif() +message(WARNING "WITH_FFTW: ${WITH_FFTW}") # FFTW if(WITH_FFTW) if(AUDASPACE_STANDALONE) @@ -507,6 +515,7 @@ if(WITH_FFTW) endif() if(FFTW_FOUND) + message(WARNING "FFTW Found") set(FFTW_SRC src/fx/BinauralSound.cpp src/fx/BinauralReader.cpp @@ -535,8 +544,12 @@ if(WITH_FFTW) add_definitions(-DWITH_CONVOLUTION) - list(APPEND INCLUDE ${FFTW_INCLUDE_DIR}) - list(APPEND LIBRARIES ${FFTW_LIBRARY}) + list(APPEND INCLUDE ${FFTW3_INCLUDE_DIRS}) + list(APPEND LIBRARIES ${FFTW3_LIBRARIES}) + + message(WARNING "INCLUDE: ${INCLUDE}") + message(WARNING "LIBRARIES: ${LIBRARIES}") + list(APPEND SRC ${FFTW_SRC}) list(APPEND HDR ${FFTW_HDR}) diff --git a/extern/audaspace/bindings/C/AUD_Sound.cpp b/extern/audaspace/bindings/C/AUD_Sound.cpp index dbedd0045b5..64c1da935a9 100644 --- a/extern/audaspace/bindings/C/AUD_Sound.cpp +++ b/extern/audaspace/bindings/C/AUD_Sound.cpp @@ -26,6 +26,7 @@ #include "fx/ADSR.h" #include "fx/Delay.h" #include "fx/Envelope.h" +#include "fx/Equalizer.h" #include "fx/Fader.h" #include "fx/Highpass.h" #include "fx/IIRFilter.h" @@ -779,4 +780,14 @@ AUD_API AUD_Sound* AUD_Sound_equalize(AUD_Sound* sound, float *definition, int s return equalizer; } +#else + +AUD_API AUD_Sound* AUD_Sound_equalize(AUD_Sound* sound, float *definition, int size, float maxFreqEq, int sizeConversion) +{ + assert(sound); + + return sound; +} + + #endif diff --git a/extern/audaspace/bindings/C/AUD_Sound.h b/extern/audaspace/bindings/C/AUD_Sound.h index dd4fad85122..df988cc5465 100644 --- a/extern/audaspace/bindings/C/AUD_Sound.h +++ b/extern/audaspace/bindings/C/AUD_Sound.h @@ -394,19 +394,19 @@ extern AUD_API int AUD_SoundList_addSound(AUD_Sound* list, AUD_Sound* sound); */ extern AUD_API AUD_Sound* AUD_Sound_mutable(AUD_Sound* sound); +/* + * Creates an Equalizer for the sound + * \param sound The handle of the sound + * \param definition buffer of size*sizeof(float) with the array of equalization values + * \param maxFreqEq Maximum frequency refered by the array + * \param sizeConversion Size of the transformation. Must be 2^number (for example 1024, 2048,...) + * \return A handle to the Equalizer refered to that sound + */ +extern AUD_API AUD_Sound* AUD_Sound_equalize(AUD_Sound* sound, float *definition, int size, float maxFreqEq, int sizeConversion); + #ifdef WITH_CONVOLUTION extern AUD_API AUD_Sound* AUD_Sound_Convolver(AUD_Sound* sound, AUD_ImpulseResponse* filter, AUD_ThreadPool* threadPool); extern AUD_API AUD_Sound* AUD_Sound_Binaural(AUD_Sound* sound, AUD_HRTF* hrtfs, AUD_Source* source, AUD_ThreadPool* threadPool); - - /** - * Creates an Equalizer for the sound - * \param sound The handle of the sound - * \param definition buffer of size*sizeof(float) with the array of equalization values - * \param maxFreqEq Maximum frequency refered by the array - * \param sizeConversion Size of the transformation. Must be 2^number (for example 1024, 2048,...) - * \return A handle to the Equalizer refered to that sound - */ - extern AUD_API AUD_Sound* AUD_Sound_equalize(AUD_Sound* sound, float *definition, int size, float maxFreqEq, int sizeConversion); #endif #ifdef __cplusplus diff --git a/extern/audaspace/blender_config.cmake b/extern/audaspace/blender_config.cmake index 14d7d593838..1204506eb66 100644 --- a/extern/audaspace/blender_config.cmake +++ b/extern/audaspace/blender_config.cmake @@ -7,7 +7,7 @@ set(SHARED_LIBRARY FALSE) # "Build Shared Library" set(WITH_C TRUE) # "Build C Module" set(WITH_DOCS FALSE) # "Build C++ HTML Documentation with Doxygen" set(WITH_FFMPEG ${WITH_CODEC_FFMPEG}) # "Build With FFMPEG" -set(WITH_FFTW FALSE) # "Build With FFTW" +set(WITH_FFTW TRUE) # "Build With FFTW" set(WITH_LIBSNDFILE ${WITH_CODEC_SNDFILE}) # "Build With LibSndFile" set(SEPARATE_C FALSE) # "Build C Binding as separate library" set(PLUGIN_COREAUDIO FALSE) # "Build CoreAudio Plugin" diff --git a/extern/audaspace/config/Audaspace.h.in b/extern/audaspace/config/Audaspace.h.in index 3e6912727b8..925744cc05f 100644 --- a/extern/audaspace/config/Audaspace.h.in +++ b/extern/audaspace/config/Audaspace.h.in @@ -123,8 +123,18 @@ AUD_NAMESPACE_BEGIN /// Sample type.(float samples) +// double samples because of the fftw3 library typedef float sample_t; +// Indicates that the FFT library uses "double" +#define AUDASPACE_FFTW + +#ifdef AUDASPACE_FFTW +typedef double fft_real; +#else +typedef float fft_real; +#endif + /// Sample data type (format samples) typedef unsigned char data_t; diff --git a/extern/audaspace/include/util/FFTPlan.h b/extern/audaspace/include/util/FFTPlan.h index 7d533ca8773..84ab9e94203 100644 --- a/extern/audaspace/include/util/FFTPlan.h +++ b/extern/audaspace/include/util/FFTPlan.h @@ -45,6 +45,18 @@ private: */ int m_N; +#ifdef AUDASPACE_FFTW + /** + * The plan to transform the input to the frequency domain. + */ + fftw_plan m_fftPlanR2C; + + /** + * The plan to transform the input to the time domain again. + */ + fftw_plan m_fftPlanC2R; + +#else /** * The plan to transform the input to the frequency domain. */ @@ -54,6 +66,7 @@ private: * The plan to transform the input to the time domain again. */ fftwf_plan m_fftPlanC2R; +#endif /** * The size of a buffer for its use with the FFT plan (in bytes). diff --git a/extern/audaspace/src/sequence/SequenceEntry.cpp b/extern/audaspace/src/sequence/SequenceEntry.cpp index b63bdd2ffca..a41e8889fe2 100644 --- a/extern/audaspace/src/sequence/SequenceEntry.cpp +++ b/extern/audaspace/src/sequence/SequenceEntry.cpp @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - ******************************************************************************/ +******************************************************************************/ #include "sequence/SequenceEntry.h" #include "sequence/SequenceReader.h" diff --git a/extern/audaspace/src/sequence/SequenceHandle.cpp b/extern/audaspace/src/sequence/SequenceHandle.cpp index fca4e805df2..9a489a97628 100644 --- a/extern/audaspace/src/sequence/SequenceHandle.cpp +++ b/extern/audaspace/src/sequence/SequenceHandle.cpp @@ -21,23 +21,18 @@ #include +#include "util/Buffer.h" + + #define KEEP_TIME 10 #define POSITION_EPSILON (1.0 / static_cast(RATE_48000)) AUD_NAMESPACE_BEGIN -void SequenceHandle::start() + +void SequenceHandle::createHandles() { - // we already tried to start, aborting - if(!m_valid) - return; - - // in case the sound is playing, we need to stop first - stop(); - std::lock_guard lock(*m_entry); - - // let's try playing if(m_entry->m_sound.get()) { try @@ -53,7 +48,19 @@ void SequenceHandle::start() // after starting we have to set the properties, so let's ensure that m_status--; } +} +void SequenceHandle::start() +{ + // we already tried to start, aborting + if(!m_valid) + return; + + // in case the sound is playing, we need to stop first + stop(); + + + createHandles(); // if the sound could not be played, we invalidate m_valid = m_handle.get(); } diff --git a/extern/audaspace/src/sequence/SequenceHandle.h b/extern/audaspace/src/sequence/SequenceHandle.h index 14a94365878..03161fa9796 100644 --- a/extern/audaspace/src/sequence/SequenceHandle.h +++ b/extern/audaspace/src/sequence/SequenceHandle.h @@ -26,6 +26,9 @@ class ReadDevice; class IHandle; class I3DHandle; class SequenceEntry; +class IReader; +class EqualizerReader; +class ISound; /** * Represents a playing sequenced entry. @@ -73,6 +76,10 @@ private: */ bool updatePosition(double position); + /** + * Creates the handles needed to play the sound + */ + void createHandles(); public: /** * Creates a new sequenced handle. diff --git a/extern/audaspace/src/util/FFTPlan.cpp b/extern/audaspace/src/util/FFTPlan.cpp index 5e99dbff247..68f3101e9ca 100644 --- a/extern/audaspace/src/util/FFTPlan.cpp +++ b/extern/audaspace/src/util/FFTPlan.cpp @@ -22,20 +22,41 @@ FFTPlan::FFTPlan(double measureTime) : { } +// internal_buffer = fftw_malloc(sizeof(fftw_complex)*m_N); // I think that with m_N should be enough +#ifdef AUDASPACE_FFTW + FFTPlan::FFTPlan(int n, double measureTime) : - m_N(n), m_bufferSize(((n/2)+1)*2*sizeof(fftwf_complex)) + m_N(n), m_bufferSize((( n / 2) + 1) * 2 * sizeof(fftw_complex)) +{ + fftw_set_timelimit(measureTime); + void* buf = fftw_malloc(sizeof(fftw_complex)*m_bufferSize); + m_fftPlanR2C = fftw_plan_dft_r2c_1d(m_N, (fft_real *)buf, (fftw_complex *)buf, FFTW_EXHAUSTIVE); + m_fftPlanC2R = fftw_plan_dft_c2r_1d(m_N, (fftw_complex *)buf, (fft_real *)buf, FFTW_EXHAUSTIVE); + fftw_free(buf); +} + +#else + +FFTPlan::FFTPlan(int n, double measureTime) : + m_N(n), m_bufferSize((( n / 2) + 1) * 2 * sizeof(fftwf_complex)) { fftwf_set_timelimit(measureTime); - void* buf = fftwf_malloc(m_bufferSize); - m_fftPlanR2C = fftwf_plan_dft_r2c_1d(m_N, (float*)buf, (fftwf_complex*)buf, FFTW_EXHAUSTIVE); - m_fftPlanC2R = fftwf_plan_dft_c2r_1d(m_N, (fftwf_complex*)buf, (float*)buf, FFTW_EXHAUSTIVE); - fftwf_free(buf); + void* buf = fftw_malloc(sizeof(fftwf_complex) * m_bufferSize); + m_fftPlanR2C = fftwf_plan_dft_r2c_1d(m_N, (fft_real *)buf, (fftwf_complex *)buf, FFTW_EXHAUSTIVE); + m_fftPlanC2R = fftwf_plan_dft_c2r_1d(m_N, (fftwf_complex *)buf, (fft_real *)buf, FFTW_EXHAUSTIVE); + fftw_free(buf); } +#endif FFTPlan::~FFTPlan() { - fftwf_destroy_plan(m_fftPlanC2R); - fftwf_destroy_plan(m_fftPlanR2C); +#ifdef AUDASPACE_FFTW + fftw_destroy_plan(m_fftPlanC2R); + fftw_destroy_plan(m_fftPlanR2C); +#else + fftwf_destroy_plan(m_fftPlanC2R); + fftwf_destroy_plan(m_fftPlanR2C); +#endif } int FFTPlan::getSize() @@ -43,24 +64,85 @@ int FFTPlan::getSize() return m_N; } +/* + * Input is Float / Double .... (sample_t) + * Output is fftwf_complex / fftw_complex / ... + */ void FFTPlan::FFT(void* buffer) { - fftwf_execute_dft_r2c(m_fftPlanR2C, (float*)buffer, (fftwf_complex*)buffer); +#ifdef AUDASPACE_FFTW + void *internal_buffer = &(((fftwf_complex *)buffer)[m_bufferSize]); + // Translate forward + sample_t *pt_buffer = (sample_t *)buffer; + fft_real *internal_pt_buffer = (fft_real *)internal_buffer; + + // Translate from float to wide float + for(int i = 0; i < m_N; i++) + //internal_pt_buffer[i]=(fft_real)pt_buffer[i]; + *internal_pt_buffer++ = (fft_real)(*pt_buffer++); + + fftw_execute_dft_r2c(m_fftPlanR2C, (fft_real *)internal_buffer, + (fftw_complex *)internal_buffer); + + // Translate backward + fftwf_complex *pt_buffer2 = (fftwf_complex *)buffer; + fftw_complex *internal_pt_buffer2 = (fftw_complex *)internal_buffer; + + for(int i = 0; i < m_N; i++) { + pt_buffer2[i][0] = (sample_t)internal_pt_buffer2[i][0]; + pt_buffer2[i][1] = (sample_t)internal_pt_buffer2[i][1]; + } + +#else + fftwf_execute_dft_r2c(m_fftPlanR2C, (fft_real *)buffer, + (fftwf_complex *)buffer); +#endif } -void FFTPlan::IFFT(void* buffer) +/* + * Input is fftwf_complex / fftw_complex / ... + * Output is Float / Double .... (sample_t) + */ +void FFTPlan::IFFT(void *buffer) { - fftwf_execute_dft_c2r(m_fftPlanC2R, (fftwf_complex*)buffer, (float*)buffer); +#ifdef AUDASPACE_FFTW + void *internal_buffer = &(((fftwf_complex *)buffer)[m_bufferSize]); + // Translate forward + fftwf_complex *pt_buffer = (fftwf_complex *)buffer; + fftw_complex *internal_pt_buffer = (fftw_complex *)internal_buffer; + for(int i = 0; i < m_N; i++) { + internal_pt_buffer[i][0] = (fft_real)pt_buffer[i][0]; + internal_pt_buffer[i][1] = (fft_real)pt_buffer[i][1]; + } + + fftw_execute_dft_c2r(m_fftPlanC2R, (fftw_complex *)internal_buffer, + (fft_real *)internal_buffer); + + + sample_t *pt_buffer2 = (sample_t *)buffer; + fft_real *internal_pt_buffer2 = (fft_real *)internal_buffer; + for(int i = 0; i < m_N; i++) + pt_buffer2[i] = (sample_t)internal_pt_buffer2[i]; + +#else + fftwf_execute_dft_c2r(m_fftPlanC2R, (fftwf_complex *)buffer, + (fft_real *)buffer); +#endif } -void* FFTPlan::getBuffer() +void *FFTPlan::getBuffer() { - return fftwf_malloc(m_bufferSize); +#ifdef AUDASPACE_FFTW + return fftw_malloc(sizeof(fftwf_complex) * m_bufferSize + + sizeof(fftw_complex) * m_bufferSize); +#else + return fftw_malloc(sizeof(fftwf_complex) * m_bufferSize); +#endif } -void FFTPlan::freeBuffer(void* buffer) +void FFTPlan::freeBuffer(void *buffer) { - fftwf_free(buffer); + fftw_free(buffer); } AUD_NAMESPACE_END diff --git a/scripts/startup/bl_ui/space_sequencer.py b/scripts/startup/bl_ui/space_sequencer.py index 5fce60035a6..ad67de7d492 100644 --- a/scripts/startup/bl_ui/space_sequencer.py +++ b/scripts/startup/bl_ui/space_sequencer.py @@ -960,7 +960,11 @@ class SEQUENCER_MT_strip(Menu): if strip_type != 'SOUND': layout.separator() - layout.operator_menu_enum("sequencer.strip_modifier_add", "type", text="Add Modifier") + layout.operator_menu_enum("sequencer.strip_video_modifier_add", "type", text="Add Modifier") + layout.operator("sequencer.strip_modifier_copy", text="Copy Modifiers to Selection") + else: + layout.separator() + layout.operator_menu_enum("sequencer.strip_sound_modifier_add", "type", text="Add Modifier") layout.operator("sequencer.strip_modifier_copy", text="Copy Modifiers to Selection") if strip_type in { @@ -1101,17 +1105,19 @@ class SEQUENCER_MT_context_menu(Menu): if strip_type != 'SOUND': layout.separator() - layout.operator_menu_enum("sequencer.strip_modifier_add", "type", text="Add Modifier") + layout.operator_menu_enum("sequencer.strip_video_modifier_add", "type", text="Add Modifier") layout.operator("sequencer.strip_modifier_copy", text="Copy Modifiers to Selection") - if selected_sequences_count >= 2: layout.separator() col = layout.column() col.menu("SEQUENCER_MT_add_transitions", text="Add Transition") - - elif selected_sequences_count >= 2: + else: layout.separator() - layout.operator("sequencer.crossfade_sounds", text="Crossfade Sounds") + layout.operator_menu_enum("sequencer.strip_sound_modifier_add", "type", text="Add Modifier") + layout.operator("sequencer.strip_modifier_copy", text="Copy Modifiers to Selection") + if selected_sequences_count >= 2: + layout.separator() + layout.operator("sequencer.crossfade_sounds", text="Crossfade Sounds") if selected_sequences_count >= 1: col = layout.column() @@ -2500,8 +2506,13 @@ class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel): strip = context.active_sequence_strip ed = context.scene.sequence_editor + if strip.type == 'SOUND': + sound = strip.sound + else: + sound = None - layout.prop(strip, "use_linear_modifiers") + if sound is None: + layout.prop(strip, "use_linear_modifiers") layout.operator_menu_enum("sequencer.strip_modifier_add", "type") layout.operator("sequencer.strip_modifier_copy") @@ -2528,45 +2539,66 @@ class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel): row.operator("sequencer.strip_modifier_remove", text="", icon='X', emboss=False).name = mod.name if mod.show_expanded: - row = box.row() - row.prop(mod, "input_mask_type", expand=True) - - if mod.input_mask_type == 'STRIP': - sequences_object = ed - if ed.meta_stack: - sequences_object = ed.meta_stack[-1] - box.prop_search(mod, "input_mask_strip", sequences_object, "sequences", text="Mask") - else: - box.prop(mod, "input_mask_id") + if sound is None: row = box.row() - row.prop(mod, "mask_time", expand=True) + row.prop(mod, "input_mask_type", expand=True) - if mod.type == 'COLOR_BALANCE': - box.prop(mod, "color_multiply") - draw_color_balance(box, mod.color_balance) - elif mod.type == 'CURVES': - box.template_curve_mapping(mod, "curve_mapping", type='COLOR', show_tone=True) - elif mod.type == 'HUE_CORRECT': - box.template_curve_mapping(mod, "curve_mapping", type='HUE') - elif mod.type == 'BRIGHT_CONTRAST': - col = box.column() - col.prop(mod, "bright") - col.prop(mod, "contrast") - elif mod.type == 'WHITE_BALANCE': - col = box.column() - col.prop(mod, "white_value") - elif mod.type == 'TONEMAP': - col = box.column() - col.prop(mod, "tonemap_type") - if mod.tonemap_type == 'RD_PHOTORECEPTOR': - col.prop(mod, "intensity") + if mod.input_mask_type == 'STRIP': + sequences_object = ed + if ed.meta_stack: + sequences_object = ed.meta_stack[-1] + box.prop_search(mod, "input_mask_strip", sequences_object, "sequences", text="Mask") + else: + box.prop(mod, "input_mask_id") + row = box.row() + row.prop(mod, "mask_time", expand=True) + + if mod.type == 'COLOR_BALANCE': + box.prop(mod, "color_multiply") + draw_color_balance(box, mod.color_balance) + elif mod.type == 'CURVES': + box.template_curve_mapping(mod, "curve_mapping", type='COLOR', show_tone=True) + elif mod.type == 'HUE_CORRECT': + box.template_curve_mapping(mod, "curve_mapping", type='HUE') + elif mod.type == 'BRIGHT_CONTRAST': + col = box.column() + col.prop(mod, "bright") col.prop(mod, "contrast") - col.prop(mod, "adaptation") - col.prop(mod, "correction") - elif mod.tonemap_type == 'RH_SIMPLE': - col.prop(mod, "key") - col.prop(mod, "offset") - col.prop(mod, "gamma") + elif mod.type == 'WHITE_BALANCE': + col = box.column() + col.prop(mod, "white_value") + elif mod.type == 'TONEMAP': + col = box.column() + col.prop(mod, "tonemap_type") + if mod.tonemap_type == 'RD_PHOTORECEPTOR': + col.prop(mod, "intensity") + col.prop(mod, "contrast") + col.prop(mod, "adaptation") + col.prop(mod, "correction") + elif mod.tonemap_type == 'RH_SIMPLE': + col.prop(mod, "key") + col.prop(mod, "offset") + col.prop(mod, "gamma") + else: + if mod.type == 'SOUND_EQUALIZER': + eq_row = box.row() + # eq_graphs = eq_row.operator_menu_enum("sequencer.strip_modifier_equalizer_redefine", "graphs") + # eq_graphs.name = mod.name + flow = box.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) + for i in range(len(mod.graphics)): + soundEq = mod.graphics[i] + col = flow.column() + box = col.box() + split = box.split(factor=0.4) + split.label(text = "{:.2f}".format(soundEq.curve_mapping.clip_min_x)) + split.label(text = "Hz") + split.alignment = "RIGHT" + split.label(text = "{:.2f}".format(soundEq.curve_mapping.clip_max_x)) + box.template_curve_mapping(soundEq, "curve_mapping", + type='NONE', levels=False, brush=True, use_negative_slope=True, show_tone=False) + second_row = col.row() + second_row.label(text = "dB") + second_row.alignment = "CENTER" class SEQUENCER_PT_annotation(AnnotationDataPanel, SequencerButtonsPanel_Output, Panel): diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index e1dcd28b83a..ed08ebd80b8 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -23,8 +23,13 @@ struct ImBuf; struct Scopes; struct rctf; -void BKE_curvemapping_set_defaults( - struct CurveMapping *cumap, int tot, float minx, float miny, float maxx, float maxy); +void BKE_curvemapping_set_defaults(struct CurveMapping *cumap, + int tot, + float minx, + float miny, + float maxx, + float maxy, + short default_handle_type); struct CurveMapping *BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy); void BKE_curvemapping_free_data(struct CurveMapping *cumap); void BKE_curvemapping_free(struct CurveMapping *cumap); diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index f0bb530e32b..314e63454b9 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -126,6 +126,7 @@ void BKE_sound_update_scene_listener(struct Scene *scene); void *BKE_sound_scene_add_scene_sound( struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip); + void *BKE_sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence); void *BKE_sound_add_scene_sound( @@ -144,8 +145,14 @@ void BKE_sound_move_scene_sound(const struct Scene *scene, double audio_offset); void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence); +/* Join the Sequence with the structure in Audaspace, the second parameter is a bSound */ void BKE_sound_update_scene_sound(void *handle, struct bSound *sound); +/* Join the Sequence with the structure in Audaspace, the second parameter is the AUD_Sound created + * in Audaspace previously + */ +void BKE_sound_update_sequence_handle(void *handle, void *sound_handle); + void BKE_sound_set_cfra(int cfra); void BKE_sound_set_scene_volume(struct Scene *scene, float volume); diff --git a/source/blender/blenkernel/intern/brush.cc b/source/blender/blenkernel/intern/brush.cc index cd2be70530b..073b808e4cc 100644 --- a/source/blender/blenkernel/intern/brush.cc +++ b/source/blender/blenkernel/intern/brush.cc @@ -791,7 +791,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) /* Curve. */ custom_curve = brush->gpencil_settings->curve_sensitivity; - BKE_curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f); + BKE_curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f, HD_AUTO); BKE_curvemapping_init(custom_curve); brush_gpencil_curvemap_reset(custom_curve->cm, 3, GPCURVE_PRESET_INK); @@ -828,7 +828,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) /* Curve. */ custom_curve = brush->gpencil_settings->curve_sensitivity; - BKE_curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f); + BKE_curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f, HD_AUTO); BKE_curvemapping_init(custom_curve); brush_gpencil_curvemap_reset(custom_curve->cm, 3, GPCURVE_PRESET_INKNOISE); @@ -865,7 +865,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) /* Curve. */ custom_curve = brush->gpencil_settings->curve_sensitivity; - BKE_curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f); + BKE_curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f, HD_AUTO); BKE_curvemapping_init(custom_curve); brush_gpencil_curvemap_reset(custom_curve->cm, 4, GPCURVE_PRESET_MARKER); @@ -901,12 +901,12 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) /* Curve. */ custom_curve = brush->gpencil_settings->curve_sensitivity; - BKE_curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f); + BKE_curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f, HD_AUTO); BKE_curvemapping_init(custom_curve); brush_gpencil_curvemap_reset(custom_curve->cm, 3, GPCURVE_PRESET_CHISEL_SENSIVITY); custom_curve = brush->gpencil_settings->curve_strength; - BKE_curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f); + BKE_curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f, HD_AUTO); BKE_curvemapping_init(custom_curve); brush_gpencil_curvemap_reset(custom_curve->cm, 4, GPCURVE_PRESET_CHISEL_STRENGTH); diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 838fdc21fde..a031184efce 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -34,9 +34,14 @@ /* ***************** operations on full struct ************* */ -void BKE_curvemapping_set_defaults( - CurveMapping *cumap, int tot, float minx, float miny, float maxx, float maxy) -{ +void BKE_curvemapping_set_defaults(CurveMapping *cumap, + int tot, + float minx, + float miny, + float maxx, + float maxy, + short default_handle_type) + { int a; float clipminx, clipminy, clipmaxx, clipmaxy; @@ -57,13 +62,23 @@ void BKE_curvemapping_set_defaults( cumap->bwmul[0] = cumap->bwmul[1] = cumap->bwmul[2] = 1.0f; for (a = 0; a < tot; a++) { + if (default_handle_type == HD_VECT) { + cumap->cm[a].default_handle_type = CUMA_HANDLE_VECTOR; + } + else if (default_handle_type == HD_AUTO_ANIM) { + cumap->cm[a].default_handle_type = CUMA_HANDLE_AUTO_ANIM; + } + cumap->cm[a].totpoint = 2; cumap->cm[a].curve = MEM_callocN(2 * sizeof(CurveMapPoint), "curve points"); cumap->cm[a].curve[0].x = minx; cumap->cm[a].curve[0].y = miny; + cumap->cm[a].curve[0].flag |= default_handle_type; + cumap->cm[a].curve[1].x = maxx; cumap->cm[a].curve[1].y = maxy; + cumap->cm[a].curve[1].flag |= default_handle_type; } cumap->changed_timestamp = 0; @@ -75,7 +90,7 @@ CurveMapping *BKE_curvemapping_add(int tot, float minx, float miny, float maxx, cumap = MEM_callocN(sizeof(CurveMapping), "new curvemap"); - BKE_curvemapping_set_defaults(cumap, tot, minx, miny, maxx, maxy); + BKE_curvemapping_set_defaults(cumap, tot, minx, miny, maxx, maxy, HD_AUTO); return cumap; } @@ -233,6 +248,7 @@ CurveMapPoint *BKE_curvemap_insert(CurveMap *cuma, float x, float y) cmp[a].x = x; cmp[a].y = y; cmp[a].flag = CUMA_SELECT; + cmp[a].flag |= cuma->default_handle_type; foundloc = true; newcmp = &cmp[a]; } @@ -292,6 +308,10 @@ void BKE_curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope cuma->curve = MEM_callocN(cuma->totpoint * sizeof(CurveMapPoint), "curve points"); + for (int i = 0; i < cuma->totpoint; i++) { + cuma->curve[i].flag = cuma->default_handle_type; + } + switch (preset) { case CURVE_PRESET_LINE: cuma->curve[0].x = clipr->xmin; @@ -299,6 +319,8 @@ void BKE_curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope cuma->curve[1].x = clipr->xmax; cuma->curve[1].y = clipr->ymin; if (slope == CURVEMAP_SLOPE_POS_NEG) { + cuma->curve[0].flag &= ~CUMA_HANDLE_AUTO_ANIM; + cuma->curve[1].flag &= ~CUMA_HANDLE_AUTO_ANIM; cuma->curve[0].flag |= CUMA_HANDLE_VECTOR; cuma->curve[1].flag |= CUMA_HANDLE_VECTOR; } diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc index ccf62a6f899..94c19316794 100644 --- a/source/blender/blenkernel/intern/scene.cc +++ b/source/blender/blenkernel/intern/scene.cc @@ -155,7 +155,7 @@ static void scene_init_data(ID *id) BLI_strncpy(scene->r.bake.filepath, U.renderdir, sizeof(scene->r.bake.filepath)); mblur_shutter_curve = &scene->r.mblur_shutter_curve; - BKE_curvemapping_set_defaults(mblur_shutter_curve, 1, 0.0f, 0.0f, 1.0f, 1.0f); + BKE_curvemapping_set_defaults(mblur_shutter_curve, 1, 0.0f, 0.0f, 1.0f, 1.0f, HD_AUTO); BKE_curvemapping_init(mblur_shutter_curve); BKE_curvemap_reset(mblur_shutter_curve->cm, &mblur_shutter_curve->clipr, diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 96e4fb941af..4153cdaceb3 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -791,6 +791,11 @@ void BKE_sound_update_scene_sound(void *handle, bSound *sound) AUD_SequenceEntry_setSound(handle, sound->playback_handle); } +void BKE_sound_update_sequence_handle(void *handle, void *sound_handle) +{ + AUD_SequenceEntry_setSound(handle, sound_handle); +} + void BKE_sound_set_cfra(int cfra) { sound_cfra = cfra; diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 3278309641d..4f7c0cddd4f 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1103,7 +1103,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) Scene *scene; for (scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) { CurveMapping *curve_mapping = &scene->r.mblur_shutter_curve; - BKE_curvemapping_set_defaults(curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f); + BKE_curvemapping_set_defaults(curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f, HD_AUTO); BKE_curvemapping_init(curve_mapping); BKE_curvemap_reset( curve_mapping->cm, &curve_mapping->clipr, CURVE_PRESET_MAX, CURVEMAP_SLOPE_POS_NEG); diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index d88ff6a5dff..dec9cd0880e 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -277,6 +277,7 @@ void SEQUENCER_OT_strip_modifier_add(struct wmOperatorType *ot); void SEQUENCER_OT_strip_modifier_remove(struct wmOperatorType *ot); void SEQUENCER_OT_strip_modifier_move(struct wmOperatorType *ot); void SEQUENCER_OT_strip_modifier_copy(struct wmOperatorType *ot); +void SEQUENCER_OT_strip_modifier_equalizer_redefine(struct wmOperatorType *ot); /* sequencer_view.c */ diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c index 49fcdd1f4f6..b8d57dcc0a0 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.c +++ b/source/blender/editors/space_sequencer/sequencer_modifier.c @@ -10,6 +10,8 @@ #include "DNA_scene_types.h" +#include "DEG_depsgraph.h" + #include "BKE_context.h" #include "WM_api.h" @@ -23,28 +25,13 @@ #include "SEQ_relations.h" #include "SEQ_select.h" #include "SEQ_sequencer.h" +#include "SEQ_sound.h" /* Own include. */ #include "sequencer_intern.h" /*********************** Add modifier operator *************************/ -static bool strip_modifier_active_poll(bContext *C) -{ - Scene *scene = CTX_data_scene(C); - Editing *ed = SEQ_editing_get(scene); - - if (ed) { - Sequence *seq = SEQ_select_active_get(scene); - - if (seq) { - return SEQ_sequence_supports_modifiers(seq); - } - } - - return false; -} - static int strip_modifier_add_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -59,6 +46,21 @@ static int strip_modifier_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static const EnumPropertyItem *filter_modifiers_by_sequence_type(bContext *C, + PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), + bool *UNUSED(r_free)) +{ + Scene *scene = CTX_data_scene(C); + Sequence *seq = SEQ_select_active_get(scene); + if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { + return rna_enum_sequence_sound_modifier_type_items; + } + else { + return rna_enum_sequence_video_modifier_type_items; + } +} + void SEQUENCER_OT_strip_modifier_add(wmOperatorType *ot) { PropertyRNA *prop; @@ -70,7 +72,10 @@ void SEQUENCER_OT_strip_modifier_add(wmOperatorType *ot) /* api callbacks */ ot->exec = strip_modifier_add_exec; - ot->poll = strip_modifier_active_poll; + + /* + * No poll because a modifier can be applied to any kind of strip + */ /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -78,13 +83,15 @@ void SEQUENCER_OT_strip_modifier_add(wmOperatorType *ot) /* properties */ prop = RNA_def_enum(ot->srna, "type", - rna_enum_sequence_modifier_type_items, - seqModifierType_ColorBalance, + DummyRNA_NULL_items, + 0, "Type", ""); + RNA_def_enum_funcs(prop, filter_modifiers_by_sequence_type); ot->prop = prop; } + /*********************** Remove modifier operator *************************/ static int strip_modifier_remove_exec(bContext *C, wmOperator *op) @@ -104,7 +111,12 @@ static int strip_modifier_remove_exec(bContext *C, wmOperator *op) BLI_remlink(&seq->modifiers, smd); SEQ_modifier_free(smd); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); + } + else { + SEQ_relations_invalidate_cache_preprocessed(scene, seq); + } WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -121,7 +133,9 @@ void SEQUENCER_OT_strip_modifier_remove(wmOperatorType *ot) /* api callbacks */ ot->exec = strip_modifier_remove_exec; - ot->poll = strip_modifier_active_poll; + /* + * No poll is needed because all kind of strips can have their modifiers erased + */ /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -167,7 +181,13 @@ static int strip_modifier_move_exec(bContext *C, wmOperator *op) } } - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); + } + else { + SEQ_relations_invalidate_cache_preprocessed(scene, seq); + } + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -190,7 +210,10 @@ void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot) /* api callbacks */ ot->exec = strip_modifier_move_exec; - ot->poll = strip_modifier_active_poll; + + /* + * No poll is needed because all strips can have modifiers + */ /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -220,11 +243,20 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + int isSound = ELEM(seq->type, SEQ_TYPE_SOUND_RAM); + LISTBASE_FOREACH (Sequence *, seq_iter, SEQ_active_seqbase_get(ed)) { if (seq_iter->flag & SELECT) { if (seq_iter == seq) { continue; } + int seq_iter_is_sound =ELEM(seq_iter->type, SEQ_TYPE_SOUND_RAM); + /* If original is sound, only copy to "sound" strips + * If original is not sound, only copy to "not sound" strips + */ + if(isSound != seq_iter_is_sound) + continue; + if (type == SEQ_MODIFIER_COPY_REPLACE) { if (seq_iter->modifiers.first) { @@ -243,7 +275,14 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *op) } } - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + + if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); + } + else { + SEQ_relations_invalidate_cache_preprocessed(scene, seq); + } + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -269,7 +308,9 @@ void SEQUENCER_OT_strip_modifier_copy(wmOperatorType *ot) /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = strip_modifier_copy_exec; - ot->poll = strip_modifier_active_poll; + /* + * No poll is needed because all kind of strips can have modifier + */ /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -277,3 +318,63 @@ void SEQUENCER_OT_strip_modifier_copy(wmOperatorType *ot) /* properties */ ot->prop = RNA_def_enum(ot->srna, "type", type_items, SEQ_MODIFIER_COPY_REPLACE, "Type", ""); } + +static int strip_modifier_equalizer_redefine_exec(bContext *C, wmOperator *op) +{ + Scene *scene = CTX_data_scene(C); + Sequence *seq = SEQ_select_active_get(scene); + SequenceModifierData *smd; + char name[MAX_NAME]; + RNA_string_get(op->ptr, "name", name); + int number = RNA_enum_get(op->ptr, "graphs"); + + smd = SEQ_modifier_find_by_name(seq, name); + if (!smd) { + return OPERATOR_CANCELLED; + } + + SEQ_sound_equalizermodifier_set_graphs((SoundEqualizerModifierData *)smd, number); + + SEQ_relations_invalidate_cache_preprocessed(scene, seq); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; +} + +void SEQUENCER_OT_strip_modifier_equalizer_redefine(wmOperatorType *ot) +{ + + static const EnumPropertyItem enum_modifier_equalizer_presets_items[] = { + {1, "SIMPLE", 0, "Unique", "One unique graphical definition"}, + {2, "DOUBLE", 0, "Double", "Graphical definition in 2 sections"}, + {3, "TRIPLE", 0, "Triplet", "Graphical definition in 3 sections"}, + {0, NULL, 0, NULL, NULL}, +}; + PropertyRNA *prop; + + /* identifiers */ + ot->name = "Redefine equalizer graphs"; + ot->idname = "SEQUENCER_OT_strip_modifier_equalizer_redefine"; + ot->description = "Redefine equalizer graphs"; + + /* api callbacks */ + ot->exec = strip_modifier_equalizer_redefine_exec; + + /* + * No poll because a modifier can be applied to any kind of strip + */ + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + prop = RNA_def_enum(ot->srna, + "graphs", + enum_modifier_equalizer_presets_items, + 1, + "Graphs", + "Number of graphs"); + ot->prop = prop; + prop = RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to redefine"); + RNA_def_property_flag(prop, PROP_HIDDEN); +} diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index bd2d53c1fca..319beee39ad 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -102,6 +102,7 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_strip_modifier_remove); WM_operatortype_append(SEQUENCER_OT_strip_modifier_move); WM_operatortype_append(SEQUENCER_OT_strip_modifier_copy); + WM_operatortype_append(SEQUENCER_OT_strip_modifier_equalizer_redefine); /* sequencer_view.h */ WM_operatortype_append(SEQUENCER_OT_sample); diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h index 8dd405acdf9..bc4ae1ac818 100644 --- a/source/blender/makesdna/DNA_color_types.h +++ b/source/blender/makesdna/DNA_color_types.h @@ -59,6 +59,8 @@ typedef struct CurveMap { /** For RGB curves, pre-multiplied extrapolation vector. */ float premul_ext_in[2]; float premul_ext_out[2]; + short default_handle_type; + char _pad[6]; } CurveMap; typedef struct CurveMapping { diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index a601ed4ee25..78d4a0cf8e1 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -516,6 +516,23 @@ enum { /** \} */ + +/** \name Sound Modifiers +* \{ */ + +typedef struct EQCurveMappingData{ + struct EQCurveMappingData *next, *prev; + struct CurveMapping curve_mapping; +} EQCurveMappingData; + + +typedef struct SoundEqualizerModifierData{ + SequenceModifierData modifier; + /* EQCurveMappingData */ + ListBase graphics; +} SoundEqualizerModifierData; +/** \} */ + /* -------------------------------------------------------------------- */ /** \name Scopes * \{ */ @@ -729,6 +746,7 @@ enum { seqModifierType_Mask = 5, seqModifierType_WhiteBalance = 6, seqModifierType_Tonemap = 7, + seqModifierType_SoundEqualizer = 8, /* Keep last. */ NUM_SEQUENCE_MODIFIER_TYPES, }; diff --git a/source/blender/makesrna/RNA_enum_items.h b/source/blender/makesrna/RNA_enum_items.h index 510469c2756..6322ffc2483 100644 --- a/source/blender/makesrna/RNA_enum_items.h +++ b/source/blender/makesrna/RNA_enum_items.h @@ -42,6 +42,8 @@ DEF_ENUM(rna_enum_object_modifier_type_items) DEF_ENUM(rna_enum_constraint_type_items) DEF_ENUM(rna_enum_boidrule_type_items) DEF_ENUM(rna_enum_sequence_modifier_type_items) +DEF_ENUM(rna_enum_sequence_video_modifier_type_items) +DEF_ENUM(rna_enum_sequence_sound_modifier_type_items) DEF_ENUM(rna_enum_object_greasepencil_modifier_type_items) DEF_ENUM(rna_enum_object_shaderfx_type_items) diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 369cde9cc89..254dd5cb3e1 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -69,6 +69,23 @@ const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = { {seqModifierType_Mask, "MASK", ICON_NONE, "Mask", ""}, {seqModifierType_Tonemap, "TONEMAP", ICON_NONE, "Tone Map", ""}, {seqModifierType_WhiteBalance, "WHITE_BALANCE", ICON_NONE, "White Balance", ""}, + {seqModifierType_SoundEqualizer, "SOUND_EQUALIZER", ICON_NONE, "Sound Equalizer", ""}, + {0, NULL, 0, NULL, NULL}, +}; + +const EnumPropertyItem rna_enum_sequence_video_modifier_type_items[] = { + {seqModifierType_BrightContrast, "BRIGHT_CONTRAST", ICON_NONE, "Bright/Contrast", ""}, + {seqModifierType_ColorBalance, "COLOR_BALANCE", ICON_NONE, "Color Balance", ""}, + {seqModifierType_Curves, "CURVES", ICON_NONE, "Curves", ""}, + {seqModifierType_HueCorrect, "HUE_CORRECT", ICON_NONE, "Hue Correct", ""}, + {seqModifierType_Mask, "MASK", ICON_NONE, "Mask", ""}, + {seqModifierType_Tonemap, "TONEMAP", ICON_NONE, "Tone Map", ""}, + {seqModifierType_WhiteBalance, "WHITE_BALANCE", ICON_NONE, "White Balance", ""}, + {0, NULL, 0, NULL, NULL}, +}; + +const EnumPropertyItem rna_enum_sequence_sound_modifier_type_items[] = { + {seqModifierType_SoundEqualizer, "SOUND_EQUALIZER", ICON_NONE, "Equalizer", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -86,6 +103,8 @@ const EnumPropertyItem rna_enum_strip_color_items[] = { {0, NULL, 0, NULL, NULL}, }; + + #ifdef RNA_RUNTIME # include "BKE_global.h" @@ -1274,6 +1293,8 @@ static StructRNA *rna_SequenceModifier_refine(struct PointerRNA *ptr) return &RNA_WhiteBalanceModifier; case seqModifierType_Tonemap: return &RNA_SequencerTonemapModifierData; + case seqModifierType_SoundEqualizer: + return &RNA_SoundEqualizerModifier; default: return &RNA_SequenceModifier; } @@ -1332,14 +1353,33 @@ static void rna_SequenceModifier_name_set(PointerRNA *ptr, const char *value) } } -static void rna_SequenceModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_SequenceModifier_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { /* strip from other scenes could be modified, so using active scene is not reliable */ Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); Sequence *seq = sequence_get_by_modifier(ed, ptr->data); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); + DEG_relations_tag_update(bmain); + } + else + { + SEQ_relations_invalidate_cache_preprocessed(scene, seq); + } +} + +/* + * Update of Curve in an EQ Sound Modifier + */ +static void rna_SequenceModifier_EQCurveMapping_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->owner_id; + + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); } static bool rna_SequenceModifier_otherSequence_poll(PointerRNA *ptr, PointerRNA value) @@ -1454,6 +1494,7 @@ static void rna_Sequence_separate(ID *id, Sequence *seqm, Main *bmain) WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); } + /* Find channel owner. If NULL, owner is `Editing`, otherwise it's `Sequence`. */ static Sequence *rna_SeqTimelineChannel_owner_get(Editing *ed, SeqTimelineChannel *channel) { @@ -1541,6 +1582,20 @@ static char *rna_SeqTimelineChannel_path(const PointerRNA *ptr) } } +static EQCurveMappingData *rna_Sequence_SoundEqualizer_Curve_add(SoundEqualizerModifierData *semd, + bContext *UNUSED(C), float min_freq, float max_freq) +{ + EQCurveMappingData *eqcmd= SEQ_sound_equalizermodifier_add_graph(semd, min_freq, max_freq); + WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); + return eqcmd; +} + +static void rna_Sequence_SoundEqualizer_Curve_clear(SoundEqualizerModifierData *semd, bContext *UNUSED(C)) +{ + SEQ_sound_equalizermodifier_free((SequenceModifierData *)semd); + WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); +} + #else static void rna_def_strip_element(BlenderRNA *brna) @@ -3722,6 +3777,75 @@ static void rna_def_modifiers(BlenderRNA *brna) rna_def_tonemap_modifier(brna); } +static void rna_def_graphical_sound_equalizer(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + /* Define Sound EQ */ + srna = RNA_def_struct(brna, "EQCurveMappingData", NULL); + RNA_def_struct_sdna(srna, "EQCurveMappingData"); + RNA_def_struct_ui_text(srna, "EQCurveMappingData", "EQCurveMappingData"); + + prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping"); + RNA_def_property_struct_type(prop, "CurveMapping"); + RNA_def_property_ui_text(prop, "Curve Mapping", ""); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_EQCurveMapping_update"); +} + +static void rna_def_sound_equalizer_modifier(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + FunctionRNA *func; + PropertyRNA *parm; + + srna = RNA_def_struct(brna, "SoundEqualizerModifier", "SequenceModifier"); + RNA_def_struct_sdna(srna, "SoundEqualizerModifierData"); + RNA_def_struct_ui_text(srna, "SoundEqualizerModifier", "Equalize audio"); + + /* Sound Equalizers*/ + prop = RNA_def_property(srna, "graphics", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "EQCurveMappingData"); + RNA_def_property_ui_text(prop, "Graphical definition equalization", "Graphical definition equalization"); + + + /* add band*/ + func = RNA_def_function(srna, "new_graphic", "rna_Sequence_SoundEqualizer_Curve_add"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Add a new EQ band"); + + parm = RNA_def_float(func, "min_freq", SOUND_EQUALIZER_DEFAULT_MIN_FREQ, + 0.0, SOUND_EQUALIZER_DEFAULT_MAX_FREQ, /* Hard min and max */ + "Minimum Frequency", "Minimum Frequency", + 0.0, SOUND_EQUALIZER_DEFAULT_MAX_FREQ); /* Soft min and max */ + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_float(func, "max_freq", SOUND_EQUALIZER_DEFAULT_MAX_FREQ, + 0.0, SOUND_EQUALIZER_DEFAULT_MAX_FREQ, /* Hard min and max */ + "Maximum Frequency", "Maximum Frequency", + 0.0, SOUND_EQUALIZER_DEFAULT_MAX_FREQ); /* Soft min and max */ + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + + /* return type */ + parm = RNA_def_pointer(func, "graphic_eqs", "EQCurveMappingData", "", "Newly created graphical Equalizer definition"); + RNA_def_function_return(func, parm); + + /* clear all modifiers */ + func = RNA_def_function(srna, "clear_soundeqs", "rna_Sequence_SoundEqualizer_Curve_clear"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, "Remove all graphical equalizers from the Equalizer modifier"); + + rna_def_graphical_sound_equalizer(brna); +} + + + +static void rna_def_sound_modifiers(BlenderRNA *brna) +{ + rna_def_sound_equalizer_modifier(brna); +} + void RNA_def_sequencer(BlenderRNA *brna) { rna_def_color_balance(brna); @@ -3747,6 +3871,7 @@ void RNA_def_sequencer(BlenderRNA *brna) rna_def_effect(brna); rna_def_effects(brna); rna_def_modifiers(brna); + rna_def_sound_modifiers(brna); } #endif diff --git a/source/blender/sequencer/SEQ_sound.h b/source/blender/sequencer/SEQ_sound.h index e49f081109f..09f37162337 100644 --- a/source/blender/sequencer/SEQ_sound.h +++ b/source/blender/sequencer/SEQ_sound.h @@ -15,12 +15,51 @@ struct Main; struct Scene; struct Sequence; struct bSound; +struct SequencerSoundEqualizer; +struct BlendWriter; +struct BlendDataReader; +struct ListBase; +struct SoundEqualizerModifierData; + +#define SOUND_EQUALIZER_DEFAULT_MIN_FREQ 30.0 +#define SOUND_EQUALIZER_DEFAULT_MAX_FREQ 20000.0 +#define SOUND_EQUALIZER_DEFAULT_MAX_DB 35.0 +#define SOUND_EQUALIZER_SIZE_CONVERSION 2048 +#define SOUND_EQUALIZER_SIZE_DEFINITION 1000 void SEQ_sound_update_bounds_all(struct Scene *scene); void SEQ_sound_update_bounds(struct Scene *scene, struct Sequence *seq); void SEQ_sound_update(struct Scene *scene, struct bSound *sound); void SEQ_sound_update_length(struct Main *bmain, struct Scene *scene); float SEQ_sound_pitch_get(const struct Scene *scene, const struct Sequence *seq); +struct EQCurveMappingData *SEQ_sound_equalizer_add(struct SoundEqualizerModifierData *semd, + float minX, + float maxX); +void SEQ_sound_blend_write(struct BlendWriter *writer, struct ListBase *soundbase); +void SEQ_sound_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb); + +void *SEQ_sound_modifier_recreator(struct Sequence *seq, + struct SequenceModifierData *smd, + void *sound); + +void SEQ_sound_equalizermodifier_init_data(struct SequenceModifierData *smd); +void SEQ_sound_equalizermodifier_free(struct SequenceModifierData *smd); +void SEQ_sound_equalizermodifier_copy_data(struct SequenceModifierData *target, + struct SequenceModifierData *smd); +void *SEQ_sound_equalizermodifier_recreator(struct Sequence *seq, + struct SequenceModifierData *smd, + void *sound); +void SEQ_sound_equalizermodifier_set_graphs(struct SoundEqualizerModifierData *semd, int number); +const struct SoundModifierWorkerInfo *SEQ_sound_modifier_worker_info_get(int type); +struct EQCurveMappingData *SEQ_sound_equalizermodifier_add_graph( + struct SoundEqualizerModifierData *semd, float min_freq, float max_freq); +void SEQ_sound_equalizermodifier_remove_graph(struct SoundEqualizerModifierData *semd, + struct EQCurveMappingData *gsed); + +typedef struct SoundModifierWorkerInfo { + int type; + void *(*recreator)(struct Sequence *seq, struct SequenceModifierData *smd, void *sound); +} SoundModifierWorkerInfo; #ifdef __cplusplus } diff --git a/source/blender/sequencer/intern/modifier.c b/source/blender/sequencer/intern/modifier.c index 150b72e8e87..73838dbbc1f 100644 --- a/source/blender/sequencer/intern/modifier.c +++ b/source/blender/sequencer/intern/modifier.c @@ -30,6 +30,7 @@ #include "SEQ_modifier.h" #include "SEQ_render.h" +#include "SEQ_sound.h" #include "BLO_read_write.h" @@ -741,7 +742,7 @@ static void curves_init_data(SequenceModifierData *smd) { CurvesModifierData *cmd = (CurvesModifierData *)smd; - BKE_curvemapping_set_defaults(&cmd->curve_mapping, 4, 0.0f, 0.0f, 1.0f, 1.0f); + BKE_curvemapping_set_defaults(&cmd->curve_mapping, 4, 0.0f, 0.0f, 1.0f, 1.0f, HD_AUTO); } static void curves_free_data(SequenceModifierData *smd) @@ -860,7 +861,7 @@ static void hue_correct_init_data(SequenceModifierData *smd) HueCorrectModifierData *hcmd = (HueCorrectModifierData *)smd; int c; - BKE_curvemapping_set_defaults(&hcmd->curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f); + BKE_curvemapping_set_defaults(&hcmd->curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f, HD_AUTO); hcmd->curve_mapping.preset = CURVE_PRESET_MID9; for (c = 0; c < 3; c++) { @@ -1370,6 +1371,15 @@ static SequenceModifierTypeInfo seqModifier_Tonemap = { /*apply*/ tonemapmodifier_apply, }; +static SequenceModifierTypeInfo seqModifier_SoundEqualizer = { + CTX_N_(BLT_I18NCONTEXT_ID_SEQUENCE, "Equalizer"), /* name */ + "SoundEqualizerModifierData", /* struct_name */ + sizeof(SoundEqualizerModifierData), /* struct_size */ + SEQ_sound_equalizermodifier_init_data, /* init_data */ + SEQ_sound_equalizermodifier_free, /* free_data */ + SEQ_sound_equalizermodifier_copy_data, /* copy_data */ + NULL, /* apply */ +}; /** \} */ /* -------------------------------------------------------------------- */ @@ -1387,6 +1397,7 @@ static void sequence_modifier_type_info_init(void) INIT_TYPE(Mask); INIT_TYPE(WhiteBalance); INIT_TYPE(Tonemap); + INIT_TYPE(SoundEqualizer); #undef INIT_TYPE } @@ -1586,6 +1597,13 @@ void SEQ_modifier_blend_write(BlendWriter *writer, ListBase *modbase) BKE_curvemapping_blend_write(writer, &hcmd->curve_mapping); } + else if (smd->type == seqModifierType_SoundEqualizer) { + SoundEqualizerModifierData *semd = (SoundEqualizerModifierData *)smd; + LISTBASE_FOREACH (EQCurveMappingData *, eqcmd, &semd->graphics) { + BLO_write_struct_by_name(writer, "EQCurveMappingData", eqcmd); + BKE_curvemapping_blend_write(writer, &eqcmd->curve_mapping); + } + } } else { BLO_write_struct(writer, SequenceModifierData, smd); @@ -1612,6 +1630,13 @@ void SEQ_modifier_blend_read_data(BlendDataReader *reader, ListBase *lb) BKE_curvemapping_blend_read(reader, &hcmd->curve_mapping); } + else if (smd->type == seqModifierType_SoundEqualizer) { + SoundEqualizerModifierData *semd = (SoundEqualizerModifierData *)smd; + BLO_read_list(reader, &semd->graphics); + LISTBASE_FOREACH (EQCurveMappingData *, eqcmd, &semd->graphics) { + BKE_curvemapping_blend_read(reader, &eqcmd->curve_mapping); + } + } } } diff --git a/source/blender/sequencer/intern/sequencer.c b/source/blender/sequencer/intern/sequencer.c index 478b3acda6a..1f901a4526e 100644 --- a/source/blender/sequencer/intern/sequencer.c +++ b/source/blender/sequencer/intern/sequencer.c @@ -987,6 +987,17 @@ static bool seq_update_seq_cb(Sequence *seq, void *user_data) if (scene->id.recalc & ID_RECALC_AUDIO || seq->sound->id.recalc & ID_RECALC_AUDIO) { BKE_sound_update_scene_sound(seq->scene_sound, seq->sound); } + + void *sound = seq->sound->playback_handle; + + if(!BLI_listbase_is_empty(&seq->modifiers)) + { + SequenceModifierData *smd; + for (smd= seq->modifiers.first; smd; smd= smd->next) { + sound = SEQ_sound_modifier_recreator(seq, smd, sound); + } + } + BKE_sound_update_sequence_handle(seq->scene_sound, sound); } BKE_sound_set_scene_sound_volume( seq->scene_sound, seq->volume, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0); diff --git a/source/blender/sequencer/intern/sound.c b/source/blender/sequencer/intern/sound.c index 69ccbdcb54e..312b422ee49 100644 --- a/source/blender/sequencer/intern/sound.c +++ b/source/blender/sequencer/intern/sound.c @@ -8,7 +8,11 @@ */ #include +#include +#include "MEM_guardedalloc.h" + +#include "DNA_curve_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" #include "DNA_sound_types.h" @@ -16,10 +20,15 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLO_read_write.h" + +#include "BKE_colortools.h" #include "BKE_main.h" #include "BKE_scene.h" #include "BKE_sound.h" +#include "AUD_Sound.h" + #include "SEQ_sound.h" #include "SEQ_time.h" @@ -28,6 +37,9 @@ /* Unlike _update_sound_ functions, * these ones take info from audaspace to update sequence length! */ +const SoundModifierWorkerInfo workersSoundModifiers[] = { + {seqModifierType_SoundEqualizer, SEQ_sound_equalizermodifier_recreator}, {0, NULL}}; + #ifdef WITH_AUDASPACE static bool sequencer_refresh_sound_length_recursive(Main *bmain, Scene *scene, ListBase *seqbase) { @@ -144,3 +156,192 @@ float SEQ_sound_pitch_get(const Scene *scene, const Sequence *seq) } return seq->speed_factor; } + +struct EQCurveMappingData *SEQ_sound_equalizer_add(SoundEqualizerModifierData *semd, + float minX, + float maxX) +{ + EQCurveMappingData *eqcmd; + + if (maxX < 0) + maxX = SOUND_EQUALIZER_DEFAULT_MAX_FREQ; + if (minX < 0) + minX = 0.0; + /* It's the same as BKE_curvemapping_add , but changing the name */ + eqcmd = MEM_callocN(sizeof(EQCurveMappingData), "Equalizer"); + BKE_curvemapping_set_defaults(&eqcmd->curve_mapping, + 1, /* tot*/ + minX, + -SOUND_EQUALIZER_DEFAULT_MAX_DB, /* Min x, y */ + maxX, + SOUND_EQUALIZER_DEFAULT_MAX_DB, /* Max x, y */ + HD_AUTO_ANIM); + + eqcmd->curve_mapping.preset = CURVE_PRESET_CONSTANT_MEDIAN; + + rctf clipr; + clipr.xmin = minX; + clipr.xmax = maxX; + clipr.ymin = 0.0; + clipr.ymax = 0.0; + + BKE_curvemap_reset(&eqcmd->curve_mapping.cm[0], &clipr, CURVE_PRESET_CONSTANT_MEDIAN, 0); + + BLI_addtail(&semd->graphics, eqcmd); + + return eqcmd; +} + +void SEQ_sound_equalizermodifier_set_graphs(struct SoundEqualizerModifierData *semd, int number) +{ + SEQ_sound_equalizermodifier_free((SequenceModifierData *)semd); + if (number == 1) { + SEQ_sound_equalizer_add( + semd, SOUND_EQUALIZER_DEFAULT_MIN_FREQ, SOUND_EQUALIZER_DEFAULT_MAX_FREQ); + } + else if (number == 2) { + SEQ_sound_equalizer_add(semd, 30.0, 2000.0); + SEQ_sound_equalizer_add(semd, 2000.1, 20000.0); + } + else if (number == 3) { + SEQ_sound_equalizer_add(semd, 30.0, 1000.0); + SEQ_sound_equalizer_add(semd, 1000.1, 5000.0); + SEQ_sound_equalizer_add(semd, 5000.1, 20000.0); + } +} + +EQCurveMappingData *SEQ_sound_equalizermodifier_add_graph(struct SoundEqualizerModifierData *semd, + float min_freq, + float max_freq) +{ + if (min_freq < 0.0) + return NULL; + if (max_freq < 0.0) + return NULL; + if (max_freq <= min_freq) + return NULL; + return SEQ_sound_equalizer_add(semd, min_freq, max_freq); +} + +void SEQ_sound_equalizermodifier_remove_graph(struct SoundEqualizerModifierData *semd, + struct EQCurveMappingData *eqcmd) +{ + BLI_remlink_safe(&semd->graphics, eqcmd); + MEM_freeN(eqcmd); +} + +void SEQ_sound_equalizermodifier_init_data(SequenceModifierData *smd) +{ + SoundEqualizerModifierData *semd = (SoundEqualizerModifierData *)smd; + + SEQ_sound_equalizer_add(semd, SOUND_EQUALIZER_DEFAULT_MIN_FREQ, SOUND_EQUALIZER_DEFAULT_MAX_FREQ); +} + +void SEQ_sound_equalizermodifier_free(SequenceModifierData *smd) +{ + SoundEqualizerModifierData *semd = (SoundEqualizerModifierData *)smd; + EQCurveMappingData *eqcmd, *eqcmd_next; + for (eqcmd = semd->graphics.first; eqcmd; eqcmd = eqcmd_next) { + eqcmd_next = eqcmd->next; + BKE_curvemapping_free_data(&eqcmd->curve_mapping); + MEM_freeN(eqcmd); + } + BLI_listbase_clear(&semd->graphics); +} + +void SEQ_sound_equalizermodifier_copy_data(struct SequenceModifierData *target, + struct SequenceModifierData *smd) +{ + SoundEqualizerModifierData *semd = (SoundEqualizerModifierData *)smd; + SoundEqualizerModifierData *semd_target = (SoundEqualizerModifierData *)target; + EQCurveMappingData *eqcmd, *eqcmd_n; + + BLI_listbase_clear(&semd_target->graphics); + + for (eqcmd = semd->graphics.first; eqcmd; eqcmd = eqcmd->next) { + eqcmd_n = MEM_dupallocN(eqcmd); + BKE_curvemapping_copy_data(&eqcmd_n->curve_mapping, &eqcmd->curve_mapping); + + eqcmd_n->next = eqcmd_n->prev = NULL; + BLI_addtail(&semd_target->graphics, eqcmd_n); + } +} + +void *SEQ_sound_equalizermodifier_recreator(struct Sequence *seq, + struct SequenceModifierData *smd, + void *sound) +{ + UNUSED_VARS(seq); + + SoundEqualizerModifierData *semd = (SoundEqualizerModifierData *)smd; + + // No Equalizer definition + if (BLI_listbase_is_empty(&semd->graphics)) { + return sound; + } + + float *buf = (float *)MEM_callocN(sizeof(float) * SOUND_EQUALIZER_SIZE_DEFINITION, + "eqrecreator"); + + CurveMapping *eq_mapping; + CurveMap *cm; + float minX; + float maxX; + float interval = SOUND_EQUALIZER_DEFAULT_MAX_FREQ / (float)SOUND_EQUALIZER_SIZE_DEFINITION; + + // Visit all equalizer definitions + LISTBASE_FOREACH (EQCurveMappingData *, mapping, &semd->graphics) { + eq_mapping = &mapping->curve_mapping; + BKE_curvemapping_init(eq_mapping); + cm = eq_mapping->cm; + minX = eq_mapping->curr.xmin; + maxX = eq_mapping->curr.xmax; + int idx = (int)ceil(minX / interval); + int i = idx; + for (; i * interval <= maxX && i < SOUND_EQUALIZER_SIZE_DEFINITION; i++) { + float freq = i * interval; + float val = BKE_curvemap_evaluateF(eq_mapping, cm, freq); + if (fabs(val) > SOUND_EQUALIZER_DEFAULT_MAX_DB) + val = (val / fabs(val)) * SOUND_EQUALIZER_DEFAULT_MAX_DB; + buf[i] = val; + /* To soften lower limit, but not the first position which is the constant value */ + if (i == idx && i > 2) { + buf[i-1] = 0.5 * (buf[i] + buf[i-1]); + } + } + /* To soften higher limit */ + if (i < SOUND_EQUALIZER_SIZE_DEFINITION) + buf[i] = 0.5 * (buf[i] + buf[i-1]); + } + + AUD_Sound *equ = AUD_Sound_equalize(sound, + buf, + SOUND_EQUALIZER_SIZE_DEFINITION, + SOUND_EQUALIZER_DEFAULT_MAX_FREQ, + SOUND_EQUALIZER_SIZE_CONVERSION); + + MEM_freeN(buf); + + return equ; +} + +const struct SoundModifierWorkerInfo *SEQ_sound_modifier_worker_info_get(int type) +{ + for (int i = 0; workersSoundModifiers[i].type > 0; i++) { + if (workersSoundModifiers[i].type == type) + return &workersSoundModifiers[i]; + } + return NULL; +} + +void *SEQ_sound_modifier_recreator(struct Sequence *seq, + struct SequenceModifierData *smd, + void *sound) +{ + + if (!(smd->flag & SEQUENCE_MODIFIER_MUTE)) { + const SoundModifierWorkerInfo *smwi = SEQ_sound_modifier_worker_info_get(smd->type); + return smwi->recreator(seq, smd, sound); + } + return sound; +} -- 2.30.2 From 6ac585410d9c45f6be5d0f461a44cbdc24e3dbb7 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Sat, 20 May 2023 04:43:31 +0200 Subject: [PATCH 03/11] Revert changes in Audaspace --- extern/audaspace/bindings/C/AUD_Sound.cpp | 11 -- extern/audaspace/bindings/C/AUD_Sound.h | 20 ++-- extern/audaspace/config/Audaspace.h.in | 10 -- extern/audaspace/include/util/FFTPlan.h | 13 --- .../audaspace/src/sequence/SequenceEntry.cpp | 2 +- .../audaspace/src/sequence/SequenceHandle.cpp | 27 ++--- .../audaspace/src/sequence/SequenceHandle.h | 7 -- extern/audaspace/src/util/FFTPlan.cpp | 110 +++--------------- 8 files changed, 35 insertions(+), 165 deletions(-) diff --git a/extern/audaspace/bindings/C/AUD_Sound.cpp b/extern/audaspace/bindings/C/AUD_Sound.cpp index 64c1da935a9..dbedd0045b5 100644 --- a/extern/audaspace/bindings/C/AUD_Sound.cpp +++ b/extern/audaspace/bindings/C/AUD_Sound.cpp @@ -26,7 +26,6 @@ #include "fx/ADSR.h" #include "fx/Delay.h" #include "fx/Envelope.h" -#include "fx/Equalizer.h" #include "fx/Fader.h" #include "fx/Highpass.h" #include "fx/IIRFilter.h" @@ -780,14 +779,4 @@ AUD_API AUD_Sound* AUD_Sound_equalize(AUD_Sound* sound, float *definition, int s return equalizer; } -#else - -AUD_API AUD_Sound* AUD_Sound_equalize(AUD_Sound* sound, float *definition, int size, float maxFreqEq, int sizeConversion) -{ - assert(sound); - - return sound; -} - - #endif diff --git a/extern/audaspace/bindings/C/AUD_Sound.h b/extern/audaspace/bindings/C/AUD_Sound.h index df988cc5465..dd4fad85122 100644 --- a/extern/audaspace/bindings/C/AUD_Sound.h +++ b/extern/audaspace/bindings/C/AUD_Sound.h @@ -394,19 +394,19 @@ extern AUD_API int AUD_SoundList_addSound(AUD_Sound* list, AUD_Sound* sound); */ extern AUD_API AUD_Sound* AUD_Sound_mutable(AUD_Sound* sound); -/* - * Creates an Equalizer for the sound - * \param sound The handle of the sound - * \param definition buffer of size*sizeof(float) with the array of equalization values - * \param maxFreqEq Maximum frequency refered by the array - * \param sizeConversion Size of the transformation. Must be 2^number (for example 1024, 2048,...) - * \return A handle to the Equalizer refered to that sound - */ -extern AUD_API AUD_Sound* AUD_Sound_equalize(AUD_Sound* sound, float *definition, int size, float maxFreqEq, int sizeConversion); - #ifdef WITH_CONVOLUTION extern AUD_API AUD_Sound* AUD_Sound_Convolver(AUD_Sound* sound, AUD_ImpulseResponse* filter, AUD_ThreadPool* threadPool); extern AUD_API AUD_Sound* AUD_Sound_Binaural(AUD_Sound* sound, AUD_HRTF* hrtfs, AUD_Source* source, AUD_ThreadPool* threadPool); + + /** + * Creates an Equalizer for the sound + * \param sound The handle of the sound + * \param definition buffer of size*sizeof(float) with the array of equalization values + * \param maxFreqEq Maximum frequency refered by the array + * \param sizeConversion Size of the transformation. Must be 2^number (for example 1024, 2048,...) + * \return A handle to the Equalizer refered to that sound + */ + extern AUD_API AUD_Sound* AUD_Sound_equalize(AUD_Sound* sound, float *definition, int size, float maxFreqEq, int sizeConversion); #endif #ifdef __cplusplus diff --git a/extern/audaspace/config/Audaspace.h.in b/extern/audaspace/config/Audaspace.h.in index 925744cc05f..3e6912727b8 100644 --- a/extern/audaspace/config/Audaspace.h.in +++ b/extern/audaspace/config/Audaspace.h.in @@ -123,18 +123,8 @@ AUD_NAMESPACE_BEGIN /// Sample type.(float samples) -// double samples because of the fftw3 library typedef float sample_t; -// Indicates that the FFT library uses "double" -#define AUDASPACE_FFTW - -#ifdef AUDASPACE_FFTW -typedef double fft_real; -#else -typedef float fft_real; -#endif - /// Sample data type (format samples) typedef unsigned char data_t; diff --git a/extern/audaspace/include/util/FFTPlan.h b/extern/audaspace/include/util/FFTPlan.h index 84ab9e94203..7d533ca8773 100644 --- a/extern/audaspace/include/util/FFTPlan.h +++ b/extern/audaspace/include/util/FFTPlan.h @@ -45,18 +45,6 @@ private: */ int m_N; -#ifdef AUDASPACE_FFTW - /** - * The plan to transform the input to the frequency domain. - */ - fftw_plan m_fftPlanR2C; - - /** - * The plan to transform the input to the time domain again. - */ - fftw_plan m_fftPlanC2R; - -#else /** * The plan to transform the input to the frequency domain. */ @@ -66,7 +54,6 @@ private: * The plan to transform the input to the time domain again. */ fftwf_plan m_fftPlanC2R; -#endif /** * The size of a buffer for its use with the FFT plan (in bytes). diff --git a/extern/audaspace/src/sequence/SequenceEntry.cpp b/extern/audaspace/src/sequence/SequenceEntry.cpp index 2d439cfb90a..0fbab21cfc8 100644 --- a/extern/audaspace/src/sequence/SequenceEntry.cpp +++ b/extern/audaspace/src/sequence/SequenceEntry.cpp @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. -******************************************************************************/ + ******************************************************************************/ #include "sequence/SequenceEntry.h" #include "sequence/SequenceReader.h" diff --git a/extern/audaspace/src/sequence/SequenceHandle.cpp b/extern/audaspace/src/sequence/SequenceHandle.cpp index e71aefe2d3f..55384ba5f35 100644 --- a/extern/audaspace/src/sequence/SequenceHandle.cpp +++ b/extern/audaspace/src/sequence/SequenceHandle.cpp @@ -21,18 +21,23 @@ #include -#include "util/Buffer.h" - - #define KEEP_TIME 10 #define POSITION_EPSILON (1.0 / static_cast(RATE_48000)) AUD_NAMESPACE_BEGIN - -void SequenceHandle::createHandles() +void SequenceHandle::start() { + // we already tried to start, aborting + if(!m_valid) + return; + + // in case the sound is playing, we need to stop first + stop(); + std::lock_guard lock(*m_entry); + + // let's try playing if(m_entry->m_sound.get()) { try @@ -48,19 +53,7 @@ void SequenceHandle::createHandles() // after starting we have to set the properties, so let's ensure that m_status--; } -} -void SequenceHandle::start() -{ - // we already tried to start, aborting - if(!m_valid) - return; - - // in case the sound is playing, we need to stop first - stop(); - - - createHandles(); // if the sound could not be played, we invalidate m_valid = m_handle.get(); } diff --git a/extern/audaspace/src/sequence/SequenceHandle.h b/extern/audaspace/src/sequence/SequenceHandle.h index 03161fa9796..14a94365878 100644 --- a/extern/audaspace/src/sequence/SequenceHandle.h +++ b/extern/audaspace/src/sequence/SequenceHandle.h @@ -26,9 +26,6 @@ class ReadDevice; class IHandle; class I3DHandle; class SequenceEntry; -class IReader; -class EqualizerReader; -class ISound; /** * Represents a playing sequenced entry. @@ -76,10 +73,6 @@ private: */ bool updatePosition(double position); - /** - * Creates the handles needed to play the sound - */ - void createHandles(); public: /** * Creates a new sequenced handle. diff --git a/extern/audaspace/src/util/FFTPlan.cpp b/extern/audaspace/src/util/FFTPlan.cpp index 68f3101e9ca..5e99dbff247 100644 --- a/extern/audaspace/src/util/FFTPlan.cpp +++ b/extern/audaspace/src/util/FFTPlan.cpp @@ -22,41 +22,20 @@ FFTPlan::FFTPlan(double measureTime) : { } -// internal_buffer = fftw_malloc(sizeof(fftw_complex)*m_N); // I think that with m_N should be enough -#ifdef AUDASPACE_FFTW - FFTPlan::FFTPlan(int n, double measureTime) : - m_N(n), m_bufferSize((( n / 2) + 1) * 2 * sizeof(fftw_complex)) -{ - fftw_set_timelimit(measureTime); - void* buf = fftw_malloc(sizeof(fftw_complex)*m_bufferSize); - m_fftPlanR2C = fftw_plan_dft_r2c_1d(m_N, (fft_real *)buf, (fftw_complex *)buf, FFTW_EXHAUSTIVE); - m_fftPlanC2R = fftw_plan_dft_c2r_1d(m_N, (fftw_complex *)buf, (fft_real *)buf, FFTW_EXHAUSTIVE); - fftw_free(buf); -} - -#else - -FFTPlan::FFTPlan(int n, double measureTime) : - m_N(n), m_bufferSize((( n / 2) + 1) * 2 * sizeof(fftwf_complex)) + m_N(n), m_bufferSize(((n/2)+1)*2*sizeof(fftwf_complex)) { fftwf_set_timelimit(measureTime); - void* buf = fftw_malloc(sizeof(fftwf_complex) * m_bufferSize); - m_fftPlanR2C = fftwf_plan_dft_r2c_1d(m_N, (fft_real *)buf, (fftwf_complex *)buf, FFTW_EXHAUSTIVE); - m_fftPlanC2R = fftwf_plan_dft_c2r_1d(m_N, (fftwf_complex *)buf, (fft_real *)buf, FFTW_EXHAUSTIVE); - fftw_free(buf); + void* buf = fftwf_malloc(m_bufferSize); + m_fftPlanR2C = fftwf_plan_dft_r2c_1d(m_N, (float*)buf, (fftwf_complex*)buf, FFTW_EXHAUSTIVE); + m_fftPlanC2R = fftwf_plan_dft_c2r_1d(m_N, (fftwf_complex*)buf, (float*)buf, FFTW_EXHAUSTIVE); + fftwf_free(buf); } -#endif FFTPlan::~FFTPlan() { -#ifdef AUDASPACE_FFTW - fftw_destroy_plan(m_fftPlanC2R); - fftw_destroy_plan(m_fftPlanR2C); -#else - fftwf_destroy_plan(m_fftPlanC2R); - fftwf_destroy_plan(m_fftPlanR2C); -#endif + fftwf_destroy_plan(m_fftPlanC2R); + fftwf_destroy_plan(m_fftPlanR2C); } int FFTPlan::getSize() @@ -64,85 +43,24 @@ int FFTPlan::getSize() return m_N; } -/* - * Input is Float / Double .... (sample_t) - * Output is fftwf_complex / fftw_complex / ... - */ void FFTPlan::FFT(void* buffer) { -#ifdef AUDASPACE_FFTW - void *internal_buffer = &(((fftwf_complex *)buffer)[m_bufferSize]); - // Translate forward - sample_t *pt_buffer = (sample_t *)buffer; - fft_real *internal_pt_buffer = (fft_real *)internal_buffer; - - // Translate from float to wide float - for(int i = 0; i < m_N; i++) - //internal_pt_buffer[i]=(fft_real)pt_buffer[i]; - *internal_pt_buffer++ = (fft_real)(*pt_buffer++); - - fftw_execute_dft_r2c(m_fftPlanR2C, (fft_real *)internal_buffer, - (fftw_complex *)internal_buffer); - - // Translate backward - fftwf_complex *pt_buffer2 = (fftwf_complex *)buffer; - fftw_complex *internal_pt_buffer2 = (fftw_complex *)internal_buffer; - - for(int i = 0; i < m_N; i++) { - pt_buffer2[i][0] = (sample_t)internal_pt_buffer2[i][0]; - pt_buffer2[i][1] = (sample_t)internal_pt_buffer2[i][1]; - } - -#else - fftwf_execute_dft_r2c(m_fftPlanR2C, (fft_real *)buffer, - (fftwf_complex *)buffer); -#endif + fftwf_execute_dft_r2c(m_fftPlanR2C, (float*)buffer, (fftwf_complex*)buffer); } -/* - * Input is fftwf_complex / fftw_complex / ... - * Output is Float / Double .... (sample_t) - */ -void FFTPlan::IFFT(void *buffer) +void FFTPlan::IFFT(void* buffer) { -#ifdef AUDASPACE_FFTW - void *internal_buffer = &(((fftwf_complex *)buffer)[m_bufferSize]); - // Translate forward - fftwf_complex *pt_buffer = (fftwf_complex *)buffer; - fftw_complex *internal_pt_buffer = (fftw_complex *)internal_buffer; - for(int i = 0; i < m_N; i++) { - internal_pt_buffer[i][0] = (fft_real)pt_buffer[i][0]; - internal_pt_buffer[i][1] = (fft_real)pt_buffer[i][1]; - } - - fftw_execute_dft_c2r(m_fftPlanC2R, (fftw_complex *)internal_buffer, - (fft_real *)internal_buffer); - - - sample_t *pt_buffer2 = (sample_t *)buffer; - fft_real *internal_pt_buffer2 = (fft_real *)internal_buffer; - for(int i = 0; i < m_N; i++) - pt_buffer2[i] = (sample_t)internal_pt_buffer2[i]; - -#else - fftwf_execute_dft_c2r(m_fftPlanC2R, (fftwf_complex *)buffer, - (fft_real *)buffer); -#endif + fftwf_execute_dft_c2r(m_fftPlanC2R, (fftwf_complex*)buffer, (float*)buffer); } -void *FFTPlan::getBuffer() +void* FFTPlan::getBuffer() { -#ifdef AUDASPACE_FFTW - return fftw_malloc(sizeof(fftwf_complex) * m_bufferSize + - sizeof(fftw_complex) * m_bufferSize); -#else - return fftw_malloc(sizeof(fftwf_complex) * m_bufferSize); -#endif + return fftwf_malloc(m_bufferSize); } -void FFTPlan::freeBuffer(void *buffer) +void FFTPlan::freeBuffer(void* buffer) { - fftw_free(buffer); + fftwf_free(buffer); } AUD_NAMESPACE_END -- 2.30.2 From bbdca79df01874dbe5c8b863a5f1bc6f3d299a30 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Sun, 13 Aug 2023 11:42:37 +0200 Subject: [PATCH 04/11] Fix cmake setup and compilation issues --- extern/audaspace/CMakeLists.txt | 17 +----- extern/audaspace/blender_config.cmake | 6 +- .../blender/blenkernel/intern/colortools.cc | 3 +- .../space_sequencer/sequencer_modifier.cc | 55 ++++++++----------- source/blender/makesdna/DNA_sequence_types.h | 8 +-- .../blender/makesrna/intern/rna_sequencer.cc | 49 ++++++++--------- source/blender/sequencer/CMakeLists.txt | 4 ++ source/blender/sequencer/intern/sequencer.cc | 5 +- source/blender/sequencer/intern/sound.cc | 3 +- 9 files changed, 64 insertions(+), 86 deletions(-) diff --git a/extern/audaspace/CMakeLists.txt b/extern/audaspace/CMakeLists.txt index 9066d283632..ed48d4533a1 100644 --- a/extern/audaspace/CMakeLists.txt +++ b/extern/audaspace/CMakeLists.txt @@ -34,11 +34,6 @@ if(NOT DEFINED AUDASPACE_STANDALONE) set(AUDASPACE_STANDALONE TRUE) endif() - -if(DEFINED FFTW3_INCLUDE_DIRS) - set(FFTW_FOUND TRUE) -endif() - # sources set(SRC @@ -67,7 +62,6 @@ set(SRC src/fx/Effect.cpp src/fx/EffectReader.cpp src/fx/Envelope.cpp - src/fx/Equalizer.cpp src/fx/Fader.cpp src/fx/FaderReader.cpp src/fx/HighpassCalculator.cpp @@ -180,7 +174,6 @@ set(PUBLIC_HDR include/fx/Effect.h include/fx/EffectReader.h include/fx/Envelope.h - include/fx/Equalizer.h include/fx/Fader.h include/fx/FaderReader.h include/fx/HighpassCalculator.h @@ -507,7 +500,6 @@ if(WITH_FFMPEG) endif() endif() -message(WARNING "WITH_FFTW: ${WITH_FFTW}") # FFTW if(WITH_FFTW) if(AUDASPACE_STANDALONE) @@ -515,7 +507,6 @@ if(WITH_FFTW) endif() if(FFTW_FOUND) - message(WARNING "FFTW Found") set(FFTW_SRC src/fx/BinauralSound.cpp src/fx/BinauralReader.cpp @@ -544,12 +535,8 @@ if(WITH_FFTW) add_definitions(-DWITH_CONVOLUTION) - list(APPEND INCLUDE ${FFTW3_INCLUDE_DIRS}) - list(APPEND LIBRARIES ${FFTW3_LIBRARIES}) - - message(WARNING "INCLUDE: ${INCLUDE}") - message(WARNING "LIBRARIES: ${LIBRARIES}") - + list(APPEND INCLUDE ${FFTW_INCLUDE_DIR}) + list(APPEND LIBRARIES ${FFTW_LIBRARY}) list(APPEND SRC ${FFTW_SRC}) list(APPEND HDR ${FFTW_HDR}) diff --git a/extern/audaspace/blender_config.cmake b/extern/audaspace/blender_config.cmake index 1204506eb66..a1c60646d55 100644 --- a/extern/audaspace/blender_config.cmake +++ b/extern/audaspace/blender_config.cmake @@ -7,7 +7,11 @@ set(SHARED_LIBRARY FALSE) # "Build Shared Library" set(WITH_C TRUE) # "Build C Module" set(WITH_DOCS FALSE) # "Build C++ HTML Documentation with Doxygen" set(WITH_FFMPEG ${WITH_CODEC_FFMPEG}) # "Build With FFMPEG" -set(WITH_FFTW TRUE) # "Build With FFTW" +if(DEFINED WITH_FFTW3) # "Build With FFTW" + set(FFTW_FOUND TRUE) + set(WITH_FFTW TRUE) + set(FFTW3_INCLUDE_DIR ${FFTW3_INCLUDE_DIRS}) +endif() set(WITH_LIBSNDFILE ${WITH_CODEC_SNDFILE}) # "Build With LibSndFile" set(SEPARATE_C FALSE) # "Build C Binding as separate library" set(PLUGIN_COREAUDIO FALSE) # "Build CoreAudio Plugin" diff --git a/source/blender/blenkernel/intern/colortools.cc b/source/blender/blenkernel/intern/colortools.cc index 6eda79abd76..dbcf7353533 100644 --- a/source/blender/blenkernel/intern/colortools.cc +++ b/source/blender/blenkernel/intern/colortools.cc @@ -41,7 +41,7 @@ void BKE_curvemapping_set_defaults(CurveMapping *cumap, float maxx, float maxy, short default_handle_type) - { +{ int a; float clipminx, clipminy, clipmaxx, clipmaxy; @@ -76,7 +76,6 @@ void BKE_curvemapping_set_defaults(CurveMapping *cumap, cumap->cm[a].curve[0].x = minx; cumap->cm[a].curve[0].y = miny; cumap->cm[a].curve[0].flag |= default_handle_type; - cumap->cm[a].curve[1].x = maxx; cumap->cm[a].curve[1].y = maxy; cumap->cm[a].curve[1].flag |= default_handle_type; diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.cc b/source/blender/editors/space_sequencer/sequencer_modifier.cc index f67c120ab2b..344c2aa5a7d 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.cc +++ b/source/blender/editors/space_sequencer/sequencer_modifier.cc @@ -48,9 +48,9 @@ static int strip_modifier_add_exec(bContext *C, wmOperator *op) } static const EnumPropertyItem *filter_modifiers_by_sequence_type(bContext *C, - PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), - bool *UNUSED(r_free)) + PointerRNA * /* ptr */, + PropertyRNA * /* prop */, + bool * /* r_free */) { Scene *scene = CTX_data_scene(C); Sequence *seq = SEQ_select_active_get(scene); @@ -82,17 +82,11 @@ void SEQUENCER_OT_strip_modifier_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - prop = RNA_def_enum(ot->srna, - "type", - DummyRNA_NULL_items, - 0, - "Type", - ""); + prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", ""); RNA_def_enum_funcs(prop, filter_modifiers_by_sequence_type); ot->prop = prop; } - /*********************** Remove modifier operator *************************/ static int strip_modifier_remove_exec(bContext *C, wmOperator *op) @@ -113,7 +107,7 @@ static int strip_modifier_remove_exec(bContext *C, wmOperator *op) SEQ_modifier_free(smd); if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); } else { SEQ_relations_invalidate_cache_preprocessed(scene, seq); @@ -183,7 +177,7 @@ static int strip_modifier_move_exec(bContext *C, wmOperator *op) } if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); } else { SEQ_relations_invalidate_cache_preprocessed(scene, seq); @@ -251,13 +245,12 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *op) if (seq_iter == seq) { continue; } - int seq_iter_is_sound =ELEM(seq_iter->type, SEQ_TYPE_SOUND_RAM); - /* If original is sound, only copy to "sound" strips - * If original is not sound, only copy to "not sound" strips - */ - if(isSound != seq_iter_is_sound) - continue; - + int seq_iter_is_sound = ELEM(seq_iter->type, SEQ_TYPE_SOUND_RAM); + /* If original is sound, only copy to "sound" strips + * If original is not sound, only copy to "not sound" strips + */ + if (isSound != seq_iter_is_sound) + continue; if (type == SEQ_MODIFIER_COPY_REPLACE) { if (seq_iter->modifiers.first) { @@ -277,9 +270,8 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *op) } } - if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); } else { SEQ_relations_invalidate_cache_preprocessed(scene, seq); @@ -347,11 +339,11 @@ void SEQUENCER_OT_strip_modifier_equalizer_redefine(wmOperatorType *ot) { static const EnumPropertyItem enum_modifier_equalizer_presets_items[] = { - {1, "SIMPLE", 0, "Unique", "One unique graphical definition"}, - {2, "DOUBLE", 0, "Double", "Graphical definition in 2 sections"}, - {3, "TRIPLE", 0, "Triplet", "Graphical definition in 3 sections"}, - {0, NULL, 0, NULL, NULL}, -}; + {1, "SIMPLE", 0, "Unique", "One unique graphical definition"}, + {2, "DOUBLE", 0, "Double", "Graphical definition in 2 sections"}, + {3, "TRIPLE", 0, "Triplet", "Graphical definition in 3 sections"}, + {0, NULL, 0, NULL, NULL}, + }; PropertyRNA *prop; /* identifiers */ @@ -370,13 +362,10 @@ void SEQUENCER_OT_strip_modifier_equalizer_redefine(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - prop = RNA_def_enum(ot->srna, - "graphs", - enum_modifier_equalizer_presets_items, - 1, - "Graphs", - "Number of graphs"); + prop = RNA_def_enum( + ot->srna, "graphs", enum_modifier_equalizer_presets_items, 1, "Graphs", "Number of graphs"); ot->prop = prop; - prop = RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to redefine"); + prop = RNA_def_string( + ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to redefine"); RNA_def_property_flag(prop, PROP_HIDDEN); } diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index c1520d96fc4..cce95a9736b 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -527,17 +527,15 @@ enum { /** \} */ - /** \name Sound Modifiers -* \{ */ + * \{ */ -typedef struct EQCurveMappingData{ +typedef struct EQCurveMappingData { struct EQCurveMappingData *next, *prev; struct CurveMapping curve_mapping; } EQCurveMappingData; - -typedef struct SoundEqualizerModifierData{ +typedef struct SoundEqualizerModifierData { SequenceModifierData modifier; /* EQCurveMappingData */ ListBase graphics; diff --git a/source/blender/makesrna/intern/rna_sequencer.cc b/source/blender/makesrna/intern/rna_sequencer.cc index f81b9111322..a9ec371d105 100644 --- a/source/blender/makesrna/intern/rna_sequencer.cc +++ b/source/blender/makesrna/intern/rna_sequencer.cc @@ -72,7 +72,6 @@ const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = { {seqModifierType_Mask, "MASK", ICON_NONE, "Mask", ""}, {seqModifierType_Tonemap, "TONEMAP", ICON_NONE, "Tone Map", ""}, {seqModifierType_WhiteBalance, "WHITE_BALANCE", ICON_NONE, "White Balance", ""}, -<<<<<<< HEAD:source/blender/makesrna/intern/rna_sequencer.c {seqModifierType_SoundEqualizer, "SOUND_EQUALIZER", ICON_NONE, "Sound Equalizer", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -107,21 +106,21 @@ const EnumPropertyItem rna_enum_strip_color_items[] = { {0, nullptr, 0, nullptr, nullptr}, }; -# ifdef RNA_RUNTIME +#ifdef RNA_RUNTIME -# include "BKE_global.h" -# include "BKE_idprop.h" -# include "BKE_movieclip.h" -# include "BKE_report.h" +# include "BKE_global.h" +# include "BKE_idprop.h" +# include "BKE_movieclip.h" +# include "BKE_report.h" -# include "WM_api.hh" +# include "WM_api.hh" -# include "DEG_depsgraph.h" -# include "DEG_depsgraph_build.h" +# include "DEG_depsgraph.h" +# include "DEG_depsgraph_build.h" -# include "IMB_imbuf.h" +# include "IMB_imbuf.h" -# include "SEQ_edit.h" +# include "SEQ_edit.h" struct SequenceSearchData { Sequence *seq; @@ -722,10 +721,10 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) /* fix all the animation data which may link to this */ /* Don't rename everywhere because these are per scene. */ -# if 0 +# if 0 BKE_animdata_fix_paths_rename_all( nullptr, "sequence_editor.sequences_all", oldname, seq->name + 2); -# endif +# endif adt = BKE_animdata_from_id(&scene->id); if (adt) { BKE_animdata_fix_paths_rename(&scene->id, @@ -994,7 +993,7 @@ static void rna_Sequence_input_2_set(PointerRNA *ptr, PointerRNA ptr_value, Repo { rna_Sequence_input_set(ptr, ptr_value, reports, 2); } -# if 0 +# if 0 static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { Sequence *seq = (Sequence *)(ptr->data); @@ -1010,7 +1009,7 @@ static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value) StripElem *elem = (StripElem *)(ptr->data); BLI_path_split_file_part(value, elem->name, sizeof(elem->name)); } -# endif +# endif static void rna_Sequence_reopen_files_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) { @@ -1364,7 +1363,7 @@ static void rna_SequenceModifier_name_set(PointerRNA *ptr, const char *value) } } -static void rna_SequenceModifier_update(Main *bmain, Scene /*scene*/), PointerRNA *ptr) +static void rna_SequenceModifier_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) { /* strip from other scenes could be modified, so using active scene is not reliable */ Scene *scene = (Scene *)ptr->owner_id; @@ -1384,7 +1383,7 @@ static void rna_SequenceModifier_update(Main *bmain, Scene /*scene*/), PointerRN * Update of Curve in an EQ Sound Modifier */ static void rna_SequenceModifier_EQCurveMapping_update(Main *bmain, - Scene *UNUSED(scene), + Scene * /*scene*/, PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; @@ -1595,7 +1594,7 @@ static char *rna_SeqTimelineChannel_path(const PointerRNA *ptr) } static EQCurveMappingData *rna_Sequence_SoundEqualizer_Curve_add(SoundEqualizerModifierData *semd, - bContext *UNUSED(C), + bContext * /* C */, float min_freq, float max_freq) { @@ -1605,13 +1604,13 @@ static EQCurveMappingData *rna_Sequence_SoundEqualizer_Curve_add(SoundEqualizerM } static void rna_Sequence_SoundEqualizer_Curve_clear(SoundEqualizerModifierData *semd, - bContext *UNUSED(C)) + bContext * /* C */) { SEQ_sound_equalizermodifier_free((SequenceModifierData *)semd); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); } -# else +#else static void rna_def_strip_element(BlenderRNA *brna) { @@ -1974,7 +1973,7 @@ static void rna_def_color_balance(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update"); /* not yet used */ -# if 0 +# if 0 prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Exposure", ""); @@ -1984,7 +1983,7 @@ static void rna_def_color_balance(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Saturation", ""); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_ColorBabalnce_update"); -# endif +# endif RNA_def_struct_path_func(srna, "rna_SequenceColorBalance_path"); } @@ -2705,7 +2704,7 @@ static void rna_def_effect_inputs(StructRNA *srna, int count) RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip"); } -# if 0 +# if 0 if (count == 3) { /* Not used by any effects (perhaps one day plugins?). */ prop = RNA_def_property(srna, "input_3", PROP_POINTER, PROP_NONE); @@ -2713,7 +2712,7 @@ static void rna_def_effect_inputs(StructRNA *srna, int count) RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); RNA_def_property_ui_text(prop, "Input 3", "Third input for the effect strip"); } -# endif +# endif } static void rna_def_color_management(StructRNA *srna) @@ -3925,4 +3924,4 @@ void RNA_def_sequencer(BlenderRNA *brna) rna_def_sound_modifiers(brna); } -# endif +#endif diff --git a/source/blender/sequencer/CMakeLists.txt b/source/blender/sequencer/CMakeLists.txt index f5fc6858fda..bffd33a3331 100644 --- a/source/blender/sequencer/CMakeLists.txt +++ b/source/blender/sequencer/CMakeLists.txt @@ -101,6 +101,10 @@ if(WITH_AUDASPACE) ) endif() add_definitions(-DWITH_AUDASPACE) + + if(WITH_FFTW3) + add_definitions(-DWITH_CONVOLUTION) + endif() endif() blender_add_lib(bf_sequencer "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/sequencer/intern/sequencer.cc b/source/blender/sequencer/intern/sequencer.cc index 21eb95dca95..edcc29b1420 100644 --- a/source/blender/sequencer/intern/sequencer.cc +++ b/source/blender/sequencer/intern/sequencer.cc @@ -990,10 +990,9 @@ static bool seq_update_seq_cb(Sequence *seq, void *user_data) void *sound = seq->sound->playback_handle; - if(!BLI_listbase_is_empty(&seq->modifiers)) - { + if (!BLI_listbase_is_empty(&seq->modifiers)) { SequenceModifierData *smd; - for (smd= seq->modifiers.first; smd; smd= smd->next) { + LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) { sound = SEQ_sound_modifier_recreator(seq, smd, sound); } } diff --git a/source/blender/sequencer/intern/sound.cc b/source/blender/sequencer/intern/sound.cc index 02706fbe51b..434e09a8014 100644 --- a/source/blender/sequencer/intern/sound.cc +++ b/source/blender/sequencer/intern/sound.cc @@ -239,8 +239,7 @@ void SEQ_sound_equalizermodifier_free(SequenceModifierData *smd) { SoundEqualizerModifierData *semd = (SoundEqualizerModifierData *)smd; EQCurveMappingData *eqcmd, *eqcmd_next; - LISTBASE_FOREACH (EQCurveMappingData *, eqcmd, &semd->graphics) { - eqcmd_next = eqcmd->next; + LISTBASE_FOREACH_MUTABLE (EQCurveMappingData *, eqcmd, &semd->graphics) { BKE_curvemapping_free_data(&eqcmd->curve_mapping); MEM_freeN(eqcmd); } -- 2.30.2 From 143bd67f5f05e914c075af801c713e293edee4cc Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Sun, 13 Aug 2023 11:55:21 +0200 Subject: [PATCH 05/11] Fix MSVC build warnings --- source/blender/sequencer/intern/sequencer.cc | 1 - source/blender/sequencer/intern/sound.cc | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/source/blender/sequencer/intern/sequencer.cc b/source/blender/sequencer/intern/sequencer.cc index edcc29b1420..e782f9a0b55 100644 --- a/source/blender/sequencer/intern/sequencer.cc +++ b/source/blender/sequencer/intern/sequencer.cc @@ -991,7 +991,6 @@ static bool seq_update_seq_cb(Sequence *seq, void *user_data) void *sound = seq->sound->playback_handle; if (!BLI_listbase_is_empty(&seq->modifiers)) { - SequenceModifierData *smd; LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) { sound = SEQ_sound_modifier_recreator(seq, smd, sound); } diff --git a/source/blender/sequencer/intern/sound.cc b/source/blender/sequencer/intern/sound.cc index 434e09a8014..0ac553e999d 100644 --- a/source/blender/sequencer/intern/sound.cc +++ b/source/blender/sequencer/intern/sound.cc @@ -238,7 +238,6 @@ void SEQ_sound_equalizermodifier_init_data(SequenceModifierData *smd) void SEQ_sound_equalizermodifier_free(SequenceModifierData *smd) { SoundEqualizerModifierData *semd = (SoundEqualizerModifierData *)smd; - EQCurveMappingData *eqcmd, *eqcmd_next; LISTBASE_FOREACH_MUTABLE (EQCurveMappingData *, eqcmd, &semd->graphics) { BKE_curvemapping_free_data(&eqcmd->curve_mapping); MEM_freeN(eqcmd); @@ -251,7 +250,7 @@ void SEQ_sound_equalizermodifier_copy_data(struct SequenceModifierData *target, { SoundEqualizerModifierData *semd = (SoundEqualizerModifierData *)smd; SoundEqualizerModifierData *semd_target = (SoundEqualizerModifierData *)target; - EQCurveMappingData *eqcmd, *eqcmd_n; + EQCurveMappingData *eqcmd_n; BLI_listbase_clear(&semd_target->graphics); -- 2.30.2 From b440d0f6fec6c1ae0465674e9d7d5a6426021e45 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Mon, 14 Aug 2023 03:31:23 +0200 Subject: [PATCH 06/11] Fix typo --- extern/audaspace/blender_config.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/audaspace/blender_config.cmake b/extern/audaspace/blender_config.cmake index a1c60646d55..e840ea60536 100644 --- a/extern/audaspace/blender_config.cmake +++ b/extern/audaspace/blender_config.cmake @@ -10,7 +10,7 @@ set(WITH_FFMPEG ${WITH_CODEC_FFMPEG}) # "Build With FFMPEG" if(DEFINED WITH_FFTW3) # "Build With FFTW" set(FFTW_FOUND TRUE) set(WITH_FFTW TRUE) - set(FFTW3_INCLUDE_DIR ${FFTW3_INCLUDE_DIRS}) + set(FFTW_INCLUDE_DIR ${FFTW3_INCLUDE_DIRS}) endif() set(WITH_LIBSNDFILE ${WITH_CODEC_SNDFILE}) # "Build With LibSndFile" set(SEPARATE_C FALSE) # "Build C Binding as separate library" -- 2.30.2 From bd35eb86b97dc990c49aea055d2c50a7d7cae3bd Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Thu, 17 Aug 2023 14:10:13 +0200 Subject: [PATCH 07/11] Update cmake variables, so it should build on Linux/Mac --- extern/audaspace/blender_config.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extern/audaspace/blender_config.cmake b/extern/audaspace/blender_config.cmake index e840ea60536..7db7dc156df 100644 --- a/extern/audaspace/blender_config.cmake +++ b/extern/audaspace/blender_config.cmake @@ -8,9 +8,10 @@ set(WITH_C TRUE) # "Build C Module" set(WITH_DOCS FALSE) # "Build C++ HTML Documentation with Doxygen" set(WITH_FFMPEG ${WITH_CODEC_FFMPEG}) # "Build With FFMPEG" if(DEFINED WITH_FFTW3) # "Build With FFTW" - set(FFTW_FOUND TRUE) - set(WITH_FFTW TRUE) + set(FFTW_FOUND ${FFTW3_FOUND}) + set(WITH_FFTW ${WITH_FFTW3}) set(FFTW_INCLUDE_DIR ${FFTW3_INCLUDE_DIRS}) + set(FFTW_LIBRARY ${FFTW3_LIBRARIES}) endif() set(WITH_LIBSNDFILE ${WITH_CODEC_SNDFILE}) # "Build With LibSndFile" set(SEPARATE_C FALSE) # "Build C Binding as separate library" -- 2.30.2 From 9db996ea5e150ac69ef1883f7f32b1d4beefa270 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Thu, 17 Aug 2023 14:57:40 +0200 Subject: [PATCH 08/11] "fix" FFTW3_FOUND not being defined despite `FindFftw3.cmake` file docs --- extern/audaspace/blender_config.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/audaspace/blender_config.cmake b/extern/audaspace/blender_config.cmake index 7db7dc156df..476d82f1c81 100644 --- a/extern/audaspace/blender_config.cmake +++ b/extern/audaspace/blender_config.cmake @@ -8,7 +8,7 @@ set(WITH_C TRUE) # "Build C Module" set(WITH_DOCS FALSE) # "Build C++ HTML Documentation with Doxygen" set(WITH_FFMPEG ${WITH_CODEC_FFMPEG}) # "Build With FFMPEG" if(DEFINED WITH_FFTW3) # "Build With FFTW" - set(FFTW_FOUND ${FFTW3_FOUND}) + set(FFTW_FOUND TRUE) set(WITH_FFTW ${WITH_FFTW3}) set(FFTW_INCLUDE_DIR ${FFTW3_INCLUDE_DIRS}) set(FFTW_LIBRARY ${FFTW3_LIBRARIES}) -- 2.30.2 From bdf5b111b8498c53e988f001c61038db77b3373c Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Mon, 28 Aug 2023 17:49:04 +0200 Subject: [PATCH 09/11] Fix build issue on Linux/Mac --- build_files/cmake/Modules/FindFftw3.cmake | 41 +++++++++++++---------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/build_files/cmake/Modules/FindFftw3.cmake b/build_files/cmake/Modules/FindFftw3.cmake index ca9effb7349..72a987f8f0a 100644 --- a/build_files/cmake/Modules/FindFftw3.cmake +++ b/build_files/cmake/Modules/FindFftw3.cmake @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2011 Blender Foundation +# SPDX-FileCopyrightText: 2011 Blender Authors # # SPDX-License-Identifier: BSD-3-Clause @@ -16,19 +16,19 @@ # FFTW3_LIBRARY, where to find the Fftw3 library. # If `FFTW3_ROOT_DIR` was defined in the environment, use it. -IF(DEFINED FFTW3_ROOT_DIR) +if(DEFINED FFTW3_ROOT_DIR) # Pass. -ELSEIF(DEFINED ENV{FFTW3_ROOT_DIR}) - SET(FFTW3_ROOT_DIR $ENV{FFTW3_ROOT_DIR}) -ELSE() - SET(FFTW3_ROOT_DIR "") -ENDIF() +elseif(DEFINED ENV{FFTW3_ROOT_DIR}) + set(FFTW3_ROOT_DIR $ENV{FFTW3_ROOT_DIR}) +else() + set(FFTW3_ROOT_DIR "") +endif() -SET(_fftw3_SEARCH_DIRS +set(_fftw3_SEARCH_DIRS ${FFTW3_ROOT_DIR} ) -FIND_PATH(FFTW3_INCLUDE_DIR +find_path(FFTW3_INCLUDE_DIR NAMES fftw3.h HINTS @@ -37,27 +37,32 @@ FIND_PATH(FFTW3_INCLUDE_DIR include ) -FIND_LIBRARY(FFTW3_LIBRARY +find_library(FFTW3_LIBRARY NAMES - fftw3 + #libfftw3 + libfftw3f + HINTS ${_fftw3_SEARCH_DIRS} PATH_SUFFIXES lib64 lib ) +message(WARNING "looking for fifty") +message(WARNING ${FFTW3_LIBRARY}) + # handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fftw3 DEFAULT_MSG +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Fftw3 DEFAULT_MSG FFTW3_LIBRARY FFTW3_INCLUDE_DIR) -IF(FFTW3_FOUND) - SET(FFTW3_LIBRARIES ${FFTW3_LIBRARY}) - SET(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) -ENDIF() +if(FFTW3_FOUND) + set(FFTW3_LIBRARIES ${FFTW3_LIBRARY}) + set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) +endif() -MARK_AS_ADVANCED( +mark_as_advanced( FFTW3_INCLUDE_DIR FFTW3_LIBRARY ) -- 2.30.2 From 31f75f7f7e81a7a14cf2f403fff9268955d72106 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Mon, 28 Aug 2023 18:49:37 +0200 Subject: [PATCH 10/11] Fix incorrect changes --- build_files/cmake/Modules/FindFftw3.cmake | 27 ++++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/build_files/cmake/Modules/FindFftw3.cmake b/build_files/cmake/Modules/FindFftw3.cmake index 72a987f8f0a..4a350d60269 100644 --- a/build_files/cmake/Modules/FindFftw3.cmake +++ b/build_files/cmake/Modules/FindFftw3.cmake @@ -37,31 +37,42 @@ find_path(FFTW3_INCLUDE_DIR include ) -find_library(FFTW3_LIBRARY - NAMES - #libfftw3 - libfftw3f +set(_FFTW3_LIBRARIES) +find_library(FFTW3_LIBRARY_F + NAMES + fftw3f HINTS ${_fftw3_SEARCH_DIRS} PATH_SUFFIXES lib64 lib ) -message(WARNING "looking for fifty") -message(WARNING ${FFTW3_LIBRARY}) +find_library(FFTW3_LIBRARY_D + NAMES + fftw3 + HINTS + ${_fftw3_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +list(APPEND _FFTW3_LIBRARIES "${FFTW3_LIBRARY_F}") +list(APPEND _FFTW3_LIBRARIES "${FFTW3_LIBRARY_D}") # handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if # all listed variables are TRUE include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Fftw3 DEFAULT_MSG - FFTW3_LIBRARY FFTW3_INCLUDE_DIR) + _FFTW3_LIBRARIES FFTW3_INCLUDE_DIR) if(FFTW3_FOUND) - set(FFTW3_LIBRARIES ${FFTW3_LIBRARY}) + set(FFTW3_LIBRARIES ${_FFTW3_LIBRARIES}) set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) endif() +unset(_FFTW3_LIBRARIES) + mark_as_advanced( FFTW3_INCLUDE_DIR FFTW3_LIBRARY -- 2.30.2 From a3dd2129c7eda308a638d790b0780bfd83dd0eac Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Wed, 30 Aug 2023 20:02:20 +0200 Subject: [PATCH 11/11] Fix issues after merging --- source/blender/editors/space_sequencer/sequencer_modifier.cc | 2 +- source/blender/sequencer/intern/sound.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.cc b/source/blender/editors/space_sequencer/sequencer_modifier.cc index 4d8d466bf61..c81e9ebbafb 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.cc +++ b/source/blender/editors/space_sequencer/sequencer_modifier.cc @@ -82,7 +82,7 @@ void SEQUENCER_OT_strip_modifier_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", ""); + prop = RNA_def_enum(ot->srna, "type", rna_enum_dummy_NULL_items, 0, "Type", ""); RNA_def_enum_funcs(prop, filter_modifiers_by_sequence_type); ot->prop = prop; } diff --git a/source/blender/sequencer/intern/sound.cc b/source/blender/sequencer/intern/sound.cc index 0dd7ab8ba37..d7af260f992 100644 --- a/source/blender/sequencer/intern/sound.cc +++ b/source/blender/sequencer/intern/sound.cc @@ -22,7 +22,7 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" -#include "BLO_read_write.h" +#include "BLO_read_write.hh" #include "BKE_colortools.h" #include "BKE_main.h" -- 2.30.2