ALSA project - the C library reference
Data Structures | Macros | Typedefs | Enumerations | Functions
Timer Interface

Data Structures

struct  snd_timer_read_t
 
struct  snd_timer_tread_t
 

Macros

#define SND_TIMER_DLSYM_VERSION   _dlsym_timer_001
 
#define SND_TIMER_QUERY_DLSYM_VERSION   _dlsym_timer_query_001
 
#define SND_TIMER_GLOBAL_SYSTEM   0
 
#define SND_TIMER_GLOBAL_RTC   1 /* Obsoleted, due to enough legacy. */
 
#define SND_TIMER_GLOBAL_HPET   2
 
#define SND_TIMER_GLOBAL_HRTIMER   3
 
#define SND_TIMER_OPEN_NONBLOCK   (1<<0)
 
#define SND_TIMER_OPEN_TREAD   (1<<1)
 
#define snd_timer_id_alloca(ptr)   __snd_alloca(ptr, snd_timer_id)
 
#define snd_timer_ginfo_alloca(ptr)   __snd_alloca(ptr, snd_timer_ginfo)
 
#define snd_timer_info_alloca(ptr)   __snd_alloca(ptr, snd_timer_info)
 
#define snd_timer_params_alloca(ptr)   __snd_alloca(ptr, snd_timer_params)
 
#define snd_timer_status_alloca(ptr)   __snd_alloca(ptr, snd_timer_status)
 

Typedefs

typedef struct _snd_timer_id snd_timer_id_t
 
typedef struct _snd_timer_ginfo snd_timer_ginfo_t
 
typedef struct _snd_timer_gparams snd_timer_gparams_t
 
typedef struct _snd_timer_gstatus snd_timer_gstatus_t
 
typedef struct _snd_timer_info snd_timer_info_t
 
typedef struct _snd_timer_params snd_timer_params_t
 
typedef struct _snd_timer_status snd_timer_status_t
 
typedef struct _snd_timer_query snd_timer_query_t
 
typedef struct _snd_timer snd_timer_t
 

Enumerations

enum  snd_timer_class_t {
  SND_TIMER_CLASS_NONE = -1 , SND_TIMER_CLASS_SLAVE = 0 , SND_TIMER_CLASS_GLOBAL , SND_TIMER_CLASS_CARD ,
  SND_TIMER_CLASS_PCM , SND_TIMER_CLASS_LAST = SND_TIMER_CLASS_PCM
}
 
enum  snd_timer_slave_class_t {
  SND_TIMER_SCLASS_NONE = 0 , SND_TIMER_SCLASS_APPLICATION , SND_TIMER_SCLASS_SEQUENCER , SND_TIMER_SCLASS_OSS_SEQUENCER ,
  SND_TIMER_SCLASS_LAST = SND_TIMER_SCLASS_OSS_SEQUENCER
}
 
enum  snd_timer_event_t {
  SND_TIMER_EVENT_RESOLUTION = 0 , SND_TIMER_EVENT_TICK , SND_TIMER_EVENT_START , SND_TIMER_EVENT_STOP ,
  SND_TIMER_EVENT_CONTINUE , SND_TIMER_EVENT_PAUSE , SND_TIMER_EVENT_EARLY , SND_TIMER_EVENT_SUSPEND ,
  SND_TIMER_EVENT_RESUME , SND_TIMER_EVENT_MSTART = SND_TIMER_EVENT_START + 10 , SND_TIMER_EVENT_MSTOP = SND_TIMER_EVENT_STOP + 10 , SND_TIMER_EVENT_MCONTINUE = SND_TIMER_EVENT_CONTINUE + 10 ,
  SND_TIMER_EVENT_MPAUSE = SND_TIMER_EVENT_PAUSE + 10 , SND_TIMER_EVENT_MSUSPEND = SND_TIMER_EVENT_SUSPEND + 10 , SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10
}
 
enum  snd_timer_type_t { SND_TIMER_TYPE_HW = 0 , SND_TIMER_TYPE_SHM , SND_TIMER_TYPE_INET }
 

Functions

int snd_timer_query_open (snd_timer_query_t **handle, const char *name, int mode)
 Opens a new connection to the timer query interface. More...
 
int snd_timer_query_open_lconf (snd_timer_query_t **handle, const char *name, int mode, snd_config_t *lconf)
 Opens a new connection to the timer query interface using local configuration. More...
 
int snd_timer_query_close (snd_timer_query_t *handle)
 close timer query handle More...
 
int snd_timer_query_next_device (snd_timer_query_t *handle, snd_timer_id_t *tid)
 obtain the next timer identification More...
 
int snd_timer_query_info (snd_timer_query_t *handle, snd_timer_ginfo_t *info)
 obtain the timer global information More...
 
int snd_timer_query_params (snd_timer_query_t *handle, snd_timer_gparams_t *params)
 set the timer global parameters More...
 
int snd_timer_query_status (snd_timer_query_t *handle, snd_timer_gstatus_t *status)
 get the timer global status More...
 
int snd_timer_open (snd_timer_t **handle, const char *name, int mode)
 Opens a new connection to the timer interface. More...
 
int snd_timer_open_lconf (snd_timer_t **handle, const char *name, int mode, snd_config_t *lconf)
 Opens a new connection to the timer interface using local configuration. More...
 
