[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24761] trunk/blender/source/blender: Just a few compiler warnings...

Joshua Leung aligorith at gmail.com
Sun Nov 22 13:45:37 CET 2009


Revision: 24761
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24761
Author:   aligorith
Date:     2009-11-22 13:45:37 +0100 (Sun, 22 Nov 2009)

Log Message:
-----------
Just a few compiler warnings...

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/fmodifier.c
    trunk/blender/source/blender/editors/animation/fmodifier_ui.c

Modified: trunk/blender/source/blender/blenkernel/intern/fmodifier.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/fmodifier.c	2009-11-22 12:28:38 UTC (rev 24760)
+++ trunk/blender/source/blender/blenkernel/intern/fmodifier.c	2009-11-22 12:45:37 UTC (rev 24761)
@@ -890,18 +890,23 @@
 {
 	FMod_Sound *data= (FMod_Sound *)fcm->data;
 	float amplitude;
-
-	AUD_Device* device;
-	SoundHandle* handle;
-	AUD_Sound* limiter;
+	
+	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;
-
-	if(evaltime < 0.0f || data->sound == NULL || data->sound->cache == NULL)
+	
+	/* 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;
@@ -909,7 +914,7 @@
 	limiter = AUD_limitSound(data->sound->cache, evaltime, evaltime + 1);
 	AUD_playDevice(device, limiter);
 	AUD_unload(limiter);
-	AUD_readDevice(device, &amplitude, 1);
+	AUD_readDevice(device, (sample_t*)&amplitude, 1);
 	AUD_closeReadDevice(device);
 
 	/* combine the amplitude with existing motion data */

Modified: trunk/blender/source/blender/editors/animation/fmodifier_ui.c
===================================================================
--- trunk/blender/source/blender/editors/animation/fmodifier_ui.c	2009-11-22 12:28:38 UTC (rev 24760)
+++ trunk/blender/source/blender/editors/animation/fmodifier_ui.c	2009-11-22 12:45:37 UTC (rev 24761)
@@ -330,40 +330,44 @@
 /* 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;
 	uiLayout *split, *col;
 	PointerRNA ptr;
-	FMod_Sound *data= (FMod_Sound *)fcm->data;
-
+	
 	/* init the RNA-pointer */
 	RNA_pointer_create(id, &RNA_FModifierSound, fcm, &ptr);
-
+	
 	/* sound */
-	uiTemplateID(layout, C, &ptr, "sound", NULL, "sound.open", NULL);
-
-	if(data->sound)
+	uiTemplateID(layout, (bContext*)C, &ptr, "sound", NULL, "sound.open", NULL);
+	
+	if (data->sound)
 	{
-		if(data->sound->cache)
+		/* 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);
-
+			
 			/* split into 2 columns */
 			split= uiLayoutSplit(layout, 0.5f);
-
+			
 			/* col 1 */
 			col= uiLayoutColumn(split, 0);
 			uiItemR(col, NULL, 0, &ptr, "strength", 0);
-
+			
 			/* col 2 */
 			col= uiLayoutColumn(split, 0);
 			uiItemR(col, NULL, 0, &ptr, "delay", 0);
 		}
 		else
 		{
-			PointerRNA ptr2;
-			RNA_id_pointer_create(data->sound, &ptr2);
+			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, &ptr2, "caching", UI_ITEM_R_TOGGLE);
+			uiItemR(layout, NULL, 0, &id_ptr, "caching", UI_ITEM_R_TOGGLE);
 		}
 	}
 }





More information about the Bf-blender-cvs mailing list