[alsa-devel] snd_pcm_meter_get_rate() (and other meter functions) - can it be used in user applications?

James Huk huk256 at gmail.com
Mon Nov 14 22:03:04 CET 2011

Hello everybody.

I'm trying to understand how to add a sound meter that would monitor
sound  level on certain channel defined in .asoundrc (like ameter
does). I think I should use snd_pcm_meter... however, if I try to use
this simple test program:

#include <stdio.h>
#include <alsa/asoundlib.h>

snd_pcm_t *pcm;
snd_pcm_scope_t *scope;

int main()
	int err=snd_pcm_open(&pcm, "meter-x", SND_PCM_STREAM_PLAYBACK,0);
	snd_pcm_meter_add_scope(pcm, scope);
	return 0;	

I get:

pcm_meter.c:906: snd_pcm_meter_get_rate: Assertion
`meter->gen.slave->setup' failed.

I don't understand why - is it because snd_pcm_meter functions can
only be used in external plugins, and not in user applications (since
similar construction works fine with ameter...), or did I missed

Thanks in advance.

More information about the Alsa-devel mailing list