int snd_timer_close (snd_timer_t *handle)
 close timer handle More...
 
int snd_async_add_timer_handler (snd_async_handler_t **handler, snd_timer_t *timer, snd_async_callback_t callback, void *private_data)
 Add an async handler for a timer. More...
 
snd_timer_tsnd_async_handler_get_timer (snd_async_handler_t *handler)
 Return timer handle related to an async handler. More...
 
int snd_timer_poll_descriptors_count (snd_timer_t *handle)
 get count of poll descriptors for timer handle More...
 
int snd_timer_poll_descriptors (snd_timer_t *handle, struct pollfd *pfds, unsigned int space)
 get poll descriptors More...
 
int snd_timer_poll_descriptors_revents (snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
 get returned events from poll descriptors More...
 
int snd_timer_info (snd_timer_t *handle, snd_timer_info_t *timer)
 get information about timer handle More...
 
int snd_timer_params (snd_timer_t *handle, snd_timer_params_t *params)
 set parameters for timer handle More...
 
int snd_timer_status (snd_timer_t *handle, snd_timer_status_t *status)
 get status from timer handle More...
 
int snd_timer_start (snd_timer_t *handle)
 start the timer More...
 
int snd_timer_stop (snd_timer_t *handle)
 stop the timer More...
 
int snd_timer_continue (snd_timer_t *handle)
 continue the timer More...
 
ssize_t snd_timer_read (snd_timer_t *handle, void *buffer, size_t size)
 read bytes using timer handle More...
 
size_t snd_timer_id_sizeof (void)
 get size of the snd_timer_id_t structure in bytes More...
 
int snd_timer_id_malloc (snd_timer_id_t **ptr)
 allocate a new snd_timer_id_t structure More...
 
void snd_timer_id_free (snd_timer_id_t *obj)
 frees the snd_timer_id_t structure More...
 
void snd_timer_id_copy (snd_timer_id_t *dst, const snd_timer_id_t *src)
 copy one snd_timer_id_t structure to another More...
 
void snd_timer_id_set_class (snd_timer_id_t *id, int dev_class)
 set timer class More...
 
int snd_timer_id_get_class (snd_timer_id_t *id)
 get timer class More...
 
void snd_timer_id_set_sclass (snd_timer_id_t *id, int dev_sclass)
 set timer sub-class More...
 
int snd_timer_id_get_sclass (snd_timer_id_t *id)
 get timer sub-class More...
 
void snd_timer_id_set_card (snd_timer_id_t *id, int card)
 set timer card More...
 
int snd_timer_id_get_card (snd_timer_id_t *id)
 get timer card More...
 
void snd_timer_id_set_device (snd_timer_id_t *id, int device)
 set timer device More...
 
int snd_timer_id_get_device (snd_timer_id_t *id)
 get timer device More...
 
void snd_timer_id_set_subdevice (snd_timer_id_t *id, int subdevice)
 set timer subdevice More...
 
int snd_timer_id_get_subdevice (snd_timer_id_t *id)
 get timer subdevice More...
 
size_t snd_timer_ginfo_sizeof (void)
 get size of the snd_timer_ginfo_t structure in bytes More...
 
int snd_timer_ginfo_malloc (snd_timer_ginfo_t **ptr)
 allocate a new snd_timer_ginfo_t structure More...
 
void snd_timer_ginfo_free (snd_timer_ginfo_t *obj)
 frees the snd_timer_ginfo_t structure More...
 
void snd_timer_ginfo_copy (snd_timer_ginfo_t *dst, const snd_timer_ginfo_t *src)
 copy one snd_timer_info_t structure to another More...
 
int snd_timer_ginfo_set_tid (snd_timer_ginfo_t *obj, snd_timer_id_t *tid)
 set timer identification More...
 
snd_timer_id_tsnd_timer_ginfo_get_tid (snd_timer_ginfo_t *obj)
 get timer identification More...
 
unsigned int snd_timer_ginfo_get_flags (snd_timer_ginfo_t *obj)
 get timer flags More...
 
int snd_timer_ginfo_get_card (snd_timer_ginfo_t *obj)
 get associated card with timer More...
 
char * snd_timer_ginfo_get_id (snd_timer_ginfo_t *obj)
 get timer identification More...
 
char * snd_timer_ginfo_get_name (snd_timer_ginfo_t *obj)
 get timer name More...
 
unsigned long snd_timer_ginfo_get_resolution (snd_timer_ginfo_t *obj)
 get timer resolution in ns More...
 
unsigned long snd_timer_ginfo_get_resolution_min (snd_timer_ginfo_t *obj)
 get timer minimal resolution in ns More...
 
unsigned long snd_timer_ginfo_get_resolution_max (snd_timer_ginfo_t *obj)
 get timer maximal resolution in ns More...
 
unsigned int snd_timer_ginfo_get_clients (snd_timer_ginfo_t *obj)
 get current timer clients More...
 
size_t snd_timer_info_sizeof (void)
 get size of the snd_timer_info_t structure in bytes More...
 
int snd_timer_info_malloc (snd_timer_info_t **ptr)
 allocate a new snd_timer_info_t structure More...
 
void snd_timer_info_free (snd_timer_info_t *obj)
 frees the snd_timer_info_t structure More...
 
void snd_timer_info_copy (snd_timer_info_t *dst, const snd_timer_info_t *src)
 copy one snd_timer_info_t structure to another More...
 
int snd_timer_info_is_slave (snd_timer_info_t *info)
 determine, if timer is slave More...
 
int snd_timer_info_get_card (snd_timer_info_t *info)
 get timer card More...
 
const char * snd_timer_info_get_id (snd_timer_info_t *info)
 get timer id More...
 
const char * snd_timer_info_get_name (snd_timer_info_t *info)
 get timer name More...
 
long snd_timer_info_get_resolution (snd_timer_info_t *info)
 get timer resolution in us More...
 
size_t snd_timer_params_sizeof (void)
 get size of the snd_timer_params_t structure in bytes More...
 
int snd_timer_params_malloc (snd_timer_params_t **ptr)
 allocate a new snd_timer_params_t structure More...
 
void snd_timer_params_free (snd_timer_params_t *obj)
 frees the snd_timer_params_t structure More...
 
void snd_timer_params_copy (snd_timer_params_t *dst, const snd_timer_params_t *src)
 copy one snd_timer_params_t structure to another More...
 
int snd_timer_params_set_auto_start (snd_timer_params_t *params, int auto_start)
 set timer auto start More...
 
int snd_timer_params_get_auto_start (snd_timer_params_t *params)
 determine if timer has auto start flag More...
 
int snd_timer_params_set_exclusive (snd_timer_params_t *params, int exclusive)
 set timer exclusive use More...
 
int snd_timer_params_get_exclusive (snd_timer_params_t *params)
 determine if timer has exclusive flag More...
 
int snd_timer_params_set_early_event (snd_timer_params_t *params, int early_event)
 set timer early event More...
 
int snd_timer_params_get_early_event (snd_timer_params_t *params)
 determine if timer has early event flag More...
 
void snd_timer_params_set_ticks (snd_timer_params_t *params, long ticks)
 set timer ticks More...
 
long snd_timer_params_get_ticks (snd_timer_params_t *params)
 get timer ticks More...
 
void snd_timer_params_set_queue_size (snd_timer_params_t *params, long queue_size)
 set timer queue size (32-1024) More...
 
long snd_timer_params_get_queue_size (snd_timer_params_t *params)
 get queue size More...
 
void snd_timer_params_set_filter (snd_timer_params_t *params, unsigned int filter)
 set timer event filter More...
 
unsigned int snd_timer_params_get_filter (snd_timer_params_t *params)
 get timer event filter More...
 
size_t snd_timer_status_sizeof (void)
 get size of the snd_timer_status_t structure in bytes More...
 
int snd_timer_status_malloc (snd_timer_status_t **ptr)
 allocate a new snd_timer_status_t structure More...
 
void snd_timer_status_free (snd_timer_status_t *obj)
 frees the snd_timer_status_t structure More...
 
void snd_timer_status_copy (snd_timer_status_t *dst, const snd_timer_status_t *src)
 copy one snd_timer_status_t structure to another More...
 
snd_htimestamp_t snd_timer_status_get_timestamp (snd_timer_status_t *status)
 get timestamp More...
 
long snd_timer_status_get_resolution (snd_timer_status_t *status)
 get resolution in us More...
 
long snd_timer_status_get_lost (snd_timer_status_t *status)
 get master tick lost count More...
 
long snd_timer_status_get_overrun (snd_timer_status_t *status)
 get overrun count More...
 
long snd_timer_status_get_queue (snd_timer_status_t *status)
 get count of used queue elements More...
 
long snd_timer_info_get_ticks (snd_timer_info_t *info)
 (DEPRECATED) get maximum timer ticks More...
 

Detailed Description

Timer Interface. See Timer interface page for more details.

Macro Definition Documentation

◆ SND_TIMER_DLSYM_VERSION

#define SND_TIMER_DLSYM_VERSION   _dlsym_timer_001

dlsym version for interface entry callback

◆ snd_timer_ginfo_alloca

#define snd_timer_ginfo_alloca (   ptr)    __snd_alloca(ptr, snd_timer_ginfo)

allocate snd_timer_ginfo_t container on stack

◆ SND_TIMER_GLOBAL_HPET

#define SND_TIMER_GLOBAL_HPET   2

global timer - HPET

◆ SND_TIMER_GLOBAL_HRTIMER

#define SND_TIMER_GLOBAL_HRTIMER   3

global timer - HRTIMER

◆ SND_TIMER_GLOBAL_RTC

#define SND_TIMER_GLOBAL_RTC   1 /* Obsoleted, due to enough legacy. */

global timer - RTC

◆ SND_TIMER_GLOBAL_SYSTEM

#define SND_TIMER_GLOBAL_SYSTEM   0

global timer - system

Examples
/test/timer.c.

◆ snd_timer_id_alloca

#define snd_timer_id_alloca (   ptr)    __snd_alloca(ptr, snd_timer_id)

allocate snd_timer_id_t container on stack

Examples
/test/timer.c.

◆ snd_timer_info_alloca

#define snd_timer_info_alloca (   ptr)    __snd_alloca(ptr, snd_timer_info)

allocate snd_timer_info_t container on stack

Examples
/test/timer.c.

◆ SND_TIMER_OPEN_NONBLOCK

#define SND_TIMER_OPEN_NONBLOCK   (1<<0)

timer open mode flag - non-blocking behaviour

Examples
/test/timer.c.

◆ SND_TIMER_OPEN_TREAD

#define SND_TIMER_OPEN_TREAD   (1<<1)

use timestamps and event notification - enhanced read

◆ snd_timer_params_alloca

#define snd_timer_params_alloca (   ptr)    __snd_alloca(ptr, snd_timer_params)

allocate snd_timer_params_t container on stack

Examples
/test/timer.c.

◆ SND_TIMER_QUERY_DLSYM_VERSION

#define SND_TIMER_QUERY_DLSYM_VERSION   _dlsym_timer_query_001

dlsym version for interface entry callback

◆ snd_timer_status_alloca

#define snd_timer_status_alloca (   ptr)    __snd_alloca(ptr, snd_timer_status)

allocate snd_timer_status_t container on stack

Examples
/test/timer.c.

Typedef Documentation

◆ snd_timer_ginfo_t

typedef struct _snd_timer_ginfo snd_timer_ginfo_t

timer global info structure

◆ snd_timer_gparams_t

typedef struct _snd_timer_gparams snd_timer_gparams_t

timer global params structure

◆ snd_timer_gstatus_t

typedef struct _snd_timer_gstatus snd_timer_gstatus_t

timer global status structure

◆ snd_timer_id_t

typedef struct _snd_timer_id snd_timer_id_t

timer identification structure

◆ snd_timer_info_t

typedef struct _snd_timer_info snd_timer_info_t

timer info structure

◆ snd_timer_params_t

typedef struct _snd_timer_params snd_timer_params_t

timer params structure

◆ snd_timer_query_t

typedef struct _snd_timer_query snd_timer_query_t

timer query handle

◆ snd_timer_status_t

typedef struct _snd_timer_status snd_timer_status_t

timer status structure

◆ snd_timer_t

typedef struct _snd_timer snd_timer_t

timer handle

Enumeration Type Documentation

◆ snd_timer_class_t

timer master class

Enumerator
SND_TIMER_CLASS_NONE 

invalid

SND_TIMER_CLASS_SLAVE 

slave timer

SND_TIMER_CLASS_GLOBAL 

global timer

SND_TIMER_CLASS_CARD 

card timer

SND_TIMER_CLASS_PCM 

PCM timer

SND_TIMER_CLASS_LAST 

last timer

◆ snd_timer_event_t

timer read event identification

◆ snd_timer_slave_class_t

timer slave class

Enumerator
SND_TIMER_SCLASS_NONE 

none

SND_TIMER_SCLASS_APPLICATION 

for internal use

SND_TIMER_SCLASS_SEQUENCER 

sequencer timer

SND_TIMER_SCLASS_OSS_SEQUENCER 

OSS sequencer timer

SND_TIMER_SCLASS_LAST 

last slave timer

◆ snd_timer_type_t

timer handle type

Enumerator
SND_TIMER_TYPE_HW 

Kernel level HwDep

SND_TIMER_TYPE_SHM 

Shared memory client timer (not yet implemented)

SND_TIMER_TYPE_INET 

INET client timer (not yet implemented)

Function Documentation

◆ snd_async_add_timer_handler()

int snd_async_add_timer_handler ( snd_async_handler_t **  handler,
snd_timer_t timer,
snd_async_callback_t  callback,
void *  private_data 
)

Add an async handler for a timer.

Parameters
handlerReturned handler handle
timertimer handle
callbackCallback function
private_dataCallback private data
Returns
0 otherwise a negative error code on failure

The asynchronous callback is called when new timer event occurs.

Examples
/test/timer.c.

◆ snd_async_handler_get_timer()

snd_timer_t * snd_async_handler_get_timer ( snd_async_handler_t handler)

Return timer handle related to an async handler.

Parameters
handlerAsync handler handle
Returns
timer handle
Examples
/test/timer.c.

◆ snd_timer_close()

int snd_timer_close ( snd_timer_t timer)

close timer handle

Parameters
timertimer handle
Returns
0 on success otherwise a negative error code

Closes the specified timer handle and frees all associated resources.

Examples
/test/timer.c.

◆ snd_timer_continue()

int snd_timer_continue ( snd_timer_t timer)

continue the timer

Parameters
timertimer handle
Returns
0 on success otherwise a negative error code

◆ snd_timer_ginfo_copy()

void snd_timer_ginfo_copy ( snd_timer_ginfo_t dst,
const snd_timer_ginfo_t src 
)

copy one snd_timer_info_t structure to another

Parameters
dstdestination snd_timer_info_t structure
srcsource snd_timer_info_t structure

◆ snd_timer_ginfo_free()

void snd_timer_ginfo_free ( snd_timer_ginfo_t info)

frees the snd_timer_ginfo_t structure

Parameters
infopointer to the snd_timer_ginfo_t structure to free

Frees the given snd_timer_info_t structure using the standard free C library function.

◆ snd_timer_ginfo_get_card()

int snd_timer_ginfo_get_card ( snd_timer_ginfo_t obj)

get associated card with timer

Parameters
objpointer to snd_timer_ginfo_t structure
Returns
associated card

◆ snd_timer_ginfo_get_clients()

unsigned int snd_timer_ginfo_get_clients ( snd_timer_ginfo_t obj)

get current timer clients

Parameters
objpointer to snd_timer_ginfo_t structure
Returns
current timer clients

◆ snd_timer_ginfo_get_flags()

unsigned int snd_timer_ginfo_get_flags ( snd_timer_ginfo_t obj)

get timer flags

Parameters
objpointer to snd_timer_ginfo_t structure
Returns
timer flags

◆ snd_timer_ginfo_get_id()

char * snd_timer_ginfo_get_id ( snd_timer_ginfo_t obj)

get timer identification

Parameters
objpointer to snd_timer_ginfo_t structure
Returns
timer identification

◆ snd_timer_ginfo_get_name()

char * snd_timer_ginfo_get_name ( snd_timer_ginfo_t obj)

get timer name

Parameters
objpointer to snd_timer_ginfo_t structure
Returns
timer name

◆ snd_timer_ginfo_get_resolution()

unsigned long snd_timer_ginfo_get_resolution ( snd_timer_ginfo_t obj)

get timer resolution in ns

Parameters
objpointer to snd_timer_ginfo_t structure
Returns
timer resolution in ns

◆ snd_timer_ginfo_get_resolution_max()

unsigned long snd_timer_ginfo_get_resolution_max ( snd_timer_ginfo_t obj)

get timer maximal resolution in ns

Parameters
objpointer to snd_timer_ginfo_t structure
Returns
timer maximal resolution in ns

◆ snd_timer_ginfo_get_resolution_min()

unsigned long snd_timer_ginfo_get_resolution_min ( snd_timer_ginfo_t obj)

get timer minimal resolution in ns

Parameters
objpointer to snd_timer_ginfo_t structure
Returns
timer minimal resolution in ns

◆ snd_timer_ginfo_get_tid()

snd_timer_id_t * snd_timer_ginfo_get_tid ( snd_timer_ginfo_t obj)

get timer identification

Parameters
objpointer to snd_timer_ginfo_t structure
Returns
pointer to snd_timer_id_t

◆ snd_timer_ginfo_malloc()

int snd_timer_ginfo_malloc ( snd_timer_ginfo_t **  info)

allocate a new snd_timer_ginfo_t structure

Parameters
inforeturned pointer
Returns
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.

◆ snd_timer_ginfo_set_tid()

int snd_timer_ginfo_set_tid ( snd_timer_ginfo_t obj,
snd_timer_id_t tid 
)

set timer identification

Parameters
objpointer to snd_timer_ginfo_t structure
tidpointer to snd_timer_id_t structure
Returns
zero on success otherwise a negative error number

◆ snd_timer_ginfo_sizeof()

size_t snd_timer_ginfo_sizeof ( void  )

get size of the snd_timer_ginfo_t structure in bytes

Returns
size of the snd_timer_ginfo_t structure in bytes

◆ snd_timer_id_copy()

void snd_timer_id_copy ( snd_timer_id_t dst,
const snd_timer_id_t src 
)

copy one snd_timer_id_t structure to another

Parameters
dstdestination snd_timer_id_t structure
srcsource snd_timer_id_t structure

◆ snd_timer_id_free()

void snd_timer_id_free ( snd_timer_id_t info)

frees the snd_timer_id_t structure

Parameters
infopointer to the snd_timer_id_t structure to free

Frees the given snd_timer_id_t structure using the standard free C library function.

◆ snd_timer_id_get_card()

int snd_timer_id_get_card ( snd_timer_id_t tid)

get timer card

Parameters
tidpointer to snd_timer_id_t structure
Returns
timer card number
Examples
/test/timer.c.

◆ snd_timer_id_get_class()

int snd_timer_id_get_class ( snd_timer_id_t tid)

get timer class

Parameters
tidpointer to snd_timer_id_t structure
Returns
timer class
Examples
/test/timer.c.

◆ snd_timer_id_get_device()

int snd_timer_id_get_device ( snd_timer_id_t tid)

get timer device

Parameters
tidpointer to snd_timer_id_t structure
Returns
timer device number
Examples
/test/timer.c.

◆ snd_timer_id_get_sclass()

int snd_timer_id_get_sclass ( snd_timer_id_t tid)

get timer sub-class

Parameters
tidpointer to snd_timer_id_t structure
Returns
timer sub-class
Examples
/test/timer.c.

◆ snd_timer_id_get_subdevice()

int snd_timer_id_get_subdevice ( snd_timer_id_t tid)

get timer subdevice

Parameters
tidpointer to snd_timer_id_t structure
Returns
timer subdevice number
Examples
/test/timer.c.

◆ snd_timer_id_malloc()

int snd_timer_id_malloc ( snd_timer_id_t **  info)

allocate a new snd_timer_id_t structure

Parameters
inforeturned pointer
Returns
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.

◆ snd_timer_id_set_card()

void snd_timer_id_set_card ( snd_timer_id_t tid,
int  card 
)

set timer card

Parameters
tidpointer to snd_timer_id_t structure
cardcard number

◆ snd_timer_id_set_class()

void snd_timer_id_set_class ( snd_timer_id_t tid,
int  dev_class 
)

set timer class

Parameters
tidpointer to snd_timer_id_t structure
dev_classclass of timer device
Examples
/test/timer.c.

◆ snd_timer_id_set_device()

void snd_timer_id_set_device ( snd_timer_id_t tid,
int  device 
)

set timer device

Parameters
tidpointer to snd_timer_id_t structure
devicedevice number

◆ snd_timer_id_set_sclass()

void snd_timer_id_set_sclass ( snd_timer_id_t tid,
int  dev_sclass 
)

set timer sub-class

Parameters
tidpointer to snd_timer_id_t structure
dev_sclasssub-class of timer device

◆ snd_timer_id_set_subdevice()

void snd_timer_id_set_subdevice ( snd_timer_id_t tid,
int  subdevice 
)

set timer subdevice

Parameters
tidpointer to snd_timer_id_t structure
subdevicesubdevice number

◆ snd_timer_id_sizeof()

size_t snd_timer_id_sizeof ( void  )

get size of the snd_timer_id_t structure in bytes

Returns
size of the snd_timer_id_t structure in bytes

◆ snd_timer_info()

int snd_timer_info ( snd_timer_t timer,
snd_timer_info_t info 
)

get information about timer handle

Parameters
timertimer handle
infopointer to a snd_timer_info_t structure to be filled
Returns
0 on success otherwise a negative error code
Examples
/test/timer.c.

◆ snd_timer_info_copy()

void snd_timer_info_copy ( snd_timer_info_t dst,
const snd_timer_info_t src 
)

copy one snd_timer_info_t structure to another

Parameters
dstdestination snd_timer_info_t structure
srcsource snd_timer_info_t structure

◆ snd_timer_info_free()

void snd_timer_info_free ( snd_timer_info_t info)

frees the snd_timer_info_t structure

Parameters
infopointer to the snd_timer_info_t structure to free

Frees the given snd_timer_info_t structure using the standard free C library function.

◆ snd_timer_info_get_card()

int snd_timer_info_get_card ( snd_timer_info_t info)

get timer card

Parameters
infopointer to snd_timer_info_t structure
Returns
timer card number
Examples
/test/timer.c.

◆ snd_timer_info_get_id()

const char * snd_timer_info_get_id ( snd_timer_info_t info)

get timer id

Parameters
infopointer to snd_timer_info_t structure
Returns
timer id
Examples
/test/timer.c.

◆ snd_timer_info_get_name()

const char * snd_timer_info_get_name ( snd_timer_info_t info)

get timer name

Parameters
infopointer to snd_timer_info_t structure
Returns
timer name
Examples
/test/timer.c.

◆ snd_timer_info_get_resolution()

long snd_timer_info_get_resolution ( snd_timer_info_t info)

get timer resolution in us

Parameters
infopointer to snd_timer_info_t structure
Returns
timer resolution
Examples
/test/timer.c.

◆ snd_timer_info_get_ticks()

long snd_timer_info_get_ticks ( snd_timer_info_t info)

(DEPRECATED) get maximum timer ticks

Parameters
infopointer to snd_timer_info_t structure
Returns
maximum timer ticks

◆ snd_timer_info_is_slave()

int snd_timer_info_is_slave ( snd_timer_info_t info)

determine, if timer is slave

Parameters
infopointer to snd_timer_info_t structure
Returns
nonzero if timer is slave
Examples
/test/timer.c.

◆ snd_timer_info_malloc()

int snd_timer_info_malloc ( snd_timer_info_t **  info)

allocate a new snd_timer_info_t structure

Parameters
inforeturned pointer
Returns
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.

◆ snd_timer_info_sizeof()

size_t snd_timer_info_sizeof ( void  )

get size of the snd_timer_info_t structure in bytes

Returns
size of the snd_timer_info_t structure in bytes

◆ snd_timer_open()

int snd_timer_open ( snd_timer_t **  timer,
const char *  name,
int  mode 
)

Opens a new connection to the timer interface.

Parameters
timerReturned handle (NULL if not wanted)
nameASCII identifier of the timer handle
modeOpen mode
Returns
0 on success otherwise a negative error code

Opens a new connection to the timer interface specified with an ASCII identifier and mode.

Examples
/test/timer.c.

◆ snd_timer_open_lconf()

int snd_timer_open_lconf ( snd_timer_t **  timer,
const char *  name,
int  mode,
snd_config_t lconf 
)

Opens a new connection to the timer interface using local configuration.

Parameters
timerReturned handle (NULL if not wanted)
nameASCII identifier of the timer handle
modeOpen mode
lconfLocal configuration
Returns
0 on success otherwise a negative error code

Opens a new connection to the timer interface specified with an ASCII identifier and mode.

◆ snd_timer_params()

int snd_timer_params ( snd_timer_t timer,
snd_timer_params_t params 
)

set parameters for timer handle

Parameters
timertimer handle
paramspointer to a snd_timer_params_t structure
Returns
0 on success otherwise a negative error code
Examples
/test/timer.c.

◆ snd_timer_params_copy()

void snd_timer_params_copy ( snd_timer_params_t dst,
const snd_timer_params_t src 
)

copy one snd_timer_params_t structure to another

Parameters
dstdestination snd_timer_params_t structure
srcsource snd_timer_params_t structure

◆ snd_timer_params_free()

void snd_timer_params_free ( snd_timer_params_t params)

frees the snd_timer_params_t structure

Parameters
paramspointer to the snd_timer_params_t structure to free

Frees the given snd_timer_params_t structure using the standard free C library function.

◆ snd_timer_params_get_auto_start()

int snd_timer_params_get_auto_start ( snd_timer_params_t params)

determine if timer has auto start flag

Parameters
paramspointer to snd_timer_params_t structure
Returns
nonzero if timer has auto start flag

◆ snd_timer_params_get_early_event()

int snd_timer_params_get_early_event ( snd_timer_params_t params)

determine if timer has early event flag

Parameters
paramspointer to snd_timer_params_t structure
Returns
nonzero if timer has early event flag set

◆ snd_timer_params_get_exclusive()

int snd_timer_params_get_exclusive ( snd_timer_params_t params)

determine if timer has exclusive flag

Parameters
paramspointer to snd_timer_params_t structure
Returns
nonzero if timer has exclusive flag

◆ snd_timer_params_get_filter()

unsigned int snd_timer_params_get_filter ( snd_timer_params_t params)

get timer event filter

Parameters
paramspointer to snd_timer_params_t structure
Returns
timer event filter

◆ snd_timer_params_get_queue_size()

long snd_timer_params_get_queue_size ( snd_timer_params_t params)

get queue size

Parameters
paramspointer to snd_timer_params_t structure
Returns
queue size

◆ snd_timer_params_get_ticks()

long snd_timer_params_get_ticks ( snd_timer_params_t params)

get timer ticks

Parameters
paramspointer to snd_timer_params_t structure
Returns
timer ticks
Examples
/test/timer.c.

◆ snd_timer_params_malloc()

int snd_timer_params_malloc ( snd_timer_params_t **  params)

allocate a new snd_timer_params_t structure

Parameters
paramsreturned pointer
Returns
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.

◆ snd_timer_params_set_auto_start()

int snd_timer_params_set_auto_start ( snd_timer_params_t params,
int  auto_start 
)

set timer auto start

Parameters
paramspointer to snd_timer_params_t structure
auto_startThe boolean value to set
Examples
/test/timer.c.

◆ snd_timer_params_set_early_event()

int snd_timer_params_set_early_event ( snd_timer_params_t params,
int  early_event 
)

set timer early event

Parameters
paramspointer to snd_timer_params_t structure
early_eventThe boolean value to set

◆ snd_timer_params_set_exclusive()

int snd_timer_params_set_exclusive ( snd_timer_params_t params,
int  exclusive 
)

set timer exclusive use

Parameters
paramspointer to snd_timer_params_t structure
exclusiveThe boolean value to set

◆ snd_timer_params_set_filter()

void snd_timer_params_set_filter ( snd_timer_params_t params,
unsigned int  filter 
)

set timer event filter

Parameters
paramspointer to snd_timer_params_t structure
filterThe event filter bits to set

◆ snd_timer_params_set_queue_size()

void snd_timer_params_set_queue_size ( snd_timer_params_t params,
long  queue_size 
)

set timer queue size (32-1024)

Parameters
paramspointer to snd_timer_params_t structure
queue_sizeThe queue size to set

◆ snd_timer_params_set_ticks()

void snd_timer_params_set_ticks ( snd_timer_params_t params,
long  ticks 
)

set timer ticks

Parameters
paramspointer to snd_timer_params_t structure
ticksTicks to set
Examples
/test/timer.c.

◆ snd_timer_params_sizeof()

size_t snd_timer_params_sizeof ( void  )

get size of the snd_timer_params_t structure in bytes

Returns
size of the snd_timer_params_t structure in bytes

◆ snd_timer_poll_descriptors()

int snd_timer_poll_descriptors ( snd_timer_t timer,
struct pollfd *  pfds,
unsigned int  space 
)

get poll descriptors

Parameters
timertimer handle
pfdsarray of poll descriptors
spacespace in the poll descriptor array
Returns
count of filled descriptors
Examples
/test/timer.c.

◆ snd_timer_poll_descriptors_count()

int snd_timer_poll_descriptors_count ( snd_timer_t timer)

get count of poll descriptors for timer handle

Parameters
timertimer handle
Returns
count of poll descriptors
Examples
/test/timer.c.

◆ snd_timer_poll_descriptors_revents()

int snd_timer_poll_descriptors_revents ( snd_timer_t timer,
struct pollfd *  pfds,
unsigned int  nfds,
unsigned short *  revents 
)

get returned events from poll descriptors

Parameters
timertimer handle
pfdsarray of poll descriptors
nfdscount of poll descriptors
reventsreturned events
Returns
zero if success, otherwise a negative error code

◆ snd_timer_query_close()

int snd_timer_query_close ( snd_timer_query_t timer)

close timer query handle

Parameters
timertimer handle
Returns
0 on success otherwise a negative error code

Closes the specified timer handle and frees all associated resources.

Examples
/test/timer.c.

◆ snd_timer_query_info()

int snd_timer_query_info ( snd_timer_query_t timer,
snd_timer_ginfo_t info 
)

obtain the timer global information

Parameters
timertimer handle
infotimer information
Returns
0 on success otherwise a negative error code

◆ snd_timer_query_next_device()

int snd_timer_query_next_device ( snd_timer_query_t timer,
snd_timer_id_t tid 
)

obtain the next timer identification

Parameters
timertimer handle
tidtimer identification
Returns
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

Examples
/test/timer.c.

◆ snd_timer_query_open()

int snd_timer_query_open ( snd_timer_query_t **  timer,
const char *  name,
int  mode 
)

Opens a new connection to the timer query interface.

Parameters
timerReturned handle (NULL if not wanted)
nameASCII identifier of the RawMidi handle
modeOpen mode
Returns
0 on success otherwise a negative error code

Opens a new connection to the RawMidi interface specified with an ASCII identifier and mode.

Examples
/test/timer.c.

◆ snd_timer_query_open_lconf()

int snd_timer_query_open_lconf ( snd_timer_query_t **  timer,
const char *  name,
int  mode,
snd_config_t lconf 
)

Opens a new connection to the timer query interface using local configuration.

Parameters
timerReturned handle (NULL if not wanted)
nameASCII identifier of the RawMidi handle
modeOpen mode
lconfLocal configuration
Returns
0 on success otherwise a negative error code

Opens a new connection to the RawMidi interface specified with an ASCII identifier and mode.

◆ snd_timer_query_params()

int snd_timer_query_params ( snd_timer_query_t timer,
snd_timer_gparams_t params 
)

set the timer global parameters

Parameters
timertimer handle
paramstimer parameters
Returns
0 on success otherwise a negative error code

◆ snd_timer_query_status()

int snd_timer_query_status ( snd_timer_query_t timer,
snd_timer_gstatus_t status 
)

get the timer global status

Parameters
timertimer handle
statustimer status
Returns
0 on success otherwise a negative error code

◆ snd_timer_read()

ssize_t snd_timer_read ( snd_timer_t timer,
void *  buffer,
size_t  size 
)

read bytes using timer handle

Parameters
timertimer handle
bufferbuffer to store the input bytes
sizeinput buffer size in bytes
Examples
/test/timer.c.

◆ snd_timer_start()

int snd_timer_start ( snd_timer_t timer)

start the timer

Parameters
timertimer handle
Returns
0 on success otherwise a negative error code
Examples
/test/timer.c.

◆ snd_timer_status()

int snd_timer_status ( snd_timer_t timer,
snd_timer_status_t status 
)

get status from timer handle

Parameters
timertimer handle
statuspointer to a snd_timer_status_t structure to be filled
Returns
0 on success otherwise a negative error code
Examples
/test/timer.c.

◆ snd_timer_status_copy()

void snd_timer_status_copy ( snd_timer_status_t dst,
const snd_timer_status_t src 
)

copy one snd_timer_status_t structure to another

Parameters
dstdestination snd_timer_status_t structure
srcsource snd_timer_status_t structure

◆ snd_timer_status_free()

void snd_timer_status_free ( snd_timer_status_t status)

frees the snd_timer_status_t structure

Parameters
statuspointer to the snd_timer_status_t structure to free

Frees the given snd_timer_status_t structure using the standard free C library function.

◆ snd_timer_status_get_lost()

long snd_timer_status_get_lost ( snd_timer_status_t status)

get master tick lost count

Parameters
statuspointer to snd_timer_status_t structure
Returns
master tick lost count
Examples
/test/timer.c.

◆ snd_timer_status_get_overrun()

long snd_timer_status_get_overrun ( snd_timer_status_t status)

get overrun count

Parameters
statuspointer to snd_timer_status_t structure
Returns
overrun count
Examples
/test/timer.c.

◆ snd_timer_status_get_queue()

long snd_timer_status_get_queue ( snd_timer_status_t status)

get count of used queue elements

Parameters
statuspointer to snd_timer_status_t structure
Returns
count of used queue elements
Examples
/test/timer.c.

◆ snd_timer_status_get_resolution()

long snd_timer_status_get_resolution ( snd_timer_status_t status)

get resolution in us

Parameters
statuspointer to snd_timer_status_t structure
Returns
resolution
Examples
/test/timer.c.

◆ snd_timer_status_get_timestamp()

snd_htimestamp_t snd_timer_status_get_timestamp ( snd_timer_status_t status)

get timestamp

Parameters
statuspointer to snd_timer_status_t structure
Returns
timestamp

◆ snd_timer_status_malloc()

int snd_timer_status_malloc ( snd_timer_status_t **  status)

allocate a new snd_timer_status_t structure

Parameters
statusreturned pointer
Returns
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.

◆ snd_timer_status_sizeof()

size_t snd_timer_status_sizeof ( void  )

get size of the snd_timer_status_t structure in bytes

Returns
size of the snd_timer_status_t structure in bytes

◆ snd_timer_stop()

int snd_timer_stop ( snd_timer_t timer)

stop the timer

Parameters
timertimer handle
Returns
0 on success otherwise a negative error code
Examples
/test/timer.c.