ALSA project - the C library reference

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

## ◆ snd_seq_port_subscribe_alloca

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

allocate a snd_seq_port_subscribe_t container on stack

## ◆ snd_seq_query_subscribe_alloca

#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

## ◆ snd_seq_port_subscribe_t

typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t

port subscription container

## ◆ snd_seq_query_subscribe_t

typedef struct _snd_seq_query_subscribe snd_seq_query_subscribe_t

subscription query container

## Enumeration Type Documentation

## ◆ snd_seq_query_subs_type_t

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

## ◆ snd_seq_get_port_subscription()

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()

## ◆ snd_seq_port_subscribe_copy()

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

## ◆ snd_seq_port_subscribe_free()

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

## ◆ snd_seq_port_subscribe_get_dest()

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()

## ◆ snd_seq_port_subscribe_get_exclusive()

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()

## ◆ snd_seq_port_subscribe_get_queue()

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()

## ◆ snd_seq_port_subscribe_get_sender()

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()

## ◆ snd_seq_port_subscribe_get_time_real()

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()

## ◆ snd_seq_port_subscribe_get_time_update()

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()

## ◆ snd_seq_port_subscribe_malloc()

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

## ◆ snd_seq_port_subscribe_set_dest()

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()

## ◆ snd_seq_port_subscribe_set_exclusive()

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()

## ◆ snd_seq_port_subscribe_set_queue()

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()

## ◆ snd_seq_port_subscribe_set_sender()

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()

## ◆ snd_seq_port_subscribe_set_time_real()

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()

## ◆ snd_seq_port_subscribe_set_time_update()

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()

## ◆ snd_seq_port_subscribe_sizeof()

size_t snd_seq_port_subscribe_sizeof | ( | void |  | ) |

get size of snd_seq_port_subscribe_t

Returns
  size in bytes

## ◆ snd_seq_query_port_subscribers()

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()

## ◆ snd_seq_query_subscribe_copy()

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

## ◆ snd_seq_query_subscribe_free()

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

## ◆ snd_seq_query_subscribe_get_addr()

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()

## ◆ snd_seq_query_subscribe_get_client()

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()

## ◆ snd_seq_query_subscribe_get_exclusive()

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()

## ◆ snd_seq_query_subscribe_get_index()

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()

## ◆ snd_seq_query_subscribe_get_num_subs()

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()

## ◆ snd_seq_query_subscribe_get_port()

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()

## ◆ snd_seq_query_subscribe_get_queue()

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()

## ◆ snd_seq_query_subscribe_get_root()

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()

## ◆ snd_seq_query_subscribe_get_time_real()

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()

## ◆ snd_seq_query_subscribe_get_time_update()

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_subscribe_get_type()

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()

## ◆ snd_seq_query_subscribe_malloc()

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

## ◆ snd_seq_query_subscribe_set_client()

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()

## ◆ snd_seq_query_subscribe_set_index()

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()

## ◆ snd_seq_query_subscribe_set_port()

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()

## ◆ snd_seq_query_subscribe_set_root()

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()

## ◆ snd_seq_query_subscribe_set_type()

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()

## ◆ snd_seq_query_subscribe_sizeof()

size_t snd_seq_query_subscribe_sizeof | ( | void |  | ) |

get size of snd_seq_query_subscribe_t

Returns
  size in bytes

## ◆ snd_seq_subscribe_port()

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()

## ◆ snd_seq_unsubscribe_port()

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()