From 04df6c5aa18c89a85643d2ee8cd870d1b739c11a Mon Sep 17 00:00:00 2001 From: John T Nogatch Date: Wed, 5 Jun 2013 21:28:31 +0000 Subject: [PATCH] If paInDevice was not a saved setting, use Pa_GetDefaultInputDevice(). If paOutDevice was not a saved setting, use Pa_GetDefaultOutputDevice(). This allows wsjtx to startup with default audio on a new install. However, it does not set the menu index numbers, so the Config SoundIn/Out menus do not look correct, until they have been set and saved once. It would be better if only the device names were saved in settings, because the index numbers can change, especially if USB soundcards are added or removed. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3339 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index d33bbfe5e..88135ace9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -446,9 +446,21 @@ void MainWindow::readSettings() m_pttPort=settings.value("PTTport",0).toInt(); m_saveDir=settings.value("SaveDir",m_appDir + "/save").toString(); m_nDevIn = settings.value("SoundInIndex", 0).toInt(); - m_paInDevice = settings.value("paInDevice",0).toInt(); + m_paInDevice = settings.value("paInDevice", paNoDevice).toInt(); + if (m_paInDevice == paNoDevice) { // no saved input device? + m_paInDevice = Pa_GetDefaultInputDevice(); + if (m_paInDevice == paNoDevice) { // no default input device? + m_paInDevice = 0; + } + } m_nDevOut = settings.value("SoundOutIndex", 0).toInt(); - m_paOutDevice = settings.value("paOutDevice",0).toInt(); + m_paOutDevice = settings.value("paOutDevice", paNoDevice).toInt(); + if (m_paOutDevice == paNoDevice) { // no saved output device? + m_paOutDevice = Pa_GetDefaultOutputDevice(); + if (m_paOutDevice == paNoDevice) { // no default output device? + m_paOutDevice = 0; + } + } ui->actionCuteSDR->setChecked(settings.value( "PaletteCuteSDR",true).toBool()); ui->actionLinrad->setChecked(settings.value(