Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / camd / deletemidi.c
blob5fefeaf7c71da31dfc6b60de50aabd716f29c0f3
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>
11 #include "camd_intern.h"
13 /*****************************************************************************
15 NAME */
17 AROS_LH1(void, DeleteMidi,
19 /* SYNOPSIS */
20 AROS_LHA(struct MidiNode *, midinode, A0),
22 /* LOCATION */
23 struct CamdBase *, CamdBase, 8, Camd)
25 /* FUNCTION
26 First deletes all midilinks attached to the midinode, then
27 frees all buffers, before it frees itself.
29 INPUTS
31 RESULT
33 NOTES
35 EXAMPLE
37 BUGS
39 SEE ALSO
41 INTERNALS
43 HISTORY
45 2001-01-12 ksvalast first created
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
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){
59 temp=node->mln_Succ;
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));
67 node=temp;
70 if( ! (IsListEmpty((struct List *)&midinode->mi_InLinks))){
71 node=midinode->mi_InLinks.mlh_Head;
72 while(node->mln_Succ!=NULL){
73 temp=node->mln_Succ;
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));
82 node=temp;
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));
99 AROS_LIBFUNC_EXIT