[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23373] trunk/blender/source/blender: Sound:

Joerg Mueller nexyon at gmail.com
Sun Sep 20 19:55:03 CEST 2009


Revision: 23373
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23373
Author:   nexyon
Date:     2009-09-20 19:55:03 +0200 (Sun, 20 Sep 2009)

Log Message:
-----------
Sound:

* Fixed mixdown volume being int instead of float
* Fixed audio muting for sequencer not working
* Added 3D listener settings with RNA (not working in GE yet)

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/scene.c
    trunk/blender/source/blender/blenkernel/intern/sound.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/makesdna/DNA_scene_types.h
    trunk/blender/source/blender/makesrna/intern/rna_scene.c

Modified: trunk/blender/source/blender/blenkernel/intern/scene.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/scene.c	2009-09-20 17:24:56 UTC (rev 23372)
+++ trunk/blender/source/blender/blenkernel/intern/scene.c	2009-09-20 17:55:03 UTC (rev 23373)
@@ -421,6 +421,10 @@
 	sce->jumpframe = 10;
 	sce->r.ffcodecdata.audio_mixrate = 44100;
 
+	sce->audio.distance_model = 2.0;
+	sce->audio.doppler_factor = 1.0;
+	sce->audio.speed_of_sound = 343.3;
+
 	strcpy(sce->r.backbuf, "//backbuf");
 	strcpy(sce->r.pic, U.renderdir);
 

Modified: trunk/blender/source/blender/blenkernel/intern/sound.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sound.c	2009-09-20 17:24:56 UTC (rev 23372)
+++ trunk/blender/source/blender/blenkernel/intern/sound.c	2009-09-20 17:55:03 UTC (rev 23373)
@@ -340,7 +340,7 @@
 
 	for(handle = scene->sound_handles.first; handle; handle = handle->next)
 	{
-		if(cfra < handle->startframe || cfra >= handle->endframe || handle->mute)
+		if(cfra < handle->startframe || cfra >= handle->endframe || handle->mute || (scene->audio.flag & AUDIO_MUTE))
 		{
 			if(handle->state == AUD_STATUS_PLAYING)
 			{

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2009-09-20 17:24:56 UTC (rev 23372)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2009-09-20 17:55:03 UTC (rev 23373)
@@ -9352,13 +9352,6 @@
 		 */
 		//do_versions_ipos_to_animato(main);
 		
-		/* toolsettings */
-		for(scene= main->scene.first; scene; scene= scene->id.next)
-		{
-			scene->r.ffcodecdata.audio_mixrate = scene->audio.mixrate;
-			scene->r.ffcodecdata.audio_volume = scene->audio.main;
-		}
-		
 		/* shader, composit and texture node trees have id.name empty, put something in
 		 * to have them show in RNA viewer and accessible otherwise.
 		 */
@@ -9714,6 +9707,18 @@
 				}
 			}
 		}
+
+		for(sce= main->scene.first; sce; sce= sce->id.next)
+		{
+			if(sce->audio.main == 0.0)
+				sce->audio.main = 1.0;
+
+			sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate;
+			sce->r.ffcodecdata.audio_volume = sce->audio.main;
+			sce->audio.distance_model = 2.0;
+			sce->audio.doppler_factor = 1.0;
+			sce->audio.speed_of_sound = 343.3;
+		}
 	}
 
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */

Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_scene_types.h	2009-09-20 17:24:56 UTC (rev 23372)
+++ trunk/blender/source/blender/makesdna/DNA_scene_types.h	2009-09-20 17:55:03 UTC (rev 23373)
@@ -94,7 +94,7 @@
 	int video_bitrate;
 	int audio_bitrate;
 	int audio_mixrate;
-	int audio_volume;
+	float audio_volume;
 	int gop_size;
 	int flags;
 
