Check channel number when opening audio device

The configured channel number for an audio device is now checked against
the value set in CARD_CHANNELS before trying to open the audio device.
This commit is contained in:
Tobias Blomberg 2020-07-27 18:57:26 +02:00
parent be4d911302
commit b38dff32ec
3 changed files with 13 additions and 2 deletions

View File

@ -227,6 +227,7 @@ class AudioDevice : public sigc::trackable
AudioDevice::channels = channels;
}
static int getChannels(void) { return channels; }
/**
* @brief Check if the audio device has full duplex capability

View File

@ -318,6 +318,16 @@ bool AudioIO::isFullDuplexCapable(void)
bool AudioIO::open(Mode mode)
{
if (m_channel >= AudioDevice::getChannels())
{
std::cerr << "*** ERROR: Audio channel out of range when opening audio "
"device \"" << audio_dev->devName() << ". "
<< "The card have " << AudioDevice::getChannels()
<< " channel(s) configured, but (zero based) channel number "
<< m_channel << " was requested." << std::endl;
return false;
}
if (audio_dev == 0)
{
return false;

View File

@ -8,7 +8,7 @@ QTEL=1.2.4
LIBECHOLIB=1.3.3
# Version for the Async library
LIBASYNC=1.6.0.99.9
LIBASYNC=1.6.0.99.10
# SvxLink versions
SVXLINK=1.7.99.23