[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29092] trunk/blender: == Sequencer ==
Peter Schlaile
peter at schlaile.de
Sun May 30 23:18:00 CEST 2010
Revision: 29092
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29092
Author: schlaile
Date: 2010-05-30 23:17:59 +0200 (Sun, 30 May 2010)
Log Message:
-----------
== Sequencer ==
This makes volume range larger and adds an additional attenuation-variable to RNA,
which makes volume-changes in dezibel units possible.
Modified Paths:
--------------
trunk/blender/release/scripts/ui/space_sequencer.py
trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
Modified: trunk/blender/release/scripts/ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/ui/space_sequencer.py 2010-05-30 20:48:09 UTC (rev 29091)
+++ trunk/blender/release/scripts/ui/space_sequencer.py 2010-05-30 21:17:59 UTC (rev 29092)
@@ -457,7 +457,7 @@
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 @@
row.prop(strip.sound, "caching")
layout.prop(strip, "volume")
+ layout.prop(strip, "attenuation")
col = layout.column(align=True)
col.label(text="Trim Duration:")
Modified: trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sequencer.c 2010-05-30 20:48:09 UTC (rev 29091)
+++ trunk/blender/source/blender/makesrna/intern/rna_sequencer.c 2010-05-30 21:17:59 UTC (rev 29092)
@@ -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,7 +404,21 @@
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)
{
Sequence *seq= (Sequence*)(ptr->data);
@@ -1045,10 +1070,17 @@
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",
More information about the Bf-blender-cvs
mailing list