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_scope_malloc(&scope); snd_pcm_meter_add_scope(pcm, scope); snd_pcm_meter_get_rate(pcm); 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 something?
Thanks in advance.