From 81a8ff3c3605ddcd22f2e6400e5a7a3e2f330f43 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 28 Oct 2009 09:10:56 +0000 Subject: alsa plugin: show more devices git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1336 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Output/alsa/settingsdialog.cpp | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/plugins/Output/alsa/settingsdialog.cpp') diff --git a/src/plugins/Output/alsa/settingsdialog.cpp b/src/plugins/Output/alsa/settingsdialog.cpp index 5790cf6ed..e47a27cd8 100644 --- a/src/plugins/Output/alsa/settingsdialog.cpp +++ b/src/plugins/Output/alsa/settingsdialog.cpp @@ -35,6 +35,7 @@ SettingsDialog::SettingsDialog ( QWidget *parent ) setAttribute ( Qt::WA_DeleteOnClose ); ui.deviceComboBox->setEditable ( TRUE ); getCards(); + getSoftDevices(); connect (ui.deviceComboBox, SIGNAL(activated(int)),SLOT(setText(int))); connect(ui.mixerCardComboBox, SIGNAL(activated(int)), SLOT(showMixerDevices(int))); QSettings settings(Qmmp::configFile(), QSettings::IniFormat); @@ -88,6 +89,38 @@ void SettingsDialog::getCards() } } +void SettingsDialog::getSoftDevices() +{ + void **hints = 0; + int i = 0; + + if(snd_device_name_hint(-1, "pcm", &hints) < 0) + return; + + while(hints[i]) + { + char *type = snd_device_name_get_hint (hints[i], "IOID"); + if (!type || !strcmp (type, "Output")) + { + char *device_name = snd_device_name_get_hint (hints[i], "NAME"); + char *device_desc = snd_device_name_get_hint (hints[i], "DESC"); + + m_devices << QString(device_name); + QString str = QString("%1 (%2)").arg(device_desc).arg(device_name); + qDebug("%s", qPrintable(str)); + ui.deviceComboBox->addItem(str); + free (device_name); + free (device_desc); + } + if(type) + free (type); + ++i; + } + + if (hints) + snd_device_name_free_hint (hints); +} + void SettingsDialog::getCardDevices(int card) { int pcm_device = -1, err; -- cgit v1.2.3-13-gbd6f