diff options
author | Joerg Mueller <nexyon@gmail.com> | 2011-08-03 13:25:40 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2011-08-03 13:25:40 +0400 |
commit | 6d7490632f13f9744c6b3e507c838a34f3481846 (patch) | |
tree | 941fa3faa93beb2fbb63798b2c1c416a5c3821f1 /source/blender | |
parent | 2b446aa280af60aefd304aae904bc16b1b15f373 (diff) |
3D Audio GSoC:
* Minor audaspace library improvements.
* Considering location, velocity and orientation in AUD_SequencerReader and AUD_SequencerHandle.
* Bugfix: Maximum and Minimum volume weren't used before in the software device.
* Bugfix: Adding speaker objects via info space crashed.
* Listener settings now get updated in the audio system.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_sound.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 11 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 14 |
5 files changed, 26 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 5ccb34338af..632a2a0bb3b 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -84,6 +84,8 @@ void sound_mute_scene(struct Scene *scene, int muted); void sound_update_fps(struct Scene *scene); +void sound_update_scene_listener(struct Scene *scene); + void* sound_scene_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip); void* sound_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 6e8b26c6ca6..59f5cdb678e 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -354,8 +354,11 @@ AUD_Device* sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, void sound_create_scene(struct Scene *scene) { scene->sound_scene = AUD_createSequencer(FPS, scene->audio.flag & AUDIO_MUTE); + AUD_updateSequencerData(scene->sound_scene, scene->audio.speed_of_sound, + scene->audio.doppler_factor, scene->audio.distance_model); scene->sound_scene_handle = NULL; scene->sound_scrub_handle = NULL; + scene->speaker_handles = NULL; } void sound_destroy_scene(struct Scene *scene) @@ -366,6 +369,8 @@ void sound_destroy_scene(struct Scene *scene) AUD_stop(scene->sound_scrub_handle); if(scene->sound_scene) AUD_destroySequencer(scene->sound_scene); + if(scene->speaker_handles) + AUD_destroySet(scene->speaker_handles); } void sound_mute_scene(struct Scene *scene, int muted) @@ -380,6 +385,12 @@ void sound_update_fps(struct Scene *scene) AUD_setSequencerFPS(scene->sound_scene, FPS); } +void sound_update_scene_listener(struct Scene *scene) +{ + AUD_updateSequencerData(scene->sound_scene, scene->audio.speed_of_sound, + scene->audio.doppler_factor, scene->audio.distance_model); +} + void* sound_scene_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip) { if(scene != sequence->scene) diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 48e138dfcdc..97a98d2017f 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -789,14 +789,13 @@ void OBJECT_OT_speaker_add(wmOperatorType *ot) ot->idname= "OBJECT_OT_speaker_add"; /* api callbacks */ - ot->invoke= WM_menu_invoke; ot->exec= object_speaker_add_exec; ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - ED_object_add_generic_props(ot, FALSE); + ED_object_add_generic_props(ot, TRUE); } /* only used as menu */ @@ -1636,7 +1635,6 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base } break; case OB_SPEAKER: - // AUD_XXX TODO: always duplicate Speakers on speaker object duplication? if(dupflag!=0) { ID_NEW_US2(obn->data ) else { diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 7a5d417b59c..542aea00b00 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -806,6 +806,7 @@ typedef struct Scene { void *sound_scene; void *sound_scene_handle; void *sound_scrub_handle; + void *speaker_handles; void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 0a97344928f..f2618280fa2 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -337,6 +337,11 @@ static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA * sound_update_fps(scene); } +static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +{ + sound_update_scene_listener(scene); +} + static void rna_Scene_volume_set(PointerRNA *ptr, float value) { Scene *scene= (Scene*)(ptr->data); @@ -3462,21 +3467,24 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "audio_doppler_speed", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "audio.speed_of_sound"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.01f, FLT_MAX); RNA_def_property_ui_text(prop, "Speed of Sound", "Speed of sound for Doppler effect calculation"); - RNA_def_property_update(prop, NC_SCENE, NULL); + RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update"); prop= RNA_def_property(srna, "audio_doppler_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "audio.doppler_factor"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_text(prop, "Doppler Factor", "Pitch factor for Doppler effect calculation"); - RNA_def_property_update(prop, NC_SCENE, NULL); + RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update"); prop= RNA_def_property(srna, "audio_distance_model", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio.distance_model"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, audio_distance_model_items); RNA_def_property_ui_text(prop, "Distance Model", "Distance model for distance attenuation calculation"); - RNA_def_property_update(prop, NC_SCENE, NULL); + RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update"); prop= RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "audio.volume"); |