ALSA project - the C library reference: Sequencer Port Subscription

ALSA project - the C library reference

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Enumerations | Functions
Sequencer Port Subscription
MIDI Sequencer

## Macros
#define | snd_seq_port_subscribe_alloca(ptr) __snd_alloca(ptr, snd_seq_port_subscribe)
#define | snd_seq_query_subscribe_alloca(ptr) __snd_alloca(ptr, snd_seq_query_subscribe)

## Typedefs
typedef struct _snd_seq_port_subscribe | snd_seq_port_subscribe_t
typedef struct _snd_seq_query_subscribe | snd_seq_query_subscribe_t

## Enumerations
enum | snd_seq_query_subs_type_t { SND_SEQ_QUERY_SUBS_READ, SND_SEQ_QUERY_SUBS_WRITE }

## Functions
size_t | snd_seq_port_subscribe_sizeof (void)
| get size of snd_seq_port_subscribe_t More...
int | snd_seq_port_subscribe_malloc (snd_seq_port_subscribe_t **ptr)
| allocate an empty snd_seq_port_subscribe_t using standard malloc More...
void | snd_seq_port_subscribe_free (snd_seq_port_subscribe_t *ptr)
| frees a previously allocated snd_seq_port_subscribe_t More...
void | snd_seq_port_subscribe_copy (snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src)
| copy one snd_seq_port_subscribe_t to another More...
const snd_seq_addr_t * | snd_seq_port_subscribe_get_sender (const snd_seq_port_subscribe_t *info)
| Get sender address of a port_subscribe container. More...
const snd_seq_addr_t * | snd_seq_port_subscribe_get_dest (const snd_seq_port_subscribe_t *info)
| Get destination address of a port_subscribe container. More...
int | snd_seq_port_subscribe_get_queue (const snd_seq_port_subscribe_t *info)
| Get the queue id of a port_subscribe container. More...
int | snd_seq_port_subscribe_get_exclusive (const snd_seq_port_subscribe_t *info)
| Get the exclusive mode of a port_subscribe container. More...
int | snd_seq_port_subscribe_get_time_update (const snd_seq_port_subscribe_t *info)
| Get the time-update mode of a port_subscribe container. More...
int | snd_seq_port_subscribe_get_time_real (const snd_seq_port_subscribe_t *info)
| Get the real-time update mode of a port_subscribe container. More...
void | snd_seq_port_subscribe_set_sender (snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr)
| Set sender address of a port_subscribe container. More...
void | snd_seq_port_subscribe_set_dest (snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr)
| Set destination address of a port_subscribe container. More...
void | snd_seq_port_subscribe_set_queue (snd_seq_port_subscribe_t *info, int q)
| Set the queue id of a port_subscribe container. More...
void | snd_seq_port_subscribe_set_exclusive (snd_seq_port_subscribe_t *info, int val)
| Set the exclusive mode of a port_subscribe container. More...
void | snd_seq_port_subscribe_set_time_update (snd_seq_port_subscribe_t *info, int val)
| Set the time-update mode of a port_subscribe container. More...
void | snd_seq_port_subscribe_set_time_real (snd_seq_port_subscribe_t *info, int val)
| Set the real-time mode of a port_subscribe container. More...
int | snd_seq_get_port_subscription (snd_seq_t *handle, snd_seq_port_subscribe_t *sub)
| obtain subscription information More...
int | snd_seq_subscribe_port (snd_seq_t *handle, snd_seq_port_subscribe_t *sub)
| subscribe a port connection More...
int | snd_seq_unsubscribe_port (snd_seq_t *handle, snd_seq_port_subscribe_t *sub)
| unsubscribe a connection between ports More...
size_t | snd_seq_query_subscribe_sizeof (void)
| get size of snd_seq_query_subscribe_t More...
int | snd_seq_query_subscribe_malloc (snd_seq_query_subscribe_t **ptr)
| allocate an empty snd_seq_query_subscribe_t using standard malloc More...
void | snd_seq_query_subscribe_free (snd_seq_query_subscribe_t *ptr)
| frees a previously allocated snd_seq_query_subscribe_t More...
void | snd_seq_query_subscribe_copy (snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src)
| copy one snd_seq_query_subscribe_t to another More...
int | snd_seq_query_subscribe_get_client (const snd_seq_query_subscribe_t *info)
| Get the client id of a query_subscribe container. More...
int | snd_seq_query_subscribe_get_port (const snd_seq_query_subscribe_t *info)
| Get the port id of a query_subscribe container. More...
const snd_seq_addr_t * | snd_seq_query_subscribe_get_root (const snd_seq_query_subscribe_t *info)
| Get the client/port address of a query_subscribe container. More...
snd_seq_query_subs_type_t | snd_seq_query_subscribe_get_type (const snd_seq_query_subscribe_t *info)
| Get the query type of a query_subscribe container. More...
int | snd_seq_query_subscribe_get_index (const snd_seq_query_subscribe_t *info)
| Get the index of subscriber of a query_subscribe container. More...
int | snd_seq_query_subscribe_get_num_subs (const snd_seq_query_subscribe_t *info)
| Get the number of subscriptions of a query_subscribe container. More...
const snd_seq_addr_t * | snd_seq_query_subscribe_get_addr (const snd_seq_query_subscribe_t *info)
| Get the address of subscriber of a query_subscribe container. More...
int | snd_seq_query_subscribe_get_queue (const snd_seq_query_subscribe_t *info)
| Get the queue id of subscriber of a query_subscribe container. More...
int | snd_seq_query_subscribe_get_exclusive (const snd_seq_query_subscribe_t *info)
| Get the exclusive mode of a query_subscribe container. More...
int | snd_seq_query_subscribe_get_time_update (const snd_seq_query_subscribe_t *info)
| Get the time-update mode of a query_subscribe container. More...
int | snd_seq_query_subscribe_get_time_real (const snd_seq_query_subscribe_t *info)
| Get the real-time update mode of a query_subscribe container. More...
void | snd_seq_query_subscribe_set_client (snd_seq_query_subscribe_t *info, int client)
| Set the client id of a query_subscribe container. More...
void | snd_seq_query_subscribe_set_port (snd_seq_query_subscribe_t *info, int port)
| Set the port id of a query_subscribe container. More...
void | snd_seq_query_subscribe_set_root (snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr)
| Set the client/port address of a query_subscribe container. More...
void | snd_seq_query_subscribe_set_type (snd_seq_query_subscribe_t *info, snd_seq_query_subs_type_t type)
| Set the query type of a query_subscribe container. More...
void | snd_seq_query_subscribe_set_index (snd_seq_query_subscribe_t *info, int _index)
| Set the subscriber's index to be queried. More...
int | snd_seq_query_port_subscribers (snd_seq_t *seq, snd_seq_query_subscribe_t *subs)
| query port subscriber list More...

