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

View file

@ -149,7 +149,7 @@ LED bar: lbr
// maximum number of recognized sound cards installed in the system, // maximum number of recognized sound cards installed in the system,
// definition for "no device" // 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 INVALID_SNC_CARD_DEVICE -1
// define the maximum number of audio channel for input/output we can store // define the maximum number of audio channel for input/output we can store