Skip to contentSkip to conversation

virtual master control for HD-audio

RFC In review Takashi Iwai 5 participants 28 messages Dec 20, 2007 – May 6, 2008 Sound

lore
Share & tools
lore
#0 lore raw

Hi,

another thing I'd like to push into the next kernel is the virtual master volume control. As I posted in earlier posts, it adds virtual controls that have several slave controls with the same types, e.g. Front, Surround, Center, LFE, etc. Then these are adjusted simultaneously via the master control.

It'd be appreciated if some one can test the patches with HD-audio h/w that has no master control yet (e.g. some STAC codecs).

Note that this won't add the master volumes if there are no real volume controls. Some codecs have really no volume control, and this won't help for such devices.

Two (and one for driver) patches will follow after this.

Takashi

#1 lore raw

RFC PATCH 1/2 Add virtual master control

This patch adds the virtual master control to sound core.

Takashi

core/Kconfig +3 -0
diff -r 1207d46e60b3 core/Kconfig
@@ -15,6 +15,9 @@ config SND_RAWMIDI
 config SND_RAWMIDI
 	tristate
 	depends on SND
+
+config SND_VMASTER
+	bool
 
 config SND_SEQUENCER
 	tristate "Sequencer support"
core/Makefile +1 -0
diff -r 1207d46e60b3 core/Makefile
@@ -6,6 +6,7 @@ snd-y     := sound.o init.o memory.o inf
 snd-y     := sound.o init.o memory.o info.o control.o misc.o device.o
 snd-$(CONFIG_ISA_DMA_API) += isadma.o
 snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o info_oss.o
+snd-$(CONFIG_SND_VMASTER) += vmaster.o
 
 snd-pcm-objs := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \
 		pcm_memory.o
core/vmaster.c new file +379 -0

379 lines not on this page · raw message

include/control.h +8 -0
diff -r 1207d46e60b3 include/control.h
@@ -169,4 +169,12 @@ int snd_ctl_boolean_stereo_info(struct s
 int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol,
 				struct snd_ctl_elem_info *uinfo);
 
+/*
+ * virtual master control
+ */
+struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
+						 const unsigned int *tlv);
+int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave);
+		      
+
 #endif	/* __SOUND_CONTROL_H */
#2 lore raw

Re: [RFC] [Patch 1/2] Add virtual master control

Quoted 9 lines · Takashi Iwai

This patch adds the virtual master control to sound core.

Takashi

diff -r 1207d46e60b3 core/Kconfig

core/Kconfig config SND_RAWMIDI · line 23

Quoted 9 lines
core/Kconfig +3 -0
@@ -15,6 +15,9 @@ config SND_RAWMIDI
 config SND_RAWMIDI
 	tristate
 	depends on SND
+
+config SND_VMASTER
+	bool
 
 config SND_SEQUENCER
 	tristate "Sequencer support"

When you committed this to hg, you put vmaster.c into hda instead of core - could you explain why? I'd like to use it with ice1724.

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
#3 lore raw

Re: [RFC] [Patch 1/2] Add virtual master control

At Wed, 30 Jan 2008 10:19:10 -0500,

Quoted 18 lines · Daniel Jacobowitz
Quoted 16 lines · Takashi Iwai

This patch adds the virtual master control to sound core.

Takashi

diff -r 1207d46e60b3 core/Kconfig

core/Kconfig +3 -0
@@ -15,6 +15,9 @@ config SND_RAWMIDI
 config SND_RAWMIDI
 	tristate
 	depends on SND
+
+config SND_VMASTER
+	bool
 
Quoted 5 lines

core/Kconfig config SND_RAWMIDI · line 23

Quoted 2 lines
core/Kconfig +0 -0
 config SND_SEQUENCER
 	tristate "Sequencer support"

When you committed this to hg, you put vmaster.c into hda instead of core - could you explain why? I'd like to use it with ice1724.

Because HD-audio is the only user, so far. I don't want to expand the core stuff (and kconfig) unless really needed.

Takashi

#4 lore raw

Re: [RFC] [Patch 1/2] Add virtual master control

Quoted 2 lines · Takashi Iwai

Because HD-audio is the only user, so far. I don't want to expand the core stuff (and kconfig) unless really needed.

I said I'd want this for ice1724 / vt1616, and I finally got time to do it. What do you think of this patch? I'm happily using it.

From: Daniel Jacobowitz <[email protected]>

Move VMASTER from HDA out to core, and enable it for VT1616.

include/sound/control.h +7 -0
index e79baa6..3dc1291 100644
@@ -169,4 +169,11 @@ int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol,
 int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol,
 				struct snd_ctl_elem_info *uinfo);
 
+/*
+ * virtual master control
+ */
+struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
+						 const unsigned int *tlv);
+int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave);
+		      
 #endif	/* __SOUND_CONTROL_H */
sound/core/Kconfig +3 -0
index 829ca38..b0528c4 100644
@@ -16,6 +16,9 @@ config SND_RAWMIDI
 	tristate
 	depends on SND
 
+config SND_VMASTER
+       bool
+
 config SND_SEQUENCER
 	tristate "Sequencer support"
 	depends on SND
sound/core/Makefile +1 -0
index 267039a..da8e685 100644
@@ -6,6 +6,7 @@
 snd-y     := sound.o init.o memory.o info.o control.o misc.o device.o
 snd-$(CONFIG_ISA_DMA_API) += isadma.o
 snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o info_oss.o
+snd-$(CONFIG_SND_VMASTER) += vmaster.o
 
 snd-pcm-objs := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \
 		pcm_memory.o
sound/core/vmaster.c new file +368 -0

368 lines not on this page · raw message

sound/drivers/Kconfig +1 -0
index 75d4fe0..154e0ae 100644
@@ -27,6 +27,7 @@ config SND_AC97_CODEC
 	tristate
 	select SND_PCM
 	select AC97_BUS
+	select SND_VMASTER
 
 config SND_DUMMY
 	tristate "Dummy (/dev/null) soundcard"
sound/pci/Kconfig +1 -0
index 812085d..48296d9 100644
@@ -517,6 +517,7 @@ config SND_HDA_INTEL
 	tristate "Intel HD Audio"
 	depends on SND
 	select SND_PCM
+	select SND_VMASTER
 	help
 	  Say Y here to include support for Intel "High Definition
 	  Audio" (Azalia) motherboard devices.
sound/pci/ac97/ac97_patch.c +76 -0

90 lines not on this page · raw message

