[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10995] branches/soc-2007-hcube/intern/ tinySND/blender/SND_C-api.cpp: Added function implementations.

Csaba Hruska csaba.hruska at gmail.com
Thu Jun 21 14:11:46 CEST 2007


Revision: 10995
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10995
Author:   hcube
Date:     2007-06-21 14:11:45 +0200 (Thu, 21 Jun 2007)

Log Message:
-----------
Added function implementations.

Modified Paths:
--------------
    branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp

Modified: branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp	2007-06-21 12:10:00 UTC (rev 10994)
+++ branches/soc-2007-hcube/intern/tinySND/blender/SND_C-api.cpp	2007-06-21 12:11:45 UTC (rev 10995)
@@ -45,6 +45,8 @@
  // hides various DataProvider backends
 SND_SoundIHandle SND_NewSound( char *filename )
 {
+	assert( filename != 0 );
+	
 	// we'll try all DataProvider we have ill one can open the file, if any then return 0
 	// if load succed we attach the FXSample to a FXMixer and return with new FXSample handle
 	SND_DataProvider *dataProvider;
@@ -60,34 +62,53 @@
 
 	fxsample = new SND_FXSample( dataProvider, 1 );
 	gSamples.push_back( fxsample );
+
+	// FXSound -> FXSRC -> FXMixer -> devices'channel
 	
 	return (SND_SoundIHandle)fxsample;
 }
 
 SND_SoundIHandle SND_CloneSound( SND_SoundIHandle sound )
 {
+	assert( sound != 0 );
+	
     return (SND_SoundIHandle)0;
 }
 
 void SND_DeleteSound( SND_SoundIHandle sound )
 {
+	assert( sound != 0 );
 }
 
 void SND_PlaySound( SND_SoundIHandle sound )
 {
+	assert( sound != 0 );
+
+	SND_FXSample *sample = (SND_FXSample*)sound;
+	sample->play();
 }
 
 void SND_StopSound( SND_SoundIHandle sound )
 {
+	assert( sound != 0 );
+	
+	SND_FXSample *sample = (SND_FXSample*)sound;
+	sample->stop();
 }
 
 void SND_SeekSound( SND_SoundIHandle sound, int frameNum )
 {
+	assert( sound != 0 );
+	
+	SND_FXSample *sample = (SND_FXSample*)sound;
+	sample->seek( frameNum );
 }
 
 void SND_GetSoundInfo( SND_SoundIHandle sound, SND_SoundInfo *sndInfo )
 {
-	// !!!!!!!!! UNIMPLEMENTED YET !!!!!!!!!!!!!!!!!
+	assert( sound != 0 );
+
+// !!!!!!!!! UNIMPLEMENTED YET !!!!!!!!!!!!!!!!!
 	sndInfo->channelsNum = 2;
 	sndInfo->framesNum = 60;
 	sndInfo->bitRate = 16;
@@ -98,6 +119,12 @@
 {
     assert( gDevice != 0 );
 	
+	std::vector<SND_FXSample*>::const_iterator i;
+	for( i = gSamples.begin() ; i != gSamples.end() ; ++i )
+	{
+		(*i)->stop();
+	}
+	
 	gDevice->disable();
 }
 





More information about the Bf-blender-cvs mailing list