Skip to contentSkip to conversation

Volume Peak display

DISCUSSION Manuel Jander 3 participants 7 messages Sep 20, 2003 – Jun 22, 2005 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello,

I'm implementing Hardware EQ peak visualization code in the Aureal Vortex driver, and took as a reference the ICE1712 MultiTrack peak kcontrol code.

The problems are:

- The peaks doesnt get updated by alsamixer nor alsamixergui. I set the "volatile" flag, but is doesnt have any effect.
- Alsamixer shows only 4 of the peak control set (20 total), and other mixers just show 2 of them.
- The controls are declared as read only, but i can change their value. This shouldn't be allowed.

Any suggestions ?

Best Regards

Manuel Jander.

static int snd_vortex_peaks_info(snd_kcontrol_t *kcontrol,

snd_ctl_elem_info_t *uinfo) {
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = 20;
	uinfo->value.integer.min = 0x0000;
	uinfo->value.integer.max = 0xffff;
	return 0;
}

static int snd_vortex_peaks_get(snd_kcontrol_t *kcontrol,

snd_ctl_elem_value_t *ucontrol) {
	vortex_t *vortex = snd_kcontrol_chip(kcontrol);
	int i, count;
	u16 peaks[20];
	
	vortex_Eqlzr_GetAllPeaks(vortex, peaks, &count);
	printk("vortex: Peak = %x\n", peaks[5]);
	for (i=0; i<20; i++)
		ucontrol->value.integer.value[i] = peaks[i];
	
	return 0;
}

static snd_kcontrol_new_t vortex_levels_kcontrol __devinitdata = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "EQ Peaks",
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_vortex_peaks_info,
.get = snd_vortex_peaks_get,
};

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#1 lore raw

At Sat, 20 Sep 2003 01:11:12 -0400,

Quoted 11 lines · Manuel Jander

Hello,

I'm implementing Hardware EQ peak visualization code in the Aureal Vortex driver, and took as a reference the ICE1712 MultiTrack peak kcontrol code.

The problems are:

- The peaks doesnt get updated by alsamixer nor alsamixergui. I set the "volatile" flag, but is doesnt have any effect.

this is inteintional.
(otherwise it will be too heavy for terminals over a slow network
connection :)

for these purposes, we'll need anyway a special mixer app like envy24control.

Quoted 2 lines

- Alsamixer shows only 4 of the peak control set (20 total), and other mixers just show 2 of them.

maybe the result of abstraction by simple-mixer API.

Quoted 2 lines

- The controls are declared as read only, but i can change their value. This shouldn't be allowed.

really? then it must be fixed.
could you elaborate how this can happen?

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

A message that is not in the archive (sent off-list or not yet received): 1064414023.1630.11.camel@localhost

#3 lore raw

At Wed, 24 Sep 2003 10:33:43 -0400,

Quoted 7 lines · Manuel Jander

Hi Takashi,

I was thinking that wouldn't it be a good idea to have a "visualization" category for alsa controls ? Or at least some naming scheme that allows to identify controls that should just show some data, like VU meters, or the hardware EQ peak i'm implementing for the aureal vortex.

well, the volatile flag should be used for such a purpose. if it's set, the control change won't be notified to the application. the application which shows these controls must re-read the data periodically (not passively like others).

the other flag name might be more obvious, though.

Quoted 32 lines
Quoted 11 lines
Quoted 4 lines

- The peaks doesnt get updated by alsamixer nor alsamixergui. I set the "volatile" flag, but is doesnt have any effect.

this is inteintional.
(otherwise it will be too heavy for terminals over a slow network
connection :)

for these purposes, we'll need anyway a special mixer app like envy24control.

Ok. I got it. I'll start writing our "Vortex turbo mixer" as soon as i can :-)

Quoted 10 lines
Quoted 2 lines

- Alsamixer shows only 4 of the peak control set (20 total), and other mixers just show 2 of them.

maybe the result of abstraction by simple-mixer API.

Quoted 2 lines

- The controls are declared as read only, but i can change their value. This shouldn't be allowed.