sound/pci/hda/Makefile +1 -1
index 9e0d8a1..ab0c726 100644
@@ -2,7 +2,7 @@ snd-hda-intel-y := hda_intel.o
 # since snd-hda-intel is the only driver using hda-codec,
 # merge it into a single module although it was originally
 # designed to be individual modules
-snd-hda-intel-y += hda_codec.o vmaster.o
+snd-hda-intel-y += hda_codec.o
 snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o
 snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
 snd-hda-intel-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o
sound/pci/hda/hda_local.h +0 -7
index ad0014a..5a859d8 100644
@@ -407,11 +407,4 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec,
 				 hda_nid_t nid);
 #endif /* CONFIG_SND_HDA_POWER_SAVE */
 
-/*
- * virtual master control
- */
-struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
-						 const unsigned int *tlv);
-int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave);
-		      
 #endif /* __SOUND_HDA_LOCAL_H */
sound/pci/hda/vmaster.c deleted +0 -364

364 lines not on this page · raw message

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
#5 lore raw

Re: [RFC] [Patch 1/2] Add virtual master control

At Fri, 21 Mar 2008 15:08:55 -0400,

Quoted 7 lines · Daniel Jacobowitz
Quoted 2 lines · Takashi Iwai

Because HD-audio is the only user, so far. I don't want to expand the core stuff (and kconfig) unless really needed.

I said I'd want this for ice1724 / vt1616, and I finally got time to do it. What do you think of this patch? I'm happily using it.

Well, don't forget to check HG version before you submit a patch :)

Takashi

#6 lore raw

Re: [RFC] [Patch 1/2] Add virtual master control

Quoted 11 lines · Takashi Iwai

At Fri, 21 Mar 2008 15:08:55 -0400,

Quoted 7 lines · Daniel Jacobowitz
Quoted 2 lines · Takashi Iwai

Because HD-audio is the only user, so far. I don't want to expand the core stuff (and kconfig) unless really needed.

I said I'd want this for ice1724 / vt1616, and I finally got time to do it. What do you think of this patch? I'm happily using it.

Well, don't forget to check HG version before you submit a patch :)

Whoops! This version works with the hg tree. The new snd_ac97_add_vmaster is mostly similar to the hda version so it might make sense to put that in vmaster.c instead.

From: Daniel Jacobowitz <[email protected]>

Enable VMASTER for VT1616 / VT1617A.

drivers/Kconfig +1 -0
diff -r 0d5f43585ca7 drivers/Kconfig
@@ -44,6 +44,7 @@ config SND_AC97_CODEC
 	tristate
 	select SND_PCM
 	select AC97_BUS
+	select SND_VMASTER
 
 config SND_DUMMY
 	tristate "Dummy (/dev/null) soundcard"
pci/ac97/ac97_patch.c +76 -0

90 lines not on this page · raw message

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
#7 lore raw

Re: [RFC] [Patch 1/2] Add virtual master control

At Sat, 22 Mar 2008 11:30:46 -0400,

Quoted 18 lines · Daniel Jacobowitz
Quoted 11 lines · Takashi Iwai

At Fri, 21 Mar 2008 15:08:55 -0400,

Quoted 7 lines · Daniel Jacobowitz
Quoted 2 lines · Takashi Iwai

Because HD-audio is the only user, so far. I don't want to expand the core stuff (and kconfig) unless really needed.

I said I'd want this for ice1724 / vt1616, and I finally got time to do it. What do you think of this patch? I'm happily using it.

Well, don't forget to check HG version before you submit a patch :)

Whoops! This version works with the hg tree. The new snd_ac97_add_vmaster is mostly similar to the hda version so it might make sense to put that in vmaster.c instead.

Quoted 5 lines

From: Daniel Jacobowitz <[email protected]>

Enable VMASTER for VT1616 / VT1617A.

Thanks. This kind of change is basically good to apply, I think, but a couple of things related are in my mind:

- other AC97 codecs need similar hacks, so it could be done cleaner (in a more generic way) than in each patch_*()?
- headphone and line-out have the similar issue - it's handled as a bind-control right now, though
- what about if the device actually uses only two channels although codec supports more than two? Then the additional master control makes little sense. But, we have no way to know it from the codec itself. Another quirk table? That's to be avoided...

Since this is a non-urgent fix and I'll be on vacation for three weeks from tomorrow, I'd like to keep this pending unless other developers want to put this in. Is it OK?

Takashi

Quoted 111 lines

diff -r 0d5f43585ca7 drivers/Kconfig

drivers/Kconfig +1 -0
@@ -44,6 +44,7 @@ config SND_AC97_CODEC
 	tristate
 	select SND_PCM
 	select AC97_BUS
+	select SND_VMASTER
 
 config SND_DUMMY
 	tristate "Dummy (/dev/null) soundcard"

diff -r 0d5f43585ca7 pci/ac97/ac97_patch.c

pci/ac97/ac97_patch.c +76 -0
@@ -3332,8 +3332,66 @@ AC97_SINGLE("Downmix Surround to Front",
 AC97_SINGLE("Downmix Surround to Front", 0x5a, 11, 1, 0),
 };
 
