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:
authorJoerg Mueller <nexyon@gmail.com>2009-12-24 17:01:22 +0300
committerJoerg Mueller <nexyon@gmail.com>2009-12-24 17:01:22 +0300
commita2b0020e11e27c6d7ecdacf747a4543ab733867b (patch)
tree2739db8b8e5cec0dba71434b72f7436c2eef3061
parentbb452f29d6c8bce1c34ba56f521e2876377e6bda (diff)
Reverted the addition of the f-curve sound modifier (was added in revision 24759) due to unusability and performance issues. The ability to use a sound as animation source will be added as an import operator later that renders a sound to an f-curve which brings the advantage that you can edit the generated curve later and the disadvantage it is not automatically updated when the sound changes.
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c93
-rw-r--r--source/blender/blenloader/intern/readfile.c13
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c49
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c2
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c2
-rw-r--r--source/blender/makesdna/DNA_anim_types.h21
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c45
9 files changed, 6 insertions, 222 deletions
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 877c6d6b62e..5daa2ed1924 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -53,8 +53,6 @@
#include "RNA_access.h"
#include "RNA_types.h"
-#include "AUD_C-API.h"
-
#ifndef DISABLE_PYTHON
#include "BPY_extern.h" /* for BPY_pydriver_eval() */
#endif
@@ -873,96 +871,6 @@ static FModifierTypeInfo FMI_LIMITS = {
fcm_limits_evaluate /* evaluate */
};
-/* Sound F-Curve Modifier --------------------------- */
-
-static void fcm_sound_new_data (void *mdata)
-{
- FMod_Sound *data= (FMod_Sound *)mdata;
-
- /* defaults */
- data->strength= 1.0f;
- data->delay = 0.0f;
- data->modification = FCM_SOUND_MODIF_REPLACE;
- data->sound = NULL;
-}
-
-static void fcm_sound_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime)
-{
- FMod_Sound *data= (FMod_Sound *)fcm->data;
- float amplitude;
-
- AUD_Device *device;
- AUD_Sound *limiter;
- AUD_SoundInfo info;
-
- // XXX fixme - need to get in terms of time instead of frames to be really useful
-// evaltime = FRA2TIME(evaltime);
- evaltime -= data->delay;
-
- /* sound-system cannot cope with negative times/frames */
- if (evaltime < 0.0f)
- return;
- /* must have a sound with a cache so that this can be used */
- if (ELEM(NULL, data->sound, data->sound->cache))
- return;
-
- /* examine this snippet of the wave, and extract the amplitude from it */
- info = AUD_getInfo(data->sound->cache);
- info.specs.channels = 1;
- info.specs.format = AUD_FORMAT_FLOAT32;
- device = AUD_openReadDevice(info.specs);
- limiter = AUD_limitSound(data->sound->cache, evaltime, evaltime + 1);
- AUD_playDevice(device, limiter);
- AUD_unload(limiter);
- AUD_readDevice(device, (sample_t*)&amplitude, 1);
- AUD_closeReadDevice(device);
-
- /* combine the amplitude with existing motion data */
- switch (data->modification) {
- case FCM_SOUND_MODIF_ADD:
- *cvalue= *cvalue + amplitude * data->strength;
- break;
- case FCM_SOUND_MODIF_SUBTRACT:
- *cvalue= *cvalue - amplitude * data->strength;
- break;
- case FCM_SOUND_MODIF_MULTIPLY:
- *cvalue= *cvalue * amplitude * data->strength;
- break;
- case FCM_SOUND_MODIF_REPLACE:
- default:
- *cvalue= *cvalue + amplitude * data->strength;
- break;
- }
-}
-
-static float fcm_sound_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime)
-{
- FMod_Sound *data= (FMod_Sound *)fcm->data;
-
- /* check for the time delay */
-// evaltime = FRA2TIME(evaltime);
- if(evaltime < data->delay)
- return data->delay;
-
- /* modifier doesn't change time */
- return evaltime;
-}
-
-static FModifierTypeInfo FMI_SOUND = {
- FMODIFIER_TYPE_SOUND, /* type */
- sizeof(FMod_Sound), /* size */
- FMI_TYPE_REPLACE_VALUES, /* action type */
- 0, /* requirements */
- "Sound", /* name */
- "FMod_Sound", /* struct name */
- NULL, /* free data */
- NULL, /* copy data */
- fcm_sound_new_data, /* new data */
- NULL, /* verify */
- fcm_sound_time, /* evaluate time */
- fcm_sound_evaluate /* evaluate */
-};
-
/* F-Curve Modifier API --------------------------- */
/* All of the F-Curve Modifier api functions use FModifierTypeInfo structs to carry out
* and operations that involve F-Curve modifier specific code.
@@ -984,7 +892,6 @@ static void fmods_init_typeinfo ()
fmodifiersTypeInfo[6]= NULL/*&FMI_FILTER*/; /* Filter F-Curve Modifier */ // XXX unimplemented
fmodifiersTypeInfo[7]= &FMI_PYTHON; /* Custom Python F-Curve Modifier */
fmodifiersTypeInfo[8]= &FMI_LIMITS; /* Limits F-Curve Modifier */
- fmodifiersTypeInfo[9]= &FMI_SOUND; /* Sound F-Curve Modifier */
}
/* This function should be used for getting the appropriate type-info when only
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 7512a7ebb02..d6858f664a3 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1695,12 +1695,6 @@ static void lib_link_fmodifiers(FileData *fd, ID *id, ListBase *list)
data->script = newlibadr(fd, id->lib, data->script);
}
break;
- case FMODIFIER_TYPE_SOUND:
- {
- FMod_Sound *data= (FMod_Sound *)fcm->data;
- data->sound = newlibadr(fd, id->lib, data->sound);
- }
- break;
}
}
}
@@ -10663,13 +10657,6 @@ static void expand_fmodifiers(FileData *fd, Main *mainvar, ListBase *list)
expand_doit(fd, mainvar, data->script);
}
break;
- case FMODIFIER_TYPE_SOUND:
- {
- FMod_Sound *data= (FMod_Sound *)fcm->data;
-
- expand_doit(fd, mainvar, data->sound);
- }
- break;
}
}
}
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index ebddcd45a8b..3ba20ca3e88 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -321,45 +321,6 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short
/* --------------- */
-/* draw settings for sound modifier */
-static void draw_modifier__sound(const bContext *C, uiLayout *layout, ID *id, FModifier *fcm, short width)
-{
- FMod_Sound *data= (FMod_Sound *)fcm->data;
- PointerRNA ptr;
-
- /* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierSound, fcm, &ptr);
-
- /* sound */
- uiTemplateID(layout, (bContext*)C, &ptr, "sound", NULL, "sound.open", NULL);
-
- if (data->sound)
- {
- /* only sounds that are cached can be used, so display error if not cached */
- if (data->sound->cache)
- {
- /* blending mode */
- uiItemR(layout, NULL, 0, &ptr, "modification", 0);
-
- /* settings */
- uiItemR(layout, NULL, 0, &ptr, "strength", 0);
- uiItemR(layout, NULL, 0, &ptr, "delay", 0);
- }
- else
- {
- PointerRNA id_ptr;
-
- RNA_id_pointer_create((ID *)data->sound, &id_ptr);
-
- /* error message with a button underneath allowing users to rectify the issue */
- uiItemL(layout, "Sound must be cached.", ICON_ERROR);
- uiItemR(layout, NULL, 0, &id_ptr, "caching", UI_ITEM_R_TOGGLE);
- }
- }
-}
-
-/* --------------- */
-
#define BINARYSEARCH_FRAMEEQ_THRESH 0.0001
/* Binary search algorithm for finding where to insert Envelope Data Point.
@@ -623,7 +584,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
/* --------------- */
-void ANIM_uiTemplate_fmodifier_draw (const bContext *C, uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
+void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
{
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
uiLayout *box, *row, *subrow;
@@ -704,15 +665,11 @@ void ANIM_uiTemplate_fmodifier_draw (const bContext *C, uiLayout *layout, ID *id
case FMODIFIER_TYPE_LIMITS: /* Limits */
draw_modifier__limits(box, id, fcm, width);
break;
-
+
case FMODIFIER_TYPE_NOISE: /* Noise */
draw_modifier__noise(box, id, fcm, width);
break;
-
- case FMODIFIER_TYPE_SOUND: /* Sound */
- draw_modifier__sound(C, box, id, fcm, width);
- break;
-
+
default: /* unknown type */
break;
}
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 48e2eff0d31..b971abac995 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -428,7 +428,7 @@ void ANIM_draw_previewrange(const struct bContext *C, struct View2D *v2d);
/* F-MODIFIER TOOLS */
/* draw a given F-Modifier for some layout/UI-Block */
-void ANIM_uiTemplate_fmodifier_draw(const struct bContext *C, struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm);
+void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm);
/* ************************************************* */
/* ASSORTED TOOLS */
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 1eaac8ffd20..3faba9bbba7 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -452,7 +452,7 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
for (fcm= fcu->modifiers.first; fcm; fcm= fcm->next) {
col= uiLayoutColumn(pa->layout, 1);
- ANIM_uiTemplate_fmodifier_draw(C, col, ale->id, &fcu->modifiers, fcm);
+ ANIM_uiTemplate_fmodifier_draw(col, ale->id, &fcu->modifiers, fcm);
}
MEM_freeN(ale);
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index e8eca9de281..df791297967 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -434,7 +434,7 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
for (fcm= strip->modifiers.first; fcm; fcm= fcm->next) {
col= uiLayoutColumn(pa->layout, 1);
- ANIM_uiTemplate_fmodifier_draw(C, col, strip_ptr.id.data, &strip->modifiers, fcm);
+ ANIM_uiTemplate_fmodifier_draw(col, strip_ptr.id.data, &strip->modifiers, fcm);
}
}
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 31d50e03cce..dcb10d0f2cf 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -36,7 +36,6 @@ extern "C" {
#include "DNA_listBase.h"
#include "DNA_action_types.h"
#include "DNA_curve_types.h"
-#include "DNA_sound_types.h"
/* ************************************************ */
/* F-Curve DataTypes */
@@ -74,7 +73,6 @@ typedef enum eFModifier_Types {
FMODIFIER_TYPE_FILTER, /* unimplemented - for applying: fft, high/low pass filters, etc. */
FMODIFIER_TYPE_PYTHON,
FMODIFIER_TYPE_LIMITS,
- FMODIFIER_TYPE_SOUND,
/* NOTE: all new modifiers must be added above this line */
FMODIFIER_NUM_TYPES
@@ -232,25 +230,6 @@ typedef enum eFMod_Noise_Modifications {
FCM_NOISE_MODIF_MULTIPLY, /* Multiply the curve by noise */
} eFMod_Noise_Modifications;
-/* sound modifier data */
-typedef struct FMod_Sound {
- float strength;
- float delay;
-
- short modification;
- short pad[3];
-
- bSound *sound;
-} FMod_Sound;
-
-/* modification modes */
-typedef enum eFMod_Sound_Modifications {
- FCM_SOUND_MODIF_REPLACE = 0, /* Modify existing curve, matching it's shape */
- FCM_SOUND_MODIF_ADD, /* Add amplitude to the curve */
- FCM_SOUND_MODIF_SUBTRACT, /* Subtract amplitude from the curve */
- FCM_SOUND_MODIF_MULTIPLY, /* Multiply the curve by amplitude */
-} eFMod_Sound_Modifications;
-
/* Drivers -------------------------------------- */
/* Driver Target
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index a5978937ed5..fc374ff093a 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -211,7 +211,6 @@ extern StructRNA RNA_FModifierGenerator;
extern StructRNA RNA_FModifierLimits;
extern StructRNA RNA_FModifierNoise;
extern StructRNA RNA_FModifierPython;
-extern StructRNA RNA_FModifierSound;
extern StructRNA RNA_FollowPathConstraint;
extern StructRNA RNA_Function;
extern StructRNA RNA_GameBooleanProperty;
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index f3d36d60c23..62ee19df352 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -34,7 +34,6 @@
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "DNA_sound_types.h"
#include "MEM_guardedalloc.h"
@@ -50,7 +49,6 @@ EnumPropertyItem fmodifier_type_items[] = {
{FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""},
{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""},
{FMODIFIER_TYPE_LIMITS, "LIMITS", 0, "Limits", ""},
- {FMODIFIER_TYPE_SOUND, "SOUND", 0, "Sound", ""},
{0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
@@ -78,8 +76,6 @@ static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr)
return &RNA_FModifierPython;
case FMODIFIER_TYPE_LIMITS:
return &RNA_FModifierLimits;
- case FMODIFIER_TYPE_SOUND:
- return &RNA_FModifierSound;
default:
return &RNA_UnknownType;
}
@@ -622,46 +618,6 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna)
/* --------- */
-static void rna_def_fmodifier_sound(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static EnumPropertyItem prop_modification_items[] = {
- {FCM_SOUND_MODIF_REPLACE, "REPLACE", 0, "Replace", ""},
- {FCM_SOUND_MODIF_ADD, "ADD", 0, "Add", ""},
- {FCM_SOUND_MODIF_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
- {FCM_SOUND_MODIF_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
- {0, NULL, 0, NULL, NULL}};
-
- srna= RNA_def_struct(brna, "FModifierSound", "FModifier");
- RNA_def_struct_ui_text(srna, "Sound F-Modifier", "Modifies an F-Curve based on the amplitudes in a sound.");
- RNA_def_struct_sdna_from(srna, "FMod_Sound", "data");
-
- prop= RNA_def_property(srna, "modification", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_modification_items);
- RNA_def_property_ui_text(prop, "Modification", "Method of modifying the existing F-Curve.");
- RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
-
- prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "strength");
- RNA_def_property_ui_text(prop, "Strength", "Amplitude of the sound - the amount that it modifies the underlying curve");
- RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
-
- prop= RNA_def_property(srna, "delay", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "delay");
- RNA_def_property_ui_text(prop, "delay", "The delay before the sound curve modification should start");
- RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
-
- prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Sound");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this modifier.");
-
-}
-
-/* --------- */
-
static void rna_def_fmodifier(BlenderRNA *brna)
{
StructRNA *srna;
@@ -989,7 +945,6 @@ void RNA_def_fcurve(BlenderRNA *brna)
rna_def_fmodifier_python(brna);
rna_def_fmodifier_limits(brna);
rna_def_fmodifier_noise(brna);
- rna_def_fmodifier_sound(brna);
}