[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11724] branches/soc-2007-hcube/source/ blender/src/seqaudio.c: removed commented code.

Csaba Hruska csaba.hruska at gmail.com
Mon Aug 20 02:07:25 CEST 2007


Revision: 11724
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11724
Author:   hcube
Date:     2007-08-20 02:07:25 +0200 (Mon, 20 Aug 2007)

Log Message:
-----------
removed commented code.

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 23:49:48 UTC (rev 11723)
+++ branches/soc-2007-hcube/source/blender/src/seqaudio.c	2007-08-20 00:07:25 UTC (rev 11724)
@@ -42,10 +42,6 @@
 int				gScrubCounter		= 0;
 int				gAudioFrameCounter	= 0;
 
-////////////////////////////////////
-// sequencing code NEW
-////////////////////////////////////
-
 static void do_seqaudio_update( Sequence *seq )
 {
 	int sndMute;
@@ -63,13 +59,8 @@
 		{
 			assert( seq->sound != 0 );
 			
-			/*
-			!!! Obsolete: Sequence->curpos
+			// Obsolete: Sequence.curpos
 			
-			//int curpos;		// last sample position in audio_fill() 
-			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 )
 			{
@@ -79,16 +70,6 @@
 			{
 				if( (seq->startdisp <= CFRA) && ( CFRA < seq->enddisp) )
 				{
-					if( !audio_sound_isplaying( seq->sound ) )
-					{
-						// start sound
-						float startPos = seq->startofs + CFRA - seq->startdisp;
-						startPos *= ((float)seq->sound->sample->rate) / ((float)G.scene->r.frs_sec);
-						
-						audio_sound_play( seq->sound );
-						audio_sound_setframeposition( seq->sound, (int)startPos );
-					}
-
 					// update sounds attributes: gain, pan, mute
 					// Sequence members
 					//float level, pan;	// level in dB (0=full), pan -1..1 
@@ -109,6 +90,16 @@
 					audio_sound_setgain( seq->sound, sndGain );
 					audio_sound_setpan( seq->sound, sndPan );
 					audio_sound_setmute( seq->sound, sndMute );
+					
+					if( !audio_sound_isplaying( seq->sound ) )
+					{
+						// start sound
+						float startPos = seq->startofs + CFRA - seq->startdisp;
+						startPos *= ((float)seq->sound->sample->rate) / ((float)G.scene->r.frs_sec);
+						
+						audio_sound_play( seq->sound );
+						audio_sound_setframeposition( seq->sound, (int)startPos );
+					}
 				}
 				else
 				{
@@ -203,7 +194,6 @@
 {
 	float pos;
 	
-	//pos = (int)( ((float)(audio_pos-U.mixbufsize)/( G.scene->audio.mixrate*4 ))*(float)G.scene->r.frs_sec );
 	pos = ((float)gSequenceStartFrame) + ((float)gAudioFrameCounter) / ((float)audio_getmixrate()) * ((float)G.scene->r.frs_sec);
 	
 	if( pos < 1.0 )
@@ -276,200 +266,3 @@
 	return TRUE;
 }
 
-////////////////////////////////////
-// sequencing code OLD
-////////////////////////////////////
-/*
-void audio_mixdown()
-{
-	int file, c, totlen, totframe, i, oldcfra;
-	char *buf;
-
-	buf = MEM_mallocN(65536, "audio_mixdown");
-	makewavstring(buf);
-
-	file = open(buf, O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
-
-	if(file == -1) 
-	{
-		error("Can't open output file");
-		return;
-	}
-	
-	waitcursor(1);
-	
-	printf("Saving: %s ", buf);
-
-	strcpy(buf, "RIFFlengWAVEfmt fmln01ccRATEbsecBP16dataDLEN");
-	totframe = (EFRA - SFRA + 1);
-	totlen = (int) ( ((float)totframe / (float)G.scene->r.frs_sec) * (float)G.scene->audio.mixrate * 4.0);
-	printf(" totlen %d\n", totlen+36+8);
-	
-	totlen+= 36;	// len is filesize-8 in WAV spec, total header is 44 bytes 
-	memcpy(buf+4, &totlen, 4);
-	totlen-= 36;
-	
-	buf[16] = 0x10; buf[17] = buf[18] = buf[19] = 0; buf[20] = 1; buf[21] = 0;
-	buf[22] = 2; buf[23]= 0;
-	memcpy(buf+24, &G.scene->audio.mixrate, 4);
-	i = G.scene->audio.mixrate * 4;
-	memcpy(buf+28, &i, 4);
-	buf[32] = 4; buf[33] = 0; buf[34] = 16; buf[35] = 0;
-	i = totlen;
-	memcpy(buf+40, &i, 4);
-
-	if (G.order == B_ENDIAN) {
-		// swap the four ints to little endian 
-		
-		// length 
-		SWITCH_INT(buf[4]);
-		
-		// audio rate 
-		SWITCH_INT(buf[24]);
-
-		// audio mixrate * 4 
-		SWITCH_INT(buf[28]);
-		
-		// length 
-		SWITCH_INT(buf[40]);
-	}
-	
-	c = write(file, buf, 44);
-	
-	oldcfra = CFRA;
-	audiostream_play(SFRA, 0, 1);
-	
-	i= 0;
-	while ( totlen > 0 ) {
-		totlen -= 64;
-		
-		memset(buf+i, 0, 64);
-		
-		CFRA=(int) ( ((float)(audio_pos-64)/( G.scene->audio.mixrate*4 ))*(float)G.scene->r.frs_sec );
-			
-		audio_fill(buf+i, NULL, 64);
-		if (G.order == B_ENDIAN) {
-			char tbuf[64];
-			memcpy(tbuf, buf+i, 64);
-			swab(tbuf, buf+i, 64);
-		}
-		if (i == (65536-64)) {
-			i=0;
-			write(file, buf, 65536);			
-		} 
-		else i+=64;
-	}
-	write(file, buf, i);
-	
-	waitcursor(0);
-	CFRA = oldcfra;
-	close(file);
-	MEM_freeN(buf);
-
-	return;
-}
-
-
-static int audiostream_play_seq(Sequence * seq, Uint32 startframe)
-{
-	char name[FILE_MAXDIR+FILE_MAXFILE];
-	int have_sound = 0;
-
-	while(seq) {
-		if (seq->type == SEQ_META) {
-			if (audiostream_play_seq(
-				    seq->seqbase.first, startframe)) {
-				have_sound = 1;
-			}
-		}
-		if ((seq->type == SEQ_RAM_SOUND) && (seq->sound)) {
-			have_sound = 1;
-			seq->curpos = (int)( (((float)((float)startframe
-						       -(float)seq->start)
-					       / (float)G.scene->r.frs_sec)
-					      * ((float)G.scene->audio.mixrate)
-					      * 4 ));
-		}
-		if ((seq->type == SEQ_HD_SOUND)) {
-			have_sound = 1;
-			if (!seq->hdaudio) {
-				strncpy(name, seq->strip->dir, FILE_MAXDIR-1);
-				strncat(name, seq->strip->stripdata->name, 
-					FILE_MAXFILE-1);
-				
-				seq->hdaudio = sound_open_hdaudio(name);
-			}
-			seq->curpos = (int)( (((float)((float)startframe
-						       - (float)seq->start)
-					       / (float)G.scene->r.frs_sec)
-					      * ((float)G.scene->audio.mixrate)
-					      * 4 ));
-		}
-		seq= seq->next;
-	}
-	return have_sound;
-}
-
-void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown)
-{
-	static SDL_AudioSpec desired;
-
-   	if (!audio_initialised && !(duration + mixdown)) {
-   		desired.freq=G.scene->audio.mixrate;
-		desired.format=AUDIO_S16SYS;
-   		desired.channels=2;
-   		desired.samples=U.mixbufsize;
-   		desired.userdata=0;	
-   		if (audio_init(&desired)==0) {
-   			U.mixbufsize = 0;	// no audio 
-   		}
-   	}
-
-	audio_pos = ( ((int)( (((float)startframe)
-			       /(float)G.scene->r.frs_sec)
-			      *(G.scene->audio.mixrate)*4 )) & (~3) );
-	
-	audio_scrub = duration;
-	if (!mixdown) {
-		SDL_PauseAudio(0);
-		audio_playing++;
-	}
-}
-
-void audiostream_start(Uint32 frame)
-{
-	audiostream_play(frame, 0, 0);
-}
-
-static void audio_fill_ram_sound(Sequence *seq, void * mixdown, 
-				 Uint8 * sstream, int len)
-{
-	Uint8* cvtbuf;
-	bSound* sound;
-	float facf;
-
-	sound = seq->sound;
-	audio_makestream(sound);
-	if ((seq->curpos<sound->streamlen -len) && (seq->curpos>=0) &&
-	    (seq->startdisp <= CFRA) && ((seq->enddisp) > CFRA))
-	{
-		if(seq->ipo && seq->ipo->curve.first) {
-			do_seq_ipo(seq);
-			facf = seq->facf0;
-		} else {
-			facf = 1.0;
-		}
-		cvtbuf = malloc(len);					
-		memcpy(cvtbuf, ((Uint8*)sound->stream)+(seq->curpos & (~3)), len);
-		audio_levels(cvtbuf, len, seq->level, facf, seq->pan);
-		if (!mixdown) {
-			SDL_MixAudio(sstream, cvtbuf, len, SDL_MIX_MAXVOLUME);
-		} else {
-			SDL_MixAudio((Uint8*)mixdown, cvtbuf, len, SDL_MIX_MAXVOLUME);
-		}
-		free(cvtbuf);
-	}
-	seq->curpos += len;
-}
-*/
-





More information about the Bf-blender-cvs mailing list