## Detailed Description

Sequencer Port Subscription

## Macro Definition Documentation

#define snd_seq_port_subscribe_alloca | ( |  | ptr | ) | __snd_alloca(ptr, snd_seq_port_subscribe)

allocate a snd_seq_port_subscribe_t container on stack

#define snd_seq_query_subscribe_alloca | ( |  | ptr | ) | __snd_alloca(ptr, snd_seq_query_subscribe)

allocate a snd_seq_query_subscribe_t container on stack

## Typedef Documentation

typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t

port subscription container

typedef struct _snd_seq_query_subscribe snd_seq_query_subscribe_t

subscription query container

## Enumeration Type Documentation

enum snd_seq_query_subs_type_t

type of query subscription

Enumerator
SND_SEQ_QUERY_SUBS_READ | query read subscriptions
SND_SEQ_QUERY_SUBS_WRITE | query write subscriptions

## Function Documentation

int snd_seq_get_port_subscription | ( | snd_seq_t * | seq,
|  | snd_seq_port_subscribe_t * | sub
| ) |  |

obtain subscription information

Parameters

  seq | sequencer handle
  sub | pointer to return the subscription information

Returns
  0 on success otherwise a negative error code

See Also
  snd_seq_subscribe_port(), snd_seq_query_port_subscribers()

void snd_seq_port_subscribe_copy | ( | snd_seq_port_subscribe_t * | dst,
|  | const snd_seq_port_subscribe_t * | src
| ) |  |

copy one snd_seq_port_subscribe_t to another

Parameters

  dst | pointer to destination
  src | pointer to source

void snd_seq_port_subscribe_free | ( | snd_seq_port_subscribe_t * | obj | ) |

frees a previously allocated snd_seq_port_subscribe_t

Parameters

  obj | pointer to object to free

const snd_seq_addr_t* snd_seq_port_subscribe_get_dest | ( | const snd_seq_port_subscribe_t * | info | ) |

Get destination address of a port_subscribe container.

Parameters

  info | port_subscribe container

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_set_dest()

int snd_seq_port_subscribe_get_exclusive | ( | const snd_seq_port_subscribe_t * | info | ) |

Get the exclusive mode of a port_subscribe container.

