Creates a sequencer port on the current client. Retruns zero if successful, or a negative error code. The attributes of created port is specified in info argument.
typedef struct { int client; /* client number */ int port; /* port number */ char name[64]; /* port name */ char group[32]; /* group name (copied from client) */ unsigned int capability; /* port capability bits */ unsigned int cap_group; /* permission to group */ unsigned int type; /* port type bits */ int midi_channels; /* channels per MIDI port */ int midi_voices; /* voices per MIDI port */ int synth_voices; /* voices per SYNTH port */ int read_use; /* R/O: subscribers for output (from this port) */ int write_use; /* R/O: subscribers for input (to this port) */ void *kernel; /* reserved for kernel use (must be NULL) */ unsigned int flags; /* misc. conditioning */ char reserved[60]; /* for future use */ } snd_seq_port_info_t;The client field is overwritten with the current client id. Behavior of port creation depends on a flag defined in flags field. The flags field is a bit mask containing miscellaneous conditions.
Value | Description |
---|---|
SND_SEQ_PORT_FLG_GIVEN_PORT | The port number is specified in port field. |
The group and name fields can be defined arbitrary. There are some pre-defined group names for system, MIDI device and applications.
Value | Description |
---|---|
SND_SEQ_GROUP_SYSTEM | For sequencer system use. |
SND_SEQ_GROUP_DEVICE | For input/output device driver or equivalent. |
SND_SEQ_GROUP_APPLICATION | For usual applications. |
The capability and cap_group are bit-masks to specify the access capability of the port from other clients and from the same group, respectively. The capability bit flags are defined as follows:
Value | Description |
---|---|
SND_SEQ_PORT_CAP_READ | Readable from this port. |
SND_SEQ_PORT_CAP_WRITE | Writable to this port. |
SND_SEQ_PORT_CAP_SYNC_READ | For synchronization (not implemented). |
SND_SEQ_PORT_CAP_SYNC_WRITE | For synchronization (not implemented). |
SND_SEQ_PORT_CAP_DUPLEX | Read/write duplex access is supported. |
SND_SEQ_PORT_SUBS_READ | Read subscription is allowed. |
SND_SEQ_PORT_SUBS_WRITE | Write subscription is allowed. |
SND_SEQ_PORT_SUBS_NO_EXPORT | Subscription management from 3rd client is disallowed. |
The type field is used to specify the type of the port. It is a bitmask defined as follows:
Value | Description |
---|---|
SND_SEQ_PORT_TYPE_SPECIFIC | Hardware specific port |
SND_SEQ_PORT_TYPE_MIDI_GENERIC | Generic MIDI device |
SND_SEQ_PORT_TYPE_MIDI_GM | General MIDI compatible device |
SND_SEQ_PORT_TYPE_MIDI_GS | GS compatible device |
SND_SEQ_PORT_TYPE_MIDI_XG | XG compatible device |
SND_SEQ_PORT_TYPE_MIDI_MT32 | MT-32 compatible device |
SND_SEQ_PORT_TYPE_SYNTH | Synth device |
SND_SEQ_PORT_TYPE_DIRECT_SAMPLE | Sampling device (supporting download) |
SND_SEQ_PORT_TYPE_SAMPLE | Sampling device (sample can be downloaded at any time) |
SND_SEQ_PORT_TYPE_APPLICATION | Application (suquencer/editor) |
The midi_channels, midi_voices and synth_voices fields are number of channels and voices of this port. These values could be zero as default. The read_use, write_use and kernel fields are at creation. They should be zero-cleared.