@@ -110,8 +110,11 @@
 typedef struct AudioData {
 	int mixrate; // 2.5: now in FFMpegCodecData: audio_mixrate
 	float main; // 2.5: now in FFMpegCodecData: audio_volume
+	float speed_of_sound;
+	float doppler_factor;
+	int distance_model;
 	short flag;
-	short pad[3];
+	short pad;
 } AudioData;
 
 typedef struct SceneRenderLayer {

Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c	2009-09-20 17:24:56 UTC (rev 23372)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c	2009-09-20 17:55:03 UTC (rev 23373)
@@ -1516,7 +1516,7 @@
 	prop= RNA_def_property(srna, "ffmpeg_audio_mixrate", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.audio_mixrate");
 	RNA_def_property_range(prop, 8000, 192000);
-	RNA_def_property_ui_text(prop, "Sample", "Audio samplerate(samples/s)");
+	RNA_def_property_ui_text(prop, "Samplerate", "Audio samplerate(samples/s)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
 	prop= RNA_def_property(srna, "ffmpeg_audio_volume", PROP_FLOAT, PROP_NONE);
@@ -1915,6 +1915,16 @@
 	PropertyRNA *prop;
 	FunctionRNA *func;
 	
+	static EnumPropertyItem audio_distance_model_items[] = {
+		{0, "NONE", 0, "None", "No distance attenuation."},
+		{1, "INVERSE", 0, "Inverse", "Inverse distance model."},
+		{2, "INVERSE_CLAMPED", 0, "Inverse Clamped", "Inverse distance model with clamping."},
+		{3, "LINEAR", 0, "Linear", "Linear distance model."},
+		{4, "LINEAR_CLAMPED", 0, "Linear Clamped", "Linear distance model with clamping."},
+		{5, "EXPONENT", 0, "Exponent", "Exponent distance model."},
+		{6, "EXPONENT_CLAMPED", 0, "Exponent Clamped", "Exponent distance model with clamping."},
+		{0, NULL, 0, NULL, NULL}};
+
 	/* Struct definition */
 	srna= RNA_def_struct(brna, "Scene", "ID");
 	RNA_def_struct_ui_text(srna, "Scene", "Scene consisting objects and defining time and render related settings.");
@@ -2074,19 +2084,37 @@
 	/* Audio Settings */
 	prop= RNA_def_property(srna, "mute_audio", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_MUTE);
-	RNA_def_property_ui_text(prop, "Mute Audio", "Play back of audio from Sequence Editor will be muted.");
+	RNA_def_property_ui_text(prop, "Audio Muted", "Play back of audio from Sequence Editor will be muted.");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
 	prop= RNA_def_property(srna, "sync_audio", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SYNC);
-	RNA_def_property_ui_text(prop, "Sync Audio", "Play back and sync with audio from Sequence Editor.");
+	RNA_def_property_ui_text(prop, "Audio Sync", "Play back and sync with audio from Sequence Editor.");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
 	prop= RNA_def_property(srna, "scrub_audio", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SCRUB);
-	RNA_def_property_ui_text(prop, "Scrub Audio", "Play audio from Sequence Editor while scrubbing.");
+	RNA_def_property_ui_text(prop, "Audio Scrubbing", "Play audio from Sequence Editor while scrubbing.");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
+	prop= RNA_def_property(srna, "speed_of_sound", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "audio.speed_of_sound");
+	RNA_def_property_range(prop, 1.0f, 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);
+
+	prop= RNA_def_property(srna, "doppler_factor", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "audio.doppler_factor");
+	RNA_def_property_range(prop, FLT_MIN, FLT_MAX);
+	RNA_def_property_ui_text(prop, "Doppler Factor", "Pitch factor for doppler effect calculation.");
+	RNA_def_property_update(prop, NC_SCENE, NULL);
+
+	prop= RNA_def_property(srna, "distance_model", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio.distance_model");
+	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);
+
 	/* Game Settings */
 	prop= RNA_def_property(srna, "game_data", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);





More information about the Bf-blender-cvs mailing list