Make sure setting a recording device in kmix also succeeds if the mixer

device only supports one recording source (true for most supported sound
devices).

Submitted by: Tim McCormick <tim@pcbsd.org>
This commit is contained in:
Michael Nottebrock 2007-09-18 08:35:17 +00:00
parent 2f027f53fc
commit a1cf1276b1
4 changed files with 44 additions and 2 deletions

View file

@ -8,7 +8,7 @@
PORTNAME= kdemultimedia
PORTVERSION= ${KDE_VERSION}
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= multimedia kde
MASTER_SITES= ${MASTER_SITE_KDE}
MASTER_SITE_SUBDIR= stable/${PORTVERSION:S/.0//}/src

View file

@ -0,0 +1,21 @@
--- kmix/mixer_oss.cpp Fri Sep 14 18:02:58 2007
+++ kmix/mixer_oss.cpp Fri Sep 14 19:45:27 2007
@@ -243,6 +243,18 @@
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &i_recsrc) == -1)
errormsg(Mixer::ERR_READ);
+ // If the record source is supposed to be on, but wasn't set, explicitly
+ // set the record source. Not all cards support multiple record sources.
+ // As a result, we also need to do the read & write again.
+ if (((i_recsrc & ( 1<<devnum)) == 0) && on)
+ {
+ oldrecsrc = i_recsrc = 1 << devnum;
+ if (ioctl(m_fd, SOUND_MIXER_WRITE_RECSRC, &i_recsrc) == -1)
+ errormsg (Mixer::ERR_WRITE);
+ if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &i_recsrc) == -1)
+ errormsg(Mixer::ERR_READ);
+ }
+
// PORTING: Hint: Do not forget to set i_recsrc to the new valid
// record source mask.

View file

@ -8,7 +8,7 @@
PORTNAME= kdemultimedia
PORTVERSION= ${KDE_VERSION}
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= multimedia kde
MASTER_SITES= ${MASTER_SITE_KDE}
MASTER_SITE_SUBDIR= stable/${PORTVERSION:S/.0//}/src

View file

@ -0,0 +1,21 @@
--- kmix/mixer_oss.cpp Fri Sep 14 18:02:58 2007
+++ kmix/mixer_oss.cpp Fri Sep 14 19:45:27 2007
@@ -243,6 +243,18 @@
if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &i_recsrc) == -1)
errormsg(Mixer::ERR_READ);
+ // If the record source is supposed to be on, but wasn't set, explicitly
+ // set the record source. Not all cards support multiple record sources.
+ // As a result, we also need to do the read & write again.
+ if (((i_recsrc & ( 1<<devnum)) == 0) && on)
+ {
+ oldrecsrc = i_recsrc = 1 << devnum;
+ if (ioctl(m_fd, SOUND_MIXER_WRITE_RECSRC, &i_recsrc) == -1)
+ errormsg (Mixer::ERR_WRITE);
+ if (ioctl(m_fd, SOUND_MIXER_READ_RECSRC, &i_recsrc) == -1)
+ errormsg(Mixer::ERR_READ);
+ }
+
// PORTING: Hint: Do not forget to set i_recsrc to the new valid
// record source mask.