really? then it must be fixed.
could you elaborate how this can happen?

This could be a problem of the mixer app. I mean that i can modify the sliders on alsamixer or alsamixergui. The alsalib doesnt try to invoke a "control_put()" function (which is correct), since that would yield a segfault (i didnt implemented the control_put(), because that would be nonsense).

Quoted 4 lines

What i wanted to say, is that it shouldn't be possible in a mixer app to "Move" sliders from readonly controls. Their appearance should be different too. They should look like "progress bars" or something else. Or better than that, VU meters should look like VU meters :)

agreed. at least, showing the elements with volatile in alsamixer doens't make sense unless alsamixer shows vu meter (hey, it's not bad :)

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#4 lore raw
Quoted 10 lines · Takashi Iwai

At Wed, 24 Sep 2003 10:33:43 -0400,

Quoted 6 lines · Manuel Jander

Hi Takashi,

I was thinking that wouldn't it be a good idea to have a "visualization" category for alsa controls ? Or at least some naming scheme that allows to identify controls that should just show some data, like VU meters, or the hardware EQ peak i'm implementing for the aureal vortex.

Are those VU meters measure in db or percentage ?

Quoted 22 lines

well, the volatile flag should be used for such a purpose. if it's set, the control change won't be notified to the application. the application which shows these controls must re-read the data periodically (not passively like others).

the other flag name might be more obvious, though.

Quoted 13 lines
Quoted 9 lines
Quoted 2 lines

- The peaks doesnt get updated by alsamixer nor alsamixergui. I set the "volatile" flag, but is doesnt have any effect.

this is inteintional.
(otherwise it will be too heavy for terminals over a slow network connection :)

for these purposes, we'll need anyway a special mixer app like envy24control.

Ok. I got it. I'll start writing our "Vortex turbo mixer" as soon as i can :-)

10-bands Graphic equalizer has been implemented in vortexcontrol.

Quoted 14 lines
Quoted 13 lines
Quoted 12 lines
Quoted 3 lines

- Alsamixer shows only 4 of the peak control set (20 total), and other mixers just show 2 of them.

maybe the result of abstraction by simple-mixer API.

Quoted 2 lines

- The controls are declared as read only, but i can change their value. This shouldn't be allowed.

really? then it must be fixed.
could you elaborate how this can happen?

Quoted 5 lines
Quoted 5 lines

This could be a problem of the mixer app. I mean that i can modify the sliders on alsamixer or alsamixergui. The alsalib doesnt try to invoke a "control_put()" function (which is correct), since that would yield a segfault (i didnt implemented the control_put(), because that would be nonsense).

The message return by amixer seem to be misleading.

# amixer cget numid=12
numid=12,iface=MIXER,name='EQ Peaks'
  ; type=INTEGER,access=r----,values=20,min=0,max=32767,step=0
  : values=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
# amixer sget numid=12 1,1,1,1,1,1,1,1,1
amixer: Unable to find simple control 'numid=12',0

static snd_kcontrol_new_t vortex_levels_kcontrol __devinitdata = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "EQ Peaks",
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_vortex_peaks_info,
.get = snd_vortex_peaks_get,
};

Refer to Alien's png

http://article.gmane.org/gmane.linux.alsa.devel/23112

There are 4 sliders marked as "EQ peaks" in alsamixer (1.0.9a) , the first two are stereo and the last two are mono.

The 4 EQ peaks sliders in alsamixer can be adjusted and it is strange that alsamixer do not get "segfault" when ".put" has not been implemented in au88x0.

The following error only appear with compile with option --with-debug=full

Vortex: init.... <3>ALSA control.c:325: control 3:0:0:Playback PCM advanced processing:0 is already present
done.

It seem that this HRTF kcontrols with 6 values cannot be created.

Does it mean that kcontrols ( not enumerated ) cannot contains more than 2 values ?

Quoted 7 lines
Quoted 5 lines

What i wanted to say, is that it shouldn't be possible in a mixer app to "Move" sliders from readonly controls. Their appearance should be different too. They should look like "progress bars" or something else. Or better than that, VU meters should look like VU meters :)