+static const char *slave_vols_vt1616[] = {
+	"Front Playback Volume",
+	"Surround Playback Volume",
+	"Center Playback Volume",
+	"LFE Playback Volume",
+	NULL
+};
+
+static const char *slave_sws_vt1616[] = {
+	"Front Playback Switch",
+	"Surround Playback Switch",
+	"Center Playback Switch",
+	"LFE Playback Switch",
+	NULL
+};
+
+/* find a mixer control element with the given name */
+static struct snd_kcontrol *snd_ac97_find_mixer_ctl(struct snd_ac97 *ac97,
+						    const char *name)
+{
+	struct snd_ctl_elem_id id;
+	memset(&id, 0, sizeof(id));
+	id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+	strcpy(id.name, name);
+	return snd_ctl_find_id(ac97->bus->card, &id);
+}
+
+/* create a virtual master control and add slaves */
+int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name,
+			 const unsigned int *tlv, const char **slaves)
+{
+	struct snd_kcontrol *kctl;
+	const char **s;
+	int err;
+
+	kctl = snd_ctl_make_virtual_master(name, tlv);
+	if (!kctl)
+		return -ENOMEM;
+	err = snd_ctl_add(ac97->bus->card, kctl);
+	if (err < 0)
+		return err;
+	
+	for (s = slaves; *s; s++) {
+		struct snd_kcontrol *sctl;
+
+		sctl = snd_ac97_find_mixer_ctl(ac97, *s);
+		if (!sctl) {
+			snd_printdd("Cannot find slave %s, skipped\n", *s);
+			continue;
+		}
+		err = snd_ctl_add_slave(kctl, sctl);
+		if (err < 0)
+			return err;
+	}
+	return 0;
+}
+
 static int patch_vt1616_specific(struct snd_ac97 * ac97)
 {
+	struct snd_kcontrol *kctl;
 	int err;
 
 	if (snd_ac97_try_bit(ac97, 0x5a, 9))
@@ -3341,6 +3399,24 @@ static int patch_vt1616_specific(struct 
 			return err;
 	if ((err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[1], ARRAY_SIZE(snd_ac97_controls_vt1616) - 1)) < 0)
 		return err;
+
+	/* There is already a misnamed master switch.  Rename it.  */
+	kctl = snd_ac97_find_mixer_ctl(ac97, "Master Playback Volume");
+	if (!kctl)
+		return -EINVAL;
+
+	snd_ac97_rename_vol_ctl(ac97, "Master Playback", "Front Playback");
+
+	err = snd_ac97_add_vmaster(ac97, "Master Playback Volume",
+				   kctl->tlv.p, slave_vols_vt1616);
+	if (err < 0)
+		return err;
+
+	err = snd_ac97_add_vmaster(ac97, "Master Playback Switch",
+				   NULL, slave_sws_vt1616);
+	if (err < 0)
+		return err;
+
 	return 0;
 }
 
Signature · 3 lines
-- 
Daniel Jacobowitz
CodeSourcery
#8 lore raw

Re: [RFC] [Patch 1/2] Add virtual master control

Quoted 12 lines · Takashi Iwai

Thanks. This kind of change is basically good to apply, I think, but a couple of things related are in my mind:

- other AC97 codecs need similar hacks, so it could be done cleaner (in a more generic way) than in each patch_*()?
- headphone and line-out have the similar issue - it's handled as a bind-control right now, though
- what about if the device actually uses only two channels although codec supports more than two? Then the additional master control makes little sense. But, we have no way to know it from the codec itself. Another quirk table? That's to be avoided...

Quoted 3 lines

Since this is a non-urgent fix and I'll be on vacation for three weeks from tomorrow, I'd like to keep this pending unless other developers want to put this in. Is it OK?

Fine with me. I don't think I can make broader changes than this kind, because I don't know much about AC97; maybe there can be a flag on recognized codecs saying which channels the front volume really controls?

I noticed that the PCM mixer also only affected my front speakers.

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
#9 lore raw

Re: [RFC] [Patch 1/2] Add virtual master control

Quoted 17 lines · Daniel Jacobowitz
Quoted 12 lines · Takashi Iwai

Thanks. This kind of change is basically good to apply, I think, but a couple of things related are in my mind:

- other AC97 codecs need similar hacks, so it could be done cleaner (in a more generic way) than in each patch_*()?
- headphone and line-out have the similar issue - it's handled as a bind-control right now, though
- what about if the device actually uses only two channels although codec supports more than two? Then the additional master control makes little sense. But, we have no way to know it from the codec itself. Another quirk table? That's to be avoided...

Quoted 3 lines

Since this is a non-urgent fix and I'll be on vacation for three weeks from tomorrow, I'd like to keep this pending unless other developers want to put this in. Is it OK?

Quoted 6 lines

Fine with me. I don't think I can make broader changes than this kind, because I don't know much about AC97; maybe there can be a flag on recognized codecs saying which channels the front volume really controls?

I noticed that the PCM mixer also only affected my front speakers.

Hi Takashi,

Have you had another chance to look at this?

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
#10 lore raw

Re: [RFC] [Patch 1/2] Add virtual master control

At Fri, 2 May 2008 14:01:54 -0400,

Quoted 24 lines · Daniel Jacobowitz
Quoted 22 lines · Daniel Jacobowitz
Quoted 12 lines · Takashi Iwai

Thanks. This kind of change is basically good to apply, I think, but a couple of things related are in my mind:

- other AC97 codecs need similar hacks, so it could be done cleaner (in a more generic way) than in each patch_*()?
- headphone and line-out have the similar issue - it's handled as a bind-control right now, though
- what about if the device actually uses only two channels although codec supports more than two? Then the additional master control makes little sense. But, we have no way to know it from the codec itself. Another quirk table? That's to be avoided...

Quoted 3 lines

Since this is a non-urgent fix and I'll be on vacation for three weeks from tomorrow, I'd like to keep this pending unless other developers want to put this in. Is it OK?

Fine with me. I don't think I can make broader changes than this kind, because I don't know much about AC97; maybe there can be a flag on recognized codecs saying which channels the front volume really controls?

Quoted 5 lines
Quoted 1 line

I noticed that the PCM mixer also only affected my front speakers.

Hi Takashi,

Have you had another chance to look at this?

Not quite, unfortunately. But, in the end, I think it's relatively harmless to take your patch as is, since it's pretty local to VT161x codecs.

I'll put it on my local tree and make testing, then merge to the public tree soon later.

thanks,

Takashi

#11 lore raw

Re: [RFC] [Patch 1/2] Add virtual master control

Quoted 6 lines · Takashi Iwai

Not quite, unfortunately. But, in the end, I think it's relatively harmless to take your patch as is, since it's pretty local to VT161x codecs.

I'll put it on my local tree and make testing, then merge to the public tree soon later.

Great, thanks a lot! I agree it could be improved - but I'll leave that for another future user :-)

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
#12 lore raw

RFC PATCH 2/2 Add virtual master to HD-audio

In reply to Takashi Iwai

This patch adds the virtual master controls to some codecs. The virtual master controls are added only when no real "Master" control is present.

Takashi

pci/Kconfig +3 -0
diff -r 861c951ac951 pci/Kconfig
@@ -512,6 +512,7 @@ config SND_HDA_CODEC_REALTEK
 config SND_HDA_CODEC_REALTEK
 	bool "Build Realtek HD-audio codec support"
 	depends on SND_HDA_INTEL
+	select SND_VMASTER
 	default y
 	help
 	  Say Y here to include Realtek HD-audio codec support in
@@ -520,6 +521,7 @@ config SND_HDA_CODEC_ANALOG
 config SND_HDA_CODEC_ANALOG
 	bool "Build Analog Device HD-audio codec support"
 	depends on SND_HDA_INTEL
