Revision: 59336
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59336
Author:   mont29
Date:     2013-08-20 19:50:31 +0000 (Tue, 20 Aug 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_sequencer.h
    trunk/blender/source/blender/blenkernel/intern/sequencer.c
    trunk/blender/source/blender/blenkernel/intern/sound.c

Modified: trunk/blender/source/blender/blenkernel/BKE_sequencer.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_sequencer.h     2013-08-20 
18:55:41 UTC (rev 59335)
+++ trunk/blender/source/blender/blenkernel/BKE_sequencer.h     2013-08-20 
19:50:31 UTC (rev 59336)
@@ -318,6 +318,8 @@
 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);

Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c  2013-08-20 
18:55:41 UTC (rev 59335)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c  2013-08-20 
19:50:31 UTC (rev 59336)
@@ -3677,6 +3677,50 @@
        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;

Modified: trunk/blender/source/blender/blenkernel/intern/sound.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sound.c      2013-08-20 
18:55:41 UTC (rev 59335)
+++ trunk/blender/source/blender/blenkernel/intern/sound.c      2013-08-20 
19:50:31 UTC (rev 59336)
@@ -427,6 +427,8 @@
 {
        if (scene->sound_scene)
                AUD_setSequencerFPS(scene->sound_scene, FPS);
+
+       BKE_sequencer_refresh_sound_length(scene);
 }
 
 void sound_update_scene_listener(struct Scene *scene)

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to