Sequencer Queue Interface

Overview

Sequencer Queue Interface Moreā€¦

// typedefs

typedef struct _snd_seq_queue_info snd_seq_queue_info_t;
typedef struct _snd_seq_queue_status snd_seq_queue_status_t;
typedef struct _snd_seq_queue_tempo snd_seq_queue_tempo_t;
typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t;

// enums

enum snd_seq_queue_timer_type_t;

// global functions

size_t
snd_seq_queue_info_sizeof(void);

int
snd_seq_queue_info_malloc(snd_seq_queue_info_t** ptr);

void
snd_seq_queue_info_free(snd_seq_queue_info_t* ptr);

void
snd_seq_queue_info_copy(
    snd_seq_queue_info_t* dst,
    const snd_seq_queue_info_t* src
);

int
snd_seq_queue_info_get_queue(const snd_seq_queue_info_t* info);

const char*
snd_seq_queue_info_get_name(const snd_seq_queue_info_t* info);

int
snd_seq_queue_info_get_owner(const snd_seq_queue_info_t* info);

int
snd_seq_queue_info_get_locked(const snd_seq_queue_info_t* info);

unsigned int
snd_seq_queue_info_get_flags(const snd_seq_queue_info_t* info);

void
snd_seq_queue_info_set_name(
    snd_seq_queue_info_t* info,
    const char* name
);

void
snd_seq_queue_info_set_owner(
    snd_seq_queue_info_t* info,
    int owner
);

void
snd_seq_queue_info_set_locked(
    snd_seq_queue_info_t* info,
    int locked
);

void
snd_seq_queue_info_set_flags(
    snd_seq_queue_info_t* info,
    unsigned int flags
);

int
snd_seq_create_queue(
    snd_seq_t* seq,
    snd_seq_queue_info_t* info
);

int
snd_seq_alloc_named_queue(
    snd_seq_t* seq,
    const char* name
);

int
snd_seq_alloc_queue(snd_seq_t* handle);

int
snd_seq_free_queue(
    snd_seq_t* handle,
    int q
);

int
snd_seq_get_queue_info(
    snd_seq_t* seq,
    int q,
    snd_seq_queue_info_t* info
);

int
snd_seq_set_queue_info(
    snd_seq_t* seq,
    int q,
    snd_seq_queue_info_t* info
);

int
snd_seq_query_named_queue(
    snd_seq_t* seq,
    const char* name
);

int
snd_seq_get_queue_usage(
    snd_seq_t* handle,
    int q
);

int
snd_seq_set_queue_usage(
    snd_seq_t* handle,
    int q,
    int used
);

size_t
snd_seq_queue_status_sizeof(void);

int
snd_seq_queue_status_malloc(snd_seq_queue_status_t** ptr);

void
snd_seq_queue_status_free(snd_seq_queue_status_t* ptr);

void
snd_seq_queue_status_copy(
    snd_seq_queue_status_t* dst,
    const snd_seq_queue_status_t* src
);

int
snd_seq_queue_status_get_queue(const snd_seq_queue_status_t* info);

int
snd_seq_queue_status_get_events(const snd_seq_queue_status_t* info);

snd_seq_tick_time_t
snd_seq_queue_status_get_tick_time(const snd_seq_queue_status_t* info);

const snd_seq_real_time_t*
snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t* info);

unsigned int
snd_seq_queue_status_get_status(const snd_seq_queue_status_t* info);

int
snd_seq_get_queue_status(
    snd_seq_t* handle,
    int q,
    snd_seq_queue_status_t* status
);

size_t
snd_seq_queue_tempo_sizeof(void);

int
snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t** ptr);

void
snd_seq_queue_tempo_free(snd_seq_queue_tempo_t* ptr);

void
snd_seq_queue_tempo_copy(
    snd_seq_queue_tempo_t* dst,
    const snd_seq_queue_tempo_t* src
);