Parameters

  info | port_subscribe container

Returns
  1 if exclusive mode

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_set_exclusive()

int snd_seq_port_subscribe_get_queue | ( | const snd_seq_port_subscribe_t * | info | ) |

Get the queue id of a port_subscribe container.

Parameters

  info | port_subscribe container

Returns
  queue id

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_set_queue()

const snd_seq_addr_t* snd_seq_port_subscribe_get_sender | ( | const snd_seq_port_subscribe_t * | info | ) |

Get sender address of a port_subscribe container.

Parameters

  info | port_subscribe container

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_set_sender()

int snd_seq_port_subscribe_get_time_real | ( | const snd_seq_port_subscribe_t * | info | ) |

Get the real-time update mode of a port_subscribe container.

Parameters

  info | port_subscribe container

Returns
  1 if real-time update mode

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_set_time_real()

int snd_seq_port_subscribe_get_time_update | ( | const snd_seq_port_subscribe_t * | info | ) |

Get the time-update mode of a port_subscribe container.

Parameters

  info | port_subscribe container

Returns
  1 if update timestamp

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_set_time_update()

int snd_seq_port_subscribe_malloc | ( | snd_seq_port_subscribe_t ** | ptr | ) |

allocate an empty snd_seq_port_subscribe_t using standard malloc

Parameters

  ptr | returned pointer

Returns
  0 on success otherwise negative error code

void snd_seq_port_subscribe_set_dest | ( | snd_seq_port_subscribe_t * | info,
|  | const snd_seq_addr_t * | addr
| ) |  |

Set destination address of a port_subscribe container.

Parameters

  info | port_subscribe container
  addr | destination address

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_get_dest()

void snd_seq_port_subscribe_set_exclusive | ( | snd_seq_port_subscribe_t * | info,
|  | int | val
| ) |  |

Set the exclusive mode of a port_subscribe container.

Parameters

  info | port_subscribe container
  val | non-zero to enable

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_get_exclusive()

void snd_seq_port_subscribe_set_queue | ( | snd_seq_port_subscribe_t * | info,
|  | int | q
| ) |  |

Set the queue id of a port_subscribe container.

Parameters

  info | port_subscribe container
  q | queue id

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_get_queue()

void snd_seq_port_subscribe_set_sender | ( | snd_seq_port_subscribe_t * | info,
|  | const snd_seq_addr_t * | addr
| ) |  |

Set sender address of a port_subscribe container.

Parameters

  info | port_subscribe container
  addr | sender address

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_get_sender()

void snd_seq_port_subscribe_set_time_real | ( | snd_seq_port_subscribe_t * | info,
|  | int | val
| ) |  |

Set the real-time mode of a port_subscribe container.

Parameters

  info | port_subscribe container
  val | non-zero to enable

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_get_time_real()

void snd_seq_port_subscribe_set_time_update | ( | snd_seq_port_subscribe_t * | info,
|  | int | val
| ) |  |

Set the time-update mode of a port_subscribe container.

Parameters

  info | port_subscribe container
  val | non-zero to enable

See Also
  snd_seq_subscribe_port(), snd_seq_port_subscribe_get_time_update()

size_t snd_seq_port_subscribe_sizeof | ( | void |  | ) |

get size of snd_seq_port_subscribe_t

Returns
  size in bytes

int snd_seq_query_port_subscribers | ( | snd_seq_t * | seq,
|  | snd_seq_query_subscribe_t * | subs
| ) |  |

query port subscriber list

Parameters

  seq | sequencer handle
  subs | subscription to query

Returns
  0 on success otherwise a negative error code

Queries the subscribers accessing to a port. The query information is specified in subs argument.

At least, the client id, the port id, the index number and the query type must be set to perform a proper query. As the query type, SND_SEQ_QUERY_SUBS_READ or SND_SEQ_QUERY_SUBS_WRITE can be specified to check whether the readers or the writers to the port. To query the first subscription, set 0 to the index number. To list up all the subscriptions, call this function with the index numbers from 0 until this returns a negative value.

See Also
  snd_seq_get_port_subscription()

void snd_seq_query_subscribe_copy | ( | snd_seq_query_subscribe_t * | dst,
|  | const snd_seq_query_subscribe_t * | src
| ) |  |

copy one snd_seq_query_subscribe_t to another

Parameters

  dst | pointer to destination
  src | pointer to source

void snd_seq_query_subscribe_free | ( | snd_seq_query_subscribe_t * | obj | ) |

frees a previously allocated snd_seq_query_subscribe_t

Parameters

  obj | pointer to object to free

