revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / camd / addmidilinka.c
blobcef16f5162a14be1bc3555eb24743d6fc5786eb7
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <proto/exec.h>
10 #ifndef __amigaos4__
11 # include <proto/camd.h>
12 #endif
14 #include "camd_intern.h"
15 # undef DEBUG
16 # define DEBUG 1
17 #ifndef __amigaos4__
18 # include AROS_DEBUG_H_FILE
19 #endif
21 #undef AddMidiLinkA
23 /*****************************************************************************
25 NAME */
27 AROS_LH3(struct MidiLink *, AddMidiLinkA,
29 /* SYNOPSIS */
30 AROS_LHA(struct MidiNode *, midinode, A0),
31 AROS_LHA(LONG, type, D0),
32 AROS_LHA(struct TagItem *, tags, A1),
34 /* LOCATION */
35 struct CamdBase *, CamdBase, 14, Camd)
37 /* FUNCTION
38 Adds a midilink to a midinode.
40 INPUTS
41 midinode - Owner.
42 type - MLTYPE_Receiver or MLTYPE_Sender
43 tags - Tag-values supplied to SetMidiLinkAttrs.
45 RESULT
47 NOTES
49 EXAMPLE
51 BUGS
53 SEE ALSO
54 CreateMidiA(), SetMidiLinkAttrsA()
56 INTERNALS
58 HISTORY
60 2001-01-12 ksvalast first created
62 *****************************************************************************/
64 AROS_LIBFUNC_INIT
65 struct MidiLink *midilink;
67 midilink=AllocMem(sizeof(struct MidiLink),MEMF_ANY | MEMF_CLEAR | MEMF_PUBLIC);
69 if(midilink==NULL) return NULL;
71 midilink->ml_MidiNode=midinode;
73 midilink->ml_Node.ln_Name="noname";
74 midilink->ml_Node.ln_Type=NT_USER-type;
76 midilink->ml_EventTypeMask=(ULONG)~0;
77 midilink->ml_ChannelMask=(UWORD)~0;
79 ObtainSemaphore(CB(CamdBase)->CLSemaphore);
80 if(type==MLTYPE_Receiver){
81 AddHead((struct List *)&midinode->mi_InLinks,(struct Node *)&midilink->ml_OwnerNode);
82 }else{
83 AddHead((struct List *)&midinode->mi_OutLinks,(struct Node *)&midilink->ml_OwnerNode);
85 ReleaseSemaphore(CB(CamdBase)->CLSemaphore);
87 #ifndef __amigaos4__
88 if(SetMidiLinkAttrsA(midilink,tags)==FALSE)
89 #else
90 if(SetMidiLinkAttrsA(ICamd, midilink,tags)==FALSE)
91 #endif
94 ObtainSemaphore(CB(CamdBase)->CLSemaphore);
95 Remove((struct Node *)&midilink->ml_OwnerNode);
96 ReleaseSemaphore(CB(CamdBase)->CLSemaphore);
97 FreeMem(midilink,sizeof(struct MidiLink));
98 return NULL;
102 return midilink;
104 AROS_LIBFUNC_EXIT
109 #ifdef __amigaos4__
110 #include <stdarg.h>
111 struct MidiLink * VARARGS68K AddMidiLink(
112 struct CamdIFace *Self,
113 struct MidiNode * mi,
114 LONG type,
118 va_list ap;
119 struct TagItem * varargs;
120 va_startlinear(ap, type);
121 varargs = va_getlinearva(ap, struct TagItem *);
122 return AddMidiLinkA(Self,
124 type,
125 varargs);
128 #endif