mdReceive(3dm)							mdReceive(3dm)
      mdReceive - Accept	MIDI events from a port
      #include <dmedia/midi.h>
     int mdReceive(MDport port,	MDevent	*evbuf,	int count)
     mdReceive reads MIDI events from the MIDI interface associated with port
     into the evbuf array.  evbuf must be allocated by the user	and must
     contain space for count MDevent structures. For most events, the actual
     MIDI event	is stored in the msg array of the MDevent, and the stamp field
     is	set to a stamp value whose format is determined	by the port's stamping
     mode (see mdSetStampMode).
     In	addition, when a system	exclusive event	is received, the MIDI library
     allocates a block of memory for the system	exclusive data and places a
     pointer to	the block of memory in the sysexmsg field of the event
     structure.	 The msg[0] byte in the	MDevent	structure contains a 0xF0
     (MD_SYSEX)	to indicate that a system exclusive message has	arrived.  The
     msglen field contains a count of the bytes	in data	buffer.	 Long system
     exclusive messages	may be decomposed into smaller chunks; the last
     message will have an 0xF7 (EOX) at	the end	of the sysexmsg	buffer.
     The application must release the sysexmsg buffer with mdFree(3dm) once it
     is	finished processing the	message.
     If	no events are available	when mdReceive is called, the routine will
     block until one or	more events arrive.  The application can avoid
     blocking by calling select(2) on the file descriptor returned by
     mdGetFd(3dm) before calling mdReceive.  mdReceive returns the number of
     events read.
     mdReceive returns the number of messages read from	the given port,	or -1
     on	error.	The following error codes are expected:
     ENOMEM   -	No memory was available	for incoming message storage.
     EFAULT   -	An invalid address was passed to the MIDI driver
     EINVAL   -	An undefined operation was called.
     mdIntro(3dm), mdFree(3dm),	mdSend(3dm), mvdSetStampMode(3dm)
									PPPPaaaaggggeeee 1111 [ Back ]
 |