[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11693] branches/soc-2007-hcube/source/ blender/src/seqaudio.c: Added functions to get frame count from audio system, and added a skeleton of mixdown function.

Csaba Hruska csaba.hruska at gmail.com
Sun Aug 19 12:47:01 CEST 2007


Revision: 11693
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11693
Author:   hcube
Date:     2007-08-19 12:47:00 +0200 (Sun, 19 Aug 2007)

Log Message:
-----------
Added functions to get frame count from audio system, and added a skeleton of mixdown function. bugfix: now the sound sequence play is correct when the start frame is in the sequence. Added sound stripping.

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-08-19 10:45:13 UTC (rev 11692)
+++ branches/soc-2007-hcube/source/blender/src/seqaudio.c	2007-08-19 10:47:00 UTC (rev 11693)
@@ -37,6 +37,7 @@
 } SeqAudioState;
 
 SeqAudioState gSeqAudioState = SEQAUDIO_STOP; 
+int gSequenceStartFrame = 0;
 
 ////////////////////////////////////
 // sequencing code NEW
@@ -44,6 +45,7 @@
 void seqaudio_initialize(void)
 {
 	gSeqAudioState = SEQAUDIO_STOP;
+	gSequenceStartFrame = 0;
 }
 
 void seqaudio_finalize(void)
@@ -56,6 +58,10 @@
 	{
 		return;
 	}
+	
+	audio_clearglobalframecounter();
+	gSequenceStartFrame = CFRA;
+
 	gSeqAudioState = SEQAUDIO_PLAY;
 	seqaudio_update();
 }
@@ -71,9 +77,9 @@
 }
 
 // this will be called before mixing has been done by tinySND
-static void do_seqaudio_update_ipo_cb( void *userData )
+static void do_seqaudio_update_ipo_cb( void *userData1, void *userData2 )
 {
-	Sequence *seq = (Sequence*)userData;
+	Sequence *seq = (Sequence*)userData1;
 	float facf;
 
 	if( seq->ipo && seq->ipo->curve.first )
@@ -139,7 +145,7 @@
 					if( !audio_sound_isplaying( seq->sound ) )
 					{
 						// start sound
-						float startPos = seq->startofs;
+						float startPos = seq->startofs + CFRA - seq->startdisp;
 						startPos *= ((float)seq->sound->sample->rate) / ((float)G.scene->r.frs_sec);
 						
 						audio_sound_play( seq->sound );
@@ -175,13 +181,33 @@
 
 int seqaudio_getframeposition(void)
 {
-	return CFRA;
+	float pos;
+	
+	//pos = (int)( ((float)(audio_pos-U.mixbufsize)/( G.scene->audio.mixrate*4 ))*(float)G.scene->r.frs_sec );
+	pos = ((float)gSequenceStartFrame) + ((float)audio_getglobalframecounter()) / ((float)audio_getmixrate()) * ((float)G.scene->r.frs_sec);
+	
+	if( pos < 1.0 )
+	{
+		pos = 1.0;
+	}
+	
+	return (int)pos;
 }
 
 void seqaudio_setframeposition(int framePos)
 {
 }
 
+void seqaudio_mixdown(void)
+{
+	// !!!! UNIMPLEMNTED YET !!!!
+	
+	// disable audio device
+	// setup file writer and sequence
+	// play sequence, and store output in file
+	// finalize file output
+	// enable audio device, if it was enabled 
+}
 
 ////////////////////////////////////
 // sequencing code OLD





More information about the Bf-blender-cvs mailing list