#include <revolution/midi.h> #define MIDI_CHAN0 0 #define MIDI_CHAN1 1 #define MIDI_CHAN2 2 #define MIDI_CHAN3 3 #define MIDI_MAX_CHAN 4 #define MIDI_JSTAT_MASK 0x3a #define MIDI_JSTAT_FLAGS_SHIFT 4 #define MIDI_JSTAT_FLAGS_MASK 0x30 #define MIDI_JSTAT_SEND 0x08 #define MIDI_JSTAT_RECV 0x02 typedef void (*MIDICallback)(s32 chan, s32 ret); s32 MIDIReadAsync(s32 chan, u8* dst, u8* status, MIDICallback callback);
| chan | One of the MIDI_CHANn GameCube controller ports. |
|---|---|
| dst | u8 type of pointer to the buffer storing read data. |
| status | Pointer to the u8 type of variable, which stores the status value returned by the MIDI adapter. The value is masked using MIDI_JSTAT_MASK and is valid only when execution terminates normally. |
| callback | Callback function called when the process terminates. |
Returns one of the following codes. If MIDI_READY is returned, execution terminated normally.
MIDI_READY
MIDI_BUSY
Asynchronously issues a command for obtaining four bytes of data from the MIDI adapter. The specified callback function is called if the command is issued successfully and there is a response from the MIDI adapter. The second argument of the callback function is the same as the return value of the synchronous function MIDIRead. If the MIDI_JSTAT_SEND bit of status is 0, it indicates that the MIDI adapter has not yet output data. Function call will fail if a MIDI adapter is not connected.
2007/05/09 Initial version.
CONFIDENTIAL