int
snd_seq_queue_tempo_get_queue(const snd_seq_queue_tempo_t* info);

unsigned int
snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t* info);

int
snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t* info);

unsigned int
snd_seq_queue_tempo_get_skew(const snd_seq_queue_tempo_t* info);

unsigned int
snd_seq_queue_tempo_get_skew_base(const snd_seq_queue_tempo_t* info);

void
snd_seq_queue_tempo_set_tempo(
    snd_seq_queue_tempo_t* info,
    unsigned int tempo
);

void
snd_seq_queue_tempo_set_ppq(
    snd_seq_queue_tempo_t* info,
    int ppq
);

void
snd_seq_queue_tempo_set_skew(
    snd_seq_queue_tempo_t* info,
    unsigned int skew
);

void
snd_seq_queue_tempo_set_skew_base(
    snd_seq_queue_tempo_t* info,
    unsigned int base
);

int
snd_seq_get_queue_tempo(
    snd_seq_t* handle,
    int q,
    snd_seq_queue_tempo_t* tempo
);

int
snd_seq_set_queue_tempo(
    snd_seq_t* handle,
    int q,
    snd_seq_queue_tempo_t* tempo
);

size_t
snd_seq_queue_timer_sizeof(void);

int
snd_seq_queue_timer_malloc(snd_seq_queue_timer_t** ptr);

void
snd_seq_queue_timer_free(snd_seq_queue_timer_t* ptr);

void
snd_seq_queue_timer_copy(
    snd_seq_queue_timer_t* dst,
    const snd_seq_queue_timer_t* src
);

int
snd_seq_queue_timer_get_queue(const snd_seq_queue_timer_t* info);

snd_seq_queue_timer_type_t
snd_seq_queue_timer_get_type(const snd_seq_queue_timer_t* info);

const snd_timer_id_t*
snd_seq_queue_timer_get_id(const snd_seq_queue_timer_t* info);

unsigned int
snd_seq_queue_timer_get_resolution(const snd_seq_queue_timer_t* info);

void
snd_seq_queue_timer_set_type(
    snd_seq_queue_timer_t* info,
    snd_seq_queue_timer_type_t type
);

void
snd_seq_queue_timer_set_id(
    snd_seq_queue_timer_t* info,
    const snd_timer_id_t* id
);

void
snd_seq_queue_timer_set_resolution(
    snd_seq_queue_timer_t* info,
    unsigned int resolution
);

int
snd_seq_get_queue_timer(
    snd_seq_t* handle,
    int q,
    snd_seq_queue_timer_t* timer
);

int
snd_seq_set_queue_timer(
    snd_seq_t* handle,
    int q,
    snd_seq_queue_timer_t* timer
);

// macros

#define SND_SEQ_QUEUE_DIRECT
#define snd_seq_queue_info_alloca(ptr)
#define snd_seq_queue_status_alloca(ptr)
#define snd_seq_queue_tempo_alloca(ptr)
#define snd_seq_queue_timer_alloca(ptr)

Detailed Documentation

Sequencer Queue Interface

Typedefs

typedef struct _snd_seq_queue_info snd_seq_queue_info_t

queue information container

typedef struct _snd_seq_queue_status snd_seq_queue_status_t

queue status container

typedef struct _snd_seq_queue_tempo snd_seq_queue_tempo_t

queue tempo container

typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t

queue timer information container

Global Functions

size_t
snd_seq_queue_info_sizeof(void)

get size of snd_seq_queue_info_t

Returns:

size in bytes

int
snd_seq_queue_info_malloc(snd_seq_queue_info_t** ptr)

allocate an empty snd_seq_queue_info_t using standard malloc

Parameters:

ptr returned pointer

Returns:

0 on success otherwise negative error code

void
snd_seq_queue_info_free(snd_seq_queue_info_t* ptr)

frees a previously allocated snd_seq_queue_info_t

Parameters:

obj pointer to object to free
void
snd_seq_queue_info_copy(
    snd_seq_queue_info_t* dst,
    const snd_seq_queue_info_t* src
)

copy one snd_seq_queue_info_t to another

Parameters:

dst pointer to destination
src pointer to source
int
snd_seq_queue_info_get_queue(const snd_seq_queue_info_t* info)

Get the queue id of a queue_info container.

Parameters:

info queue_info container

Returns:

queue id

See also:

snd_seq_get_queue_info(), snd_seq_queue_info_set_queue()

const char*
snd_seq_queue_info_get_name(const snd_seq_queue_info_t* info)

Get the name of a queue_info container.

Parameters:

info queue_info container

Returns:

name string

See also:

snd_seq_get_queue_info(), snd_seq_queue_info_set_name()

int
snd_seq_queue_info_get_owner(const snd_seq_queue_info_t* info)

Get the owner client id of a queue_info container.

Parameters:

info queue_info container

Returns:

owner client id

See also:

snd_seq_get_queue_info(), snd_seq_queue_info_set_owner()

int
snd_seq_queue_info_get_locked(const snd_seq_queue_info_t* info)

Get the lock status of a queue_info container.

Parameters:

info queue_info container

Returns:

lock status non-zero = locked

See also:

snd_seq_get_queue_info(), snd_seq_queue_info_set_locked()

unsigned int
snd_seq_queue_info_get_flags(const snd_seq_queue_info_t* info)

Get the conditional bit flags of a queue_info container.

Parameters:

info queue_info container

Returns:

conditional bit flags

See also:

snd_seq_get_queue_info(), snd_seq_queue_info_set_flags()

void
snd_seq_queue_info_set_name(
    snd_seq_queue_info_t* info,
    const char* name
)

Set the name of a queue_info container.

Parameters:

info queue_info container
name name string

See also:

snd_seq_get_queue_info(), snd_seq_queue_info_get_name()

void
snd_seq_queue_info_set_owner(
    snd_seq_queue_info_t* info,
    int owner
)

Set the owner client id of a queue_info container.

Parameters:

info queue_info container
owner client id

See also:

snd_seq_get_queue_info(), snd_seq_queue_info_get_owner()

void
snd_seq_queue_info_set_locked(
    snd_seq_queue_info_t* info,
    int locked
)

Set the lock status of a queue_info container.

Parameters:

info queue_info container
locked lock status

See also:

snd_seq_get_queue_info(), snd_seq_queue_info_get_locked()

void
snd_seq_queue_info_set_flags(
    snd_seq_queue_info_t* info,
    unsigned int flags
)

Set the conditional bit flags of a queue_info container.

Parameters:

info queue_info container
flags conditional bit flags

See also:

snd_seq_get_queue_info(), snd_seq_queue_info_get_flags()

int
snd_seq_create_queue(
    snd_seq_t* seq,
    snd_seq_queue_info_t* info
)

create a queue

Parameters:

seq sequencer handle
info queue information to initialize

Returns:

the queue id (zero or positive) on success otherwise a negative error code

See also:

snd_seq_alloc_queue()

int
snd_seq_alloc_named_queue(
    snd_seq_t* seq,
    const char* name
)

allocate a queue with the specified name

Parameters:

seq sequencer handle
name the name of the new queue

Returns:

the queue id (zero or positive) on success otherwise a negative error code

See also:

snd_seq_alloc_queue()

int
snd_seq_alloc_queue(snd_seq_t* handle)

allocate a queue

Parameters:

seq sequencer handle

Returns:

the queue id (zero or positive) on success otherwise a negative error code

See also:

snd_seq_alloc_named_queue(), snd_seq_create_queue(), snd_seq_free_queue(), snd_seq_get_queue_info()

int
snd_seq_free_queue(
    snd_seq_t* handle,
    int q
)

delete the specified queue

Parameters:

seq sequencer handle
q queue id to delete

Returns:

0 on success otherwise a negative error code

See also:

snd_seq_alloc_queue()

int
snd_seq_get_queue_info(
    snd_seq_t* seq,
    int q,
    snd_seq_queue_info_t* info
)

obtain queue attributes

Parameters:

seq sequencer handle
q queue id to query
info information returned

Returns:

0 on success otherwise a negative error code

See also:

snd_seq_alloc_queue(), snd_seq_set_queue_info(), snd_seq_query_named_queue()

int
snd_seq_set_queue_info(
    snd_seq_t* seq,
    int q,
    snd_seq_queue_info_t* info
)

change the queue attributes

Parameters:

seq sequencer handle
q queue id to change
info information changed

Returns:

0 on success otherwise a negative error code

See also:

snd_seq_get_queue_info()

int
snd_seq_query_named_queue(
    snd_seq_t* seq,
    const char* name
)

query the matching queue with the specified name

Searches the matching queue with the specified name string.

Parameters:

seq sequencer handle
name the name string to query

Returns:

the queue id if found or negative error code

See also:

snd_seq_get_queue_info()

int
snd_seq_get_queue_usage(
    snd_seq_t* handle,
    int q
)

Get the queue usage flag to the client.

Parameters:

seq sequencer handle
q queue id

Returns:

1 = client is allowed to access the queue, 0 = not allowed, otherwise a negative error code

See also:

snd_seq_get_queue_info(), snd_seq_set_queue_usage()

int
snd_seq_set_queue_usage(
    snd_seq_t* handle,
    int q,
    int used
)

Set the queue usage flag to the client.

Parameters:

seq sequencer handle
q queue id
used non-zero if the client is allowed

Returns:

0 on success otherwise a negative error code

See also:

snd_seq_get_queue_info(), snd_seq_set_queue_usage()

size_t
snd_seq_queue_status_sizeof(void)

get size of snd_seq_queue_status_t

Returns:

size in bytes

int
snd_seq_queue_status_malloc(snd_seq_queue_status_t** ptr)

allocate an empty snd_seq_queue_status_t using standard malloc

Parameters:

ptr returned pointer

Returns:

0 on success otherwise negative error code

void
snd_seq_queue_status_free(snd_seq_queue_status_t* ptr)

frees a previously allocated snd_seq_queue_status_t

Parameters:

obj pointer to object to free
void
snd_seq_queue_status_copy(
    snd_seq_queue_status_t* dst,
    const snd_seq_queue_status_t* src
)

copy one snd_seq_queue_status_t to another

Parameters:

dst pointer to destination
src pointer to source
int
snd_seq_queue_status_get_queue(const snd_seq_queue_status_t* info)

Get the queue id of a queue_status container.

Parameters:

info queue_status container

Returns:

queue id

See also:

snd_seq_get_queue_status()

int
snd_seq_queue_status_get_events(const snd_seq_queue_status_t* info)

Get the number of events of a queue_status container.

Parameters:

info queue_status container

Returns:

number of events

See also:

snd_seq_get_queue_status()

snd_seq_tick_time_t
snd_seq_queue_status_get_tick_time(const snd_seq_queue_status_t* info)

Get the tick time of a queue_status container.

Parameters:

info queue_status container

Returns:

tick time

See also:

snd_seq_get_queue_status()

const snd_seq_real_time_t*
snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t* info)

Get the real time of a queue_status container.

Parameters:

info queue_status container

See also:

snd_seq_get_queue_status()

unsigned int
snd_seq_queue_status_get_status(const snd_seq_queue_status_t* info)

Get the running status bits of a queue_status container.

Parameters:

info queue_status container

Returns:

running status bits

See also:

snd_seq_get_queue_status()

int
snd_seq_get_queue_status(
    snd_seq_t* handle,
    int q,
    snd_seq_queue_status_t* status
)

obtain the running state of the queue

Obtains the running state of the specified queue q.

Parameters:

seq sequencer handle
q queue id to query
status pointer to store the current status

Returns:

0 on success otherwise a negative error code

size_t
snd_seq_queue_tempo_sizeof(void)

get size of snd_seq_queue_tempo_t

Returns:

size in bytes

int
snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t** ptr)

allocate an empty snd_seq_queue_tempo_t using standard malloc

Parameters:

ptr returned pointer

Returns:

0 on success otherwise negative error code

void
snd_seq_queue_tempo_free(snd_seq_queue_tempo_t* ptr)

frees a previously allocated snd_seq_queue_tempo_t

Parameters:

obj pointer to object to free
void
snd_seq_queue_tempo_copy(
    snd_seq_queue_tempo_t* dst,
    const snd_seq_queue_tempo_t* src
)

copy one snd_seq_queue_tempo_t to another

Parameters:

dst pointer to destination
src pointer to source
int
snd_seq_queue_tempo_get_queue(const snd_seq_queue_tempo_t* info)

Get the queue id of a queue_status container.

Parameters:

info queue_status container

Returns:

queue id

See also:

snd_seq_get_queue_tempo()

unsigned int
snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t* info)

Get the tempo of a queue_status container.

Parameters:

info queue_status container

Returns:

tempo value

See also:

snd_seq_get_queue_tempo()

int
snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t* info)

Get the ppq of a queue_status container.

Parameters:

info queue_status container

Returns:

ppq value

See also:

snd_seq_get_queue_tempo()

unsigned int
snd_seq_queue_tempo_get_skew(const snd_seq_queue_tempo_t* info)

Get the timer skew value of a queue_status container.

Parameters:

info queue_status container

Returns:

timer skew value

See also:

snd_seq_get_queue_tempo()

unsigned int
snd_seq_queue_tempo_get_skew_base(const snd_seq_queue_tempo_t* info)

Get the timer skew base value of a queue_status container.

Parameters:

info queue_status container

Returns:

timer skew base value

See also:

snd_seq_get_queue_tempo()

void
snd_seq_queue_tempo_set_tempo(
    snd_seq_queue_tempo_t* info,
    unsigned int tempo
)

Set the tempo of a queue_status container.

Parameters:

info queue_status container
tempo tempo value

See also:

snd_seq_get_queue_tempo()

void
snd_seq_queue_tempo_set_ppq(
    snd_seq_queue_tempo_t* info,
    int ppq
)

Set the ppq of a queue_status container.

Parameters:

info queue_status container
ppq ppq value

See also:

snd_seq_get_queue_tempo()

void
snd_seq_queue_tempo_set_skew(
    snd_seq_queue_tempo_t* info,
    unsigned int skew
)

Set the timer skew value of a queue_status container.

The skew of timer is calculated as skew / base. For example, to play with double speed, pass base * 2 as the skew value.

Parameters:

info queue_status container
skew timer skew value

See also:

snd_seq_get_queue_tempo()

void
snd_seq_queue_tempo_set_skew_base(
    snd_seq_queue_tempo_t* info,
    unsigned int base
)

Set the timer skew base value of a queue_status container.

Parameters:

info queue_status container
base timer skew base value

See also:

snd_seq_get_queue_tempo()

int
snd_seq_get_queue_tempo(
    snd_seq_t* handle,
    int q,
    snd_seq_queue_tempo_t* tempo
)

obtain the current tempo of the queue

Parameters:

seq sequencer handle
q queue id to be queried
tempo pointer to store the current tempo

Returns:

0 on success otherwise a negative error code

See also:

snd_seq_set_queue_tempo()

int
snd_seq_set_queue_tempo(
    snd_seq_t* handle,
    int q,
    snd_seq_queue_tempo_t* tempo
)

set the tempo of the queue

Parameters:

seq sequencer handle
q queue id to change the tempo
tempo tempo information

Returns:

0 on success otherwise a negative error code

See also:

snd_seq_get_queue_tempo()

