mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* auto-muting pcm when not in use
@ 2002-08-24 22:13 Frank v Waveren
  2002-09-01  1:51 ` [PATCH] " Frank v Waveren
  0 siblings, 1 reply; 2+ messages in thread
From: Frank v Waveren @ 2002-08-24 22:13 UTC (permalink / raw)
  To: linux-kernel

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
vaguely remember some buzz (well, at least a light hum) a while back
about automatically setting the mixer to zero for synth/pcm when not
in use.. Was there ever a patch created for this, and if not, would
anyone be interested in one?

-- 
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Re: auto-muting pcm when not in use
  2002-08-24 22:13 auto-muting pcm when not in use Frank v Waveren
@ 2002-09-01  1:51 ` Frank v Waveren
  0 siblings, 0 replies; 2+ messages in thread
From: Frank v Waveren @ 2002-09-01  1:51 UTC (permalink / raw)
  To: linux-kernel

[-- 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 */
+    
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-01  1:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-24 22:13 auto-muting pcm when not in use Frank v Waveren
2002-09-01  1:51 ` [PATCH] " Frank v Waveren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome