From 3e3deac1634fc70b9b7c7a838b250147fb9f9e9f Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sat, 12 Jul 2008 09:48:33 +0000 Subject: [PATCH] added some test code for ASIO --- windows/sound.cpp | 49 ++++++++++++++++++++++++++++++----------------- windows/sound.h | 2 +- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/windows/sound.cpp b/windows/sound.cpp index f5958d39..596ce5ad 100755 --- a/windows/sound.cpp +++ b/windows/sound.cpp @@ -392,7 +392,11 @@ void CSound::InitRecordingAndPlayback ( int iNewBufferSize ) } // create and activate buffers - ASIOCreateBuffers ( bufferInfos, 2 * NUM_IN_OUT_CHANNELS, + + +int test2; +int test = ASE_OK; + int test1 = ASIOCreateBuffers ( bufferInfos, 2 * NUM_IN_OUT_CHANNELS, iBufferSize * BYTES_PER_SAMPLE, &asioCallbacks ); // now set all the buffer details @@ -401,6 +405,12 @@ void CSound::InitRecordingAndPlayback ( int iNewBufferSize ) channelInfos[i].channel = NUM_IN_OUT_CHANNELS; channelInfos[i].isInput = bufferInfos[i].isInput; ASIOGetChannelInfo ( &channelInfos[i] ); + + // only 16 bit is supported + if ( channelInfos[i].type != ASIOSTInt16LSB ) + { + // TODO fire error + } } @@ -453,15 +463,6 @@ void CSound::InitRecordingAndPlayback ( int iNewBufferSize ) - - - - - - - - - /* // reset interface waveOutReset ( m_WaveOut ); @@ -708,20 +709,16 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow ) // perform the processing for input and output for ( int i = 0; i < 2 * NUM_IN_OUT_CHANNELS; i++ ) { - // only 16 bit is supported - if ( channelInfos[i].type != ASIOSTInt16LSB ) - { - // TODO fire error - } - if ( bufferInfos[i].isInput == false ) { + // PLAYBACK -------------------------------------------------------- // TODO the following is just a test code - memset ( bufferInfos[i].buffers[index], 0, buffSize * 2 ); + //memset ( bufferInfos[i].buffers[index], 0, buffSize /** 2*/ ); } else { - + // CAPTURE --------------------------------------------------------- +/* // TEST static FILE* pFile = fopen ( "test.dat", "w" ); for ( int iIdx = 0; iIdx < buffSize * 2; iIdx++ ) @@ -729,8 +726,24 @@ for ( int iIdx = 0; iIdx < buffSize * 2; iIdx++ ) fprintf ( pFile, "%d\n", ((short*) bufferInfos[i].buffers[index])[iIdx] ); } fflush ( pFile ); +*/ +// TEST +channelInfos[i]; + short* test; + test = (short*) bufferInfos[i].buffers[index]; +/* +// TEST +static FILE* pFile = fopen ( "test.dat", "w" ); +for ( int iIdx = 0; iIdx < buffSize; iIdx++ ) +{ + fprintf ( pFile, "%d\n", test[iIdx] ); +} +fflush ( pFile ); +*/ + +int test2 = 0; // TODO } } diff --git a/windows/sound.h b/windows/sound.h index 8696932a..1e07332e 100755 --- a/windows/sound.h +++ b/windows/sound.h @@ -125,8 +125,8 @@ protected: short* psSoundcardBuffer[MAX_SND_BUF_IN]; // wave out - short* psPlaybackBuffer[MAX_SND_BUF_OUT]; HANDLE m_WaveOutEvent; + short* psPlaybackBuffer[MAX_SND_BUF_OUT]; }; #else // USE_ASIO_SND_INTERFACE