[Bf-blender-cvs] [7c3ca0c30c1] temp-vse-retiming-tool: Add sound strip retiming support

Richard Antalik noreply at git.blender.org
Mon Nov 14 16:58:20 CET 2022


Commit: 7c3ca0c30c1ec09fed88a44c140a3855cd653b85
Author: Richard Antalik
Date:   Thu Oct 20 20:10:11 2022 +0200
Branches: temp-vse-retiming-tool
https://developer.blender.org/rB7c3ca0c30c1ec09fed88a44c140a3855cd653b85

Add sound strip retiming support

===================================================================

M	source/blender/sequencer/SEQ_time.h
M	source/blender/sequencer/intern/strip_retiming.cc

===================================================================

diff --git a/source/blender/sequencer/SEQ_time.h b/source/blender/sequencer/SEQ_time.h
index 8ac3f379226..49277cd28f7 100644
--- a/source/blender/sequencer/SEQ_time.h
+++ b/source/blender/sequencer/SEQ_time.h
@@ -153,6 +153,8 @@ float SEQ_retiming_handle_speed_get(const struct Scene *scene,
                                     const struct Sequence *seq,
                                     const struct SeqRetimingHandle *handle);
 int SEQ_retiming_handle_index_get(const struct Sequence *seq, const struct SeqRetimingHandle *handle);
+
+void SEQ_retiming_sound_animation_data_set(const struct Scene *scene,const struct Sequence *seq);
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/sequencer/intern/strip_retiming.cc b/source/blender/sequencer/intern/strip_retiming.cc
index 676603b03b4..a550ce2dd14 100644
--- a/source/blender/sequencer/intern/strip_retiming.cc
+++ b/source/blender/sequencer/intern/strip_retiming.cc
@@ -125,6 +125,7 @@ bool SEQ_retiming_is_active(const Scene *scene, const Sequence *seq)
 bool SEQ_retiming_is_allowed(const Sequence *seq)
 {
   return ELEM(seq->type,
+              SEQ_TYPE_SOUND_RAM,
               SEQ_TYPE_IMAGE,
               SEQ_TYPE_META,
               SEQ_TYPE_SCENE,
@@ -250,3 +251,20 @@ float SEQ_retiming_handle_speed_get(const Scene *scene,
   const float speed = (float)fragment_length_retimed / (float)fragment_length_original;
   return speed;
 }
+
+#include <BKE_sound.h>
+void SEQ_retiming_sound_animation_data_set(const Scene scene, const Sequence *seq)
+{
+  MutableSpan handles = SEQ_retiming_handles_get(seq);
+
+  for (const SeqRetimingHandle &handle : handles) {
+    if (handle.strip_frame_index == 0) {
+      continue;
+    }
+
+    float pitch = SEQ_retiming_handle_speed_get(scene, seq, handle);
+
+    BKE_sound_set_scene_sound_pitch(
+        seq->scene_sound, pitch, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0);
+  }
+}



More information about the Bf-blender-cvs mailing list