code cleanup (removed tabs), 2008 -> 2009

This commit is contained in:
Volker Fischer 2009-02-22 11:07:18 +00:00
parent 5eea2d96a9
commit c077f6ecf8
39 changed files with 467 additions and 465 deletions

View file

@ -5,7 +5,7 @@
- speed optimizations to improve audio interface stability
- new defaults (e.g. turn off Reverb by default since it requires significant
CPU
CPU)
2.1.3
@ -23,7 +23,8 @@
- ping time measurement problems on Windows OS fixed
- security checks for protocol messages (wrong messages could crash the software)
- security checks for protocol messages (wrong messages could crash the
software)
2.1.1
@ -51,7 +52,8 @@
- new client settings dialog
- at each client a separate audio mix can be generated for all connected clients at the server
- at each client a separate audio mix can be generated for all connected clients
at the server
0.9.4

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

2
README
View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer, Erik de Castro Lopo
@ -97,9 +97,9 @@ CVector<short> CAudioCompression::Decode ( const CVector<unsigned char>& vecbyAd
{
int current = vecbyAdpcm[2 * i] | ( vecbyAdpcm[2 * i + 1] << 8 );
if ( current & 0x8000 )
{
{
current -= 0x10000;
}
}
vecsOut[i] = (short) current;
}
@ -188,13 +188,13 @@ CVector<unsigned char> CImaAdpcm::Encode ( const CVector<short>& vecsAudio )
}
if ( bytecode & 8 )
{
{
iPrevAudio -= vpdiff;
}
}
else
{
{
iPrevAudio += vpdiff;
}
}
// adjust step size
Q_ASSERT ( bytecode < IMA_INDX_ADJUST_TAB_LEN );
@ -233,9 +233,9 @@ CVector<short> CImaAdpcm::Decode ( const CVector<unsigned char>& vecbyAdpcm )
/* Read the block header ------------------------------------------------ */
int current = vecbyAdpcm[0] | ( vecbyAdpcm[1] << 8 );
if ( current & 0x8000 )
{
{
current -= 0x10000;
}
}
// get and bound step index
int iStepindDec = CheckBounds ( vecbyAdpcm[2], 0, IMA_STEP_SIZE_TAB_LEN - 1 );
@ -270,21 +270,21 @@ CVector<short> CImaAdpcm::Decode ( const CVector<unsigned char>& vecbyAdpcm )
int diff = step >> 3;
if ( bytecode & 1 )
{
{
diff += step >> 2;
}
}
if ( bytecode & 2 )
{
{
diff += step >> 1;
}
}
if ( bytecode & 4 )
{
{
diff += step;
}
}
if ( bytecode & 8 )
{
{
diff = -diff;
}
}
current += diff;
@ -345,70 +345,70 @@ CVector<unsigned char> CMsAdpcm::Encode ( const CVector<short>& vecsAudio )
/* Encode the block header ---------------------------------------------- */
vecbyAdpcm[0] = bpred;
vecbyAdpcm[1] = idelta & 0xFF;
vecbyAdpcm[2] = ( idelta >> 8 ) & 0xFF;
vecbyAdpcm[3] = vecsAudio[1] & 0xFF;
vecbyAdpcm[4] = ( vecsAudio[1] >> 8 ) & 0xFF;
vecbyAdpcm[5] = vecsAudio[0] & 0xFF;
vecbyAdpcm[6] = ( vecsAudio[0] >> 8 ) & 0xFF;
vecbyAdpcm[1] = idelta & 0xFF;
vecbyAdpcm[2] = ( idelta >> 8 ) & 0xFF;
vecbyAdpcm[3] = vecsAudio[1] & 0xFF;
vecbyAdpcm[4] = ( vecsAudio[1] >> 8 ) & 0xFF;
vecbyAdpcm[5] = vecsAudio[0] & 0xFF;
vecbyAdpcm[6] = ( vecsAudio[0] >> 8 ) & 0xFF;
/* Encode the samples as 4 bit ------------------------------------------ */
unsigned int blockindx = 7;
unsigned char byte = 0;
unsigned int blockindx = 7;
unsigned char byte = 0;
for ( int k = 2; k < iAudSize; k++ )
{
{
const int predict = ( vecsAudioTemp[k - 1] * ms_AdaptCoeff1[bpred] +
vecsAudioTemp[k - 2] * ms_AdaptCoeff2[bpred] ) >> 8;
int errordelta = ( vecsAudio[k] - predict ) / idelta;
int errordelta = ( vecsAudio[k] - predict ) / idelta;
if ( errordelta < -8 )
if ( errordelta < -8 )
{
errordelta = -8 ;
errordelta = -8 ;
}
else
else
{
if (errordelta > 7)
{
errordelta = 7;
errordelta = 7;
}
}
int newsamp = predict + ( idelta * errordelta );
int newsamp = predict + ( idelta * errordelta );
if ( newsamp > 32767 )
if ( newsamp > 32767 )
{
newsamp = 32767;
newsamp = 32767;
}
else
else
{
if ( newsamp < -32768 )
{
newsamp = -32768;
newsamp = -32768;
}
}
if ( errordelta < 0 )
if ( errordelta < 0 )
{
errordelta += 0x10;
errordelta += 0x10;
}
byte = ( byte << 4 ) | ( errordelta & 0xF );
byte = ( byte << 4 ) | ( errordelta & 0xF );
if ( k % 2 )
{
if ( k % 2 )
{
vecbyAdpcm[blockindx++] = byte;
byte = 0;
}
idelta = ( idelta * ms_AdaptationTable[errordelta] ) >> 8;
if ( idelta < 16 )
{
idelta = 16;
byte = 0;
}
vecsAudioTemp[k] = newsamp;
}
idelta = ( idelta * ms_AdaptationTable[errordelta] ) >> 8;
if ( idelta < 16 )
{
idelta = 16;
}
vecsAudioTemp[k] = newsamp;
}
return vecbyAdpcm;
}
@ -430,10 +430,10 @@ CVector<short> CMsAdpcm::Decode ( const CVector<unsigned char>& vecbyAdpcm )
return vecsAudio;
}
short chan_idelta = vecbyAdpcm[1] | ( vecbyAdpcm[2] << 8 );
short chan_idelta = vecbyAdpcm[1] | ( vecbyAdpcm[2] << 8 );
vecsAudio[1] = vecbyAdpcm[3] | ( vecbyAdpcm[4] << 8 );
vecsAudio[0] = vecbyAdpcm[5] | ( vecbyAdpcm[6] << 8 );
vecsAudio[1] = vecbyAdpcm[3] | ( vecbyAdpcm[4] << 8 );
vecsAudio[0] = vecbyAdpcm[5] | ( vecbyAdpcm[6] << 8 );
/* -------------------------------------------------------------------------
@ -448,48 +448,48 @@ CVector<short> CMsAdpcm::Decode ( const CVector<unsigned char>& vecbyAdpcm )
/* Decode the encoded 4 bit samples ------------------------------------- */
for ( int k = 2; k < iAudSize; k ++ )
{
bytecode = vecsAudio[k] & 0xF;
for ( int k = 2; k < iAudSize; k ++ )
{
bytecode = vecsAudio[k] & 0xF;
// compute next Adaptive Scale Factor (ASF)
int idelta = chan_idelta;
// compute next Adaptive Scale Factor (ASF)
int idelta = chan_idelta;
// => / 256 => FIXED_POINT_ADAPTATION_BASE == 256
chan_idelta = ( ms_AdaptationTable[bytecode] * idelta ) >> 8;
chan_idelta = ( ms_AdaptationTable[bytecode] * idelta ) >> 8;
if ( chan_idelta < 16 )
if ( chan_idelta < 16 )
{
chan_idelta = 16;
chan_idelta = 16;
}
if ( bytecode & 0x8 )
if ( bytecode & 0x8 )
{
bytecode -= 0x10;
bytecode -= 0x10;
}
// => / 256 => FIXED_POINT_COEFF_BASE == 256
const int predict = ( ( vecsAudio[k - 1] * ms_AdaptCoeff1[bpred] ) +
const int predict = ( ( vecsAudio[k - 1] * ms_AdaptCoeff1[bpred] ) +
( vecsAudio[k - 2] * ms_AdaptCoeff2[bpred] ) ) >> 8;
int current = ( bytecode * idelta ) + predict;
int current = ( bytecode * idelta ) + predict;
if ( current > 32767 )
if ( current > 32767 )
{
current = 32767;
current = 32767;
}
else
else
{
if ( current < -32768 )
{
current = -32768;
current = -32768;
}
}
vecsAudio[k] = current;
}
vecsAudio[k] = current;
}
return vecsAudio;
return vecsAudio;
}
void CMsAdpcm::ChoosePredictor ( const CVector<short>& vecsAudio,
@ -516,39 +516,39 @@ void CMsAdpcm::ChoosePredictor ( const CVector<short>& vecsAudio,
by using all the samples to choose the predictor. */
unsigned int idelta_count = min ( MSADPCM_IDELTA_COUNT, vecsAudio.Size() - 1 );
for ( unsigned int bpred = 0; bpred < MSADPCM_ADAPT_COEFF_COUNT; bpred++ )
{
for ( unsigned int bpred = 0; bpred < MSADPCM_ADAPT_COEFF_COUNT; bpred++ )
{
unsigned int idelta_sum = 0;
for ( unsigned int k = 2; k < 2 + idelta_count; k++ )
for ( unsigned int k = 2; k < 2 + idelta_count; k++ )
{
idelta_sum += abs ( vecsAudio[k] -
idelta_sum += abs ( vecsAudio[k] -
( ( vecsAudio[k - 1] * ms_AdaptCoeff1[bpred] +
vecsAudio[k - 2] * ms_AdaptCoeff2[bpred] ) >> 8 ) );
}
idelta_sum /= ( 4 * idelta_count );
idelta_sum /= ( 4 * idelta_count );
if ( bpred == 0 || idelta_sum < best_idelta )
{
if ( bpred == 0 || idelta_sum < best_idelta )
{
best_bpred = bpred;
best_idelta = idelta_sum;
}
best_idelta = idelta_sum;
}
if ( !idelta_sum )
{
if ( !idelta_sum )
{
best_bpred = bpred;
best_idelta = 16;
break;
}
}
if ( best_idelta < 16 )
{
best_idelta = 16;
best_idelta = 16;
break;
}
}
block_pred = best_bpred;
idelta = best_idelta;
if ( best_idelta < 16 )
{
best_idelta = 16;
}
return;
block_pred = best_bpred;
idelta = best_idelta;
return;
}

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer, Erik de Castro Lopo
@ -70,7 +70,7 @@ static int ms_AdaptCoeff2[MSADPCM_ADAPT_COEFF_COUNT] =
static int ms_AdaptationTable[] =
{
230, 230, 230, 230, 307, 409, 512, 614,
768, 614, 512, 409, 307, 230, 230, 230
768, 614, 512, 409, 307, 230, 230, 230
};

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer
@ -46,22 +46,22 @@ void CNetBuf::Init ( const int iNewBlockSize, const int iNewNumBlocks )
// initialize number of samples for fading effect
if ( FADE_IN_OUT_NUM_SAM < iBlockSize )
{
{
iNumSamFading = iBlockSize;
}
}
else
{
{
iNumSamFading = FADE_IN_OUT_NUM_SAM;
}
}
if ( FADE_IN_OUT_NUM_SAM_EXTRA > iBlockSize )
{
{
iNumSamFadingExtra = iBlockSize;
}
}
else
{
{
iNumSamFadingExtra = FADE_IN_OUT_NUM_SAM_EXTRA;
}
}
// init variables for extrapolation (in case a fade out is needed)
dExPDiff = 0.0;
@ -96,9 +96,9 @@ fflush(pFileBI);
// fade in new block if required
if ( bFadeInNewPutData )
{
{
FadeInAudioDataBlock ( vecdData );
}
}
// copy new data in internal buffer
int iCurPos = 0;
@ -109,34 +109,34 @@ fflush(pFileBI);
// data must be written in two steps because of wrap around
while ( iPutPos < iMemSize )
{
{
vecdMemory[iPutPos++] = vecdData[iCurPos++];
}
}
for ( iPutPos = 0; iPutPos < iRemSpace; iPutPos++ )
{
{
vecdMemory[iPutPos] = vecdData[iCurPos++];
}
}
}
else
{
// data can be written in one step
const int iEnd = iPutPos + iInSize;
while ( iPutPos < iEnd )
{
{
vecdMemory[iPutPos++] = vecdData[iCurPos++];
}
}
}
// set buffer state flag
if ( iPutPos == iGetPos )
{
{
eBufState = CNetBuf::BS_FULL;
}
}
else
{
{
eBufState = CNetBuf::BS_OK;
}
}
return bPutOK;
}
@ -173,34 +173,34 @@ bool CNetBuf::Get ( CVector<double>& vecdData )
// data must be read in two steps because of wrap around
while ( iGetPos < iMemSize )
{
{
vecdData[iCurPos++] = vecdMemory[iGetPos++];
}
}
for ( iGetPos = 0; iGetPos < iRemData; iGetPos++ )
{
{
vecdData[iCurPos++] = vecdMemory[iGetPos];
}
}
}
else
{
// data can be read in one step
const int iEnd = iGetPos + iInSize;
while ( iGetPos < iEnd )
{
{
vecdData[iCurPos++] = vecdMemory[iGetPos++];
}
}
}
// set buffer state flag
if ( iPutPos == iGetPos )
{
{
eBufState = CNetBuf::BS_EMPTY;
}
}
else
{
{
eBufState = CNetBuf::BS_OK;
}
}
/* extrapolate data from old block to avoid "clicks"
@ -208,9 +208,9 @@ bool CNetBuf::Get ( CVector<double>& vecdData )
anymore since it is already gone (processed or send through the
network) */
if ( bFadeOutExtrap )
{
{
FadeOutExtrapolateAudioDataBlock ( vecdData, dExPDiff, dExPLastV );
}
}
/* save some paramters from last block which is needed in case we do not
have enough data for next "get" operation and need to extrapolate the
@ -229,16 +229,16 @@ int CNetBuf::GetAvailSpace() const
// check for special case and wrap around
if ( iAvSpace < 0 )
{
{
iAvSpace += iMemSize; // wrap around
}
}
else
{
if ( ( iAvSpace == 0 ) && ( eBufState == BS_EMPTY ) )
{
iAvSpace = iMemSize;
}
}
{
if ( ( iAvSpace == 0 ) && ( eBufState == BS_EMPTY ) )
{
iAvSpace = iMemSize;
}
}
return iAvSpace;
}
@ -250,16 +250,16 @@ int CNetBuf::GetAvailData() const
// check for special case and wrap around
if ( iAvData < 0 )
{
{
iAvData += iMemSize; // wrap around
}
}
else
{
if ( ( iAvData == 0 ) && ( eBufState == BS_FULL ) )
{
iAvData = iMemSize;
}
}
{
if ( ( iAvData == 0 ) && ( eBufState == BS_FULL ) )
{
iAvData = iMemSize;
}
}
return iAvData;
}
@ -298,13 +298,13 @@ void CNetBuf::Clear ( const EClearType eClearType )
/* check for special case */
if ( iPutPos == iGetPos )
{
{
eBufState = CNetBuf::BS_FULL;
}
}
else
{
{
eBufState = CNetBuf::BS_OK;
}
}
}
else
{
@ -316,9 +316,9 @@ void CNetBuf::Clear ( const EClearType eClearType )
// wrap around
iPutPos += iGetPos;
if ( iPutPos > iMemSize )
{
{
iPutPos -= iMemSize;
}
}
// fade out old data right before new put pointer
int iCurPos = iPutPos - iNumSamFading;

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer
@ -95,7 +95,7 @@ public:
}
void SetDoAutoSockBufSize ( const bool bValue ) { bDoAutoSockBufSize = bValue; }
bool GetDoAutoSockBufSize() { return bDoAutoSockBufSize; }
bool GetDoAutoSockBufSize() { return bDoAutoSockBufSize; }
void SetSockBufSize ( const int iNumBlocks )
{
if ( Channel.GetSockBufSize() != iNumBlocks )

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer
@ -185,15 +185,15 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
void CClientSettingsDlg::UpdateJitterBufferFrame()
{
// update slider value and text
const int iCurNumNetBuf = pClient->GetSockBufSize();
// update slider value and text
const int iCurNumNetBuf = pClient->GetSockBufSize();
SliderNetBuf->setValue ( iCurNumNetBuf );
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
// if auto setting is enabled, disable slider control
cbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() );
SliderNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
TextNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
// if auto setting is enabled, disable slider control
cbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() );
SliderNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
TextNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
}
void CClientSettingsDlg::UpdateSndBufInSlider ( const int iCurNumInBuf )
@ -280,8 +280,8 @@ void CClientSettingsDlg::OnSoundCrdSelection ( int iSndDevIdx )
void CClientSettingsDlg::OnAutoJitBuf ( int value )
{
pClient->SetDoAutoSockBufSize ( value == Qt::Checked );
UpdateJitterBufferFrame();
pClient->SetDoAutoSockBufSize ( value == Qt::Checked );
UpdateJitterBufferFrame();
}
void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value )

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer
@ -84,7 +84,7 @@ public slots:
void OnSliderNetBuf ( int value );
void OnSliderNetBufSiFactIn ( int value );
void OnSliderNetBufSiFactOut ( int value );
void OnAutoJitBuf ( int value );
void OnAutoJitBuf ( int value );
void OnOpenChatOnNewMessageStateChanged ( int value );
void OnAudioCompressionButtonGroupClicked ( QAbstractButton* button );
void OnPingTimeResult ( int iPingTime );

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer
@ -39,7 +39,7 @@ QDialog* pMainWindow = NULL;
int main ( int argc, char** argv )
{
std::string strArgument;
std::string strArgument;
double rDbleArgument;
/* check if server or client application shall be started */
@ -47,96 +47,96 @@ int main ( int argc, char** argv )
bool bUseGUI = true;
bool bForceLowUploadRate = false;
quint16 iPortNumber = LLCON_PORT_NUMBER;
std::string strIniFileName = "";
std::string strIniFileName = "";
std::string strHTMLStatusFileName = "";
std::string strServerName = "";
std::string strLoggingFileName = "";
/* QT docu: argv()[0] is the program name, argv()[1] is the first
argument and argv()[argc()-1] is the last argument.
Start with first argument, therefore "i = 1" */
for ( int i = 1; i < argc; i++ )
{
// server mode flag ----------------------------------------------------------
if ( GetFlagArgument ( argc, argv, i, "-s", "--server" ) )
{
bIsClient = false;
/* QT docu: argv()[0] is the program name, argv()[1] is the first
argument and argv()[argc()-1] is the last argument.
Start with first argument, therefore "i = 1" */
for ( int i = 1; i < argc; i++ )
{
// server mode flag ----------------------------------------------------------
if ( GetFlagArgument ( argc, argv, i, "-s", "--server" ) )
{
bIsClient = false;
cerr << "server mode chosen" << std::endl;
continue;
}
continue;
}
// use GUI flag --------------------------------------------------------------
if ( GetFlagArgument ( argc, argv, i, "-n", "--nogui" ) )
{
bUseGUI = false;
// use GUI flag --------------------------------------------------------------
if ( GetFlagArgument ( argc, argv, i, "-n", "--nogui" ) )
{
bUseGUI = false;
cerr << "no GUI mode chosen" << std::endl;
continue;
}
continue;
}
// use logging ---------------------------------------------------------------
if ( GetStringArgument ( argc, argv, i, "-l", "--log", strArgument ) )
{
strLoggingFileName = strArgument;
// use logging ---------------------------------------------------------------
if ( GetStringArgument ( argc, argv, i, "-l", "--log", strArgument ) )
{
strLoggingFileName = strArgument;
cerr << "logging file name: " << strLoggingFileName << std::endl;
continue;
}
continue;
}
// force low upload data rate flag -------------------------------------------
// force low upload data rate flag -------------------------------------------
if ( GetFlagArgument ( argc, argv, i, "-u", "--lowuploadrate" ) )
{
bForceLowUploadRate = true;
bForceLowUploadRate = true;
cerr << "force low upload rate" << std::endl;
continue;
continue;
}
// port number ---------------------------------------------------------------
if ( GetNumericArgument ( argc, argv, i, "-p", "--port",
if ( GetNumericArgument ( argc, argv, i, "-p", "--port",
0, 65535, rDbleArgument ) )
{
iPortNumber = static_cast<quint16> ( rDbleArgument );
{
iPortNumber = static_cast<quint16> ( rDbleArgument );
cerr << "selected port number: " << iPortNumber << std::endl;
continue;
}
continue;
}
// HTML status file ----------------------------------------------------------
if ( GetStringArgument ( argc, argv, i, "-m", "--htmlstatus", strArgument ) )
{
strHTMLStatusFileName = strArgument;
// HTML status file ----------------------------------------------------------
if ( GetStringArgument ( argc, argv, i, "-m", "--htmlstatus", strArgument ) )
{
strHTMLStatusFileName = strArgument;
cerr << "HTML status file name: " << strHTMLStatusFileName << std::endl;
continue;
}
continue;
}
if ( GetStringArgument ( argc, argv, i, "-a", "--servername", strArgument ) )
{
strServerName = strArgument;
if ( GetStringArgument ( argc, argv, i, "-a", "--servername", strArgument ) )
{
strServerName = strArgument;
cerr << "server name for HTML status file: " << strServerName << std::endl;
continue;
}
continue;
}
// initialization file -------------------------------------------------------
if ( GetStringArgument ( argc, argv, i, "-i", "--inifile", strArgument ) )
{
strIniFileName = strArgument;
// initialization file -------------------------------------------------------
if ( GetStringArgument ( argc, argv, i, "-i", "--inifile", strArgument ) )
{
strIniFileName = strArgument;
cerr << "initialization file name: " << strIniFileName << std::endl;
continue;
}
continue;
}
// help (usage) flag ---------------------------------------------------------
if ( ( !strcmp ( argv[i], "--help" ) ) ||
( !strcmp ( argv[i], "-h" ) ) || ( !strcmp ( argv[i], "-?" ) ) )
{
// help (usage) flag ---------------------------------------------------------
if ( ( !strcmp ( argv[i], "--help" ) ) ||
( !strcmp ( argv[i], "-h" ) ) || ( !strcmp ( argv[i], "-?" ) ) )
{
const std::string strHelp = UsageArguments(argv);
cerr << strHelp;
exit ( 1 );
}
exit ( 1 );
}
// unknown option ------------------------------------------------------------
cerr << argv[0] << ": ";
cerr << "Unknown option '" << argv[i] << "' -- use '--help' for help"
<< endl;
// unknown option ------------------------------------------------------------
cerr << argv[0] << ": ";
cerr << "Unknown option '" << argv[i] << "' -- use '--help' for help"
<< endl;
exit ( 1 );
}
exit ( 1 );
}
#ifdef _WIN32
// Set application priority class -> high priority
@ -240,54 +240,54 @@ int main ( int argc, char** argv )
\******************************************************************************/
std::string UsageArguments ( char **argv )
{
return
"Usage: " + std::string ( argv[0] ) + " [option] [argument]\n"
"Recognized options:\n"
" -s, --server start server\n"
" -n, --nogui disable GUI (only avaiable for server)\n"
" -l, --log enable logging, set file name\n"
" -i, --inifile initialization file name (only available for client)\n"
" -p, --port local port number (only avaiable for server)\n"
" -m, --htmlstatus enable HTML status file, set file name (only avaiable for server)\n"
" -u, --lowuploadrate force low upload rate (only avaiable for server)\n"
" -h, -?, --help this help text\n"
"Example: " + std::string ( argv[0] ) + " -l -inifile myinifile.ini\n";
return
"Usage: " + std::string ( argv[0] ) + " [option] [argument]\n"
"Recognized options:\n"
" -s, --server start server\n"
" -n, --nogui disable GUI (only avaiable for server)\n"
" -l, --log enable logging, set file name\n"
" -i, --inifile initialization file name (only available for client)\n"
" -p, --port local port number (only avaiable for server)\n"
" -m, --htmlstatus enable HTML status file, set file name (only avaiable for server)\n"
" -u, --lowuploadrate force low upload rate (only avaiable for server)\n"
" -h, -?, --help this help text\n"
"Example: " + std::string ( argv[0] ) + " -l -inifile myinifile.ini\n";
}
bool GetFlagArgument ( int, char **argv, int &i,
std::string strShortOpt, std::string strLongOpt )
{
if ( ( !strShortOpt.compare ( argv[i] ) ) || ( !strLongOpt.compare ( argv[i] ) ) )
{
return true;
}
else
{
return false;
}
if ( ( !strShortOpt.compare ( argv[i] ) ) || ( !strLongOpt.compare ( argv[i] ) ) )
{
return true;
}
else
{
return false;
}
}
bool GetStringArgument ( int argc, char **argv, int &i,
std::string strShortOpt, std::string strLongOpt,
std::string & strArg )
{
if ( ( !strShortOpt.compare ( argv[i] ) ) || ( !strLongOpt.compare ( argv[i] ) ) )
{
if ( ++i >= argc )
{
cerr << argv[0] << ": ";
cerr << "'" << strLongOpt << "' needs a string argument" << endl;
exit ( 1 );
}
if ( ( !strShortOpt.compare ( argv[i] ) ) || ( !strLongOpt.compare ( argv[i] ) ) )
{
if ( ++i >= argc )
{
cerr << argv[0] << ": ";
cerr << "'" << strLongOpt << "' needs a string argument" << endl;
exit ( 1 );
}
strArg = argv[i];
strArg = argv[i];
return true;
}
else
{
return false;
}
return true;
}
else
{
return false;
}
}
bool GetNumericArgument ( int argc, char **argv, int &i,
@ -295,32 +295,32 @@ bool GetNumericArgument ( int argc, char **argv, int &i,
double rRangeStart, double rRangeStop,
double & rValue)
{
if ( ( !strShortOpt.compare ( argv[i] ) ) || ( !strLongOpt.compare ( argv[i] ) ) )
{
if ( ++i >= argc )
{
cerr << argv[0] << ": ";
cerr << "'" << strLongOpt << "' needs a numeric argument between "
<< rRangeStart << " and " << rRangeStop << endl;
exit ( 1 );
}
if ( ( !strShortOpt.compare ( argv[i] ) ) || ( !strLongOpt.compare ( argv[i] ) ) )
{
if ( ++i >= argc )
{
cerr << argv[0] << ": ";
cerr << "'" << strLongOpt << "' needs a numeric argument between "
<< rRangeStart << " and " << rRangeStop << endl;
exit ( 1 );
}
char *p;
rValue = strtod ( argv[i], &p );
if ( *p || rValue < rRangeStart || rValue > rRangeStop )
{
cerr << argv[0] << ": ";
cerr << "'" << strLongOpt << "' needs a numeric argument between "
<< rRangeStart << " and " << rRangeStop << endl;
exit ( 1 );
}
char *p;
rValue = strtod ( argv[i], &p );
if ( *p || rValue < rRangeStart || rValue > rRangeStop )
{
cerr << argv[0] << ": ";
cerr << "'" << strLongOpt << "' needs a numeric argument between "
<< rRangeStart << " and " << rRangeStop << endl;
exit ( 1 );
}
return true;
}
else
{
return false;
}
return true;
}
else
{
return false;
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -48,8 +48,8 @@ public:
void Save ( const QString& sFileName = "" ) { WriteIniFile ( sFileName ); }
protected:
void ReadIniFile ( const QString& sFileName );
void WriteIniFile ( const QString& sFileName );
void ReadIniFile ( const QString& sFileName );
void WriteIniFile ( const QString& sFileName );
// init file access function for read/write
void SetNumericIniSet ( QDomDocument& xmlFile, const QString& strSection,

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer
@ -76,59 +76,59 @@ void CSocket::SendPacket ( const CVector<unsigned char>& vecbySendBuf,
void CSocket::OnDataReceived()
{
while ( SocketDevice.hasPendingDatagrams() )
{
QHostAddress SenderAddress;
quint16 SenderPort;
{
QHostAddress SenderAddress;
quint16 SenderPort;
// read block from network interface and query address of sender
int iNumBytesRead = SocketDevice.readDatagram ( (char*) &vecbyRecBuf[0],
MAX_SIZE_BYTES_NETW_BUF, &SenderAddress, &SenderPort );
// read block from network interface and query address of sender
int iNumBytesRead = SocketDevice.readDatagram ( (char*) &vecbyRecBuf[0],
MAX_SIZE_BYTES_NETW_BUF, &SenderAddress, &SenderPort );
// check if an error occurred
if ( iNumBytesRead < 0 )
{
return;
}
// check if an error occurred
if ( iNumBytesRead < 0 )
{
return;
}
// convert address of client
const CHostAddress RecHostAddr ( SenderAddress, SenderPort );
// convert address of client
const CHostAddress RecHostAddr ( SenderAddress, SenderPort );
if ( bIsClient )
{
// client
// check if packet comes from the server we want to connect
if ( ! ( pChannel->GetAddress() == RecHostAddr ) )
{
return;
}
{
// client
// check if packet comes from the server we want to connect
if ( ! ( pChannel->GetAddress() == RecHostAddr ) )
{
return;
}
switch ( pChannel->PutData ( vecbyRecBuf, iNumBytesRead ) )
{
case PS_AUDIO_OK:
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_GREEN );
break;
switch ( pChannel->PutData ( vecbyRecBuf, iNumBytesRead ) )
{
case PS_AUDIO_OK:
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_GREEN );
break;
case PS_AUDIO_ERR:
case PS_GEN_ERROR:
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_RED );
break;
case PS_AUDIO_ERR:
case PS_GEN_ERROR:
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_RED );
break;
case PS_PROT_ERR:
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_YELLOW );
break;
}
}
else
{
// server
if ( pChannelSet->PutData ( vecbyRecBuf, iNumBytesRead, RecHostAddr ) )
{
// this was an audio packet, start server
// tell the server object to wake up if it
// is in sleep mode (Qt will delete the event object when done)
QCoreApplication::postEvent ( pServer,
new CLlconEvent ( MS_PACKET_RECEIVED, 0, 0 ) );
}
}
}
case PS_PROT_ERR:
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_YELLOW );
break;
}
}
else
{
// server
if ( pChannelSet->PutData ( vecbyRecBuf, iNumBytesRead, RecHostAddr ) )
{
// this was an audio packet, start server
// tell the server object to wake up if it
// is in sleep mode (Qt will delete the event object when done)
QCoreApplication::postEvent ( pServer,
new CLlconEvent ( MS_PACKET_RECEIVED, 0, 0 ) );
}
}
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer

View file

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2008
* Copyright (c) 2004-2009
*
* Author(s):
* Volker Fischer
@ -54,15 +54,15 @@ inline short Double2Short ( const double dInput )
{
// lower bound
if ( dInput < _MINSHORT )
{
{
return _MINSHORT;
}
}
// upper bound
if ( dInput > _MAXSHORT )
{
{
return _MAXSHORT;
}
}
return (short) dInput;
}
@ -187,9 +187,9 @@ template<class TData> void CVector<TData>::Reset ( const TData tResetVal )
{
// set all values to reset value
for ( int i = 0; i < iVectorSize; i++ )
{
{
pData[i] = tResetVal;
}
}
}
@ -234,9 +234,9 @@ template<class TData> void CFIFO<TData>::Add ( const TData tNewD )
// increment index
iCurIdx++;
if ( iCurIdx >= this->iVectorSize )
{
{
iCurIdx = 0;
}
}
}

View file

@ -1,5 +1,5 @@
rem/******************************************************************************\
rem * Copyright (c) 2004-2008
rem * Copyright (c) 2004-2009
rem *
rem * Author(s):
rem * Volker Fischer

View file

@ -100,7 +100,7 @@ bool CSound::Read ( CVector<short>& psData )
while ( iBufferPosCapture < iBufferSizeStereo )
{
if ( bBlockingRec )
{
{
if ( !bCaptureBufferOverrun )
{
// regular case
@ -121,11 +121,11 @@ bool CSound::Read ( CVector<short>& psData )
return true;
}
}
}
}
else
{
{
return true;
}
}
}
ASIOMutex.lock(); // get mutex lock
@ -140,9 +140,9 @@ bool CSound::Read ( CVector<short>& psData )
// copy data from sound card capture buffer in function output buffer
for ( i = 0; i < iBufferSizeStereo; i++ )
{
{
psData[i] = psCaptureBuffer[i];
}
}
// move all other data in buffer
const int iLenCopyRegion = iBufferPosCapture - iBufferSizeStereo;
@ -166,7 +166,7 @@ void CSound::SetInNumBuf ( int iNewNum )
{
// check new parameter
if ( ( iNewNum < MAX_SND_BUF_IN ) && ( iNewNum >= iMinNumSndBuf ) )
{
{
// change only if parameter is different
if ( iNewNum != iNewNumSndBufIn )
{
@ -232,7 +232,7 @@ void CSound::SetOutNumBuf ( int iNewNum )
{
// check new parameter
if ( ( iNewNum < MAX_SND_BUF_OUT ) && ( iNewNum >= iMinNumSndBuf ) )
{
{
// change only if parameter is different
if ( iNewNum != iNewNumSndBufOut )
{
@ -262,9 +262,9 @@ void CSound::SetDev ( const int iNewDev )
// set event to ensure that thread leaves the waiting function
if ( m_ASIOEvent != NULL )
{
{
SetEvent ( m_ASIOEvent );
}
}
// wait for the thread to terminate
Sleep ( 500 );
@ -568,31 +568,31 @@ if ( iASIOBufferSizeMono == 256 )
// prepare input channels
for ( i = 0; i < NUM_IN_OUT_CHANNELS; i++ )
{
bufferInfos[i].isInput = ASIOTrue;
bufferInfos[i].channelNum = i;
bufferInfos[i].buffers[0] = 0;
bufferInfos[i].isInput = ASIOTrue;
bufferInfos[i].channelNum = i;
bufferInfos[i].buffers[0] = 0;
bufferInfos[i].buffers[1] = 0;
}
// prepare output channels
for ( i = 0; i < NUM_IN_OUT_CHANNELS; i++ )
{
bufferInfos[NUM_IN_OUT_CHANNELS + i].isInput = ASIOFalse;
bufferInfos[NUM_IN_OUT_CHANNELS + i].channelNum = i;
bufferInfos[NUM_IN_OUT_CHANNELS + i].buffers[0] = 0;
bufferInfos[NUM_IN_OUT_CHANNELS + i].isInput = ASIOFalse;
bufferInfos[NUM_IN_OUT_CHANNELS + i].channelNum = i;
bufferInfos[NUM_IN_OUT_CHANNELS + i].buffers[0] = 0;
bufferInfos[NUM_IN_OUT_CHANNELS + i].buffers[1] = 0;
}
// create and activate ASIO buffers (buffer size in samples)
ASIOCreateBuffers ( bufferInfos, 2 /* in/out */ * NUM_IN_OUT_CHANNELS /* stereo */,
iASIOBufferSizeMono, &asioCallbacks );
iASIOBufferSizeMono, &asioCallbacks );
// now get some buffer details
for ( i = 0; i < 2 * NUM_IN_OUT_CHANNELS; i++ )
{
channelInfos[i].channel = bufferInfos[i].channelNum;
channelInfos[i].isInput = bufferInfos[i].isInput;
ASIOGetChannelInfo ( &channelInfos[i] );
channelInfos[i].channel = bufferInfos[i].channelNum;
channelInfos[i].isInput = bufferInfos[i].isInput;
ASIOGetChannelInfo ( &channelInfos[i] );
// only 16/24/32 LSB is supported
if ( ( channelInfos[i].type != ASIOSTInt16LSB ) &&
@ -631,9 +631,9 @@ void CSound::InitRecordingAndPlayback()
// create memory for capture buffer
if ( psCaptureBuffer != NULL )
{
{
delete[] psCaptureBuffer;
}
}
psCaptureBuffer = new short[iCurNumSndBufIn * iBufferSizeStereo];
// initialize write block pointer out and underrun flag
@ -642,16 +642,16 @@ void CSound::InitRecordingAndPlayback()
// create memory for play buffer
if ( psPlayBuffer != NULL )
{
{
delete[] psPlayBuffer;
}
}
psPlayBuffer = new short[iCurNumSndBufOut * iBufferSizeStereo];
// clear new buffer
for ( int i = 0; i < iCurNumSndBufOut * iBufferSizeStereo; i++ )
{
{
psPlayBuffer[i] = 0;
}
}
// reset event
ResetEvent ( m_ASIOEvent );
@ -669,9 +669,9 @@ void CSound::Close()
// set event to ensure that thread leaves the waiting function
if ( m_ASIOEvent != NULL )
{
{
SetEvent ( m_ASIOEvent );
}
}
// wait for the thread to terminate
Sleep ( 500 );
@ -698,7 +698,7 @@ CSound::CSound ( const int iNewBufferSizeStereo )
m_ASIOEvent = NULL;
// get available ASIO driver names in system
for ( int i = 0; i < MAX_NUMBER_SOUND_CARDS; i++ )
for ( int i = 0; i < MAX_NUMBER_SOUND_CARDS; i++ )
{
cDriverNames[i] = new char[32];
}
@ -717,11 +717,11 @@ CSound::CSound ( const int iNewBufferSizeStereo )
// init device index with illegal value to show that driver is not initialized
lCurDev = -1;
// set up the asioCallback structure
asioCallbacks.bufferSwitch = &bufferSwitch;
asioCallbacks.sampleRateDidChange = &sampleRateChanged;
asioCallbacks.asioMessage = &asioMessages;
asioCallbacks.bufferSwitchTimeInfo = &bufferSwitchTimeInfo;
// set up the asioCallback structure
asioCallbacks.bufferSwitch = &bufferSwitch;
asioCallbacks.sampleRateDidChange = &sampleRateChanged;
asioCallbacks.asioMessage = &asioMessages;
asioCallbacks.bufferSwitchTimeInfo = &bufferSwitchTimeInfo;
// init buffer pointer to zero
psCaptureBuffer = NULL;
@ -747,19 +747,19 @@ CSound::~CSound()
// delete allocated memory
if ( psCaptureBuffer != NULL )
{
{
delete[] psCaptureBuffer;
}
}
if ( psPlayBuffer != NULL )
{
{
delete[] psPlayBuffer;
}
}
// close the handle for the event
if ( m_ASIOEvent != NULL )
{
{
CloseHandle ( m_ASIOEvent );
}
}
}
// ASIO callbacks -------------------------------------------------------------
@ -767,8 +767,8 @@ ASIOTime* CSound::bufferSwitchTimeInfo ( ASIOTime *timeInfo,
long index,
ASIOBool processNow )
{
bufferSwitch ( index, processNow );
return 0L;
bufferSwitch ( index, processNow );
return 0L;
}
void CSound::bufferSwitch ( long index, ASIOBool processNow )
@ -786,28 +786,28 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
bPlayBufferUnderrun = ( 2 * iASIOBufferSizeMono > iBufferPosPlay );
// 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
{
if ( bufferInfos[i].isInput == ASIOTrue )
{
{
// CAPTURE -----------------------------------------------------
// first check if space in buffer is available
if ( !bCaptureBufferOverrun )
{
// copy new captured block in thread transfer buffer (copy
// mono data interleaved in stereo buffer)
switch ( channelInfos[i].type )
{
case ASIOSTInt16LSB:
switch ( channelInfos[i].type )
{
case ASIOSTInt16LSB:
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
{
psCaptureBuffer[iBufferPosCapture +
2 * iCurSample + bufferInfos[i].channelNum] =
( (short*) bufferInfos[i].buffers[index] )[iCurSample];
}
break;
break;
case ASIOSTInt24LSB:
case ASIOSTInt24LSB:
// not yet tested, horrible things might happen with the following code ;-)
@ -821,9 +821,9 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
psCaptureBuffer[iBufferPosCapture +
2 * iCurSample + bufferInfos[i].channelNum] = static_cast<short> ( iCurSam );
}
break;
break;
case ASIOSTInt32LSB:
case ASIOSTInt32LSB:
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
{
// convert to 16 bit
@ -831,10 +831,10 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
2 * iCurSample + bufferInfos[i].channelNum] =
(((int*) bufferInfos[i].buffers[index])[iCurSample] >> 16);
}
break;
break;
}
}
}
}
else
{
// PLAYBACK ----------------------------------------------------
@ -842,42 +842,42 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
{
// copy data from sound card in output buffer (copy
// interleaved stereo data in mono sound card buffer)
switch ( channelInfos[i].type )
{
case ASIOSTInt16LSB:
switch ( channelInfos[i].type )
{
case ASIOSTInt16LSB:
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
{
{
( (short*) bufferInfos[i].buffers[index] )[iCurSample] =
psPlayBuffer[2 * iCurSample + bufferInfos[i].channelNum];
}
break;
break;
case ASIOSTInt24LSB:
case ASIOSTInt24LSB:
// not yet tested, horrible things might happen with the following code ;-)
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
{
{
// convert current sample in 24 bit format
int iCurSam = static_cast<int> ( psPlayBuffer[2 * iCurSample + bufferInfos[i].channelNum] );
iCurSam <<= 8;
memcpy ( ( (char*) bufferInfos[i].buffers[index] ) + iCurSample * 3, &iCurSam, 3 );
}
break;
break;
case ASIOSTInt32LSB:
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
{
case ASIOSTInt32LSB:
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
{
// convert to 32 bit
int iCurSam = static_cast<int> ( psPlayBuffer[2 * iCurSample + bufferInfos[i].channelNum] );
( (int*) bufferInfos[i].buffers[index] )[iCurSample] = ( iCurSam << 16 );
}
break;
}
}
}
}
}
}
// Manage thread interface buffers for input and output ----------------
@ -907,7 +907,7 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
// do it here, all data are in place -----------------------------------
if ( bASIOPostOutput )
{
ASIOOutputReady();
ASIOOutputReady();
}
// set event
@ -918,13 +918,13 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
long CSound::asioMessages ( long selector, long value, void* message, double* opt )
{
long ret = 0;
switch(selector)
{
case kAsioEngineVersion:
// return the supported ASIO version of the host application
ret = 2L;
break;
}
return ret;
long ret = 0;
switch(selector)
{
case kAsioEngineVersion:
// return the supported ASIO version of the host application
ret = 2L;
break;
}
return ret;
}

View file

@ -92,10 +92,10 @@ protected:
// audio hardware buffer info
struct sHWBufferInfo
{
long lMinSize;
long lMaxSize;
long lPreferredSize;
long lGranularity;
long lMinSize;
long lMaxSize;
long lPreferredSize;
long lGranularity;
} HWBufferInfo;
// callbacks