+	select SND_VMASTER
 	default y
 	help
 	  Say Y here to include Analog Device HD-audio codec support in
@@ -528,6 +530,7 @@ config SND_HDA_CODEC_SIGMATEL
 config SND_HDA_CODEC_SIGMATEL
 	bool "Build IDT/Sigmatel HD-audio codec support"
 	depends on SND_HDA_INTEL
+	select SND_VMASTER
 	default y
 	help
 	  Say Y here to include IDT (Sigmatel) HD-audio codec support in
pci/hda/hda_codec.c +62 -0

68 lines not on this page · raw message

pci/hda/hda_local.h +7 -0
diff -r 861c951ac951 pci/hda/hda_local.h
@@ -90,6 +90,13 @@ void snd_hda_codec_resume_amp(struct hda
 void snd_hda_codec_resume_amp(struct hda_codec *codec);
 #endif
 
+void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir,
+			     unsigned int *tlv);
+struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
+					    const char *name);
+int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
+			unsigned int *tlv, const char **slaves);
+
 /* amp value bits */
 #define HDA_AMP_MUTE	0x80
 #define HDA_AMP_UNMUTE	0x00
pci/hda/patch_analog.c +69 -0

129 lines not on this page · raw message

pci/hda/patch_realtek.c +92 -19

212 lines not on this page · raw message

pci/hda/patch_sigmatel.c +48 -0

65 lines not on this page · raw message

#13 lore raw

Re: [RFC] [Patch 2/2] Add virtual master to HD-audio

pci/hda/patch_realtek.c static struct hda_channel_mode alc880_lg · line 1881

Quoted 6 lines · Takashi Iwai

static struct snd_kcontrol_new alc880_lg_mixer[] = {

pci/hda/patch_realtek.c +2 -2
 	/* FIXME: it's not really "master" but front channels */
-	HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
-	HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),

You've just fixed that FIXME :-)

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
#14 lore raw

Re: [RFC] [Patch 2/2] Add virtual master to HD-audio

At Sat, 12 Jan 2008 15:21:22 -0500,

Quoted 10 lines · Daniel Jacobowitz

pci/hda/patch_realtek.c static struct hda_channel_mode alc880_lg · line 1881

Quoted 6 lines · Takashi Iwai

static struct snd_kcontrol_new alc880_lg_mixer[] = {

pci/hda/patch_realtek.c +2 -2
 	/* FIXME: it's not really "master" but front channels */
-	HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
-	HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),

You've just fixed that FIXME :-)

Yeah, fixed FIXME now ;)

Takashi

#15 lore raw

RFC PATCH 1/1 Add vmaster to alsa-driver

In reply to Takashi Iwai

This is the patch to alsa-driver tree.
Simply adds a stub to build vmaster object.

Rebuild from scratch (e.g. ./hgcompile) after vmaster patches because you'll need to re-create configure script.

Takashi

acore/vmaster.c new file +2 -0
diff -r 06162eef8936 acore/vmaster.c
@@ -0,0 +1,2 @@
+#define __NO_VERSION__
+#include "../alsa-kernel/core/vmaster.c"
#16 lore raw
In reply to Takashi Iwai

[Resent as I don't see the message back; if you already received it,
please disregard this]

Hi,

another thing I'd like to push into the next kernel is the virtual master volume control. As I posted in earlier posts, it adds virtual controls that have several slave controls with the same types, e.g. Front, Surround, Center, LFE, etc. Then these are adjusted simultaneously via the master control.

It'd be appreciated if some one can test the patches with HD-audio h/w that has no master control yet (e.g. some STAC codecs).

Note that this won't add the master volumes if there are no real volume controls. Some codecs have really no volume control, and this won't help for such devices.

Two (and one for driver) patches will follow after this.

Takashi

maintainer
#17 lore raw
In reply to Takashi Iwai
Quoted 8 lines · Takashi Iwai

Hi,

another thing I'd like to push into the next kernel is the virtual master volume control. As I posted in earlier posts, it adds virtual controls that have several slave controls with the same types, e.g. Front, Surround, Center, LFE, etc. Then these are adjusted simultaneously via the master control.

Quoted 8 lines

It'd be appreciated if some one can test the patches with HD-audio h/w that has no master control yet (e.g. some STAC codecs).

Note that this won't add the master volumes if there are no real volume controls. Some codecs have really no volume control, and this won't help for such devices.

Two (and one for driver) patches will follow after this.

NAK from my side. I am convinced that this code can be implemented in the user space even without any daemon just in the mixer abstract layer using standard control elements and using eventually new user controls to store data for virtual mixer controls.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project

#18 lore raw
Quoted 17 lines · Jaroslav Kysela
Quoted 15 lines · Takashi Iwai

Hi,

another thing I'd like to push into the next kernel is the virtual master volume control. As I posted in earlier posts, it adds virtual controls that have several slave controls with the same types, e.g. Front, Surround, Center, LFE, etc. Then these are adjusted simultaneously via the master control.

It'd be appreciated if some one can test the patches with HD-audio h/w that has no master control yet (e.g. some STAC codecs).

Note that this won't add the master volumes if there are no real volume controls. Some codecs have really no volume control, and this won't help for such devices.

Quoted 6 lines
Quoted 1 line

Two (and one for driver) patches will follow after this.

NAK from my side. I am convinced that this code can be implemented in the user space even without any daemon just in the mixer abstract layer using standard control elements and using eventually new user controls to store data for virtual mixer controls.

Aren't the patches supposed to be useful also for OSS-only apps, where userspace solutions can't work without LD_PRELOAD hacks? Currently, without the patch and the "aoss" wrapper, OSS apps sound too loud. I have not tested the patch, but I am too lazy to change each .desktop file for each OSS-only application provided by the distribution.

Signature · 1 line
Alexander E. Patrakov
#19 lore raw
Quoted 5 lines · Alexander E. Patrakov

Aren't the patches supposed to be useful also for OSS-only apps, where userspace solutions can't work without LD_PRELOAD hacks? Currently, without the patch and the "aoss" wrapper, OSS apps sound too loud. I have not tested the patch, but I am too lazy to change each .desktop file for each OSS-only application provided by the distribution.

Please file a bug report with your distro. It should be considered a bug for a modern distro to ship OSS only apps withut using the aoss wrapper. It causes all sorts of problems, like blocking the soundcard for ALSA apps.

Lee

#20 lore raw
In reply to Jaroslav Kysela

At Fri, 21 Dec 2007 20:37:09 +0100 (CET),

