== Sequencer ==

This makes volume range larger and adds an additional attenuation-variable to RNA,
which makes volume-changes in dezibel units possible.
This commit is contained in:
Peter Schlaile 2010-05-30 21:17:59 +00:00
parent 03220bfe71
commit d7dd651e70
2 changed files with 35 additions and 2 deletions

@ -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:")

@ -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",