preparations for ASIO buffer conversion, not yet ready
This commit is contained in:
parent
11e8dc7b3d
commit
624da195ea
1 changed files with 39 additions and 0 deletions
|
@ -60,11 +60,15 @@ HANDLE m_ASIOEvent;
|
||||||
int iInCurBlockToWrite;
|
int iInCurBlockToWrite;
|
||||||
short* psSoundcardBuffer[MAX_SND_BUF_IN];
|
short* psSoundcardBuffer[MAX_SND_BUF_IN];
|
||||||
bool bBufferOverrun;
|
bool bBufferOverrun;
|
||||||
|
short* psCaptureConvBuf;
|
||||||
|
int iCurPosCaptConvBuf;
|
||||||
|
|
||||||
// wave out
|
// wave out
|
||||||
int iOutCurBlockToWrite;
|
int iOutCurBlockToWrite;
|
||||||
short* psPlaybackBuffer[MAX_SND_BUF_OUT];
|
short* psPlaybackBuffer[MAX_SND_BUF_OUT];
|
||||||
bool bBufferUnderrun;
|
bool bBufferUnderrun;
|
||||||
|
short* psPlayConvBuf;
|
||||||
|
int iCurPosPlayConvBuf;
|
||||||
|
|
||||||
int iCurNumSndBufIn;
|
int iCurNumSndBufIn;
|
||||||
int iCurNumSndBufOut;
|
int iCurNumSndBufOut;
|
||||||
|
@ -390,6 +394,26 @@ if ( iASIOBufferSizeMono != iBufferSizeMono )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create memory for ASIO buffer conversion if required
|
||||||
|
if ( iASIOBufferSizeMono != iBufferSizeMono )
|
||||||
|
{
|
||||||
|
if ( psCaptureConvBuf != NULL )
|
||||||
|
{
|
||||||
|
delete[] psCaptureConvBuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
psCaptureConvBuf = new short[max(2 * iASIOBufferSizeMono, iBufferSizeStereo)];
|
||||||
|
iCurPosCaptConvBuf = 0;
|
||||||
|
|
||||||
|
if ( psPlayConvBuf != NULL )
|
||||||
|
{
|
||||||
|
delete[] psPlayConvBuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
psPlayConvBuf = new short[max(2 * iASIOBufferSizeMono, iBufferSizeStereo)];
|
||||||
|
iCurPosPlayConvBuf = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// reset event
|
// reset event
|
||||||
ResetEvent ( m_ASIOEvent );
|
ResetEvent ( m_ASIOEvent );
|
||||||
}
|
}
|
||||||
|
@ -527,6 +551,10 @@ pstrDevices[0] = driverInfo.name;
|
||||||
psPlaybackBuffer[i] = NULL;
|
psPlaybackBuffer[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// init ASIO convertion buffers
|
||||||
|
psCaptureConvBuf = NULL;
|
||||||
|
psPlayConvBuf = NULL;
|
||||||
|
|
||||||
// we use an event controlled structure
|
// we use an event controlled structure
|
||||||
// create event
|
// create event
|
||||||
m_ASIOEvent = CreateEvent ( NULL, FALSE, FALSE, NULL );
|
m_ASIOEvent = CreateEvent ( NULL, FALSE, FALSE, NULL );
|
||||||
|
@ -585,6 +613,17 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
|
||||||
|
|
||||||
ASIOMutex.lock(); // get mutex lock
|
ASIOMutex.lock(); // get mutex lock
|
||||||
{
|
{
|
||||||
|
// check if special treatment is required with buffer conversion
|
||||||
|
const bool bConvBufNeeded = ( iASIOBufferSizeMono != iBufferSizeMono );
|
||||||
|
|
||||||
|
|
||||||
|
// TODO implementation of ASIO conversion buffer
|
||||||
|
// psCaptureConvBuf
|
||||||
|
// iCurPosCaptConvBuf
|
||||||
|
// psPlayConvBuf
|
||||||
|
// iCurPosPlayConvBuf
|
||||||
|
|
||||||
|
|
||||||
// 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++ ) // stereo
|
for ( int i = 0; i < 2 * NUM_IN_OUT_CHANNELS; i++ ) // stereo
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue