take care of problem if input/output buffer sizes cannot be set to a common value, some cleanup
This commit is contained in:
parent
c4ae143efa
commit
db636f9d96
2 changed files with 55 additions and 45 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue