Source and destination addresses

To identify the source and destination of an event, the addressing field contains a combination of client and port ids.

/* event address */
typedef struct {
	unsigned char client;	/* Client number */
	unsigned char port;	/* Port within client */
} snd_seq_addr_t;

When an event is passed to sequencer from a client, sequencer fills source.client field with the sender's id automatically. It is the responsibility of sender client to fill the port id of source.port and both client and port of dest field.

If an existing address is set to the destination, the event is simplly delivered to it. Additionally, some special client id's are allowed for broadcasting:

SND_SEQ_ADDRESS_BROADCAST

Broadcasts the event to all clients. The event is delivered only to the clients which accept broadcast messages. See client filters. For broadcasting the event to all ports, both destination port and client must be set to SND_SEQ_ADDRESS_BROADCAST.

SND_SEQ_ADDRESS_SUBSCRIBERS

Sends the event to all subscribers to the sender port. See Subscription of ports.

A sequencer core has two pre-defined system ports.

#define SND_SEQ_CLIENT_SYSTEM		0
#define SND_SEQ_PORT_SYSTEM_TIMER	0
#define SND_SEQ_PORT_SYSTEM_ANNOUNCE	1
The SND_SEQ_PORT_SYSTEM_TIMER is the system timer port, and SND_SEQ_PORT_SYSTEM_ANNOUNCE is the system announce port. The former accpets events from other clients for controlling queues, and sends the received queue-control events to its subscribers. The latter broadcasts notify events of client/port creation, deletion and modification to its subscribers.