2 Copyright © 2001, The AROS Development Team. All rights reserved.
5 Desc: Test program for RealTime.library
10 #include <aros/debug.h>
11 #include <aros/asmcall.h>
12 #include <proto/exec.h>
13 #include <proto/dos.h>
15 #include <exec/memory.h>
16 #include <utility/hooks.h>
17 #include <utility/tagitem.h>
19 #include <libraries/realtime.h>
20 #include <proto/realtime.h>
26 AROS_UFP3(ULONG
, myFunc
,
27 AROS_UFPA(struct Hook
* , hook
, A0
),
28 AROS_UFPA(struct pmTime
*, message
, A1
),
29 AROS_UFPA(struct Player
*, player
, A2
));
32 int main(int argc
, char* argv
[])
34 struct Library
*RealTimeBase
= OpenLibrary("realtime.library", 40);
37 struct TagItem tags
[] = { { PLAYER_Name
, (IPTR
)"Test player" },
38 { PLAYER_Hook
, (IPTR
)&myHook
},
39 { PLAYER_Conductor
, (IPTR
)"Test conductor" },
40 { TAG_DONE
, (IPTR
)NULL
} };
42 struct Player
*player
;
44 myHook
.h_Entry
= (HOOKFUNC
)myFunc
;
45 myHook
.h_SubEntry
= NULL
;
48 if (RealTimeBase
== NULL
)
50 printf("Couldn't open realtime.library\n");
54 player
= CreatePlayerA(tags
);
58 printf("Couldn't create player\n");
59 CloseLibrary(RealTimeBase
);
63 SetConductorState(player
, CONDSTATE_RUNNING
, 0);
66 struct TagItem tags
[] = { { PLAYER_Ready
, TRUE
},
69 SetPlayerAttrsA(player
, tags
);
72 Wait(SIGBREAKF_CTRL_C
);
76 CloseLibrary(RealTimeBase
);
82 AROS_UFH3(ULONG
, myFunc
,
83 AROS_UFHA(struct Hook
* , hook
, A0
),
84 AROS_UFHA(struct pmTime
*, message
, A1
),
85 AROS_UFHA(struct Player
*, player
, A2
))
89 switch (message
->pmt_Method
)
92 kprintf("Tick at clock %u\n", message
->pmt_Time
);
96 kprintf("Position change: Clock %u\n", message
->pmt_Time
);
100 kprintf("Shuttling into clock %u\n", message
->pmt_Time
);
104 kprintf("State change... old state = %u\n",
105 ((struct pmState
*)message
)->pms_OldState
);
108 kprintf("Error: Bogus message with method %u\n", message
->pmt_Method
);