fixed a buffer overrun problem in the Mac audio interface if the sound card has a lot of input and output channels

This commit is contained in:
Volker Fischer 2015-07-05 12:00:54 +00:00
parent 75e38864d9
commit 12889fbea5
2 changed files with 8 additions and 7 deletions

View file

@ -180,14 +180,14 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* ar
lNumDevs++; // next device
// add detected devices (also check for maximum allowed sound cards!)
// add detected devices
//
// we add combined entries for input and output for each device so that we
// do not need two combo boxes in the GUI for input and output (therefore
// all possible combinations are required)
for ( UInt32 i = 0; ( i < deviceCount ) && ( i < MAX_NUMBER_SOUND_CARDS - 1 ); i++ )
// all possible combinations are required which can be a large number)
for ( UInt32 i = 0; i < deviceCount; i++ )
{
for ( UInt32 j = 0; ( j < deviceCount ) && ( j < MAX_NUMBER_SOUND_CARDS - 1 ); j++ )
for ( UInt32 j = 0; j < deviceCount; j++ )
{
// get device infos for both current devices
QString strDeviceName_i;
@ -207,8 +207,9 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* ar
bIsInput_j,
bIsOutput_j );
// check if i device is input and j device is output
if ( bIsInput_i && bIsOutput_j )
// check if i device is input and j device is output and that we are
// in range
if ( bIsInput_i && bIsOutput_j && ( lNumDevs < MAX_NUMBER_SOUND_CARDS ) )
{
strDriverNames[lNumDevs] = "in: " +
strDeviceName_i + "/out: " +

View file

@ -149,7 +149,7 @@ LED bar: lbr
// maximum number of recognized sound cards installed in the system,
// definition for "no device"
#define MAX_NUMBER_SOUND_CARDS 30
#define MAX_NUMBER_SOUND_CARDS 129 // e.g. 16 inputs, 8 outputs + default entry (MacOS)
#define INVALID_SNC_CARD_DEVICE -1
// define the maximum number of audio channel for input/output we can store