Quoted 18 lines · Jaroslav Kysela
Quoted 15 lines · Takashi Iwai

Hi,

another thing I'd like to push into the next kernel is the virtual master volume control. As I posted in earlier posts, it adds virtual controls that have several slave controls with the same types, e.g. Front, Surround, Center, LFE, etc. Then these are adjusted simultaneously via the master control.

It'd be appreciated if some one can test the patches with HD-audio h/w that has no master control yet (e.g. some STAC codecs).

Note that this won't add the master volumes if there are no real volume controls. Some codecs have really no volume control, and this won't help for such devices.

Quoted 6 lines
Quoted 1 line

Two (and one for driver) patches will follow after this.

NAK from my side. I am convinced that this code can be implemented in the user space even without any daemon just in the mixer abstract layer using standard control elements and using eventually new user controls to store data for virtual mixer controls.

A user-space implementation of virtual mixer elements would be far more complicated than the simplistic kernel-space patch. I've considered it many times, even tried to implement it, but got that conclusion. You'll see obviously the following difficulties:

1. Many user-space virtual elements

Each slave control element needs a virtual element (eventually a user-space one) because we need to keep both raw and virtual values to handle saturation. That is, the same number of additional controls would be added. Significant for 7.1 outputs.

2. Easy incosistency between virtual and raw elements

Even if the mixer abstraction hides the virtual elements, both virtual and raw elements are exposed on control API. This can cause the value-inconsistency between them quite easily, because many apps access directly via control API (even some mixer apps), and they likely change only raw values. The similar situation is for kernel OSS emulation.

3. Complicated configuration

The requirement of virtual master controls is very much dependent on the hardware. In the case of HD-audio, it depends on codec chip types, and even on the preset model chosen via PCI SSID or a module option. Implementing such a complex conditional in alsa-lib configuration is a clear overhead.

4. More resource requirement

Clearly a user-space solution requires more layers in alsa-lib, which is invoked by each process, and even more memory footprint than the kernel solution, not only the additional complexity.

... and think again what is the benifit of the user-space solution in this case, in comparison with the demerits above.

If you could implement the same feature on user-space with less amount of codes, I'd happily take it. But, I'm sure it's very hard.

Takashi

#21 lore raw

At Sat, 22 Dec 2007 15:55:19 +0100,

Quoted 64 lines · I wrote:

At Fri, 21 Dec 2007 20:37:09 +0100 (CET),

Quoted 18 lines · Jaroslav Kysela
Quoted 15 lines · Takashi Iwai

Hi,

another thing I'd like to push into the next kernel is the virtual master volume control. As I posted in earlier posts, it adds virtual controls that have several slave controls with the same types, e.g. Front, Surround, Center, LFE, etc. Then these are adjusted simultaneously via the master control.

It'd be appreciated if some one can test the patches with HD-audio h/w that has no master control yet (e.g. some STAC codecs).

Note that this won't add the master volumes if there are no real volume controls. Some codecs have really no volume control, and this won't help for such devices.

Quoted 6 lines
Quoted 1 line

Two (and one for driver) patches will follow after this.

NAK from my side. I am convinced that this code can be implemented in the user space even without any daemon just in the mixer abstract layer using standard control elements and using eventually new user controls to store data for virtual mixer controls.

A user-space implementation of virtual mixer elements would be far more complicated than the simplistic kernel-space patch. I've considered it many times, even tried to implement it, but got that conclusion. You'll see obviously the following difficulties:

1. Many user-space virtual elements

Each slave control element needs a virtual element (eventually a user-space one) because we need to keep both raw and virtual values to handle saturation. That is, the same number of additional controls would be added. Significant for 7.1 outputs.

2. Easy incosistency between virtual and raw elements

Even if the mixer abstraction hides the virtual elements, both virtual and raw elements are exposed on control API. This can cause the value-inconsistency between them quite easily, because many apps access directly via control API (even some mixer apps), and they likely change only raw values. The similar situation is for kernel OSS emulation.

3. Complicated configuration

The requirement of virtual master controls is very much dependent on the hardware. In the case of HD-audio, it depends on codec chip types, and even on the preset model chosen via PCI SSID or a module option. Implementing such a complex conditional in alsa-lib configuration is a clear overhead.

4. More resource requirement

Clearly a user-space solution requires more layers in alsa-lib, which is invoked by each process, and even more memory footprint than the kernel solution, not only the additional complexity.

Quoted 5 lines

... and think again what is the benifit of the user-space solution in this case, in comparison with the demerits above.

If you could implement the same feature on user-space with less amount of codes, I'd happily take it. But, I'm sure it's very hard.

The master control is really important feature. Unless you have really a better patch, I'd like to commit the vmaster patch soon, so that more people can test.

thanks,

Takashi

maintainer
#22 lore raw
In reply to Takashi Iwai
Quoted 32 lines · Takashi Iwai

At Fri, 21 Dec 2007 20:37:09 +0100 (CET),

Quoted 18 lines · Jaroslav Kysela
Quoted 15 lines · Takashi Iwai

Hi,

another thing I'd like to push into the next kernel is the virtual master volume control. As I posted in earlier posts, it adds virtual controls that have several slave controls with the same types, e.g. Front, Surround, Center, LFE, etc. Then these are adjusted simultaneously via the master control.

It'd be appreciated if some one can test the patches with HD-audio h/w that has no master control yet (e.g. some STAC codecs).

Note that this won't add the master volumes if there are no real volume controls. Some codecs have really no volume control, and this won't help for such devices.

Quoted 6 lines
Quoted 1 line

Two (and one for driver) patches will follow after this.

NAK from my side. I am convinced that this code can be implemented in the user space even without any daemon just in the mixer abstract layer using standard control elements and using eventually new user controls to store data for virtual mixer controls.

A user-space implementation of virtual mixer elements would be far more complicated than the simplistic kernel-space patch. I've considered it many times, even tried to implement it, but got that conclusion. You'll see obviously the following difficulties:

Quoted 6 lines

1. Many user-space virtual elements

Each slave control element needs a virtual element (eventually a user-space one) because we need to keep both raw and virtual values to handle saturation. That is, the same number of additional controls would be added. Significant for 7.1 outputs.

Note that these "extra" values can be handled together using only one user-space control element without "Volume/Switch" in name.

Quoted 8 lines

2. Easy incosistency between virtual and raw elements

