some more conversion buffer work

This commit is contained in:
Volker Fischer 2008-07-15 20:33:41 +00:00
parent 624da195ea
commit 33be3c0812
4 changed files with 27 additions and 6 deletions

View file

@ -188,7 +188,19 @@ void CClient::run()
#endif
// init object
Init();
try
{
Init();
}
catch ( CGenErr generr )
{
// TODO better error management -> should be catched in main thread
// problem: how to catch errors in a different thread...?
// quick hack solution
QMessageBox::critical ( 0, APP_NAME, generr.strError, "Quit", 0 );
exit ( 0 );
}
// runtime phase ------------------------------------------------------------

View file

@ -30,6 +30,7 @@
#include <qhostinfo.h>
#include <qstring.h>
#include <qdatetime.h>
#include <qmessagebox.h>
#include "global.h"
#include "socket.h"
#include "resample.h"

View file

@ -133,6 +133,7 @@ typedef unsigned int _MESSAGE_IDENT;
#define MS_JIT_BUF_GET 4
#define MS_PACKET_RECEIVED 5
#define MS_PROTOCOL 6
#define MS_ERROR_IN_THREAD 7
#define MUL_COL_LED_RED 0
#define MUL_COL_LED_YELLOW 1

View file

@ -60,15 +60,18 @@ HANDLE m_ASIOEvent;
int iInCurBlockToWrite;
short* psSoundcardBuffer[MAX_SND_BUF_IN];
bool bBufferOverrun;
short* psCaptureConvBuf;
int iCurPosCaptConvBuf;
// wave out
int iOutCurBlockToWrite;
short* psPlaybackBuffer[MAX_SND_BUF_OUT];
bool bBufferUnderrun;
// ASIO buffer size conversion buffer
short* psCaptureConvBuf;
int iCurPosCaptConvBuf;
short* psPlayConvBuf;
int iCurPosPlayConvBuf;
int iASIOConfBufSize;
int iCurNumSndBufIn;
int iCurNumSndBufOut;
@ -313,7 +316,8 @@ void CSound::InitRecordingAndPlayback ( int iNewBufferSize )
// TEST test if requested buffer size is supported by the audio hardware, if not, fire error
if ( iASIOBufferSizeMono != iBufferSizeMono )
{
throw CGenErr ( "Required sound card buffer size not allowed by the audio hardware." );
throw CGenErr ( QString ( "Required sound card buffer size of %1 samples "
"not supported by the audio hardware." ).arg(iBufferSizeMono) );
}
// prepare input channels
@ -397,12 +401,15 @@ if ( iASIOBufferSizeMono != iBufferSizeMono )
// create memory for ASIO buffer conversion if required
if ( iASIOBufferSizeMono != iBufferSizeMono )
{
// required size: two times of one stereo buffer of the larger buffer
iASIOConfBufSize = max(4 * iASIOBufferSizeMono, 2 * iBufferSizeStereo);
if ( psCaptureConvBuf != NULL )
{
delete[] psCaptureConvBuf;
}
psCaptureConvBuf = new short[max(2 * iASIOBufferSizeMono, iBufferSizeStereo)];
psCaptureConvBuf = new short[iASIOConfBufSize];
iCurPosCaptConvBuf = 0;
if ( psPlayConvBuf != NULL )
@ -410,7 +417,7 @@ if ( iASIOBufferSizeMono != iBufferSizeMono )
delete[] psPlayConvBuf;
}
psPlayConvBuf = new short[max(2 * iASIOBufferSizeMono, iBufferSizeStereo)];
psPlayConvBuf = new short[iASIOConfBufSize];
iCurPosPlayConvBuf = 0;
}