2
* Copyright (c) 2004 by Hannu Savolainen < hannu@opensound.com>
4
* This library is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License version 2.1 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public
14
* License along with this library; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31
struct _snd_timer_info
37
* \brief Opens a new connection to the timer interface.
38
* \param timer Returned handle (NULL if not wanted)
39
* \param name ASCII identifier of the timer handle
40
* \param mode Open mode
41
* \return 0 on success otherwise a negative error code
43
* Opens a new connection to the timer interface specified with
44
* an ASCII identifier and mode.
47
snd_timer_open (snd_timer_t ** tmr, const char *name, int mode)
52
if (!alib_appcheck ())
54
dbg_printf ("snd_timer_open(%s, %x) refused,\n", name, mode);
58
timer = malloc (sizeof (*timer));
60
dbg_printf ("snd_timer_open(name='%s', mode=%x)=%p\n", name, mode, timer);
71
* \brief close timer handle
72
* \param timer timer handle
73
* \return 0 on success otherwise a negative error code
75
* Closes the specified timer handle and frees all associated
79
snd_timer_close (snd_timer_t * timer)
81
dbg_printf ("snd_timer_close(%x)\n", timer);
88
* \brief get size of the snd_timer_id_t structure in bytes
89
* \return size of the snd_timer_id_t structure in bytes
92
snd_timer_id_sizeof ()
94
return sizeof (snd_timer_id_t);
98
* \brief get timer card
99
* \param params pointer to #snd_timer_id_t structure
100
* \return timer card number
103
snd_timer_id_get_card (snd_timer_id_t * tid)
105
dbg_printf ("snd_timer_id_get_card(tid=%x)\n", tid);
111
* \brief get timer class
112
* \param tid pointer to #snd_timer_id_t structure
113
* \return timer class
116
snd_timer_id_get_class (snd_timer_id_t * tid)
118
dbg_printf ("snd_timer_id_get_class(tid=%x)\n", tid);
125
* \brief get timer device
126
* \param params pointer to #snd_timer_id_t structure
127
* \return timer device number
130
snd_timer_id_get_device (snd_timer_id_t * tid)
132
dbg_printf ("snd_timer_id_get_device(tid=%x)\n", tid);
138
* \brief get timer sub-class
139
* \param params pointer to #snd_timer_id_t structure
140
* \return timer sub-class
143
snd_timer_id_get_sclass (snd_timer_id_t * tid)
145
dbg_printf ("snd_timer_id_get_sclass(tid=%x)\n", tid);
151
* \brief get timer subdevice
152
* \param params pointer to #snd_timer_id_t structure
153
* \return timer subdevice number
156
snd_timer_id_get_subdevice (snd_timer_id_t * tid)
158
dbg_printf ("snd_timer_id_get_subdevice(tid=%x)\n", tid);
164
* \brief set timer card
165
* \param tid pointer to #snd_timer_id_t structure
166
* \param card card number
169
snd_timer_id_set_card (snd_timer_id_t * tid, int card)
171
dbg_printf ("snd_timer_id_set_card(tid=%x, card=%d)\n", tid, card);
177
* \brief set timer class
178
* \param tid pointer to #snd_timer_id_t structure
179
* \param dev_class class of timer device
182
snd_timer_id_set_class (snd_timer_id_t * tid, int dev_class)
184
dbg_printf ("snd_timer_id_set_class(tid=%x, dev_class=%d)\n", tid,
190
* \brief set timer device
191
* \param tid pointer to #snd_timer_id_t structure
192
* \param device device number
195
snd_timer_id_set_device (snd_timer_id_t * tid, int device)
197
dbg_printf ("snd_timer_id_set_device(tid=%x, device=%d)\n", tid, device);
203
* \brief set timer sub-class
204
* \param tid pointer to #snd_timer_id_t structure
205
* \param dev_sclass sub-class of timer device
208
snd_timer_id_set_sclass (snd_timer_id_t * tid, int dev_sclass)
210
dbg_printf ("snd_timer_id_set_sclass(tid=%x, dev_sclass=%d)\n",
216
* \brief set timer subdevice
217
* \param tid pointer to #snd_timer_id_t structure
218
* \param subdevice subdevice number
221
snd_timer_id_set_subdevice (snd_timer_id_t * tid, int subdevice)
223
dbg_printf ("snd_timer_id_set_subdevice(tid=%x, subdevice=%d)\n",
230
* \brief get size of the snd_timer_info_t structure in bytes
231
* \return size of the snd_timer_info_t structure in bytes
234
snd_timer_info_sizeof ()
236
return sizeof (snd_timer_info_t);
240
* \brief allocate a new snd_timer_info_t structure
241
* \param ptr returned pointer
242
* \return 0 on success otherwise a negative error code if fails
244
* Allocates a new snd_timer_info_t structure using the standard
245
* malloc C library function.
248
snd_timer_info_malloc (snd_timer_info_t ** info)
250
*info = calloc (1, sizeof (snd_timer_info_t));
251
dbg_printf ("snd_timer_info_malloc()=%x\n", *info);
258
* \brief frees the snd_timer_info_t structure
259
* \param info pointer to the snd_timer_info_t structure to free
261
* Frees the given snd_timer_info_t structure using the standard
262
* free C library function.
265
snd_timer_info_free (snd_timer_info_t * info)
267
dbg_printf ("snd_timer_info_free(%x)\n", info);
272
* \brief get information about timer handle
273
* \param timer timer handle
274
* \param info pointer to a snd_timer_info_t structure to be filled
275
* \return 0 on success otherwise a negative error code
278
snd_timer_info (snd_timer_t * timer, snd_timer_info_t * info)
280
dbg_printf ("snd_timer_info(timer=%x, info=%x)\n", timer, info);
288
* \brief get timer name
289
* \param info pointer to #snd_timer_info_t structure
293
snd_timer_info_get_name (snd_timer_info_t * info)
295
dbg_printf ("snd_timer_info_get_name(info=%x)\n", info);
297
return "OSS Timer"; // TODO
302
* \brief get timer resolution in us
303
* \param info pointer to #snd_timer_info_t structure
304
* \return timer resolution
307
snd_timer_info_get_resolution (snd_timer_info_t * info)
309
dbg_printf ("snd_timer_info_get_resolution(info=%x)\n", info);
316
snd_timer_query_open_conf (snd_timer_query_t ** timer,
317
const char *name, snd_config_t * timer_root,
318
snd_config_t * timer_conf, int mode)
321
("snd_timer_query_open_conf(name='%s', root=%x, conf=%x, mode=%x)\n",
322
name, timer_root, timer_conf, mode);
324
if (!alib_appcheck ())
331
* \brief close timer query handle
332
* \param timer timer handle
333
* \return 0 on success otherwise a negative error code
335
* Closes the specified timer handle and frees all associated
339
snd_timer_query_close (snd_timer_query_t * timer)
341
dbg_printf ("snd_timer_query_close(timer=%x)\n", timer);
347
* \brief obtain the next timer identification
348
* \param timer timer handle
349
* \param tid timer identification
350
* \return 0 on success otherwise a negative error code
352
* if tid->dev_class is -1, then the first device is returned
353
* if result tid->dev_class is -1, no more devices are left
356
snd_timer_query_next_device (snd_timer_query_t * timer, snd_timer_id_t * tid)
358
dbg_printf ("snd_timer_query_next_device(timer=%x, tid=%x)\n", timer, tid);