Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / camd / createmidia.c
blob67581d9477e354a003ffa00013ba96011de0a8c1
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/utility.h>
7 #include <proto/exec.h>
8 #ifndef __amigaos4__
9 # include <proto/camd.h>
10 #endif
12 #include "camd_intern.h"
14 #undef CreateMidiA
16 /*****************************************************************************
18 NAME */
20 AROS_LH1(struct MidiNode *, CreateMidiA,
22 /* SYNOPSIS */
23 AROS_LHA(struct TagItem *, tags, A0),
25 /* LOCATION */
26 struct CamdBase *, CamdBase, 7, Camd)
28 /* FUNCTION
30 INPUTS
31 tags - Tag-values supplied to SetMidiAttrs.
33 RESULT
34 NULL if failed.
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
44 INTERNALS
46 *****************************************************************************/
48 AROS_LIBFUNC_INIT
50 struct MyMidiNode *midinode;
53 midinode=AllocMem(sizeof(struct MyMidiNode),MEMF_ANY | MEMF_CLEAR | MEMF_PUBLIC);
54 if(midinode==NULL) return NULL;
56 #ifndef __amigaos4__
57 NEWLIST((struct List *)&midinode->midinode.mi_OutLinks);
58 NEWLIST((struct List *)&midinode->midinode.mi_InLinks);
59 #else
60 NEWMINLIST(midinode->midinode.mi_OutLinks);
61 NEWMINLIST(midinode->midinode.mi_InLinks);
62 #endif
64 midinode->midinode.mi_Node.ln_Name="unnamed";
66 midinode->midinode.mi_SigTask=FindTask(0);
68 midinode->midinode.mi_ReceiveSigBit=-1;
69 midinode->midinode.mi_ParticipantSigBit=-1;
71 midinode->midinode.mi_TimeStamp=&midinode->dummytimestamp;
73 InitSemaphore(&midinode->receiversemaphore);
74 InitSemaphore(&midinode->sysexsemaphore);
75 InitSemaphore(&midinode->sysexsemaphore2);
77 #ifndef __amigaos4__
78 if(!SetMidiAttrsA(&midinode->midinode,tags))
79 #else
80 if(!SetMidiAttrsA(ICamd, &midinode->midinode,tags))
81 #endif
83 FreeMem(midinode,sizeof(struct MyMidiNode));
84 return NULL;
87 ObtainSemaphore(CB(CamdBase)->CLSemaphore);
88 AddHead(&CB(CamdBase)->mymidinodes,&midinode->midinode.mi_Node);
89 ReleaseSemaphore(CB(CamdBase)->CLSemaphore);
91 return (struct MidiNode *)midinode;
92 AROS_LIBFUNC_EXIT
98 #ifdef __amigaos4__
99 #include <stdarg.h>
100 struct MidiNode * VARARGS68K CreateMidi(
101 struct CamdIFace *Self,
105 va_list ap;
106 struct TagItem * varargs;
107 va_startlinear(ap, Self);
108 varargs = va_getlinearva(ap, struct TagItem *);
110 return CreateMidiA(Self,
111 varargs);
113 #endif