[linux-audio-dev] HOw to create an ALSA out port

Clemens Ladisch clemens at ladisch.de
Wed Jul 27 08:04:41 UTC 2005


Jens M Andreasen wrote:
>   int err = snd_rawmidi_open(/*in*/NULL,/*out*/&handle_out,
> 			     device,0);
>
> The code above will wait forever if the device is already taken.
> Opening the device with SND_RAWMIDI_NONBLOCK as last argument will get
> you past that point, but then the write operation may fail (returning
> negative) or return less bytes than you asked for to be written.

You can open the device with SND_RAWMIDI_NONBLOCK and then set it to
blocking mode with "snd_rawmidi_nonblock(handle_out, 0);".


HTH
Clemens




More information about the Linux-audio-dev mailing list