Blender Git Commit Log

Git Commits -> Revision c5fe16e

Revision c5fe16e by Sergey Sharybin (master)
May 3, 2019, 13:50 (GMT)
Sound: Make sound handles only be in evaluated datablocks

Quite straightforward change, which makes it so audio handles are
only created inside of evaluated datablocks.

Exception is adding sound strip to the sequencer, which needs an
audio handle to query length and number of channels. This is done
by temporarily loading sound file into an original datablock, and
then tossing it away.

There is an assert in sound.c which verifies that audio system is
used from an evaluated domain, which should help porting all the
cases which are likely missed by this commit.

Some annoying parts:

- `BKE_sound_update_scene()` is iterating over all bases, and does
special ID tags to see whether sound has been handled or not
already. This can not be done the old fashion now.

Ideally, this will be done as a speaker datablock evaluation,
but seems that would require a lock since audio API is not safe
for threading. So this is not a desired way i'd say.

Possible solution here would be to iterate over ID datablocks
using dependency graph query API.

- Frame jump needs to call `BKE_sound_seek_scene()` directly
because there might be some flags assigned to the scene which
could be clear after operator execution is over.

Need to verify if that's the case though. This is a bit hairy
code, so sticking to a safest and known to work approach for
now.

- Removed check for format when opening new sound file.
Maybe we can have some utility function which queries channel
and duration information, leaving the caller's code clean and
tidy.

Tested following cases:
- Adding/removing/moving sequencer's sound strips.
- Adding/moving speakers in viewport.
- Rendering audio.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D4779

Commit Details:

Full Hash: c5fe16e121eefe5dd02cc9f9ba572053c383ccfa
Parent Commit: b4e1e09
Lines Changed: +272, -173

15 Modified Paths:

/source/blender/blenkernel/BKE_sound.h (+12, -2) (Diff)
/source/blender/blenkernel/intern/scene.c (+10, -16) (Diff)
/source/blender/blenkernel/intern/sequencer.c (+12, -10) (Diff)
/source/blender/blenkernel/intern/sound.c (+167, -86) (Diff)
/source/blender/blenloader/intern/readfile.c (+2, -2) (Diff)
/source/blender/depsgraph/intern/builder/deg_builder_relations.cc (+4, -0) (Diff)
/source/blender/depsgraph/intern/depsgraph_tag.cc (+0, -5) (Diff)
/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc (+1, -3) (Diff)
/source/blender/editors/animation/anim_ops.c (+4, -2) (Diff)
/source/blender/editors/screen/screen_ops.c (+6, -3) (Diff)
/source/blender/editors/sound/CMakeLists.txt (+1, -0) (Diff)
/source/blender/editors/sound/sound_ops.c (+20, -35) (Diff)
/source/blender/makesdna/DNA_ID.h (+1, -7) (Diff)
/source/blender/windowmanager/intern/wm_event_system.c (+4, -2) (Diff)
/source/blender/windowmanager/intern/wm_init_exit.c (+28, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021