Quoted 5 lines

agreed. at least, showing the elements with volatile in alsamixer doens't make sense unless alsamixer shows vu meter (hey, it's not bad :)

Is it possible to standardise the API of multi-band equalizer ( hardware equalizer / graphic equalizer )

Beside Turtle Beach Montego II (au8830) , it seem that other cards such as Santa Cruz (cs46xx) , Montego DDL also have hardware equalizer.

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

#5 lore raw

At Tue, 21 Jun 2005 17:08:41 +0800,

Quoted 24 lines · Raymond
Quoted 15 lines
Quoted 14 lines
Quoted 13 lines
Quoted 4 lines

- Alsamixer shows only 4 of the peak control set (20 total), and other mixers just show 2 of them.

maybe the result of abstraction by simple-mixer API.

Quoted 2 lines

- The controls are declared as read only, but i can change their value. This shouldn't be allowed.

really? then it must be fixed.
could you elaborate how this can happen?

Quoted 5 lines
Quoted 5 lines

This could be a problem of the mixer app. I mean that i can modify the sliders on alsamixer or alsamixergui. The alsalib doesnt try to invoke a "control_put()" function (which is correct), since that would yield a segfault (i didnt implemented the control_put(), because that would be nonsense).

The message return by amixer seem to be misleading.

Quoted 7 lines
# amixer cget numid=12
numid=12,iface=MIXER,name='EQ Peaks'
   ; type=INTEGER,access=r----,values=20,min=0,max=32767,step=0
   : values=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
# amixer sget numid=12 1,1,1,1,1,1,1,1,1
amixer: Unable to find simple control 'numid=12',0

sget is for the simple controls. There is no numid for simple controls.

Quoted 10 lines

static snd_kcontrol_new_t vortex_levels_kcontrol __devinitdata = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "EQ Peaks",
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_vortex_peaks_info,
.get = snd_vortex_peaks_get,
};

Refer to Alien's png

Quoted 8 lines

http://article.gmane.org/gmane.linux.alsa.devel/23112

There are 4 sliders marked as "EQ peaks" in alsamixer (1.0.9a) , the first two are stereo and the last two are mono.

The 4 EQ peaks sliders in alsamixer can be adjusted and it is strange that alsamixer do not get "segfault" when ".put" has not been implemented in au88x0.

It shouldn't segfault but be simply ignored.

Quoted 10 lines

The following error only appear with compile with option --with-debug=full

Vortex: init.... <3>ALSA control.c:325: control 3:0:0:Playback PCM advanced processing:0 is already present
done.

It seem that this HRTF kcontrols with 6 values cannot be created.

Does it mean that kcontrols ( not enumerated ) cannot contains more than 2 values ?

They can. The above split of channels is just a matter of mixer abstraction layer and alsamixer. In the control API level, everyhing is fine.

Takashi

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

#6 lore raw
Quoted 18 lines · Takashi Iwai

At Tue, 21 Jun 2005 17:08:41 +0800,

Quoted 15 lines · Raymond

static snd_kcontrol_new_t vortex_levels_kcontrol __devinitdata = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "EQ Peaks",
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_vortex_peaks_info,
.get = snd_vortex_peaks_get,
};

Refer to Alien's png

http://article.gmane.org/gmane.linux.alsa.devel/23112

There are 4 sliders marked as "EQ peaks" in alsamixer (1.0.9a) , the first two are stereo and the last two are mono.

Quoted 7 lines
Quoted 3 lines

The 4 EQ peaks sliders in alsamixer can be adjusted and it is strange that alsamixer do not get "segfault" when ".put" has not been implemented in au88x0.

It shouldn't segfault but be simply ignored.

# amixer cget numid=12 numid=12,iface=MIXER,name='EQ Peaks'
  ; type=INTEGER,access=r----,values=20,min=0,max=32767,step=0
  : values=1,1,0,1,0,0,0,1,0,0,1,1,0,0,0,1,0,1,0,0
