[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22804] branches/blender2.5/blender/source : 2.5 Sound:

Joerg Mueller nexyon at gmail.com
Wed Aug 26 16:19:29 CEST 2009


Revision: 22804
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22804
Author:   nexyon
Date:     2009-08-26 16:19:29 +0200 (Wed, 26 Aug 2009)

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

- Cleaned up DNA_sound_types.h, especially the bSound structure.
- Fixed a caching bug.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/sequence.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/sound.c
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_add.c
    branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_draw.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_sound_types.h
    branches/blender2.5/blender/source/gameengine/Converter/KX_ConvertActuators.cpp

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/sequence.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/sequence.c	2009-08-26 12:51:27 UTC (rev 22803)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/sequence.c	2009-08-26 14:19:29 UTC (rev 22804)
@@ -570,7 +570,7 @@
 		}
 		seq->strip->len = seq->len;
 	} else if (seq->type == SEQ_SOUND) {
-		seq->len = AUD_getInfo(seq->sound->snd_sound).length * FPS;
+		seq->len = AUD_getInfo(seq->sound->handle).length * FPS;
 		seq->len -= seq->anim_startofs;
 		seq->len -= seq->anim_endofs;
 		if (seq->len < 0) {

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/sound.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/sound.c	2009-08-26 12:51:27 UTC (rev 22803)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/sound.c	2009-08-26 14:19:29 UTC (rev 22804)
@@ -79,11 +79,11 @@
 
 	sound = alloc_libblock(&main->sound, ID_SO, filename+len);
 	strcpy(sound->name, filename);
-	sound->type = SOUND_TYPE_FILE;
+// XXX unused currently	sound->type = SOUND_TYPE_FILE;
 
 	sound_load(main, sound);
 
-	if(!sound->snd_sound)
+	if(!sound->handle)
 	{
 		free_libblock(&main->sound, sound);
 		sound = NULL;
@@ -109,7 +109,7 @@
 
 	sound_load(CTX_data_main(C), sound);
 
-	if(!sound->snd_sound)
+	if(!sound->handle)
 	{
 		free_libblock(&CTX_data_main(C)->sound, sound);
 		sound = NULL;
@@ -135,7 +135,7 @@
 
 	sound_load(CTX_data_main(C), sound);
 
-	if(!sound->snd_sound)
+	if(!sound->handle)
 	{
 		free_libblock(&CTX_data_main(C)->sound, sound);
 		sound = NULL;
@@ -162,22 +162,25 @@
 	if(sound->cache && !ignore)
 		AUD_unload(sound->cache);
 
-	sound->cache = AUD_bufferSound(sound->snd_sound);
+	sound->cache = AUD_bufferSound(sound->handle);
 }
 
 void sound_load(struct Main *main, struct bSound* sound)
 {
 	if(sound)
 	{
-		if(sound->snd_sound)
+		if(sound->handle)
 		{
-			AUD_unload(sound->snd_sound);
-			sound->snd_sound = NULL;
+			AUD_unload(sound->handle);
+			sound->handle = NULL;
 		}
 
+// XXX unused currently
+#if 0
 		switch(sound->type)
 		{
 		case SOUND_TYPE_FILE:
+#endif
 		{
 			char fullpath[FILE_MAX];
 			char *path;
@@ -197,26 +200,25 @@
 
 			/* but we need a packed file then */
 			if (pf)
-				sound->snd_sound = AUD_loadBuffer((unsigned char*) pf->data, pf->size);
+				sound->handle = AUD_loadBuffer((unsigned char*) pf->data, pf->size);
 			/* or else load it from disk */
 			else
-				sound->snd_sound = AUD_load(fullpath);
+				sound->handle = AUD_load(fullpath);
+		} // XXX
+// XXX unused currently
+#if 0
 			break;
 		}
 		case SOUND_TYPE_BUFFER:
-			if(sound->child_sound && sound->child_sound->snd_sound)
-				sound->snd_sound = AUD_bufferSound(sound->child_sound->snd_sound);
+			if(sound->child_sound && sound->child_sound->handle)
+				sound->handle = AUD_bufferSound(sound->child_sound->handle);
 			break;
 		case SOUND_TYPE_LIMITER:
-			if(sound->child_sound && sound->child_sound->snd_sound)
-				sound->snd_sound = AUD_limitSound(sound->child_sound, sound->start, sound->end);
+			if(sound->child_sound && sound->child_sound->handle)
+				sound->handle = AUD_limitSound(sound->child_sound, sound->start, sound->end);
 			break;
 		}
-
-		if(sound->cache)
-		{
-
-		}
+#endif
 	}
 }
 
@@ -228,10 +230,10 @@
 		sound->packedfile = NULL;
 	}
 
-	if(sound->snd_sound)
+	if(sound->handle)
 	{
-		AUD_unload(sound->snd_sound);
-		sound->snd_sound = NULL;
+		AUD_unload(sound->handle);
+		sound->handle = NULL;
 	}
 }
 
@@ -241,20 +243,23 @@
 	Scene *scene;
 	SoundHandle *handle;
 
+// XXX unused currently
+#if 0
 	for(snd = CTX_data_main(C)->sound.first; snd; snd = snd->id.next)
 	{
 		if(snd->child_sound == sound)
 		{
 			snd->child_sound = NULL;
-			if(snd->snd_sound)
+			if(snd->handle)
 			{
-				AUD_unload(sound->snd_sound);
-				snd->snd_sound = NULL;
+				AUD_unload(sound->handle);
+				snd->handle = NULL;
 			}
 
 			sound_unlink(C, snd);
 		}
 	}
+#endif
 
 	for(scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next)
 	{
@@ -372,9 +377,9 @@
 			{
 				if(handle->state == AUD_STATUS_INVALID)
 				{
-					if(handle->source && handle->source->snd_sound)
+					if(handle->source && handle->source->handle)
 					{
-						AUD_Sound* limiter = AUD_limitSound(handle->source->cache ? handle->source->cache : handle->source->snd_sound, handle->frameskip / fps, (handle->frameskip + handle->endframe - handle->startframe)/fps);
+						AUD_Sound* limiter = AUD_limitSound(handle->source->cache ? handle->source->cache : handle->source->handle, handle->frameskip / fps, (handle->frameskip + handle->endframe - handle->startframe)/fps);
 						handle->handle = AUD_play(limiter, 1);
 						AUD_unload(limiter);
 						if(handle->handle)
@@ -413,10 +418,10 @@
 		{
 			if(cfra >= handle->startframe && cfra < handle->endframe && !handle->mute)
 			{
-				if(handle->source && handle->source->snd_sound)
+				if(handle->source && handle->source->handle)
 				{
 					int frameskip = handle->frameskip + cfra - handle->startframe;
-					AUD_Sound* limiter = AUD_limitSound(handle->source->cache ? handle->source->cache : handle->source->snd_sound, frameskip / fps, (frameskip + 1)/fps);
+					AUD_Sound* limiter = AUD_limitSound(handle->source->cache ? handle->source->cache : handle->source->handle, frameskip / fps, (frameskip + 1)/fps);
 					AUD_play(limiter, 0);
 					AUD_unload(limiter);
 				}
@@ -439,7 +444,7 @@
 
 	for(handle = scene->sound_handles.first; handle; handle = handle->next)
 	{
-		if(start < handle->endframe && end > handle->startframe && !handle->mute && handle->source && handle->source->snd_sound)
+		if(start < handle->endframe && end > handle->startframe && !handle->mute && handle->source && handle->source->handle)
 		{
 			frameskip = handle->frameskip;
 			s = handle->startframe - start;
@@ -451,7 +456,7 @@
 				s = 0;
 			}
 
-			limiter = AUD_limitSound(handle->source->snd_sound, frameskip / fps, e / fps);
+			limiter = AUD_limitSound(handle->source->handle, frameskip / fps, e / fps);
 			delayer = AUD_delaySound(limiter, s / fps);
 
 			AUD_playDevice(mixdown, delayer);

Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-08-26 12:51:27 UTC (rev 22803)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-08-26 14:19:29 UTC (rev 22804)
@@ -5061,10 +5061,13 @@
 
 static void direct_link_sound(FileData *fd, bSound *sound)
 {
-	sound->snd_sound = NULL;
+	sound->handle = NULL;
 
 	sound->packedfile = direct_link_packedfile(fd, sound->packedfile);
 	sound->newpackedfile = direct_link_packedfile(fd, sound->newpackedfile);
+
+	if(sound->cache)
+		sound_cache(sound, 1);
 }
 
 static void lib_link_sound(FileData *fd, Main *main)
@@ -5076,8 +5079,7 @@
 		if(sound->id.flag & LIB_NEEDLINK) {
 			sound->id.flag -= LIB_NEEDLINK;
 			sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system
-			sound->stream = 0;
-
+			
 			sound_load(main, sound);
 		}
 		sound= sound->id.next;

Modified: branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_add.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_add.c	2009-08-26 12:51:27 UTC (rev 22803)
+++ branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_add.c	2009-08-26 14:19:29 UTC (rev 22804)
@@ -242,13 +242,13 @@
 
 	sound = sound_new_file(CTX_data_main(C), filename);
 
-	if (sound==NULL || sound->snd_sound == NULL) {
+	if (sound==NULL || sound->handle == NULL) {
 		if(op)
 			BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
 		return NULL;
 	}
 
-	info = AUD_getInfo(sound->snd_sound);
+	info = AUD_getInfo(sound->handle);
 
 	if (info.specs.format == AUD_FORMAT_INVALID) {
 		sound_delete(C, sound);

Modified: branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_draw.c	2009-08-26 12:51:27 UTC (rev 22803)
+++ branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_draw.c	2009-08-26 14:19:29 UTC (rev 22804)
@@ -225,108 +225,6 @@
 	}
 }
 
-static void drawseqwave(Scene *scene, View2D *v2d, Sequence *seq, float x1, float y1, float x2, float y2, int winx)
-{
-	/*
-	x1 is the starting x value to draw the wave,
-	x2 the end x value, same for y1 and y2
-	winx is the zoom level.
-	*/
-	
-	float
-	f, /* floating point value used to store the X draw location for the wave lines when openGL drawing*/
-	midy, /* fast access to the middle location (y1+y2)/2 */
-	clipxmin, /* the minimum X value, clip this with the window */
-	clipxmax, /* the maximum X value, clip this with the window */
-	sample_step, /* steps to move per sample, floating value must later translate into an int */
-	fsofs, /* steps to move per sample, floating value must later translate into an int */
-	feofs_sofs, /*  */
-	sound_width, /* convenience: x2-x1 */
-	wavemulti; /* scale the samples by this value when GL_LINE drawing so it renders the right height */
-	
-	int
-	offset, /* initial offset value for the wave drawing */
-	offset_next, /* when in the wave drawing loop this value is the samples intil the next vert */
-	sofs, /* Constrained offset value (~3) for the wave, start */
-	eofs, /* ditto, end */
-	wavesample, /* inner loop storage if the current wave sample value, used to make the 2 values below */
-	wavesamplemin, /* used for finding the min and max wave peaks */
-	wavesamplemax, /* ditto */
-	subsample_step=4; /* when the sample step is 4 every sample of
-	the wave is evaluated for min and max values used to draw the wave,
-	however this is slow ehrn zoomed out so when the sample step is above
-	1 (the larger the further out the zoom is) so not evaluate all samples, only some. */
-	
-	signed short* s;
-	bSound *sound;
-	uint8_t *stream;
-	
-// XXX	audio_makestream(seq->sound);
-	if(seq->sound==NULL || seq->sound->stream==NULL) return;
-	
-	if (seq->flag & SEQ_MUTE) glColor3ub(0x70, 0x80, 0x80); else glColor3ub(0x70, 0xc0, 0xc0);
-	

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list