Even if the mixer abstraction hides the virtual elements, both virtual and raw elements are exposed on control API. This can cause the value-inconsistency between them quite easily, because many apps access directly via control API (even some mixer apps), and they likely change only raw values. The similar situation is for kernel OSS emulation.

I have basically two ideas to handle this.

1) create a plugin system directly in the snd_ctl_* interface

- basically code might be very same code as you proposed in kernel

2) create virtual things only in smixer

- it's something I strongly prefer
- if mixers uses CTL interface, it's not our bussiness because we haven't claimed to create virtual layers in CTL

Quoted 7 lines

3. Complicated configuration

The requirement of virtual master controls is very much dependent on the hardware. In the case of HD-audio, it depends on codec chip types, and even on the preset model chosen via PCI SSID or a module option. Implementing such a complex conditional in alsa-lib configuration is a clear overhead.

I don't agree much here. Of course, we might need some hints from the driver (using information about components in sndrv_ctl_card_info) or we might analyze available controls using their names if Master control is present or we can eventually create a configuration tool saving hints to alsa-lib's configuration files which controls should be added for given hardware (this configuration tool might create a list of useable PCM devices handled in the driver, too). Just idea.

Quoted 9 lines

4. More resource requirement

Clearly a user-space solution requires more layers in alsa-lib, which is invoked by each process, and even more memory footprint than the kernel solution, not only the additional complexity.

... and think again what is the benifit of the user-space solution in this case, in comparison with the demerits above.

The benefit is flexibility for future extensions.

Quoted 2 lines

If you could implement the same feature on user-space with less amount of codes, I'd happily take it. But, I'm sure it's very hard.

The question is also how to behave in future and if we should allow to break our basic rule in the current ALSA design - everything that can be moved to user space will be moved to user space.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

#23 lore raw

At Thu, 10 Jan 2008 11:29:39 +0100 (CET),

Quoted 37 lines · Jaroslav Kysela
Quoted 34 lines · Takashi Iwai

At Fri, 21 Dec 2007 20:37:09 +0100 (CET),

Quoted 18 lines · Jaroslav Kysela
Quoted 15 lines · Takashi Iwai

Hi,

another thing I'd like to push into the next kernel is the virtual master volume control. As I posted in earlier posts, it adds virtual controls that have several slave controls with the same types, e.g. Front, Surround, Center, LFE, etc. Then these are adjusted simultaneously via the master control.

It'd be appreciated if some one can test the patches with HD-audio h/w that has no master control yet (e.g. some STAC codecs).

Note that this won't add the master volumes if there are no real volume controls. Some codecs have really no volume control, and this won't help for such devices.

Quoted 6 lines
Quoted 1 line

Two (and one for driver) patches will follow after this.

NAK from my side. I am convinced that this code can be implemented in the user space even without any daemon just in the mixer abstract layer using standard control elements and using eventually new user controls to store data for virtual mixer controls.

A user-space implementation of virtual mixer elements would be far more complicated than the simplistic kernel-space patch. I've considered it many times, even tried to implement it, but got that conclusion. You'll see obviously the following difficulties:

1. Many user-space virtual elements

Quoted 7 lines
Quoted 4 lines

Each slave control element needs a virtual element (eventually a user-space one) because we need to keep both raw and virtual values to handle saturation. That is, the same number of additional controls would be added. Significant for 7.1 outputs.

Note that these "extra" values can be handled together using only one user-space control element without "Volume/Switch" in name.

This method is very likely fragile. Think what happens if the number of elements changes, or if the element numid changes. Then the packed values will be screwed up.

Quoted 9 lines
Quoted 8 lines

2. Easy incosistency between virtual and raw elements

Even if the mixer abstraction hides the virtual elements, both virtual and raw elements are exposed on control API. This can cause the value-inconsistency between them quite easily, because many apps access directly via control API (even some mixer apps), and they likely change only raw values. The similar situation is for kernel OSS emulation.

Quoted 5 lines

I have basically two ideas to handle this.

1) create a plugin system directly in the snd_ctl_* interface

- basically code might be very same code as you proposed in kernel

No. The big difference is that the raw values are still exposed via control API (otherwise how do you read/write raw values?). That is, any user-space program may break consistency. OTOH, the kernel solution doesn't expose raw values.

Quoted 5 lines

2) create virtual things only in smixer

- it's something I strongly prefer
- if mixers uses CTL interface, it's not our bussiness because we haven't claimed to create virtual layers in CTL

Hm, I have to say it's a bad attitude. It's our business to keep the whole system consistent. We shouldn't build such a weak and fragile system any more.

And what about the kernel OSS mixer? There are still many apps to handle it.

Quoted 8 lines
Quoted 7 lines

3. Complicated configuration

The requirement of virtual master controls is very much dependent on the hardware. In the case of HD-audio, it depends on codec chip types, and even on the preset model chosen via PCI SSID or a module option. Implementing such a complex conditional in alsa-lib configuration is a clear overhead.

Quoted 7 lines

I don't agree much here. Of course, we might need some hints from the driver (using information about components in sndrv_ctl_card_info) or we might analyze available controls using their names if Master control is present or we can eventually create a configuration tool saving hints to alsa-lib's configuration files which controls should be added for given hardware (this configuration tool might create a list of useable PCM devices handled in the driver, too). Just idea.

But it *is* an overhead.

Quoted 11 lines
Quoted 9 lines

4. More resource requirement

Clearly a user-space solution requires more layers in alsa-lib, which is invoked by each process, and even more memory footprint than the kernel solution, not only the additional complexity.

... and think again what is the benifit of the user-space solution in this case, in comparison with the demerits above.

The benefit is flexibility for future extensions.

The demerit is complexity even longing for future :)

And the worst thing is that it is not implemented yet *at all*. How many years have we told that this kind of thing must be implemented in user-space?

Seriously, we need a solution RIGHT NOW.

Quoted 6 lines
Quoted 2 lines

If you could implement the same feature on user-space with less amount of codes, I'd happily take it. But, I'm sure it's very hard.

The question is also how to behave in future and if we should allow to break our basic rule in the current ALSA design - everything that can be moved to user space will be moved to user space.

Hey, it's just the question of balance. Insisting on a rule makes you blind. The rule exists not for following rules. The rule exists for creating a better system.

Note taht this isn't for solving every mixer problem. It doesn't solve the world hunger. But, it solves nicely the really annoying problem we face right now, without messy, fragile and overly complex implementation.

Takashi

maintainer
#24 lore raw
Quoted 63 lines · Takashi Iwai

At Thu, 10 Jan 2008 11:29:39 +0100 (CET),

