diff options
author | Richard Antalik <richardantalik@gmail.com> | 2022-01-26 01:53:33 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2022-01-26 01:59:50 +0300 |
commit | 83094d9a0d43a95fa0ac2ec79234e54bb1c88675 (patch) | |
tree | 2c215dcacd172af7798102f96154f6faec01e1cd /source/blender/sequencer | |
parent | c1b5cea63acf664f43b78b11956fe482561addde (diff) |
Fix T94149: Incorrect sound strip length
Fix formula in function `SEQ_sound_update_length`.
Formula for sound strip length was changed in commit ded68fb1027, when
strip is added to timeline, but it was not changed in function
mentioned above.
Diffstat (limited to 'source/blender/sequencer')
-rw-r--r-- | source/blender/sequencer/intern/sound.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/sequencer/intern/sound.c b/source/blender/sequencer/intern/sound.c index 86a37aca4a9..0788003fb12 100644 --- a/source/blender/sequencer/intern/sound.c +++ b/source/blender/sequencer/intern/sound.c @@ -31,6 +31,7 @@ #include "DNA_sound_types.h" #include "BLI_listbase.h" +#include "BLI_utildefines.h" #include "BKE_main.h" #include "BKE_scene.h" @@ -56,11 +57,15 @@ static bool sequencer_refresh_sound_length_recursive(Main *bmain, Scene *scene, } } else if (seq->type == SEQ_TYPE_SOUND_RAM && seq->sound) { - const float length = BKE_sound_get_length(bmain, seq->sound); + SoundInfo info; + if (!BKE_sound_info_get(bmain, seq->sound, &info)) { + continue; + } + int old = seq->len; float fac; - seq->len = (int)ceil((double)length * FPS); + seq->len = MAX2(1, round((info.length - seq->sound->offset_time) * FPS)); fac = (float)seq->len / (float)old; old = seq->startofs; seq->startofs *= fac; |