2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
6 # include <aros/debug.h>
8 #include <proto/exec.h>
9 #include <proto/realtime.h>
10 #include <proto/utility.h>
11 #include <exec/memory.h>
12 #include <utility/tagitem.h>
13 #include "realtime_intern.h"
15 /*****************************************************************************
18 #include <libraries/realtime.h>
20 AROS_LH1(struct Player
*, CreatePlayerA
,
24 AROS_LHA(struct TagItem
*, tagList
, A0
),
28 struct Library
*, RealTimeBase
, 7, RealTime
)
36 tagList -- pointer to an array of tags describing the player's
41 PLAYER_Name (STRPTR) -- The name of the player; default is no
44 PLAYER_Hook (struct Hook *) -- Function to call every time the time
45 changes; default is none. The hook is
48 a0 -- address of Hook structure
49 a1 -- message (see <libraries/realtime.h>)
50 a2 -- address of Player structure
52 Be aware of that the function is not
53 necessarily called TICK_FREQ times per
54 second: this is the upper limit of times
57 PLAYER_Priority (BYTE) -- The priority of the player; default is 0.
59 PLAYER_Conductor (STRPTR) -- The name of the conductor to link the
60 player to. If the conductor doesn't exist,
61 it's created automatically. Passing ~0
62 creates a private conductor.
64 PLAYER_Ready (BOOL) -- Set / clear the ready flag; default is
67 PLAYER_AlarmTime (LONG) -- Set player's alarm time; implies setting
68 the PLAYERF_ALARMSET flag.
70 PLAYER_Alarm (BOOL) -- Set / clear the PLAYERF_ALARMSET flag;
73 PLAYER_AlarmSigTask (struct Task *)
74 -- The task to signal when the alarm goes
75 off; default is no task. If no task is
76 specified PLAYERF_ALARMSET is turned
79 PLAYER_AlarmSigBit (BYTE) -- Signal bit to use for the alarm or -1
80 to disable signalling; default is -1.
82 PLAYER_Quiet (BOOL) -- Specify whether this player should be
83 ignored or not; default is FALSE.
84 Generally only used by external sync
87 PLAYER_UserData (VOID *) -- Set pointer to user specific data;
90 PLAYER_ID (UWORD) -- Set the player's ID; default is 0.
92 PLAYER_Conducted (BOOL) -- Set / clear the PLAYERF_CONDUCTED flag;
95 PLAYER_ExtSync (BOOL) -- If TRUE, this player attempts to become
96 the external sync source.
98 PLAYER_ErrorCode (LONG *) -- Optional pointer to a LONG that will
99 contain an error code if the function
100 fails. Possible error values are:
102 RTE_NOMEMORY -- memory allocation failed
103 RTE_NOTIMER -- timer allocation failed
107 A pointer to a player structure or NULL if failure. In case of a failure
108 additional information may be retreived from the LONG variable pointed
109 to by PLAYER_ErrorCode if you have specified that tag.
119 DeletePlayer(), GetPlayerAttrsA(), SetPlayerAttrsA()
123 ******************************************************************************/
128 struct Player
*player
= AllocMem(sizeof(struct Player
),
129 MEMF_PUBLIC
| MEMF_CLEAR
);
132 D(bug("Entering CreatePlayerA()\n"));
134 error
= (LONG
*) GetTagData(PLAYER_ErrorCode
, (IPTR
) NULL
, tagList
);
140 *error
= RTE_NOMEMORY
;
146 /* Set default values */
147 player
->pl_Reserved0
= -1; /* AlarmSigBit */
148 player
->pl_Flags
|= PLAYERF_READY
;
150 D(bug("Calling SetPlayerAttrsA()\n"));
152 if (SetPlayerAttrsA(player
, tagList
))
162 } /* CreatePlayerA */