size_t
snd_seq_queue_timer_sizeof(void)

get size of snd_seq_queue_timer_t

Returns:

size in bytes

int
snd_seq_queue_timer_malloc(snd_seq_queue_timer_t** ptr)

allocate an empty snd_seq_queue_timer_t using standard malloc

Parameters:

ptr returned pointer

Returns:

0 on success otherwise negative error code

void
snd_seq_queue_timer_free(snd_seq_queue_timer_t* ptr)

frees a previously allocated snd_seq_queue_timer_t

Parameters:

obj pointer to object to free
void
snd_seq_queue_timer_copy(
    snd_seq_queue_timer_t* dst,
    const snd_seq_queue_timer_t* src
)

copy one snd_seq_queue_timer_t to another

Parameters:

dst pointer to destination
src pointer to source
int
snd_seq_queue_timer_get_queue(const snd_seq_queue_timer_t* info)

Get the queue id of a queue_timer container.

Parameters:

info queue_timer container

Returns:

queue id

See also:

snd_seq_get_queue_timer()

snd_seq_queue_timer_type_t
snd_seq_queue_timer_get_type(const snd_seq_queue_timer_t* info)

Get the timer type of a queue_timer container.

Parameters:

info queue_timer container

Returns:

timer type

See also:

snd_seq_get_queue_timer()

const snd_timer_id_t*
snd_seq_queue_timer_get_id(const snd_seq_queue_timer_t* info)

Get the timer id of a queue_timer container.

Parameters:

info queue_timer container

Returns:

timer id pointer

See also:

snd_seq_get_queue_timer()

unsigned int
snd_seq_queue_timer_get_resolution(const snd_seq_queue_timer_t* info)

Get the timer resolution of a queue_timer container.

Parameters:

info queue_timer container

Returns:

timer resolution

See also:

snd_seq_get_queue_timer()

void
snd_seq_queue_timer_set_type(
    snd_seq_queue_timer_t* info,
    snd_seq_queue_timer_type_t type
)

Set the timer type of a queue_timer container.

Parameters:

info queue_timer container
type timer type

See also:

snd_seq_get_queue_timer()

void
snd_seq_queue_timer_set_id(
    snd_seq_queue_timer_t* info,
    const snd_timer_id_t* id
)

Set the timer id of a queue_timer container.

Parameters:

info queue_timer container
id timer id pointer

See also:

snd_seq_get_queue_timer()

void
snd_seq_queue_timer_set_resolution(
    snd_seq_queue_timer_t* info,
    unsigned int resolution
)

Set the timer resolution of a queue_timer container.

Parameters:

info queue_timer container
resolution timer resolution

See also:

snd_seq_get_queue_timer()

int
snd_seq_get_queue_timer(
    snd_seq_t* handle,
    int q,
    snd_seq_queue_timer_t* timer
)

obtain the queue timer information

Parameters:

seq sequencer handle
q queue id to query
timer pointer to store the timer information

Returns:

0 on success otherwise a negative error code

See also:

snd_seq_set_queue_timer()

int
snd_seq_set_queue_timer(
    snd_seq_t* handle,
    int q,
    snd_seq_queue_timer_t* timer
)

set the queue timer information

Parameters:

seq sequencer handle
q queue id to change the timer
timer timer information

Returns:

0 on success otherwise a negative error code

See also:

snd_seq_get_queue_timer()

Macros

#define SND_SEQ_QUEUE_DIRECT

special queue ids direct dispatch

#define snd_seq_queue_info_alloca(ptr)

allocate a snd_seq_queue_info_t container on stack

#define snd_seq_queue_status_alloca(ptr)

allocate a snd_seq_queue_status_t container on stack

#define snd_seq_queue_tempo_alloca(ptr)

allocate a snd_seq_queue_tempo_t container on stack

#define snd_seq_queue_timer_alloca(ptr)

allocate a snd_seq_queue_timer_t container on stack