]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Make portaudio preferences right.
authorJoão Mesquita <jmesquita@freeswitch.org>
Wed, 6 Jan 2010 22:54:57 +0000 (22:54 +0000)
committerJoão Mesquita <jmesquita@freeswitch.org>
Wed, 6 Jan 2010 22:54:57 +0000 (22:54 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16189 d0543943-73ff-0310-b7d9-9358b9ac24b2

fscomm/prefportaudio.cpp

index 16cc01ef23c2f69a45a51fad1bf22b7139562a69..822d94f77c8e9a7370d4ae58ef08ff1f7c9b5770 100644 (file)
@@ -17,7 +17,7 @@ PrefPortaudio::PrefPortaudio(Ui::PrefDialog *ui, QObject *parent) :
 void PrefPortaudio::ringdevTest()
 {
     QString result;
-    if (g_FSHost.sendCmd("pa", QString("play %1/.fscomm/sounds/test.wav").arg(QDir::homePath()).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    if (g_FSHost.sendCmd("pa", QString("play %1/.fscomm/sounds/test.wav 0").arg(QDir::homePath()).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
     {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error testing ringdev on mod_portaudio! %s\n",
                           result.toAscii().constData());
@@ -225,11 +225,11 @@ void PrefPortaudio::getPaDevlist()
             inputs = child.attribute("inputs","0");
             outputs = child.attribute("outputs","0");
             if (inputs.toInt() != 0)
-                _ui->PaIndevCombo->addItem(name,inputs.toInt());
+                _ui->PaIndevCombo->addItem(name,id.toInt());
             if (outputs.toInt() != 0)
             {
-                _ui->PaOutdevCombo->addItem(name,inputs.toInt());
-                _ui->PaRingdevCombo->addItem(name,inputs.toInt());
+                _ui->PaOutdevCombo->addItem(name,id.toInt());
+                _ui->PaRingdevCombo->addItem(name,id.toInt());
             }
         }
         child = child.nextSiblingElement();
@@ -257,11 +257,27 @@ void PrefPortaudio::getPaDevlist()
     {
         QString id = child.attribute("device","-1");
         if (child.tagName() == "ring")
-            _ui->PaRingdevCombo->setCurrentIndex(id.toInt());
+        {
+            for(int itemId=0; itemId<_ui->PaRingdevCombo->count(); itemId++)
+            {
+                if (itemId == _ui->PaRingdevCombo->itemData(itemId,Qt::UserRole).toInt())
+                {
+                    _ui->PaRingdevCombo->setCurrentIndex(itemId);
+                    break;
+                }
+            }
+        }
         else if (child.tagName() == "input")
             _ui->PaIndevCombo->setCurrentIndex(id.toInt());
         else if (child.tagName() == "output")
-            _ui->PaOutdevCombo->setCurrentIndex(id.toInt());
+            for(int itemId=0; itemId<_ui->PaOutdevCombo->count(); itemId++)
+            {
+                if (itemId == _ui->PaOutdevCombo->itemData(itemId,Qt::UserRole).toInt())
+                {
+                    _ui->PaOutdevCombo->setCurrentIndex(itemId);
+                    break;
+                }
+            }
 
         child = child.nextSiblingElement();
     }