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 /source/blender/blenkernel/intern/fmodifier.c
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.
Diffstat (limited to 'source/blender/blenkernel/intern/fmodifier.c')
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c93
1 files changed, 0 insertions, 93 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