diff options
author | Peter Schlaile <peter@schlaile.de> | 2010-05-31 01:17:59 +0400 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2010-05-31 01:17:59 +0400 |
commit | d7dd651e70e6143582990f07dfecadf627d27617 (patch) | |
tree | 580251c17bdc1a4a0b2e12dcfc106a7f15938f0a | |
parent | 03220bfe71ba1605c7e1428132f7e29ab2ff01bb (diff) |
== Sequencer ==
This makes volume range larger and adds an additional attenuation-variable to RNA,
which makes volume-changes in dezibel units possible.
-rw-r--r-- | release/scripts/ui/space_sequencer.py | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 34 |
2 files changed, 35 insertions, 2 deletions
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py index c3f056b1394..b94acf6f3ad 100644 --- a/release/scripts/ui/space_sequencer.py +++ b/release/scripts/ui/space_sequencer.py @@ -457,7 +457,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel): row = layout.row(align=True) sub = row.row() sub.scale_x = 2.0 - + if not context.screen.animation_playing: sub.operator("screen.animation_play", text="", icon='PLAY') else: @@ -666,6 +666,7 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel): row.prop(strip.sound, "caching") layout.prop(strip, "volume") + layout.prop(strip, "attenuation") col = layout.column(align=True) col.label(text="Trim Duration:") diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index bbcc1f82826..f1f4a252c16 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -40,9 +40,20 @@ #include "MEM_guardedalloc.h" #include "WM_types.h" +#include "BLI_math.h" #ifdef RNA_RUNTIME +static float to_dB(float x) +{ + return logf(x * x + 1e-30f) * 4.34294480f; +} + +static float from_dB(float x) +{ + return expf(x * 0.11512925f); +} + /* build a temp referene to the parent */ static void meta_tmp_ref(Sequence *seq_par, Sequence *seq) { @@ -393,6 +404,20 @@ static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) return strlen(path)+1; } +static float rna_Sequence_attenuation_get(PointerRNA *ptr) +{ + Sequence *seq= (Sequence*)(ptr->data); + + return to_dB(seq->volume); +} + +static void rna_Sequence_attenuation_set(PointerRNA *ptr, float value) +{ + Sequence *seq= (Sequence*)(ptr->data); + + seq->volume = from_dB(value); +} + /*static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { @@ -1045,10 +1070,17 @@ static void rna_def_sound(BlenderRNA *brna) prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "volume"); - RNA_def_property_range(prop, 0.0f, 2.0f); + RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); + prop= RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, -100.0f, +40.0f); + RNA_def_property_ui_text(prop, "Attenuation/db", "Attenuation in dezibel"); + RNA_def_property_float_funcs(prop, "rna_Sequence_attenuation_get", "rna_Sequence_attenuation_set", NULL); + + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_ui_text(prop, "File", ""); RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length", |