snd_rawmidi_open

Name

snd_rawmidi_open -- open a RawMidi device

Synopsis

int snd_rawmidi_open(snd_rawmidi_t **handle, int card, int device, int mode);

Description

Creates a new handle and opens a connection to the kernel sound audio interface for sound card number card (0-N) and RawMidi device number device. Function also checks if protocol is compatible to prevent use of old programs with a new kernel API. Function returns zero if successful, otherwise it returns an error code. Error code -EBUSY is returned when another process owns the selected direction.

The following modes should be used for the mode argument:

#define SND_RAWMIDI_OPEN_OUTPUT		(O_WRONLY)
#define SND_RAWMIDI_OPEN_OUTPUT_APPEND	(O_WRONLY|O_APPEND|O_NONBLOCK)
#define SND_RAWMIDI_OPEN_INPUT		(O_RDONLY)
#define SND_RAWMIDI_OPEN_DUPLEX		(O_RDWR)
#define SND_RAWMIDI_OPEN_DUPLEX_APPEND	(O_RDWR|O_APPEND|O_NONBLOCK)
#define SND_RAWMIDI_OPEN_NONBLOCK	(O_NONBLOCK)