diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-03 18:47:44 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-03 18:50:43 +0300 |
commit | 888852055c1b203f5a89c7e229f87f412a6624da (patch) | |
tree | bc0a0752ec236eae297e19ea30cf00dee9672aa1 /source/blender/blenkernel | |
parent | 712fe561d58c78c2f9ecda2f07d4d45d36a384bf (diff) |
Sound: Fix for being unable to jump to a frame during playback with A/V sync
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_sound.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 9eebc6ab6be..f526dd579ce 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -32,6 +32,7 @@ struct Main; struct Sequence; struct bSound; +struct Depsgraph; typedef struct SoundWaveform { int length; @@ -143,6 +144,10 @@ void BKE_sound_stop_scene(struct Scene *scene); void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene); +/* Use this after original scene's frame has been changed. It will take care of doing all the + * updates required for BKE_sound_seek_scene(). */ +void BKE_sound_update_and_seek(struct Main *bmain, struct Depsgraph *depsgraph); + float BKE_sound_sync_scene(struct Scene *scene); int BKE_sound_scene_playing(struct Scene *scene); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 9e5fb3dac63..04e34331826 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -1213,6 +1213,19 @@ char **BKE_sound_get_device_names(void) #endif /* WITH_AUDASPACE */ +void BKE_sound_update_and_seek(Main *bmain, Depsgraph *depsgraph) +{ + Scene *scene_orig = DEG_get_input_scene(depsgraph); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + /* NOTE: We don't do copy-on-write or anything like that here because we need to know scene's + * flags like "scrubbing" in the BKE_sound_seek_scene(). So we simply update frame to which + * seek needs to happen. + * + * TODO(sergey): Might change API so the frame is passes explicitly. */ + scene_eval->r.cfra = scene_orig->r.cfra; + BKE_sound_seek_scene(bmain, scene_eval); +} + void BKE_sound_reset_scene_runtime(Scene *scene) { scene->sound_scene = NULL; |