2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
9 #include <proto/exec.h>
11 #include "camd_intern.h"
13 /*****************************************************************************
17 AROS_LH1(void, DeleteMidi
,
20 AROS_LHA(struct MidiNode
*, midinode
, A0
),
23 struct CamdBase
*, CamdBase
, 8, Camd
)
26 First deletes all midilinks attached to the midinode, then
27 frees all buffers, before it frees itself.
45 2001-01-12 ksvalast first created
47 *****************************************************************************/
51 struct MyMidiNode
*mymidinode
=(struct MyMidiNode
*)midinode
;
52 struct MinNode
*node
,*temp
;
53 struct MidiLink
*midilink
;
55 ObtainSemaphore(CB(CamdBase
)->CLSemaphore
);
56 if( ! (IsListEmpty((struct List
*)&midinode
->mi_OutLinks
))){
57 node
=midinode
->mi_OutLinks
.mlh_Head
;
58 while(node
->mln_Succ
!=NULL
){
61 midilink
=GetMidiLinkFromOwnerNode(node
);
62 UnlinkMidiLink(midilink
,FALSE
,CamdBase
);
64 if(midilink
->ml_ParserData
!=NULL
) FreeMem(midilink
->ml_ParserData
,sizeof(struct DriverData
));
66 FreeMem(midilink
,sizeof(struct MidiLink
));
70 if( ! (IsListEmpty((struct List
*)&midinode
->mi_InLinks
))){
71 node
=midinode
->mi_InLinks
.mlh_Head
;
72 while(node
->mln_Succ
!=NULL
){
75 midilink
=GetMidiLinkFromOwnerNode(node
);
77 UnlinkMidiLink(midilink
,FALSE
,CamdBase
);
79 if(midilink
->ml_ParserData
!=NULL
) FreeMem(midilink
->ml_ParserData
,sizeof(struct DriverData
));
81 FreeMem(midilink
,sizeof(struct MidiLink
));
86 Remove(&midinode
->mi_Node
);
88 ReleaseSemaphore(CB(CamdBase
)->CLSemaphore
);
91 if(mymidinode
->in_start
!=NULL
){
92 FreeVec(mymidinode
->in_start
);
94 if(mymidinode
->sysex_start
!=NULL
){
95 FreeVec(mymidinode
->sysex_start
);
97 FreeMem(midinode
,sizeof(struct MyMidiNode
));