const snd_seq_addr_t* snd_seq_query_subscribe_get_addr | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the address of subscriber of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  subscriber's address pointer

See Also
  snd_seq_query_port_subscribers()

int snd_seq_query_subscribe_get_client | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the client id of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  client id

See Also
  snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_client()

int snd_seq_query_subscribe_get_exclusive | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the exclusive mode of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  1 if exclusive mode

See Also
  snd_seq_query_port_subscribers()

int snd_seq_query_subscribe_get_index | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the index of subscriber of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  subscriber's index

See Also
  snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_index()

int snd_seq_query_subscribe_get_num_subs | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the number of subscriptions of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  number of subscriptions

See Also
  snd_seq_query_port_subscribers()

int snd_seq_query_subscribe_get_port | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the port id of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  port id

See Also
  snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_port()

int snd_seq_query_subscribe_get_queue | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the queue id of subscriber of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  subscriber's queue id

See Also
  snd_seq_query_port_subscribers()

const snd_seq_addr_t* snd_seq_query_subscribe_get_root | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the client/port address of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  client/port address pointer

See Also
  snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_root()

int snd_seq_query_subscribe_get_time_real | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the real-time update mode of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  1 if real-time update mode

See Also
  snd_seq_query_port_subscribers()

int snd_seq_query_subscribe_get_time_update | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the time-update mode of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  1 if update timestamp

See Also
  snd_seq_query_port_subscribers()

snd_seq_query_subs_type_t snd_seq_query_subscribe_get_type | ( | const snd_seq_query_subscribe_t * | info | ) |

Get the query type of a query_subscribe container.

Parameters

  info | query_subscribe container

Returns
  query type

See Also
  snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_type()

int snd_seq_query_subscribe_malloc | ( | snd_seq_query_subscribe_t ** | ptr | ) |

allocate an empty snd_seq_query_subscribe_t using standard malloc

Parameters

  ptr | returned pointer

Returns
  0 on success otherwise negative error code

void snd_seq_query_subscribe_set_client | ( | snd_seq_query_subscribe_t * | info,
|  | int | client
| ) |  |

Set the client id of a query_subscribe container.

Parameters

  info | query_subscribe container
  client | client id

See Also
  snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_client()

void snd_seq_query_subscribe_set_index | ( | snd_seq_query_subscribe_t * | info,
|  | int | index
| ) |  |

Set the subscriber's index to be queried.

Parameters

  info | query_subscribe container
  index | index to be queried

See Also
  snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_index()

void snd_seq_query_subscribe_set_port | ( | snd_seq_query_subscribe_t * | info,
|  | int | port
| ) |  |

Set the port id of a query_subscribe container.

Parameters

  info | query_subscribe container
  port | port id

See Also
  snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_port()

void snd_seq_query_subscribe_set_root | ( | snd_seq_query_subscribe_t * | info,
|  | const snd_seq_addr_t * | addr
| ) |  |

Set the client/port address of a query_subscribe container.

Parameters

  info | query_subscribe container
  addr | client/port address pointer

See Also
  snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_root()

void snd_seq_query_subscribe_set_type | ( | snd_seq_query_subscribe_t * | info,
|  | snd_seq_query_subs_type_t | type
| ) |  |

Set the query type of a query_subscribe container.

Parameters

  info | query_subscribe container
  type | query type

See Also
  snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_type()

size_t snd_seq_query_subscribe_sizeof | ( | void |  | ) |

get size of snd_seq_query_subscribe_t

Returns
  size in bytes

int snd_seq_subscribe_port | ( | snd_seq_t * | seq,
|  | snd_seq_port_subscribe_t * | sub
| ) |  |

subscribe a port connection

Parameters

  seq | sequencer handle
  sub | subscription information

Returns
  0 on success otherwise a negative error code

Subscribes a connection between two ports. The subscription information is stored in sub argument.

See Also
  snd_seq_get_port_subscription(), snd_seq_unsubscribe_port(), snd_seq_connect_from(), snd_seq_connect_to()

int snd_seq_unsubscribe_port | ( | snd_seq_t * | seq,
|  | snd_seq_port_subscribe_t * | sub
| ) |  |

unsubscribe a connection between ports

Parameters

  seq | sequencer handle
  sub | subscription information to disconnect

Returns
  0 on success otherwise a negative error code

Unsubscribes a connection between two ports, described in sender and dest fields in sub argument.

See Also
  snd_seq_subscribe_port(), snd_seq_disconnect_from(), snd_seq_disconnect_to()