take care of problem if input/output buffer sizes cannot be set to a common value, some cleanup

This commit is contained in:
Volker Fischer 2010-03-13 11:04:29 +00:00
parent c4ae143efa
commit db636f9d96
2 changed files with 55 additions and 45 deletions

View File

@ -247,6 +247,10 @@ int CSound::Init ( const int iNewPrefMonoBufferSize )
{
UInt32 iActualMonoBufferSize;
// Error message string: in case buffer sizes on input and output cannot be set to the same value
const QString strErrBufSize = tr ( "The buffer sizes of the current "
"input and output audio device cannot be set to a common value. Please "
"choose other input/output audio devices in your system settings." );
// try to set input buffer size
iActualMonoBufferSize =
@ -256,14 +260,20 @@ int CSound::Init ( const int iNewPrefMonoBufferSize )
{
// try to set the input buffer size to the output so that we
// have a matching pair
// TODO check if setting was successful
SetBufferSize ( audioOutputDevice, false, iActualMonoBufferSize );
if ( SetBufferSize ( audioOutputDevice, false, iActualMonoBufferSize ) !=
iActualMonoBufferSize )
{
throw CGenErr ( strErrBufSize );
}
}
else
{
// try to set output buffer size
// TODO check if setting was successful
SetBufferSize ( audioOutputDevice, false, iNewPrefMonoBufferSize );
if ( SetBufferSize ( audioOutputDevice, false, iNewPrefMonoBufferSize ) !=
static_cast<UInt32> ( iNewPrefMonoBufferSize ) )
{
throw CGenErr ( strErrBufSize );
}
}
// store buffer size