# amixer cset numid=12 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
amixer: Control default element write error: Operation not permitted
Quoted 9 lines
Quoted 9 lines

The following error only appear with compile with option --with-debug=full

Vortex: init.... <3>ALSA control.c:325: control 3:0:0:Playback PCM advanced processing:0 is already present
done.

It seem that this HRTF kcontrols with 6 values cannot be created.

Quoted 8 lines
Quoted 2 lines

Does it mean that kcontrols ( not enumerated ) cannot contains more than 2 values ?

They can. The above split of channels is just a matter of mixer abstraction layer and alsamixer. In the control API level, everyhing is fine.

The first HRTF kcontrol fail in snd_ctl_add() (there are 16 HRTF controls and each contain 6 values).

Is the error cause by numid or duplicate name ?

int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol)

{
	snd_ctl_elem_id_t id;
	unsigned int idx;

	snd_runtime_check(card != NULL && kcontrol != NULL, return -EINVAL);
	snd_assert(kcontrol->info != NULL, return -EINVAL);
	id = kcontrol->id;
	down_write(&card->controls_rwsem);
	if (snd_ctl_find_id(card, &id)) {
		up_write(&card->controls_rwsem);
		snd_ctl_free_one(kcontrol);
		snd_printd(KERN_ERR "control %i:%i:%i:%s:%i is already present\n",
					id.iface,
					id.device,
					id.subdevice,
					id.name,
					id.index);
		return -EBUSY;
	}

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

#7 lore raw

At Wed, 22 Jun 2005 22:21:13 +0800,

Quoted 29 lines · Raymond
Quoted 18 lines · Takashi Iwai

At Tue, 21 Jun 2005 17:08:41 +0800,

Quoted 15 lines · Raymond

static snd_kcontrol_new_t vortex_levels_kcontrol __devinitdata = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "EQ Peaks",
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_vortex_peaks_info,
.get = snd_vortex_peaks_get,
};

Refer to Alien's png

http://article.gmane.org/gmane.linux.alsa.devel/23112

There are 4 sliders marked as "EQ peaks" in alsamixer (1.0.9a) , the first two are stereo and the last two are mono.

Quoted 7 lines
Quoted 3 lines

The 4 EQ peaks sliders in alsamixer can be adjusted and it is strange that alsamixer do not get "segfault" when ".put" has not been implemented in au88x0.

It shouldn't segfault but be simply ignored.

Quoted 6 lines
# amixer cget numid=12 numid=12,iface=MIXER,name='EQ Peaks'
   ; type=INTEGER,access=r----,values=20,min=0,max=32767,step=0
   : values=1,1,0,1,0,0,0,1,0,0,1,1,0,0,0,1,0,1,0,0
# amixer cset numid=12 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
amixer: Control default element write error: Operation not permitted

So it's even better than ignoring :)

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines

The following error only appear with compile with option --with-debug=full

Vortex: init.... <3>ALSA control.c:325: control 3:0:0:Playback PCM advanced processing:0 is already present
done.

It seem that this HRTF kcontrols with 6 values cannot be created.

Quoted 8 lines
Quoted 2 lines

Does it mean that kcontrols ( not enumerated ) cannot contains more than 2 values ?

They can. The above split of channels is just a matter of mixer abstraction layer and alsamixer. In the control API level, everyhing is fine.

Quoted 4 lines

The first HRTF kcontrol fail in snd_ctl_add() (there are 16 HRTF controls and each contain 6 values).

Is the error cause by numid or duplicate name ?

Yes. (More exactly, this is not numid but the name. The numid is assigned first after the addition to the card.)
If you want to use the same name string, then give different "index" values to distinct with each other.

Instead of creating each control with a diffeent index value, you can create a single control with multiple instances by passing a positive kcontrol_new_t.count value. This will create only a single control but it's handled as if multiple control instances from outside. The get/put/info callbacks should check the given instance offset via snd_ctl_get_ioff() (defined in control.h). This is used in emu10k1, trident, etc.

Takashi

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click