r4722@vps: verhaegs | 2007-05-06 13:11:19 -0400
[cake.git] / workbench / libs / camd / putmidi.c
blob779ed7812b3d6ee130d30d7f330f7214e1a3cea0
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <proto/dos.h>
10 #include <proto/camd.h>
11 #undef PutMidi
13 #include "camd_intern.h"
15 /*****************************************************************************
17 NAME */
19 AROS_LH2(void, PutMidi,
21 /* SYNOPSIS */
22 AROS_LHA(struct MidiLink *, link, A0),
23 AROS_LHA(ULONG, msg, D0),
25 /* LOCATION */
26 struct CamdBase *, CamdBase, 23, Camd)
28 /* FUNCTION
29 Puts a midimessage to hardware and all sender-links that belongs
30 to the midilink's cluster. Does only wait if a hardware send-
31 buffer is full, and then tries again and again until the message
32 is sent. Else, the function should return immediately.
34 INPUTS
35 link - pointer to the midilink to send to.
36 msg - The complete message to send. A message can not hold more
37 than 3 bytes, so it fits fine in a ULONG integer. See NOTES
38 to see how a message is built up.
40 RESULT
42 NOTES
43 Sending an illegal message may have serious consequences. If you for
44 some reason are not completely shure whether your message is legal,
45 you could do the following test:
47 if((msg>>24)<0x80 || (msg>>24)==0xf0 || (msg>>24)==0xf7 || (msg>>16&0xff)>0x7f || (msg>>8&0xff)>0x7f){
48 debug("Warning, illegal midimessage: %x\n",msg);
49 }else{
50 PutMidi(midilink,msg);
53 EXAMPLE
55 BUGS
57 SEE ALSO
58 PutMidiMsg
60 INTERNALS
62 HISTORY
64 2001-01-12 ksvalast first created
66 *****************************************************************************/
68 AROS_LIBFUNC_INIT
70 struct DriverData *driverdata;
72 #ifndef __amigaos4__
73 driverdata=GoodPutMidi(link,msg,OUTBUFFERSIZE-1);
74 #else
75 driverdata=GoodPutMidi(ICamd, link,msg,OUTBUFFERSIZE-1);
76 #endif
78 if(driverdata!=NULL){
79 while(Midi2Driver_internal(driverdata,msg,OUTBUFFERSIZE-1)==FALSE) CamdWait();
82 AROS_LIBFUNC_EXIT