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>2011-07-28 17:58:59 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-07-28 17:58:59 +0400
commitbd6ca0570e089afc1d29b4f18b8bb6cc086545ea (patch)
tree30b512203aa9c5e73eb88fcb5e7a2afaf94770b9 /source/blender/blenkernel/intern
parent90b64737f12f749b93e6a609b1b3680938ef6b85 (diff)
3D Audio GSoC:
Implemented basic audio animation. * AnimatableProperty: Propper cache writing and spline interpolation for reading (the solution for stair steps in audio animation) * Animatable properties so far are: volume, pitch, panning * Users note: Changing the pitch of a sound results in wrong seeking, due to the resulting playback length difference. * Users note: Panning only works for mono sources, values are in the range [-2..2], this basically controls the angle of the sound, 0 is front, -1 left, 1 right and 2 and -2 are back. Typical stereo panning only supports [-1..1]. * Disabled animation of audio related ffmpeg output parameters. * Scene Audio Panel: 3D Listener settings also for Renderer, new Volume property (animatable!), Update/Bake buttons for animation problems, moved sampling rate and channel count here
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/fcurve.c12
-rw-r--r--source/blender/blenkernel/intern/scene.c9
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c2
-rw-r--r--source/blender/blenkernel/intern/sequencer.c3
-rw-r--r--source/blender/blenkernel/intern/sound.c28
5 files changed, 44 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 1f45cc56117..aa8f817ae3c 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -174,7 +174,7 @@ void copy_fcurves (ListBase *dst, ListBase *src)
/* ----------------- Finding F-Curves -------------------------- */
/* high level function to get an fcurve from C without having the rna */
-FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index)
+FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, char *driven)
{
/* anim vars */
AnimData *adt= BKE_animdata_from_id(id);
@@ -184,6 +184,9 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
PointerRNA ptr;
PropertyRNA *prop;
char *path;
+
+ if(driven)
+ *driven = 0;
/* only use the current action ??? */
if (ELEM(NULL, adt, adt->action))
@@ -201,11 +204,12 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
fcu= list_find_fcurve(&adt->action->curves, path, index);
/* if not animated, check if driven */
-#if 0
if ((fcu == NULL) && (adt->drivers.first)) {
- fcu= list_find_fcurve(&adt->drivers, path, but->rnaindex);
+ fcu= list_find_fcurve(&adt->drivers, path, index);
+ if(fcu && driven)
+ *driven = 1;
+ fcu = NULL;
}
-#endif
MEM_freeN(path);
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 42793e4b4a4..74126fd57a1 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -473,9 +473,10 @@ Scene *add_scene(const char *name)
BLI_strncpy(sce->r.engine, "BLENDER_RENDER", sizeof(sce->r.engine));
- sce->audio.distance_model = 2.0;
- sce->audio.doppler_factor = 1.0;
- sce->audio.speed_of_sound = 343.3;
+ sce->audio.distance_model = 2.0f;
+ sce->audio.doppler_factor = 1.0f;
+ sce->audio.speed_of_sound = 343.3f;
+ sce->audio.volume = 1.0f;
BLI_strncpy(sce->r.pic, U.renderdir, sizeof(sce->r.pic));
@@ -1000,6 +1001,8 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
{
float ctime = BKE_curframe(sce);
Scene *sce_iter;
+
+ sound_set_cfra(sce->r.cfra);
/* clear animation overrides */
// XXX TODO...
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 688fdd8ff49..9e8cdb964b7 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -3163,7 +3163,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
/* XXX - new in 2.5x. should we use the animation system this way?
* The fcurve is needed because many frames need evaluating at once - campbell */
- fcu= id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "speed_factor", 0);
+ fcu= id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "speed_factor", 0, NULL);
if (!v->frameMap || v->length != seq->len) {
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index e4dc3a31cb1..9ff3ce7afe2 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1775,7 +1775,7 @@ static ImBuf* seq_render_effect_strip_impl(
facf= fac;
}
else {
- fcu = id_data_find_fcurve(&context.scene->id, seq, &RNA_Sequence, "effect_fader", 0);
+ fcu = id_data_find_fcurve(&context.scene->id, seq, &RNA_Sequence, "effect_fader", 0, NULL);
if (fcu) {
fac = facf = evaluate_fcurve(fcu, cfra);
if( context.scene->r.mode & R_FIELDS ) {
@@ -3496,6 +3496,7 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine)
seq->mul= 1.0;
seq->blend_opacity = 100.0;
seq->volume = 1.0f;
+ seq->pitch = 1.0f;
seq->scene_sound = NULL;
return seq;
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 64ba9ed362a..6e8b26c6ca6 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -32,10 +32,11 @@
#include "BKE_context.h"
#include "BKE_library.h"
#include "BKE_packedFile.h"
-#include "BKE_fcurve.h"
#include "BKE_animsys.h"
#include "BKE_sequencer.h"
+// evil global ;-)
+static int sound_cfra;
struct bSound* sound_new_file(struct Main *bmain, const char *filename)
{
@@ -411,6 +412,31 @@ void sound_update_scene_sound(void* handle, struct bSound* sound)
AUD_updateSequenceSound(handle, sound->playback_handle);
}
+void sound_set_cfra(int cfra)
+{
+ sound_cfra = cfra;
+}
+
+void sound_set_scene_volume(struct Scene *scene, float volume)
+{
+ AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_VOLUME, CFRA, &volume, (scene->audio.flag & AUDIO_VOLUME_ANIMATED) != 0);
+}
+
+void sound_set_scene_sound_volume(void* handle, float volume, char animated)
+{
+ AUD_setSequenceAnimData(handle, AUD_AP_VOLUME, sound_cfra, &volume, animated);
+}
+
+void sound_set_scene_sound_pitch(void* handle, float pitch, char animated)
+{
+ AUD_setSequenceAnimData(handle, AUD_AP_PITCH, sound_cfra, &pitch, animated);
+}
+
+void sound_set_scene_sound_pan(void* handle, float pan, char animated)
+{
+ AUD_setSequenceAnimData(handle, AUD_AP_PANNING, sound_cfra, &pan, animated);
+}
+
void sound_update_sequencer(struct Main* main, struct bSound* sound)
{
struct Scene* scene;