1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
|
/*
* Copyright (c) 2004 by Hannu Savolainen < hannu@opensound.com>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include "local.h"
struct _snd_timer
{
int dummy;
};
struct _snd_timer_id
{
int dummy;
};
struct _snd_timer_info
{
int dummy;
};
/**
* \brief Opens a new connection to the timer interface.
* \param timer Returned handle (NULL if not wanted)
* \param name ASCII identifier of the timer handle
* \param mode Open mode
* \return 0 on success otherwise a negative error code
*
* Opens a new connection to the timer interface specified with
* an ASCII identifier and mode.
*/
int
snd_timer_open (snd_timer_t ** tmr, const char *name, int mode)
{
snd_timer_t *timer;
ALIB_INIT ();
if (!alib_appcheck ())
{
dbg_printf ("snd_timer_open(%s, %x) refused,\n", name, mode);
return -ENODEV;
}
timer = malloc (sizeof (*timer));
dbg_printf ("snd_timer_open(name='%s', mode=%x)=%p\n", name, mode, timer);
if (timer == NULL)
return -ENOMEM;
*tmr = timer;
return 0;
}
/**
* \brief close timer handle
* \param timer timer handle
* \return 0 on success otherwise a negative error code
*
* Closes the specified timer handle and frees all associated
* resources.
*/
int
snd_timer_close (snd_timer_t * timer)
{
dbg_printf ("snd_timer_close(%x)\n", timer);
free (timer);
return 0;
}
/**
* \brief get size of the snd_timer_id_t structure in bytes
* \return size of the snd_timer_id_t structure in bytes
*/
size_t
snd_timer_id_sizeof ()
{
return sizeof (snd_timer_id_t);
}
/**
* \brief get timer card
* \param params pointer to #snd_timer_id_t structure
* \return timer card number
*/
int
snd_timer_id_get_card (snd_timer_id_t * tid)
{
dbg_printf ("snd_timer_id_get_card(tid=%x)\n", tid);
return 0; // TODO
}
/**
* \brief get timer class
* \param tid pointer to #snd_timer_id_t structure
* \return timer class
*/
int
snd_timer_id_get_class (snd_timer_id_t * tid)
{
dbg_printf ("snd_timer_id_get_class(tid=%x)\n", tid);
return 0; // TODO
}
/**
* \brief get timer device
* \param params pointer to #snd_timer_id_t structure
* \return timer device number
*/
int
snd_timer_id_get_device (snd_timer_id_t * tid)
{
dbg_printf ("snd_timer_id_get_device(tid=%x)\n", tid);
return 0; // TODO
}
/**
* \brief get timer sub-class
* \param params pointer to #snd_timer_id_t structure
* \return timer sub-class
*/
int
snd_timer_id_get_sclass (snd_timer_id_t * tid)
{
dbg_printf ("snd_timer_id_get_sclass(tid=%x)\n", tid);
return 0; // TODO
}
/**
* \brief get timer subdevice
* \param params pointer to #snd_timer_id_t structure
* \return timer subdevice number
*/
int
snd_timer_id_get_subdevice (snd_timer_id_t * tid)
{
dbg_printf ("snd_timer_id_get_subdevice(tid=%x)\n", tid);
return 0; // TODO
}
/**
* \brief set timer card
* \param tid pointer to #snd_timer_id_t structure
* \param card card number
*/
void
snd_timer_id_set_card (snd_timer_id_t * tid, int card)
{
dbg_printf ("snd_timer_id_set_card(tid=%x, card=%d)\n", tid, card);
// TODO
}
/**
* \brief set timer class
* \param tid pointer to #snd_timer_id_t structure
* \param dev_class class of timer device
*/
void
snd_timer_id_set_class (snd_timer_id_t * tid, int dev_class)
{
dbg_printf ("snd_timer_id_set_class(tid=%x, dev_class=%d)\n", tid,
dev_class);
// TODO
}
/**
* \brief set timer device
* \param tid pointer to #snd_timer_id_t structure
* \param device device number
*/
void
snd_timer_id_set_device (snd_timer_id_t * tid, int device)
{
dbg_printf ("snd_timer_id_set_device(tid=%x, device=%d)\n", tid, device);
// TODO
}
/**
* \brief set timer sub-class
* \param tid pointer to #snd_timer_id_t structure
* \param dev_sclass sub-class of timer device
*/
void
snd_timer_id_set_sclass (snd_timer_id_t * tid, int dev_sclass)
{
dbg_printf ("snd_timer_id_set_sclass(tid=%x, dev_sclass=%d)\n",
tid, dev_sclass);
// TODO
}
/**
* \brief set timer subdevice
* \param tid pointer to #snd_timer_id_t structure
* \param subdevice subdevice number
*/
void
snd_timer_id_set_subdevice (snd_timer_id_t * tid, int subdevice)
{
dbg_printf ("snd_timer_id_set_subdevice(tid=%x, subdevice=%d)\n",
tid, subdevice);
// TODO
}
/**
* \brief get size of the snd_timer_info_t structure in bytes
* \return size of the snd_timer_info_t structure in bytes
*/
size_t
snd_timer_info_sizeof ()
{
return sizeof (snd_timer_info_t);
}
/**
* \brief allocate a new snd_timer_info_t structure
* \param ptr returned pointer
* \return 0 on success otherwise a negative error code if fails
*
* Allocates a new snd_timer_info_t structure using the standard
* malloc C library function.
*/
int
snd_timer_info_malloc (snd_timer_info_t ** info)
{
*info = calloc (1, sizeof (snd_timer_info_t));
dbg_printf ("snd_timer_info_malloc()=%x\n", *info);
if (!*info)
return -ENOMEM;
return 0;
}
/**
* \brief frees the snd_timer_info_t structure
* \param info pointer to the snd_timer_info_t structure to free
*
* Frees the given snd_timer_info_t structure using the standard
* free C library function.
*/
void
snd_timer_info_free (snd_timer_info_t * info)
{
dbg_printf ("snd_timer_info_free(%x)\n", info);
free (info);
}
/**
* \brief get information about timer handle
* \param timer timer handle
* \param info pointer to a snd_timer_info_t structure to be filled
* \return 0 on success otherwise a negative error code
*/
int
snd_timer_info (snd_timer_t * timer, snd_timer_info_t * info)
{
dbg_printf ("snd_timer_info(timer=%x, info=%x)\n", timer, info);
// TODO
return 0;
}
/**
* \brief get timer name
* \param info pointer to #snd_timer_info_t structure
* \return timer name
*/
const char *
snd_timer_info_get_name (snd_timer_info_t * info)
{
dbg_printf ("snd_timer_info_get_name(info=%x)\n", info);
return "OSS Timer"; // TODO
}
/**
* \brief get timer resolution in us
* \param info pointer to #snd_timer_info_t structure
* \return timer resolution
*/
long
snd_timer_info_get_resolution (snd_timer_info_t * info)
{
dbg_printf ("snd_timer_info_get_resolution(info=%x)\n", info);
return 1000; // TODO
}
static int
snd_timer_query_open_conf (snd_timer_query_t ** timer,
const char *name, snd_config_t * timer_root,
snd_config_t * timer_conf, int mode)
{
dbg_printf
("snd_timer_query_open_conf(name='%s', root=%x, conf=%x, mode=%x)\n",
name, timer_root, timer_conf, mode);
ALIB_INIT ();
if (!alib_appcheck ())
return -ENODEV;
return -EIO;
}
/**
* \brief close timer query handle
* \param timer timer handle
* \return 0 on success otherwise a negative error code
*
* Closes the specified timer handle and frees all associated
* resources.
*/
int
snd_timer_query_close (snd_timer_query_t * timer)
{
dbg_printf ("snd_timer_query_close(timer=%x)\n", timer);
return 0;
}
/**
* \brief obtain the next timer identification
* \param timer timer handle
* \param tid timer identification
* \return 0 on success otherwise a negative error code
*
* if tid->dev_class is -1, then the first device is returned
* if result tid->dev_class is -1, no more devices are left
*/
int
snd_timer_query_next_device (snd_timer_query_t * timer, snd_timer_id_t * tid)
{
dbg_printf ("snd_timer_query_next_device(timer=%x, tid=%x)\n", timer, tid);
return -1;
}
|