Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-06-04 17:52:48 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-06-05 15:23:54 +0300
commitbbaa1bffe9dbc35d2791b83d0014ccb4ffb6087a (patch)
treed0ded24e2fb254943831cacca7c28b7752e57eae /source/blender/makesrna
parent863b7b3668fe67a082439181eaf49c3e94a87536 (diff)
Sound: Port to a copy-on-write concept
This change makes it so sound handles are created for evaluated scene, sequencer and speakers. This allows to have properly evaluated animation on them. For the viewport playback sound uses regular dependency graph. For the final render sound uses dependency graph created for render pipeline, which now also contains sequencer and sound datablocks. All the direct sound update calls are replaced with corresponding dependency graph recalc tag.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_scene.c30
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c46
2 files changed, 22 insertions, 54 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index f101a29ec22..0f0d057845e 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -669,7 +669,6 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = {
# include "BKE_pointcache.h"
# include "BKE_scene.h"
# include "BKE_mesh.h"
-# include "BKE_sound.h"
# include "BKE_screen.h"
# include "BKE_sequencer.h"
# include "BKE_animsys.h"
@@ -819,23 +818,17 @@ static void rna_Scene_camera_update(Main *bmain, Scene *UNUSED(scene_unused), Po
static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- BKE_sound_update_fps(scene);
- BKE_sequencer_update_sound_bounds_all(scene);
+ DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_FPS | ID_RECALC_SEQUENCER_STRIPS);
}
static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- BKE_sound_update_scene_listener(scene);
+ DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_LISTENER);
}
-static void rna_Scene_volume_set(PointerRNA *ptr, float value)
+static void rna_Scene_volume_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- Scene *scene = (Scene *)(ptr->data);
-
- scene->audio.volume = value;
- if (scene->sound_scene) {
- BKE_sound_set_scene_volume(scene, value);
- }
+ DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_VOLUME);
}
static const char *rna_Scene_statistics_string_get(Scene *scene,
@@ -962,10 +955,12 @@ static void rna_Scene_show_subframe_update(Main *UNUSED(bmain),
scene->r.subframe = 0.0f;
}
-static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr)
+static void rna_Scene_frame_update(Main *UNUSED(bmain),
+ Scene *UNUSED(current_scene),
+ PointerRNA *ptr)
{
Scene *scene = (Scene *)ptr->id.data;
- BKE_sound_seek_scene(bmain, scene);
+ DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK);
WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
}
@@ -1825,8 +1820,11 @@ static void rna_Scene_use_audio_set(PointerRNA *ptr, bool value)
else {
scene->audio.flag &= ~AUDIO_MUTE;
}
+}
- BKE_sound_mute_scene(scene, value);
+static void rna_Scene_use_audio_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
+{
+ DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_MUTE);
}
static int rna_Scene_sync_mode_get(PointerRNA *ptr)
@@ -7420,7 +7418,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_Scene_use_audio_get", "rna_Scene_use_audio_set");
RNA_def_property_ui_text(
prop, "Audio Muted", "Play back of audio from Sequence Editor will be muted");
- RNA_def_property_update(prop, NC_SCENE, NULL);
+ RNA_def_property_update(prop, NC_SCENE, "rna_Scene_use_audio_update");
# if 0 /* XXX: Is this actually needed? */
prop = RNA_def_property(srna, "use_audio_sync", PROP_BOOLEAN, PROP_NONE);
@@ -7467,7 +7465,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Volume", "Audio volume");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
RNA_def_property_update(prop, NC_SCENE, NULL);
- RNA_def_property_float_funcs(prop, NULL, "rna_Scene_volume_set", NULL);
+ RNA_def_property_update(prop, NC_SCENE, "rna_Scene_volume_update");
/* Statistics */
func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get");
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 29a06eeabf2..3915c989614 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -75,6 +75,8 @@ const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = {
# include "WM_api.h"
+# include "DEG_depsgraph.h"
+
# include "IMB_imbuf.h"
typedef struct SequenceSearchData {
@@ -727,37 +729,9 @@ static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr)
return strlen(path);
}
-static void rna_Sequence_volume_set(PointerRNA *ptr, float value)
-{
- Sequence *seq = (Sequence *)(ptr->data);
-
- seq->volume = value;
- if (seq->scene_sound) {
- BKE_sound_set_scene_sound_volume(
- seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
- }
-}
-
-static void rna_Sequence_pitch_set(PointerRNA *ptr, float value)
-{
- Sequence *seq = (Sequence *)(ptr->data);
-
- seq->pitch = value;
- if (seq->scene_sound) {
- BKE_sound_set_scene_sound_pitch(
- seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0);
- }
-}
-
-static void rna_Sequence_pan_set(PointerRNA *ptr, float value)
+static void rna_Sequence_audio_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- Sequence *seq = (Sequence *)(ptr->data);
-
- seq->pan = value;
- if (seq->scene_sound) {
- BKE_sound_set_scene_sound_pan(
- seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
- }
+ DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
}
static int rna_Sequence_input_count_get(PointerRNA *ptr)
@@ -801,9 +775,8 @@ static void rna_Sequence_reopen_files_update(Main *bmain, Scene *UNUSED(scene),
static void rna_Sequence_mute_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Scene *scene = (Scene *)ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- BKE_sequencer_update_muting(ed);
+ DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
}
static void rna_Sequence_filepath_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
@@ -2392,23 +2365,20 @@ static void rna_def_sound(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
- RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_volume_set", NULL);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_audio_update");
prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "pitch");
RNA_def_property_range(prop, 0.1f, 10.0f);
RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
- RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pitch_set", NULL);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_audio_update");
prop = RNA_def_property(srna, "pan", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "pan");
RNA_def_property_range(prop, -2.0f, 2.0f);
RNA_def_property_ui_text(prop, "Pan", "Playback panning of the sound (only for Mono sources)");
- RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pan_set", NULL);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_audio_update");
prop = RNA_def_property(srna, "show_waveform", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_AUDIO_DRAW_WAVEFORM);