4 #include <devices/ahi.h>
5 #include <exec/execbase.h>
6 #include <libraries/ahi_sub.h>
8 #include "DriverData.h"
11 #define dd ((struct VoidData*) AudioCtrl->ahiac_DriverData)
13 /******************************************************************************
14 ** The slave process **********************************************************
15 ******************************************************************************/
19 void Slave( struct ExecBase
* SysBase
);
21 #if defined( __AROS__ )
23 #include <aros/asmcall.h>
25 AROS_UFH3(void, SlaveEntry
,
26 AROS_UFHA(STRPTR
, argPtr
, A0
),
27 AROS_UFHA(ULONG
, argSize
, D0
),
28 AROS_UFHA(struct ExecBase
*, SysBase
, A6
))
39 struct ExecBase
* SysBase
= *((struct ExecBase
**) 4);
46 Slave( struct ExecBase
* SysBase
)
48 struct AHIAudioCtrlDrv
* AudioCtrl
;
49 struct DriverBase
* AHIsubBase
;
53 /* Note that in OS4, we cannot call FindTask(NULL) here, since IExec
54 * is inside AHIsubBase! */
55 AudioCtrl
= (struct AHIAudioCtrlDrv
*) FindTask(NULL
)->tc_UserData
;
56 AHIsubBase
= (struct DriverBase
*) dd
->ahisubbase
;
58 dd
->slavesignal
= AllocSignal( -1 );
60 if( dd
->slavesignal
!= -1 )
62 // Everything set up. Tell Master we're alive and healthy.
64 Signal( (struct Task
*) dd
->mastertask
,
65 1L << dd
->mastersignal
);
71 signals
= SetSignal(0L,0L);
73 if( signals
& ( SIGBREAKF_CTRL_C
| (1L << dd
->slavesignal
) ) )
79 CallHookPkt( AudioCtrl
->ahiac_PlayerFunc
, AudioCtrl
, NULL
);
80 CallHookPkt( AudioCtrl
->ahiac_MixerFunc
, AudioCtrl
, dd
->mixbuffer
);
82 // The mixing buffer is now filled with AudioCtrl->ahiac_BuffSamples
83 // of sample frames (type AudioCtrl->ahiac_BuffType). Send them
84 // to the sound card here.
89 FreeSignal( dd
->slavesignal
);
94 // Tell the Master we're dying
96 Signal( (struct Task
*) dd
->mastertask
,
97 1L << dd
->mastersignal
);
101 // Multitaking will resume when we are dead.