Quoted 37 lines · Jaroslav Kysela
Quoted 34 lines · Takashi Iwai

At Fri, 21 Dec 2007 20:37:09 +0100 (CET),

Quoted 18 lines · Jaroslav Kysela
Quoted 15 lines · Takashi Iwai

Hi,

another thing I'd like to push into the next kernel is the virtual master volume control. As I posted in earlier posts, it adds virtual controls that have several slave controls with the same types, e.g. Front, Surround, Center, LFE, etc. Then these are adjusted simultaneously via the master control.

It'd be appreciated if some one can test the patches with HD-audio h/w that has no master control yet (e.g. some STAC codecs).

Note that this won't add the master volumes if there are no real volume controls. Some codecs have really no volume control, and this won't help for such devices.

Quoted 6 lines
Quoted 1 line

Two (and one for driver) patches will follow after this.

NAK from my side. I am convinced that this code can be implemented in the user space even without any daemon just in the mixer abstract layer using standard control elements and using eventually new user controls to store data for virtual mixer controls.

A user-space implementation of virtual mixer elements would be far more complicated than the simplistic kernel-space patch. I've considered it many times, even tried to implement it, but got that conclusion. You'll see obviously the following difficulties:

1. Many user-space virtual elements

Quoted 7 lines
Quoted 4 lines

Each slave control element needs a virtual element (eventually a user-space one) because we need to keep both raw and virtual values to handle saturation. That is, the same number of additional controls would be added. Significant for 7.1 outputs.

Note that these "extra" values can be handled together using only one user-space control element without "Volume/Switch" in name.

This method is very likely fragile. Think what happens if the number of elements changes, or if the element numid changes. Then the packed values will be screwed up.

Quoted 11 lines
Quoted 8 lines

2. Easy incosistency between virtual and raw elements

Even if the mixer abstraction hides the virtual elements, both virtual and raw elements are exposed on control API. This can cause the value-inconsistency between them quite easily, because many apps access directly via control API (even some mixer apps), and they likely change only raw values. The similar situation is for kernel OSS emulation.

I have basically two ideas to handle this.

Quoted 8 lines
Quoted 3 lines

1) create a plugin system directly in the snd_ctl_* interface

- basically code might be very same code as you proposed in kernel

No. The big difference is that the raw values are still exposed via control API (otherwise how do you read/write raw values?). That is, any user-space program may break consistency. OTOH, the kernel solution doesn't expose raw values.

Alsa-lib can filter raw writes from applications, but it's really not something I prefer, of course.

Quoted 9 lines
Quoted 5 lines

2) create virtual things only in smixer

- it's something I strongly prefer
- if mixers uses CTL interface, it's not our bussiness because we haven't claimed to create virtual layers in CTL

Hm, I have to say it's a bad attitude. It's our business to keep the whole system consistent. We shouldn't build such a weak and fragile system any more.

But the definition of consistency is relative in this case. If we have universal control API (which is not a mixer API, but just API to pass runtime configuration parameters to driver) and second one API (simple mixer - fully abstract) then everything is consistent.

Quoted 2 lines

And what about the kernel OSS mixer? There are still many apps to handle it.

Yes, OSS mixer support still requires a rework. My idea is to create a helper userspace application which will start automatically by udev when /dev/mixer devices are created passing values through smixer API in user space.

For OSS PCM emulation, similar thing can be done using snd-aloop module.

Quoted 16 lines
Quoted 8 lines
Quoted 7 lines

3. Complicated configuration

The requirement of virtual master controls is very much dependent on the hardware. In the case of HD-audio, it depends on codec chip types, and even on the preset model chosen via PCI SSID or a module option. Implementing such a complex conditional in alsa-lib configuration is a clear overhead.

Quoted 7 lines

I don't agree much here. Of course, we might need some hints from the driver (using information about components in sndrv_ctl_card_info) or we might analyze available controls using their names if Master control is present or we can eventually create a configuration tool saving hints to alsa-lib's configuration files which controls should be added for given hardware (this configuration tool might create a list of useable PCM devices handled in the driver, too). Just idea.

Quoted 1 line

But it *is* an overhead.

Maybe for this simple case. I would be really happy to see a system which allows me to split for example six channel hardware to three stereo soundcards with full abstract and independent mixers.

If we agree that it's the way to go, it does not make much sense to implement these things again in the kernel space, because virtual master implemented there becomes unuseable.

Quoted 4 lines

Note taht this isn't for solving every mixer problem. It doesn't solve the world hunger. But, it solves nicely the really annoying problem we face right now, without messy, fragile and overly complex implementation.

My point is that if we allow this now, we might have trouble to remove it in future when it becomes obsolete. It is much more difficult for the kernel code. We definitely need to settle a clear way about future mixer directions now and decide where the abstraction should be.

I'm sure I can hack smixer - simple_none.c - to add virtual master support in few days. If I fail for a reason or code is really ugly, I give you my ack for your implementation, ok?

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

#25 lore raw

At Thu, 10 Jan 2008 15:09:46 +0100 (CET),

Quoted 70 lines · Jaroslav Kysela
Quoted 67 lines · Takashi Iwai

At Thu, 10 Jan 2008 11:29:39 +0100 (CET),

Quoted 37 lines · Jaroslav Kysela
Quoted 34 lines · Takashi Iwai

At Fri, 21 Dec 2007 20:37:09 +0100 (CET),

Quoted 18 lines · Jaroslav Kysela
Quoted 15 lines · Takashi Iwai

Hi,

another thing I'd like to push into the next kernel is the virtual master volume control. As I posted in earlier posts, it adds virtual controls that have several slave controls with the same types, e.g. Front, Surround, Center, LFE, etc. Then these are adjusted simultaneously via the master control.

It'd be appreciated if some one can test the patches with HD-audio h/w that has no master control yet (e.g. some STAC codecs).

Note that this won't add the master volumes if there are no real volume controls. Some codecs have really no volume control, and this won't help for such devices.

Quoted 6 lines
Quoted 1 line

Two (and one for driver) patches will follow after this.

NAK from my side. I am convinced that this code can be implemented in the user space even without any daemon just in the mixer abstract layer using standard control elements and using eventually new user controls to store data for virtual mixer controls.

A user-space implementation of virtual mixer elements would be far more complicated than the simplistic kernel-space patch. I've considered it many times, even tried to implement it, but got that conclusion. You'll see obviously the following difficulties:

1. Many user-space virtual elements

Quoted 7 lines
Quoted 4 lines

