diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-08-20 23:50:31 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-08-20 23:50:31 +0400 |
commit | aa10489a0df3ff828f0fdd45cb03a771505f3471 (patch) | |
tree | 6437ae049a6dde67991049f5316379289fe048dd /source/blender | |
parent | e2534eac8e9c949010286b67ab02a41d6c1ef6c8 (diff) |
Fix [#36351] Changing the Frame Rate value doesnt adjust audio strip length.
Simply recalc sequence len for audio (and meta!) strips when modifying fps value. Note start, startofs and endofs are also updated, to try to keep final pos and length as consistent as possible.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 44 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 2 |
3 files changed, 48 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 78018f04458..0fab38df780 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -318,6 +318,8 @@ void BKE_sequencer_update_sound_bounds(struct Scene *scene, struct Sequence *seq void BKE_sequencer_update_muting(struct Editing *ed); void BKE_sequencer_update_sound(struct Scene *scene, struct bSound *sound); +void BKE_sequencer_refresh_sound_length(struct Scene *scene); + void BKE_sequence_base_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq); void BKE_sequence_base_dupli_recursive(struct Scene *scene, struct Scene *scene_to, ListBase *nseqbase, ListBase *seqbase, int dupe_flag); bool BKE_sequence_is_valid_check(struct Sequence *seq); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 34b19e3f357..95605cd2d2d 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3677,6 +3677,50 @@ bool BKE_sequence_base_shuffle_time(ListBase *seqbasep, Scene *evil_scene) return offset ? false : true; } +/* Unlike _update_sound_ funcs, these ones take info from audaspace to update sequence length! */ +#ifdef WITH_AUDASPACE +static bool sequencer_refresh_sound_length_recursive(Scene *scene, ListBase *seqbase) { + Sequence *seq; + bool changed = false; + + for (seq = seqbase->first; seq; seq = seq->next) { + if (seq->type == SEQ_TYPE_META) { + if (sequencer_refresh_sound_length_recursive(scene, &seq->seqbase)) { + BKE_sequence_calc(scene, seq); + changed = true; + } + } + else if (seq->type == SEQ_TYPE_SOUND_RAM) { + AUD_SoundInfo info = AUD_getInfo(seq->sound->playback_handle); + int old = seq->len; + float fac; + + seq->len = (int)ceil((double)info.length * FPS); + fac = (float)seq->len / (float)old; + old = seq->startofs; + seq->startofs *= fac; + seq->endofs *= fac; + seq->start += (old - seq->startofs); /* So that visual/"real" start frame does not change! */ + + BKE_sequence_calc(scene, seq); + changed = true; + } + } + return changed; +} +#endif + +void BKE_sequencer_refresh_sound_length(Scene *scene) +{ +#ifdef WITH_AUDASPACE + if (scene->ed) { + sequencer_refresh_sound_length_recursive(scene, &scene->ed->seqbase); + } +#else + (void)scene; +#endif +} + void BKE_sequencer_update_sound_bounds_all(Scene *scene) { Editing *ed = scene->ed; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 2f8eb7d9931..3910ef5cb69 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -427,6 +427,8 @@ void sound_update_fps(struct Scene *scene) { if (scene->sound_scene) AUD_setSequencerFPS(scene->sound_scene, FPS); + + BKE_sequencer_refresh_sound_length(scene); } void sound_update_scene_listener(struct Scene *scene) |