Mar - 2016-10-24

I'm attempting a barebones program to use tinyalsa, but pcm_start always fails, returning -1 and setting errno to 9 (EBADF, i.e. bad file number). The call to pcm_open before this returns a non-null pointer, but it sets errno to 22.

There appears to be no documentation for tinyalsa, so I'm having trouble understanding what I'm supposed to do. I based my program on an example from alsa (not tinyalsa), and I've read the header files for tinyalsa. Can anyone provide guidance?

pcm * dev = pcm_open(1, 0, PCM_OUT, &config);
if (err = pcm_start(dev)) printf("err: %d\t errno: %d\n", err, errno);

(Full code available on pastebin.)

I infer the values for the first two arguments of pcm_open from aplay --list-devices, which outputs:

**** List of PLAYBACK Hardware Devices ****
card 1: PCH [HDA Intel PCH], device 0: ALC3232 Analog [ALC3232 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0