Each slave control element needs a virtual element (eventually a user-space one) because we need to keep both raw and virtual values to handle saturation. That is, the same number of additional controls would be added. Significant for 7.1 outputs.

Note that these "extra" values can be handled together using only one user-space control element without "Volume/Switch" in name.

This method is very likely fragile. Think what happens if the number of elements changes, or if the element numid changes. Then the packed values will be screwed up.

Quoted 14 lines
Quoted 8 lines

2. Easy incosistency between virtual and raw elements

Even if the mixer abstraction hides the virtual elements, both virtual and raw elements are exposed on control API. This can cause the value-inconsistency between them quite easily, because many apps access directly via control API (even some mixer apps), and they likely change only raw values. The similar situation is for kernel OSS emulation.

I have basically two ideas to handle this.

1) create a plugin system directly in the snd_ctl_* interface

- basically code might be very same code as you proposed in kernel

Quoted 7 lines
Quoted 4 lines

No. The big difference is that the raw values are still exposed via control API (otherwise how do you read/write raw values?). That is, any user-space program may break consistency. OTOH, the kernel solution doesn't expose raw values.

Alsa-lib can filter raw writes from applications, but it's really not something I prefer, of course.

Right. It'd be really bad to do that.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

2) create virtual things only in smixer

- it's something I strongly prefer
- if mixers uses CTL interface, it's not our bussiness because we haven't claimed to create virtual layers in CTL

Quoted 8 lines
Quoted 3 lines

Hm, I have to say it's a bad attitude. It's our business to keep the whole system consistent. We shouldn't build such a weak and fragile system any more.

But the definition of consistency is relative in this case. If we have universal control API (which is not a mixer API, but just API to pass runtime configuration parameters to driver) and second one API (simple mixer - fully abstract) then everything is consistent.

What I meant is that this would create bogus values easily, that is, screw up the volumes. The kernel OSS can change the raw value while mixer changes the value at the same time.

Quoted 9 lines
Quoted 2 lines

And what about the kernel OSS mixer? There are still many apps to handle it.

Yes, OSS mixer support still requires a rework. My idea is to create a helper userspace application which will start automatically by udev when /dev/mixer devices are created passing values through smixer API in user space.

For OSS PCM emulation, similar thing can be done using snd-aloop module.

Yeah, that's good. But this needs a lot of work and more resources. And don't forget that many people hate daemons.

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 7 lines

3. Complicated configuration

The requirement of virtual master controls is very much dependent on the hardware. In the case of HD-audio, it depends on codec chip types, and even on the preset model chosen via PCI SSID or a module option. Implementing such a complex conditional in alsa-lib configuration is a clear overhead.

I don't agree much here. Of course, we might need some hints from the driver (using information about components in sndrv_ctl_card_info) or we might analyze available controls using their names if Master control is present or we can eventually create a configuration tool saving hints to alsa-lib's configuration files which controls should be added for given hardware (this configuration tool might create a list of useable PCM devices handled in the driver, too). Just idea.

Quoted 3 lines
Quoted 1 line

But it *is* an overhead.

Maybe for this simple case.

Exactly, that's the point. This case is DAMN SIMPLE.

The virtual master patch simply fills the hole in the driver. It should have been there, but I didn't put it. That's my fault.

It has nothing to do with the virtual cards or complicated layering. It just adds a control for binding several registers. We don't need too much work for this simple purpose.

Quoted 3 lines

I would be really happy to see a system which allows me to split for example six channel hardware to three stereo soundcards with full abstract and independent mixers.

I'm afraid this would result in a similar situation like PCM plugins. Without a proper setup utility, the whole thing could be too complicated to use in practice...

Quoted 3 lines

If we agree that it's the way to go, it does not make much sense to implement these things again in the kernel space, because virtual master implemented there becomes unuseable.

The virtual master in the kernel doesn't conflict with the user-space additions. It's simply a master volume in the end, nothing different from the real master volume on hardware. So, it's fine to have both.

Quoted 9 lines
Quoted 4 lines

Note taht this isn't for solving every mixer problem. It doesn't solve the world hunger. But, it solves nicely the really annoying problem we face right now, without messy, fragile and overly complex implementation.

My point is that if we allow this now, we might have trouble to remove it in future when it becomes obsolete. It is much more difficult for the kernel code. We definitely need to settle a clear way about future mixer directions now and decide where the abstraction should be.

It doesn't have to be obsoleted. The user-space solution requires more resources for the same purpose. Then why do we need to switch? And above all, both can coexist peacefully.

Quoted 3 lines

I'm sure I can hack smixer - simple_none.c - to add virtual master support in few days. If I fail for a reason or code is really ugly, I give you my ack for your implementation, ok?

Well, as I wrote, smixer alone won't solve all the corner cases. Imlementing smixer would be relatively easy. But it can't be solid like the kernel driver, and we have still problems with control API and kernel mixer OSS.

Takashi

maintainer
#26 lore raw
Quoted 8 lines · Takashi Iwai
Quoted 3 lines

I'm sure I can hack smixer - simple_none.c - to add virtual master support in few days. If I fail for a reason or code is really ugly, I give you my ack for your implementation, ok?

Well, as I wrote, smixer alone won't solve all the corner cases. Imlementing smixer would be relatively easy. But it can't be solid like the kernel driver, and we have still problems with control API and kernel mixer OSS.

Ok, I switch to rather neutral mode in this issue. Although I don't think that it's the right solution. You can commit this code to repo. Time shows us if it was good or not. Back to coding.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

#27 lore raw

At Thu, 10 Jan 2008 16:43:24 +0100 (CET),

Quoted 7 lines · Jaroslav Kysela
Quoted 4 lines · Takashi Iwai
Quoted 3 lines

I'm sure I can hack smixer - simple_none.c - to add virtual master support in few days. If I fail for a reason or code is really ugly, I give you my ack for your implementation, ok?

Quoted 8 lines
Quoted 4 lines

Well, as I wrote, smixer alone won't solve all the corner cases. Imlementing smixer would be relatively easy. But it can't be solid like the kernel driver, and we have still problems with control API and kernel mixer OSS.

Ok, I switch to rather neutral mode in this issue. Although I don't think that it's the right solution. You can commit this code to repo. Time shows us if it was good or not. Back to coding.

Glad to hear that.

The user-space solution would be of course nice, but in this particular case, it results in far more codes and may give even more problems. Once after we get a better infrastructure for mixer abstraction, let's clean up the whole stuff.

Takashi