1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 8<title>MIDIReadAsync</title> 9</head> 10 11<body> 12 13<h1>MIDIReadAsync</h1> 14 15<h2>C Specification</h2> 16<dl><dd><pre><code> 17#include <revolution/midi.h> 18 19#define MIDI_CHAN0 0 20#define MIDI_CHAN1 1 21#define MIDI_CHAN2 2 22#define MIDI_CHAN3 3 23#define MIDI_MAX_CHAN 4 24 25#define MIDI_JSTAT_MASK 0x3a 26#define MIDI_JSTAT_FLAGS_SHIFT 4 27#define MIDI_JSTAT_FLAGS_MASK 0x30 28#define MIDI_JSTAT_SEND 0x08 29#define MIDI_JSTAT_RECV 0x02 30 31typedef void (*MIDICallback)(s32 chan, s32 ret); 32 33s32 MIDIReadAsync(s32 chan, u8* dst, u8* status, MIDICallback callback); 34</code></pre></dd></dl> 35 36<h2>Arguments</h2> 37<p> 38<TABLE border="1" > 39 <tr> 40<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>chan</EM></STRONG></CODE></TD> 41<TD width="520">One of the <code>MIDI_CHAN<em>n</em></code> Nintendo GameCube Controller Sockets.</TD> 42 </tr> 43 <tr> 44<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>dst</EM></STRONG></CODE></TD> 45<TD width="520">u8 type of pointer to the buffer storing read data.</TD> 46 </tr> 47 <tr> 48<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>status</EM></STRONG></CODE></TD> 49<TD width="520">Pointer to the u8 type of variable, which stores the status returned by the MIDI adapter. The value is masked using <CODE>MIDI_JSTAT_MASK</CODE> and is valid only when execution terminates normally.</TD> 50 </tr> 51 <tr> 52<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>callback</EM></STRONG></CODE></TD> 53<TD width="520">Callback function called when the process terminates.</TD> 54 </tr> 55</TABLE> 56</p> 57 58 59<h2>Return Values</h2> 60<p> 61Returns one of the following codes: Execution terminated normally as long as <CODE>MIDI_READY</CODE> was returned. 62<p> 63<code>MIDI_READY<br> MIDI_BUSY<br></code> 64</p> 65</p> 66 67<h2>Description</h2> 68<p> 69Asynchronously 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 <CODE>MIDIRead</CODE>. If the <CODE>MIDI_JSTAT_SEND</CODE> bit of <CODE>status</CODE> is 0, it indicates that the MIDI adapter has not yet output data. The function call will fail if a MIDI adapter is not connected. 70</p> 71 72<h2>See Also</h2> 73<p> 74<code><a href="./MIDIRead.html">MIDIRead</a></code> 75</p> 76 77<h2>Revision History</h2> 78<p> 792007/05/09 Initial version. <BR> 80</p> 81 82</body> 83</html> 84