mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Added encapsulation for timer interface
This commit is contained in:
parent
bf858b7312
commit
24945eca0c
5 changed files with 577 additions and 21 deletions
|
|
@ -68,6 +68,12 @@ typedef struct sndrv_seq_instr snd_seq_instr_t;
|
|||
typedef struct sndrv_seq_event snd_seq_event_t;
|
||||
#define snd_seq_instr_cluster_t sndrv_seq_instr_cluster_t
|
||||
|
||||
#define _snd_timer_id sndrv_timer_id
|
||||
#define _snd_timer_select sndrv_timer_select
|
||||
#define _snd_timer_info sndrv_timer_info
|
||||
#define _snd_timer_params sndrv_timer_params
|
||||
#define _snd_timer_status sndrv_timer_status
|
||||
|
||||
#include "asoundlib.h"
|
||||
#include "list.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -11,16 +11,14 @@
|
|||
* \{
|
||||
*/
|
||||
|
||||
/** timer identification */
|
||||
typedef struct sndrv_timer_id snd_timer_id_t;
|
||||
/** timer select structure */
|
||||
typedef struct sndrv_timer_select snd_timer_select_t;
|
||||
/** timer identification structure */
|
||||
typedef struct _snd_timer_id snd_timer_id_t;
|
||||
/** timer info structure */
|
||||
typedef struct sndrv_timer_info snd_timer_info_t;
|
||||
/** timer parameters structure */
|
||||
typedef struct sndrv_timer_params snd_timer_params_t;
|
||||
typedef struct _snd_timer_info snd_timer_info_t;
|
||||
/** timer params structure */
|
||||
typedef struct _snd_timer_params snd_timer_params_t;
|
||||
/** timer status structure */
|
||||
typedef struct sndrv_timer_status snd_timer_status_t;
|
||||
typedef struct _snd_timer_status snd_timer_status_t;
|
||||
/** timer read structure */
|
||||
typedef struct sndrv_timer_read snd_timer_read_t;
|
||||
|
||||
|
|
@ -48,11 +46,6 @@ typedef enum _snd_timer_slave_class {
|
|||
/** global timer - RTC */
|
||||
#define SND_TIMER_GLOBAL_RTC SNDRV_TIMER_GLOBAL_RTC
|
||||
|
||||
/** timer cannot be controlled */
|
||||
#define SND_TIMER_FLG_SLAVE SNDRV_TIMER_FLG_SLAVE
|
||||
/** timer supports auto-start */
|
||||
#define SND_TIMER_PSFLG_AUTO SNDRV_TIMER_PSFLG_AUTO
|
||||
|
||||
/** timer open mode flag - nonblock */
|
||||
#define SND_TIMER_OPEN_NONBLOCK 1
|
||||
|
||||
|
|
@ -91,6 +84,64 @@ int snd_timer_stop(snd_timer_t *handle);
|
|||
int snd_timer_continue(snd_timer_t *handle);
|
||||
ssize_t snd_timer_read(snd_timer_t *handle, void *buffer, size_t size);
|
||||
|
||||
size_t snd_timer_id_sizeof(void);
|
||||
/** allocate #snd_timer_id_t container on stack */
|
||||
#define snd_timer_id_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_id_t *) alloca(snd_timer_id_sizeof()); memset(*ptr, 0, snd_timer_id_sizeof()); } while (0)
|
||||
int snd_timer_id_malloc(snd_timer_id_t **ptr);
|
||||
void snd_timer_id_free(snd_timer_id_t *obj);
|
||||
void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src);
|
||||
|
||||
void snd_timer_id_set_class(snd_timer_id_t *id, int class);
|
||||
int snd_timer_id_get_class(snd_timer_id_t *id);
|
||||
void snd_timer_id_set_sclass(snd_timer_id_t *id, int sclass);
|
||||
int snd_timer_id_get_sclass(snd_timer_id_t *id);
|
||||
void snd_timer_id_set_card(snd_timer_id_t *id, int card);
|
||||
int snd_timer_id_get_card(snd_timer_id_t *id);
|
||||
void snd_timer_id_set_device(snd_timer_id_t *id, int device);
|
||||
int snd_timer_id_get_device(snd_timer_id_t *id);
|
||||
void snd_timer_id_set_subdevice(snd_timer_id_t *id, int subdevice);
|
||||
int snd_timer_id_get_subdevice(snd_timer_id_t *id);
|
||||
|
||||
size_t snd_timer_info_sizeof(void);
|
||||
/** allocate #snd_timer_info_t container on stack */
|
||||
#define snd_timer_info_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_info_t *) alloca(snd_timer_info_sizeof()); memset(*ptr, 0, snd_timer_info_sizeof()); } while (0)
|
||||
int snd_timer_info_malloc(snd_timer_info_t **ptr);
|
||||
void snd_timer_info_free(snd_timer_info_t *obj);
|
||||
void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src);
|
||||
|
||||
int snd_timer_info_is_slave(snd_timer_info_t * info);
|
||||
int snd_timer_info_get_card(snd_timer_info_t * info);
|
||||
const char *snd_timer_info_get_id(snd_timer_info_t * info);
|
||||
const char *snd_timer_info_get_name(snd_timer_info_t * info);
|
||||
long snd_timer_info_get_ticks(snd_timer_info_t * info);
|
||||
long snd_timer_info_get_resolution(snd_timer_info_t * info);
|
||||
|
||||
size_t snd_timer_params_sizeof(void);
|
||||
/** allocate #snd_timer_params_t container on stack */
|
||||
#define snd_timer_params_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_params_t *) alloca(snd_timer_params_sizeof()); memset(*ptr, 0, snd_timer_params_sizeof()); } while (0)
|
||||
int snd_timer_params_malloc(snd_timer_params_t **ptr);
|
||||
void snd_timer_params_free(snd_timer_params_t *obj);
|
||||
void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src);
|
||||
|
||||
void snd_timer_params_set_auto_start(snd_timer_params_t * params, int auto_start);
|
||||
void snd_timer_params_set_ticks(snd_timer_params_t * params, long ticks);
|
||||
int snd_timer_params_get_ticks(snd_timer_params_t * params);
|
||||
void snd_timer_params_set_queue_size(snd_timer_params_t * params, long queue_size);
|
||||
long snd_timer_params_get_queue_size(snd_timer_params_t * params);
|
||||
|
||||
size_t snd_timer_status_sizeof(void);
|
||||
/** allocate #snd_timer_status_t container on stack */
|
||||
#define snd_timer_status_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_status_t *) alloca(snd_timer_status_sizeof()); memset(*ptr, 0, snd_timer_status_sizeof()); } while (0)
|
||||
int snd_timer_status_malloc(snd_timer_status_t **ptr);
|
||||
void snd_timer_status_free(snd_timer_status_t *obj);
|
||||
void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src);
|
||||
|
||||
struct timeval snd_timer_status_get_timestamp(snd_timer_status_t * status);
|
||||
long snd_timer_status_get_resolution(snd_timer_status_t * status);
|
||||
long snd_timer_status_get_lost(snd_timer_status_t * status);
|
||||
long snd_timer_status_get_overrun(snd_timer_status_t * status);
|
||||
long snd_timer_status_get_queue(snd_timer_status_t * status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -263,6 +263,122 @@ int snd_timer_nonblock(snd_timer_t *timer, int nonblock)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(info);
|
||||
*info = calloc(1, sizeof(snd_timer_info_t));
|
||||
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)
|
||||
{
|
||||
assert(info);
|
||||
free(info);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief copy one snd_timer_info_t structure to another
|
||||
* \param dst destination snd_timer_info_t structure
|
||||
* \param src source snd_timer_info_t structure
|
||||
*/
|
||||
void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src)
|
||||
{
|
||||
assert(dst && src);
|
||||
*dst = *src;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief determine, if timer is slave
|
||||
* \param info pointer to #snd_timer_info_t structure
|
||||
* \return nonzero if timer is slave
|
||||
*/
|
||||
int snd_timer_info_is_slave(snd_timer_info_t * info)
|
||||
{
|
||||
assert(info);
|
||||
return info->flags & SNDRV_TIMER_FLG_SLAVE ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get timer card
|
||||
* \param info pointer to #snd_timer_info_t structure
|
||||
* \return timer card number
|
||||
*/
|
||||
int snd_timer_info_get_card(snd_timer_info_t * info)
|
||||
{
|
||||
assert(info);
|
||||
return info->card;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get timer id
|
||||
* \param info pointer to #snd_timer_info_t structure
|
||||
* \return timer id
|
||||
*/
|
||||
const char *snd_timer_info_get_id(snd_timer_info_t * info)
|
||||
{
|
||||
assert(info);
|
||||
return info->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(info);
|
||||
return info->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get maximum timer ticks
|
||||
* \param info pointer to #snd_timer_info_t structure
|
||||
* \return maximum timer ticks
|
||||
*/
|
||||
long snd_timer_info_get_ticks(snd_timer_info_t * info)
|
||||
{
|
||||
assert(info);
|
||||
return info->ticks;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(info);
|
||||
return info->resolution;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get information about timer handle
|
||||
* \param timer timer handle
|
||||
|
|
@ -276,6 +392,122 @@ int snd_timer_info(snd_timer_t *timer, snd_timer_info_t * info)
|
|||
return timer->ops->info(timer, info);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get size of the snd_timer_params_t structure in bytes
|
||||
* \return size of the snd_timer_params_t structure in bytes
|
||||
*/
|
||||
size_t snd_timer_params_sizeof()
|
||||
{
|
||||
return sizeof(snd_timer_params_t);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief allocate a new snd_timer_params_t structure
|
||||
* \param ptr returned pointer
|
||||
* \return 0 on success otherwise a negative error code if fails
|
||||
*
|
||||
* Allocates a new snd_timer_params_t structure using the standard
|
||||
* malloc C library function.
|
||||
*/
|
||||
int snd_timer_params_malloc(snd_timer_params_t **params)
|
||||
{
|
||||
assert(params);
|
||||
*params = calloc(1, sizeof(snd_timer_params_t));
|
||||
if (!*params)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief frees the snd_timer_params_t structure
|
||||
* \param params pointer to the snd_timer_params_t structure to free
|
||||
*
|
||||
* Frees the given snd_timer_params_t structure using the standard
|
||||
* free C library function.
|
||||
*/
|
||||
void snd_timer_params_free(snd_timer_params_t *params)
|
||||
{
|
||||
assert(params);
|
||||
free(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief copy one snd_timer_params_t structure to another
|
||||
* \param dst destination snd_timer_params_t structure
|
||||
* \param src source snd_timer_params_t structure
|
||||
*/
|
||||
void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src)
|
||||
{
|
||||
assert(dst && src);
|
||||
*dst = *src;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set timer auto start
|
||||
* \param params pointer to #snd_timer_params_t structure
|
||||
*/
|
||||
void snd_timer_params_set_auto_start(snd_timer_params_t * params, int auto_start)
|
||||
{
|
||||
assert(params);
|
||||
if (auto_start)
|
||||
params->flags |= SNDRV_TIMER_PSFLG_AUTO;
|
||||
else
|
||||
params->flags &= ~SNDRV_TIMER_PSFLG_AUTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief determine if timer has auto start flag
|
||||
* \param params pointer to #snd_timer_params_t structure
|
||||
* \return nonzero if timer has auto start flag
|
||||
*/
|
||||
int snd_timer_params_get_auto_start(snd_timer_params_t * params)
|
||||
{
|
||||
assert(params);
|
||||
return params->flags & SNDRV_TIMER_PSFLG_AUTO ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set timer ticks
|
||||
* \param params pointer to #snd_timer_params_t structure
|
||||
*/
|
||||
void snd_timer_params_set_ticks(snd_timer_params_t * params, long ticks)
|
||||
{
|
||||
assert(params);
|
||||
params->ticks = ticks;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get timer ticks
|
||||
* \param params pointer to #snd_timer_params_t structure
|
||||
* \return timer ticks
|
||||
*/
|
||||
int snd_timer_params_get_ticks(snd_timer_params_t * params)
|
||||
{
|
||||
assert(params);
|
||||
return params->ticks;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set timer queue size (32-1024)
|
||||
* \param params pointer to #snd_timer_params_t structure
|
||||
*/
|
||||
void snd_timer_params_set_queue_size(snd_timer_params_t * params, long queue_size)
|
||||
{
|
||||
assert(params);
|
||||
params->queue_size = queue_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get queue size
|
||||
* \param params pointer to #snd_timer_params_t structure
|
||||
* \return queue size
|
||||
*/
|
||||
long snd_timer_params_get_queue_size(snd_timer_params_t * params)
|
||||
{
|
||||
assert(params);
|
||||
return params->queue_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief set parameters for timer handle
|
||||
* \param timer timer handle
|
||||
|
|
@ -289,6 +521,113 @@ int snd_timer_params(snd_timer_t *timer, snd_timer_params_t * params)
|
|||
return timer->ops->params(timer, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get size of the snd_timer_status_t structure in bytes
|
||||
* \return size of the snd_timer_status_t structure in bytes
|
||||
*/
|
||||
size_t snd_timer_status_sizeof()
|
||||
{
|
||||
return sizeof(snd_timer_status_t);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief allocate a new snd_timer_status_t structure
|
||||
* \param ptr returned pointer
|
||||
* \return 0 on success otherwise a negative error code if fails
|
||||
*
|
||||
* Allocates a new snd_timer_status_t structure using the standard
|
||||
* malloc C library function.
|
||||
*/
|
||||
int snd_timer_status_malloc(snd_timer_status_t **status)
|
||||
{
|
||||
assert(status);
|
||||
*status = calloc(1, sizeof(snd_timer_status_t));
|
||||
if (!*status)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief frees the snd_timer_status_t structure
|
||||
* \param status pointer to the snd_timer_status_t structure to free
|
||||
*
|
||||
* Frees the given snd_timer_status_t structure using the standard
|
||||
* free C library function.
|
||||
*/
|
||||
void snd_timer_status_free(snd_timer_status_t *status)
|
||||
{
|
||||
assert(status);
|
||||
free(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief copy one snd_timer_status_t structure to another
|
||||
* \param dst destination snd_timer_status_t structure
|
||||
* \param src source snd_timer_status_t structure
|
||||
*/
|
||||
void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src)
|
||||
{
|
||||
assert(dst && src);
|
||||
*dst = *src;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief get timestamp
|
||||
* \param status pointer to #snd_timer_status_t structure
|
||||
* \return timestamp
|
||||
*/
|
||||
struct timeval snd_timer_status_get_timestamp(snd_timer_status_t * status)
|
||||
{
|
||||
assert(status);
|
||||
return status->tstamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get resolution in us
|
||||
* \param status pointer to #snd_timer_status_t structure
|
||||
* \return resolution
|
||||
*/
|
||||
long snd_timer_status_get_resolution(snd_timer_status_t * status)
|
||||
{
|
||||
assert(status);
|
||||
return status->resolution;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get master tick lost count
|
||||
* \param status pointer to #snd_timer_status_t structure
|
||||
* \return master tick lost count
|
||||
*/
|
||||
long snd_timer_status_get_lost(snd_timer_status_t * status)
|
||||
{
|
||||
assert(status);
|
||||
return status->lost;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get overrun count
|
||||
* \param status pointer to #snd_timer_status_t structure
|
||||
* \return overrun count
|
||||
*/
|
||||
long snd_timer_status_get_overrun(snd_timer_status_t * status)
|
||||
{
|
||||
assert(status);
|
||||
return status->overrun;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get count of used queue elements
|
||||
* \param status pointer to #snd_timer_status_t structure
|
||||
* \return count of used queue elements
|
||||
*/
|
||||
long snd_timer_status_get_queue(snd_timer_status_t * status)
|
||||
{
|
||||
assert(status);
|
||||
return status->queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get status from timer handle
|
||||
* \param timer timer handle
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int
|
|||
{
|
||||
int fd, ver, tmode;
|
||||
snd_timer_t *tmr;
|
||||
snd_timer_id_t id;
|
||||
struct sndrv_timer_select sel;
|
||||
|
||||
*handle = NULL;
|
||||
|
||||
|
|
@ -175,13 +175,13 @@ int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int
|
|||
close(fd);
|
||||
return -SND_ERROR_INCOMPATIBLE_VERSION;
|
||||
}
|
||||
memset(&id, 0, sizeof(id));
|
||||
id.dev_class = dev_class;
|
||||
id.dev_sclass = dev_sclass;
|
||||
id.card = card;
|
||||
id.device = device;
|
||||
id.subdevice = subdevice;
|
||||
if (ioctl(fd, SNDRV_TIMER_IOCTL_SELECT, &id) < 0) {
|
||||
memset(&sel, 0, sizeof(sel));
|
||||
sel.id.dev_class = dev_class;
|
||||
sel.id.dev_sclass = dev_sclass;
|
||||
sel.id.card = card;
|
||||
sel.id.device = device;
|
||||
sel.id.subdevice = subdevice;
|
||||
if (ioctl(fd, SNDRV_TIMER_IOCTL_SELECT, &sel) < 0) {
|
||||
int err = -errno;
|
||||
close(fd);
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -191,3 +191,163 @@ int snd_timer_query_next_device(snd_timer_query_t *timer, snd_timer_id_t *tid)
|
|||
assert(tid);
|
||||
return timer->ops->next_device(timer, tid);
|
||||
}
|
||||
|
||||
/**
|
||||
* \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 allocate a new snd_timer_id_t structure
|
||||
* \param ptr returned pointer
|
||||
* \return 0 on success otherwise a negative error code if fails
|
||||
*
|
||||
* Allocates a new snd_timer_id_t structure using the standard
|
||||
* malloc C library function.
|
||||
*/
|
||||
int snd_timer_id_malloc(snd_timer_id_t **info)
|
||||
{
|
||||
assert(info);
|
||||
*info = calloc(1, sizeof(snd_timer_id_t));
|
||||
if (!*info)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief frees the snd_timer_id_t structure
|
||||
* \param info pointer to the snd_timer_id_t structure to free
|
||||
*
|
||||
* Frees the given snd_timer_id_t structure using the standard
|
||||
* free C library function.
|
||||
*/
|
||||
void snd_timer_id_free(snd_timer_id_t *info)
|
||||
{
|
||||
assert(info);
|
||||
free(info);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief copy one snd_timer_id_t structure to another
|
||||
* \param dst destination snd_timer_id_t structure
|
||||
* \param src source snd_timer_id_t structure
|
||||
*/
|
||||
void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src)
|
||||
{
|
||||
assert(dst && src);
|
||||
*dst = *src;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(tid);
|
||||
tid->dev_class = dev_class;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(tid);
|
||||
return tid->dev_class;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(tid);
|
||||
tid->dev_sclass = dev_sclass;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(tid);
|
||||
return tid->dev_sclass;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(tid);
|
||||
tid->card = card;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(tid);
|
||||
return tid->card;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(tid);
|
||||
tid->device = device;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(tid);
|
||||
return tid->device;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(tid);
|
||||
tid->subdevice = subdevice;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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)
|
||||
{
|
||||
assert(tid);
|
||||
return tid->subdevice;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue