summaryrefslogtreecommitdiffstats
path: root/kmix/mixer_alsa9.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmix/mixer_alsa9.cpp')
-rw-r--r--kmix/mixer_alsa9.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/kmix/mixer_alsa9.cpp b/kmix/mixer_alsa9.cpp
index d778510b..751d5f9e 100644
--- a/kmix/mixer_alsa9.cpp
+++ b/kmix/mixer_alsa9.cpp
@@ -114,12 +114,8 @@ Mixer_ALSA::open()
snd_mixer_selem_id_alloca( &sid );
// Card information
- if( m_devnum == -1 )
- m_devnum = 0;
- if ( (unsigned)m_devnum > 31 )
- devName = "default";
- else
- devName = QString( "hw:%1" ).arg( m_devnum );
+ if ((unsigned)m_devnum > 31) m_devnum = -1;
+ devName = m_devnum == -1 ? "default" : QString("hw:%1").arg(m_devnum);
QString probeMessage;
@@ -146,6 +142,8 @@ Mixer_ALSA::open()
//mixer_device_name = snd_ctl_card_info_get_mixername( hw_info );
// Copy the name of kmix mixer from card name (mixername is rumoured to be not that good)
m_mixerName = mixer_card_name;
+ if (m_devnum == -1) m_devnum = snd_card_get_index(snd_ctl_card_info_get_id(hw_info));
+ if (m_devnum < 0) m_devnum = -1;
snd_ctl_close( ctl_handle );
@@ -826,3 +824,23 @@ ALSA_getDriverName()
}
+ALSA_DevIterator::ALSA_DevIterator()
+{
+ N = -1;
+ NMax = 31;
+}
+
+void ALSA_DevIterator::next()
+{
+#if 0
+ int rc = snd_card_next(&N);
+ if (rc || (N == -1)) N = NMax + 1;
+#else
+ if ((snd_card_next(&N) != 0) || (N == -1)) N = NMax + 1;
+#endif
+}
+
+DevIterator* ALSA_getDevIterator()
+{
+ return new ALSA_DevIterator();
+}