From: Frank v Waveren <fvw@var.cx>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Re: auto-muting pcm when not in use
Date: Sun, 1 Sep 2002 03:51:35 +0200 [thread overview]
Message-ID: <1030845088TRI.fvw@yendor.var.cx> (raw)
In-Reply-To: <1030226923OGI.fvw@yendor.var.cx>
[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]
On Sun, Aug 25, 2002 at 12:13:36AM +0200, Frank v Waveren wrote:
> I have an el-cheapo sound card in my desktop machine, which works
> fine for the odd mail notification sound. However, it tends to
> produce quite some white noise and a highpitched tone when not in
> use. [I recall a patch doing this] and if not, would anyone be
> interested in one?
Well, I've made the patch, it's rather kludgy but to do this
properly would require modify quite a lot of the code and possibly
API's (I'd hoped to be easily able to create an extra mixer channel
that was visible to userspace instead of pcm, and whose level would
get written to the pcm mixer channel when the audio device was
opened), but it does work rather nicely for me.
If there's any interest in having it in the main tree (as I said, it's
a kludge, but one that's needed/useful on a lot of machines) I'll put
some kernel option or module paramater if's around it, let me know.
As always, suggestions/fixes/flames welcome.
--
Frank v Waveren Fingerprint: 0EDB 8787
fvw@[var.cx|stack.nl|dse.nl|chello.nl] ICQ#10074100 09B9 6EF5 6425 B855
Public key: hkp://wwwkeys.pgp.net/fvw@var.cx 7179 3036 E136 B85D
[-- Attachment #2: linux-2.4.19-sb-automute-pcm.diff --]
[-- Type: text/plain, Size: 1499 bytes --]
diff -urNbB linux/drivers/sound/sb.h linux-fvw/drivers/sound/sb.h
--- linux/drivers/sound/sb.h Sun Sep 1 02:53:53 2002
+++ linux-fvw/drivers/sound/sb.h Sun Sep 1 02:38:24 2002
@@ -114,6 +114,8 @@
int supported_rec_devices, supported_out_devices;
int my_mixerdev;
int sbmixnum;
+ int saved_level_pcm; // for auto-muted pcm
+
/* Audio fields */
unsigned long trg_buf;
diff -urNbB /home/fvw/linux/drivers/sound/sb_audio.c /tmp/linux-fvw/drivers/sound/sb_audio.c
--- linux/drivers/sound/sb_audio.c Sun Sep 1 02:48:08 2002
+++ linux-fvw/drivers/sound/sb_audio.c Sun Sep 1 02:43:23 2002
@@ -60,6 +60,10 @@
return -EBUSY;
}
}
+
+ if (!sb_getmixer(devc, SOUND_MIXER_PCM))
+ sb_setmixer(devc, SOUND_MIXER_PCM, devc->saved_level_pcm);
+
devc->opened = mode;
spin_unlock_irqrestore(&devc->lock, flags);
@@ -122,6 +126,10 @@
sb_setmixer(devc,ALS007_OUTPUT_CTRL2,
sb_getmixer(devc,ALS007_OUTPUT_CTRL2) | 0x06);
}
+
+ devc->saved_level_pcm=sb_getmixer(devc, SOUND_MIXER_PCM);
+ sb_setmixer(devc, SOUND_MIXER_PCM, 0);
+
devc->opened = 0;
}
@@ -1090,4 +1098,10 @@
}
audio_devs[devc->dev]->mixer_dev = devc->my_mixerdev;
audio_devs[devc->dev]->min_fragment = 5;
+
+ sb_setmixer(devc, SOUND_MIXER_PCM, 0);
+ devc->saved_level_pcm=0x0000; /* This should be the *_default_levels value
+ from sb_mixer.c which we can't get at
+ from here */
+
}
prev parent reply other threads:[~2002-09-01 1:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-24 22:13 Frank v Waveren
2002-09-01 1:51 ` Frank v Waveren [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1030845088TRI.fvw@yendor.var.cx \
--to=fvw@var.cx \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®