From 302b04a5a3fc0e767ac784424f78ce2edf5d2844 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Wed, 29 Jun 2022 12:45:59 +0200 Subject: VSE: Improved Retiming system Patch implements better way to control playback speed than it is possible to do with speed effect. Speed factor property can be set in Time panel. There are 2 layers of control: Option to retime movie to match scene FPS rate. Custom speed factor to control playback rate. Since playback rate is strip property, it is now possible to manipulate strip as normal one even if it is retimed. To facilitate manipulation, some functions need to consider speed factor and apply necessary corrections to strip offset or strip start. These corrections may need to be float numbers, so start and offsets must be float as well. Sound strips now use speed factor instead of pitch. This means, that strips will change length to match usable length. In addition, it is possible to group movie and sound strip and change speed of meta strip. --- source/blender/sequencer/intern/sound.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source/blender/sequencer/intern/sound.c') diff --git a/source/blender/sequencer/intern/sound.c b/source/blender/sequencer/intern/sound.c index 50c8b76a9a0..c4992848cb5 100644 --- a/source/blender/sequencer/intern/sound.c +++ b/source/blender/sequencer/intern/sound.c @@ -23,6 +23,7 @@ #include "SEQ_sound.h" #include "SEQ_time.h" +#include "sequencer.h" #include "strip_time.h" /* Unlike _update_sound_ funcs, these ones take info from audaspace to update sequence length! */ @@ -99,8 +100,8 @@ void SEQ_sound_update_bounds(Scene *scene, Sequence *seq) BKE_sound_move_scene_sound(scene, seq->scene_sound, - SEQ_time_left_handle_frame_get(seq), - SEQ_time_right_handle_frame_get(seq), + SEQ_time_left_handle_frame_get(scene, seq), + SEQ_time_right_handle_frame_get(scene, seq), startofs, 0.0); } @@ -133,3 +134,12 @@ void SEQ_sound_update(Scene *scene, bSound *sound) seq_update_sound_recursive(scene, &scene->ed->seqbase, sound); } } + +float SEQ_sound_pitch_get(const Scene *scene, const Sequence *seq) +{ + Sequence *meta_parent = seq_sequence_lookup_meta_by_seq(scene, seq); + if (meta_parent != NULL) { + return seq->speed_factor * SEQ_sound_pitch_get(scene, meta_parent); + } + return seq->speed_factor; +} -- cgit v1.2.3