From f280ad4b3bd5a26f8ca6a18c8b7676602f5581db Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 30 Oct 2006 20:38:33 +0000 Subject: [PATCH] cleaned up a bit --- linux/sound.cpp | 101 ------------------------------------------------ linux/sound.h | 8 +--- 2 files changed, 1 insertion(+), 108 deletions(-) diff --git a/linux/sound.cpp b/linux/sound.cpp index 7723e6fc..6a0113b2 100755 --- a/linux/sound.cpp +++ b/linux/sound.cpp @@ -126,24 +126,6 @@ bool CSound::Read(CVector& psData) } ret = snd_pcm_readi(rhandle, &psData[0], iBufferSizeIn); - - -//snd_pcm_sframes_t test = snd_pcm_avail_update ( rhandle ); -//qDebug ( "test: %d", test ); -//if ( test == 64 ) -// snd_pcm_prepare ( rhandle ); - -/* -snd_pcm_status( rhandle, status ); -snd_pcm_sframes_t test = snd_pcm_status_get_delay(status); -//qDebug ( "test: %d", test ); -*/ - -//static FILE* pFile = fopen("test.dat", "w"); -//fprintf(pFile, "%d\n", test); -//fflush(pFile); - - if ( ret < 0 ) { @@ -251,60 +233,6 @@ void CSound::InitPlayback ( int iNewBufferSize, bool bNewBlocking ) // set hardware parameters SetHWParams ( phandle, iBufferSizeOut, iCurPeriodSizeOut ); - - -#if 0 - /* sw parameters --------------------------------------------------------- */ - snd_pcm_sw_params_t* swparams; - -// TEST -// allocate an invalid snd_pcm_sw_params_t using standard malloc -if ( err = snd_pcm_sw_params_malloc ( &swparams ) != 0 ) -{ - qDebug ( "snd_pcm_sw_params_malloc: %s", snd_strerror ( err ) ); -} - -/* get the current swparams */ -err = snd_pcm_sw_params_current(phandle, swparams); -if (err < 0) -{ - qDebug("Unable to determine current swparams for playback: %s\n", snd_strerror(err)); -} - -/* start the transfer when the buffer is almost full: */ -/* (buffer_size / avail_min) * avail_min */ -err = snd_pcm_sw_params_set_start_threshold(phandle, swparams, iCurPeriodSizeOut - 1); -if (err < 0) { - qDebug("Unable to set start threshold mode for playback: %s\n", snd_strerror(err)); -} - -/* allow the transfer when at least period_size samples can be processed */ -err = snd_pcm_sw_params_set_avail_min(phandle, swparams, iBufferSizeOut); -if (err < 0) { - qDebug("Unable to set avail min for playback: %s\n", snd_strerror(err)); -} - -/* align all transfers to 1 sample */ -err = snd_pcm_sw_params_set_xfer_align(phandle, swparams, 1); -if (err < 0) { - qDebug("Unable to set transfer align for playback: %s\n", snd_strerror(err)); -} - -/* write the parameters to the playback device */ -err = snd_pcm_sw_params(phandle, swparams); -if (err < 0) { - qDebug("Unable to set sw params for playback: %s\n", snd_strerror(err)); -} - -// clean-up -snd_pcm_sw_params_free ( swparams ); -#endif - - - - - - // start playback snd_pcm_start ( phandle ); @@ -329,35 +257,6 @@ bool CSound::Write ( CVector& psData ) while ( size ) { ret = snd_pcm_writei ( phandle, &psData[start], size ); - - -//snd_pcm_sframes_t test = snd_pcm_avail_update ( phandle ); -//qDebug ( "test: %d", test ); -//if ( test == 64 ) -// snd_pcm_prepare ( rhandle ); - -/* -snd_pcm_sframes_t delayp; -snd_pcm_delay ( phandle, &delayp ) ; -qDebug ( "test: %d", delayp ); -*/ - - -//snd_pcm_status_t* status; -//snd_pcm_status_alloca(&status); -//snd_pcm_status( phandle, status ); -//snd_pcm_sframes_t test = snd_pcm_status_get_delay(status); -//qDebug ( "test: %d", test ); - -//snd_pcm_status( phandle, status ); -//snd_pcm_sframes_t test = snd_pcm_status_get_delay(status); -//qDebug ( "test: %d", test ); - -//static FILE* pFile = fopen("test.dat", "w"); -//fprintf(pFile, "%d\n", test); -//fflush(pFile); - - if ( ret < 0 ) { diff --git a/linux/sound.h b/linux/sound.h index 6b2a4d8a..b290dc08 100755 --- a/linux/sound.h +++ b/linux/sound.h @@ -87,13 +87,7 @@ protected: bool bChangParamIn; int iCurPeriodSizeIn; bool bChangParamOut; - int iCurPeriodSizeOut; - - -// TEST -snd_pcm_status_t* status; - - + int iCurPeriodSizeOut; #else /* Dummy definitions */ void SetInNumBuf(int iNewNum) {}