[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx: [268] branches/fusegl/fuse/sound/ coreaudios
Brought to you by:
fredm
From: <fr...@us...> - 2006-12-27 12:55:55
|
Revision: 268 http://svn.sourceforge.net/fuse-for-macosx/?rev=268&view=rev Author: fredm Date: 2006-12-27 04:55:52 -0800 (Wed, 27 Dec 2006) Log Message: ----------- Wait to start rendering sound until we have accumulated some data in the sound fifo. Modified Paths: -------------- branches/fusegl/fuse/sound/coreaudiosound.c Modified: branches/fusegl/fuse/sound/coreaudiosound.c =================================================================== --- branches/fusegl/fuse/sound/coreaudiosound.c 2006-12-27 12:14:20 UTC (rev 267) +++ branches/fusegl/fuse/sound/coreaudiosound.c 2006-12-27 12:55:52 UTC (rev 268) @@ -54,6 +54,9 @@ */ static AudioUnit gOutputUnit; +/* Records sound writer status information */ +static int audio_output_started; + int sound_lowlevel_init( const char *dev, int *freqptr, int *stereoptr ) { @@ -176,14 +179,8 @@ return 1; } - /* Start the rendering - The DefaultOutputUnit will do any format conversions to the format of the - default device */ - err = AudioOutputUnitStart( gOutputUnit ); - if( err ) { - ui_error( UI_ERROR_ERROR, "AudioOutputUnitStart=%ld", err ); - return 1; - } + /* wait to run sound until we have some sound to play */ + audio_output_started = 0; return 0; } @@ -193,7 +190,8 @@ { OSStatus err; - verify_noerr( AudioOutputUnitStop( gOutputUnit ) ); + if( audio_output_started ) + verify_noerr( AudioOutputUnitStop( gOutputUnit ) ); err = AudioUnitUninitialize( gOutputUnit ); if( err ) { @@ -229,6 +227,19 @@ ui_error( UI_ERROR_ERROR, "Couldn't write sound fifo: %s", strerror( i ) ); } + + if( !audio_output_started ) { + /* Start the rendering + The DefaultOutputUnit will do any format conversions to the format of the + default device */ + OSStatus err = AudioOutputUnitStart( gOutputUnit ); + if( err ) { + ui_error( UI_ERROR_ERROR, "AudioOutputUnitStart=%ld", err ); + return; + } + + audio_output_started = 1; + } } /* This is the audio processing callback. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |