From d02da8de23b1d5f64695d3e7e91384d5e2f24e4c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 1 May 2019 15:12:38 +0200 Subject: Sound: Delay opening handlers for until really needed Needs to be done in order to localize sound handlers to the evaluated IDs only. This commit might not be fully optimal, since it does more things on every scene update request, but that will be solved by the upcoming change which will put those updates to a dependency graph. --- source/blender/blenkernel/intern/sound.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/sound.c') diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index c97baf8f7dd..3b46677828d 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -463,8 +463,6 @@ void BKE_sound_load(Main *bmain, bSound *sound) else { sound->playback_handle = sound->handle; } - - BKE_sound_update_sequencer(bmain, sound); } } @@ -1155,3 +1153,33 @@ char **BKE_sound_get_device_names(void) } #endif /* WITH_AUDASPACE */ + +void BKE_sound_reset_scene_pointers(Scene *scene) +{ + scene->sound_scene = NULL; + scene->playback_handle = NULL; + scene->sound_scrub_handle = NULL; + scene->speaker_handles = NULL; +} + +void BKE_sound_ensure_scene(struct Scene *scene) +{ + if (scene->sound_scene != NULL) { + return; + } + BKE_sound_create_scene(scene); +} + +void BKE_sound_reset_pointers(bSound *sound) +{ + sound->cache = NULL; + sound->playback_handle = NULL; +} + +void BKE_sound_ensure_loaded(Main *bmain, bSound *sound) +{ + if (sound->cache != NULL) { + return; + } + BKE_sound_load(bmain, sound); +} -- cgit v1.2.3