2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
9 #include <proto/exec.h>
11 #include "camd_intern.h"
15 /*****************************************************************************
19 AROS_LH3(APTR
, GoodPutMidi
,
22 AROS_LHA(struct MidiLink
*, midilink
, A0
),
23 AROS_LHA(ULONG
, msg
, D0
),
24 AROS_LHA(ULONG
, maxbuff
, D1
),
27 struct CamdBase
*, CamdBase
, 39, Camd
)
30 This is a private function, and will probably be obsolete. Please don`t use.
35 NULL if success, driverdata if not.
44 PutMidi(), PutMidiMsg(), Midi2Driver()
50 2001-07-14 ksvalast first created
52 *****************************************************************************/
56 int len
=GetMsgLen(msg
);
58 struct DriverData
*driverdata
=NULL
;
59 struct MyMidiCluster
*mycluster
=(struct MyMidiCluster
*)midilink
->ml_Location
;
60 struct MyMidiMessage2 msg2
;
61 struct MidiLink
*midilink2
;
62 struct MyMidiNode
*mymidinode
;
64 if(len
==3) return NULL
; //Illegal message.
66 ObtainSemaphoreShared(&mycluster
->semaphore
);
68 if( ! (IsListEmpty(&mycluster
->cluster
.mcl_Receivers
))){
71 msg2
.data1
=0x7f&(msg
>>16);
72 msg2
.data2
=0x7f&(msg
>>8);
75 node
=mycluster
->cluster
.mcl_Receivers
.lh_Head
;
77 while(node
->ln_Succ
!=NULL
){
78 if(node
->ln_Type
==NT_USER
-MLTYPE_NTypes
){
79 driverdata
=Midi2Driver_internal((struct DriverData
*)node
,msg
,maxbuff
)?NULL
:(struct DriverData
*)node
;
81 midilink2
=(struct MidiLink
*)node
;
82 mymidinode
=(struct MyMidiNode
*)midilink2
->ml_MidiNode
;
83 ObtainSemaphore(&mymidinode
->receiversemaphore
);
84 PutMidi2Link(midilink2
,&msg2
,*mymidinode
->midinode
.mi_TimeStamp
);
85 ReleaseSemaphore(&mymidinode
->receiversemaphore
);
87 driverdata
=Midi2Driver_internal(driverdata
,msg
,maxbuff
)?NULL
:driverdata
;
94 ReleaseSemaphore(&mycluster
->semaphore
);