Revision
16189
Author
jmesquita
Date
2010-01-06 16:54:57 -0600 (Wed, 06 Jan 2010)

Log Message

Make portaudio preferences right.

Modified Paths

Diff

Modified: freeswitch/trunk/fscomm/prefportaudio.cpp (16188 => 16189)


--- freeswitch/trunk/fscomm/prefportaudio.cpp	2010-01-06 18:09:30 UTC (rev 16188)
+++ freeswitch/trunk/fscomm/prefportaudio.cpp	2010-01-06 22:54:57 UTC (rev 16189)
@@ -17,7 +17,7 @@
 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 @@
             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 @@
     {
         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();
     }