added some test code for ASIO
This commit is contained in:
parent
90fbd027eb
commit
3e3deac163
2 changed files with 32 additions and 19 deletions
|
@ -392,7 +392,11 @@ void CSound::InitRecordingAndPlayback ( int iNewBufferSize )
|
||||||
}
|
}
|
||||||
|
|
||||||
// create and activate buffers
|
// 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 );
|
iBufferSize * BYTES_PER_SAMPLE, &asioCallbacks );
|
||||||
|
|
||||||
// now set all the buffer details
|
// now set all the buffer details
|
||||||
|
@ -401,6 +405,12 @@ void CSound::InitRecordingAndPlayback ( int iNewBufferSize )
|
||||||
channelInfos[i].channel = NUM_IN_OUT_CHANNELS;
|
channelInfos[i].channel = NUM_IN_OUT_CHANNELS;
|
||||||
channelInfos[i].isInput = bufferInfos[i].isInput;
|
channelInfos[i].isInput = bufferInfos[i].isInput;
|
||||||
ASIOGetChannelInfo ( &channelInfos[i] );
|
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
|
// reset interface
|
||||||
waveOutReset ( m_WaveOut );
|
waveOutReset ( m_WaveOut );
|
||||||
|
@ -708,20 +709,16 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
|
||||||
// perform the processing for input and output
|
// perform the processing for input and output
|
||||||
for ( int i = 0; i < 2 * NUM_IN_OUT_CHANNELS; i++ )
|
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 )
|
if ( bufferInfos[i].isInput == false )
|
||||||
{
|
{
|
||||||
|
// PLAYBACK --------------------------------------------------------
|
||||||
// TODO the following is just a test code
|
// 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
|
else
|
||||||
{
|
{
|
||||||
|
// CAPTURE ---------------------------------------------------------
|
||||||
|
/*
|
||||||
// TEST
|
// TEST
|
||||||
static FILE* pFile = fopen ( "test.dat", "w" );
|
static FILE* pFile = fopen ( "test.dat", "w" );
|
||||||
for ( int iIdx = 0; iIdx < buffSize * 2; iIdx++ )
|
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] );
|
fprintf ( pFile, "%d\n", ((short*) bufferInfos[i].buffers[index])[iIdx] );
|
||||||
}
|
}
|
||||||
fflush ( pFile );
|
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
|
// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,8 +125,8 @@ protected:
|
||||||
short* psSoundcardBuffer[MAX_SND_BUF_IN];
|
short* psSoundcardBuffer[MAX_SND_BUF_IN];
|
||||||
|
|
||||||
// wave out
|
// wave out
|
||||||
short* psPlaybackBuffer[MAX_SND_BUF_OUT];
|
|
||||||
HANDLE m_WaveOutEvent;
|
HANDLE m_WaveOutEvent;
|
||||||
|
short* psPlaybackBuffer[MAX_SND_BUF_OUT];
|
||||||
};
|
};
|
||||||
|
|
||||||
#else // USE_ASIO_SND_INTERFACE
|
#else // USE_ASIO_SND_INTERFACE
|
||||||
|
|
Loading…
Reference in a new issue