Fons Adriaensen wrote:
> I now want to write some hopefully not too convolved
> C or C++ code to read and write these parameters.
>
> Is there, after X years of ALSA, any documentation that
> explains the basic concepts and tells me how to do this ?
No.
> how I can e.g. set the sample clock source on a RME MADI card
> in less than ten lines of C code
system("amixer cset name='Sample Clock Source' 3");
or like this:
#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
static void check(int err, const char *f)
{
if (err < 0) {
fprintf(stderr, "%s failed: %s\n", f, snd_strerror(err));
exit(EXIT_FAILURE);
}
}
#define CHECK(f) check(f, #f)
int main()
{
snd_ctl_t *ctl;
snd_ctl_elem_value_t *value;
CHECK(snd_ctl_open(&ctl, "default", 0));
snd_ctl_elem_value_alloca(&value);
snd_ctl_elem_value_set_interface(value, SND_CTL_ELEM_IFACE_MIXER);
snd_ctl_elem_value_set_name(value, "Sample Clock Source");
snd_ctl_elem_value_set_enumerated(value, 0, 3); /* 3: 48 kHz */
CHECK(snd_ctl_elem_write(ctl, value));
snd_ctl_close(ctl);
return 0;
}
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Fri Nov 14 12:15:05 2008
This archive was generated by hypermail 2.1.8 : Fri Nov 14 2008 - 12:15:05 EET