Avoid enumerating audio devices until absolutely necessary

Enumerating  audio  devices with  QAudioDeviceInfo::availableDevices()
takes  a  long  time  on  Linux  with  pulseaudio.  This  change  only
enumerates  up  to  the  selected device  when  configuring  and  only
enumerates the whole list when the Settings->Audio tab is current.

This change also warns  with a message box when Tx  is started with no
audio output device configured.
This commit is contained in:
Bill Somerville
2020-08-12 02:33:15 +01:00
parent c067580071
commit e69226b29a
2 changed files with 46 additions and 42 deletions
+5 -1
View File
@@ -77,7 +77,11 @@ void SoundOutput::setFormat (QAudioDeviceInfo const& device, unsigned channels,
void SoundOutput::restart (QIODevice * source)
{
Q_ASSERT (m_stream);
if (!m_stream)
{
Q_EMIT error (tr ("No audio output device configured."));
return;
}
// we have to set this before every start on the stream because the
// Windows implementation seems to forget the buffer size after a