2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
9 #include <proto/exec.h>
11 # include <proto/camd.h>
14 #include "camd_intern.h"
18 # include AROS_DEBUG_H_FILE
23 /*****************************************************************************
27 AROS_LH3(struct MidiLink
*, AddMidiLinkA
,
30 AROS_LHA(struct MidiNode
*, midinode
, A0
),
31 AROS_LHA(LONG
, type
, D0
),
32 AROS_LHA(struct TagItem
*, tags
, A1
),
35 struct CamdBase
*, CamdBase
, 14, Camd
)
38 Adds a midilink to a midinode.
42 type - MLTYPE_Receiver or MLTYPE_Sender
43 tags - Tag-values supplied to SetMidiLinkAttrs.
54 CreateMidiA(), SetMidiLinkAttrsA()
60 2001-01-12 ksvalast first created
62 *****************************************************************************/
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
);
83 AddHead((struct List
*)&midinode
->mi_OutLinks
,(struct Node
*)&midilink
->ml_OwnerNode
);
85 ReleaseSemaphore(CB(CamdBase
)->CLSemaphore
);
88 if(SetMidiLinkAttrsA(midilink
,tags
)==FALSE
)
90 if(SetMidiLinkAttrsA(ICamd
, midilink
,tags
)==FALSE
)
94 ObtainSemaphore(CB(CamdBase
)->CLSemaphore
);
95 Remove((struct Node
*)&midilink
->ml_OwnerNode
);
96 ReleaseSemaphore(CB(CamdBase
)->CLSemaphore
);
97 FreeMem(midilink
,sizeof(struct MidiLink
));
111 struct MidiLink
* VARARGS68K
AddMidiLink(
112 struct CamdIFace
*Self
,
113 struct MidiNode
* mi
,
119 struct TagItem
* varargs
;
120 va_startlinear(ap
, type
);
121 varargs
= va_getlinearva(ap
, struct TagItem
*);
122 return AddMidiLinkA(Self
,