[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11018] branches/soc-2007-hcube/source/ blender/src/seqaudio.c: Added sound sequncing implemetation.

Csaba Hruska csaba.hruska at gmail.com
Fri Jun 22 19:05:35 CEST 2007


Revision: 11018
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11018
Author:   hcube
Date:     2007-06-22 19:05:35 +0200 (Fri, 22 Jun 2007)

Log Message:
-----------
Added sound sequncing implemetation.

Modified Paths:
--------------
    branches/soc-2007-hcube/source/blender/src/seqaudio.c

Modified: branches/soc-2007-hcube/source/blender/src/seqaudio.c
===================================================================
--- branches/soc-2007-hcube/source/blender/src/seqaudio.c	2007-06-22 17:04:48 UTC (rev 11017)
+++ branches/soc-2007-hcube/source/blender/src/seqaudio.c	2007-06-22 17:05:35 UTC (rev 11018)
@@ -19,11 +19,13 @@
 #include "BKE_sound.h"
 #include "BKE_packedFile.h"
 
-#include "BAU_sound.h"
+#include "BAU_soundsystem.h"
 #include "BSE_seqaudio.h"
 
+#include "blendef.h"
+
 /*
-	Depends only on functions from BAU_sound.h
+	Depends only on functions from BAU_soundsystem.h
 	Handles blender structures: Sequence
 */
 
@@ -50,7 +52,7 @@
 
 void seqaudio_play(void)
 {
-	if( !sound_is_initialized() )
+	if( !audio_isinitialized() )
 	{
 		return;
 	}
@@ -60,7 +62,7 @@
 
 void seqaudio_stop(void)
 {
-	if( !sound_is_initialized() )
+	if( !audio_isinitialized() )
 	{
 		return;
 	}
@@ -106,22 +108,34 @@
 		
 		if( (seq->type == SEQ_RAM_SOUND) || (seq->type == SEQ_HD_SOUND) )
 		{
+			assert( seq->sound != 0 );
+			
 			/*
-			seq->curpos = (int)( (((float)((float)startframe
-						       -(float)seq->start)
-					       / (float)G.scene->r.frs_sec)
-					      * ((float)G.scene->audio.mixrate)
-					      * 4 ));
+			seq->curpos = (int)( (((float) ((float)startframe -(float)seq->start) / (float)G.scene->r.frs_sec)  * ((float)G.scene->audio.mixrate) * 4 ));
 			*/
 			//only Play/Stop
 			if( gSeqAudioState == SEQAUDIO_STOP )
 			{
-				sound_stop_sound( seq->sound );
+				audio_sound_stop( seq->sound );
 			}
 			else
 			{
-				//if ((seq->curpos<sound->streamlen -len) && (seq->curpos>=0) &&
-				//    (seq->startdisp <= CFRA) && ((seq->enddisp) > CFRA))
+				if( (seq->startdisp <= CFRA) && ( CFRA < seq->enddisp) )
+				{
+					if( !audio_sound_isplaying( seq->sound ) )
+					{
+						// start sound
+						audio_sound_play( seq->sound );
+					}
+				}
+				else
+				{
+					if( audio_sound_isplaying( seq->sound ) )
+					{
+						// stop sound
+						audio_sound_stop( seq->sound );
+					}
+				}
 			}
 		}
 		seq = seq->next;
@@ -133,9 +147,8 @@
 	Editing *ed;
 	
 	assert( gSeqAudioState == SEQAUDIO_STOP || gSeqAudioState == SEQAUDIO_PLAY );
-
 	ed = G.scene->ed;
-	if( !sound_is_initialized() || !ed )
+	if( !audio_isinitialized() || !ed )
 	{
 		return;
 	}





More information about the Bf-blender-cvs mailing list