Improvements to comments etc.
[AROS.git] / workbench / libs / camd / getsysex.c
blob60c7d0dbdb71431023a5db5eef1eea3112bdc30a
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
10 #include <proto/exec.h>
12 #include "camd_intern.h"
15 /*****************************************************************************
17 NAME */
19 AROS_LH3(ULONG, GetSysEx,
21 /* SYNOPSIS */
22 AROS_LHA(struct MidiNode *, midinode, A0),
23 AROS_LHA(UBYTE *, Buf, A1),
24 AROS_LHA(ULONG, len, D0),
26 /* LOCATION */
27 struct CamdBase *, CamdBase, 27, Camd)
29 /* FUNCTION
30 Remind me to fill in things here later.
32 INPUTS
34 RESULT
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 SkipSysEx(), QuerySysEx()
45 INTERNALS
47 HISTORY
49 2001-01-12 ksvalast first created
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 struct MyMidiNode *mymidinode=(struct MyMidiNode *)midinode;
56 ULONG numread=0;
57 UBYTE data;
59 if(mymidinode->sysex_nextis0==TRUE) return 0;
61 ObtainSemaphore(&mymidinode->sysexsemaphore2);
63 mymidinode->sysex_nextis0=FALSE;
65 while(numread<len){
66 data=*mymidinode->sysex_read;
67 mymidinode->sysex_read++;
68 if(mymidinode->sysex_read==mymidinode->sysex_end){
69 mymidinode->sysex_read=mymidinode->sysex_start;
71 Buf[numread]=data;
72 numread++;
74 if(data==0xf7){
75 mymidinode->sysex_nextis0=TRUE;
76 break;
80 ReleaseSemaphore(&mymidinode->sysexsemaphore2);
83 return numread;
86 AROS_LIBFUNC_EXIT