Audio Toolkit - midireceive


: midimsg = midireceive (dev)
: midimsg = midireceive (dev, maxmsg)

Attempt to receive midi messages from a midi device.

Inputs

dev - a octave midi device opened using mididevice.
maxmsg - Maximum number of messages to retrieve. If not specified, the function will attempt to get all pending.

Outputs

midimsg - a midimsg containing the messages retrieved from the device.
If no messages are available, midimsg will be empty.

Examples

Open device 0, and poll and display read messages

 dev = mididevice(0);
 while true
    mx = midireceive(dev);
    if !isempty(mx)
      % display message
      mx
    endif
 endwhile
 

See also: mididevice, midisend.