Skip to content

Commit 450047a

Browse files
cladischJaroslav Kysela
authored andcommitted
[ALSA] add more sequencer port type information bits
Add four new information flags SNDRV_SEQ_PORT_TYPE_HARDWARE, _SOFTWARE, _SYNTHESIZER, _PORT for sequencer ports. This makes it easier for apps like Rosegarden to make policy decisions based on the port type. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
1 parent c97f3dd commit 450047a

10 files changed

Lines changed: 31 additions & 9 deletions

File tree

‎include/sound/asequencer.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,10 @@ struct snd_seq_remove_events {
605605
#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
606606
#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
607607
/*...*/
608+
#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */
609+
#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */
610+
#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
611+
#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */
608612
#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
609613

610614
/* misc. conditioning flags */

‎sound/core/seq/seq_dummy.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ create_port(int idx, int type)
171171
pinfo.capability |= SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE;
172172
if (duplex)
173173
pinfo.capability |= SNDRV_SEQ_PORT_CAP_DUPLEX;
174-
pinfo.type = SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC;
174+
pinfo.type = SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC
175+
| SNDRV_SEQ_PORT_TYPE_SOFTWARE
176+
| SNDRV_SEQ_PORT_TYPE_PORT;
175177
memset(&pcb, 0, sizeof(pcb));
176178
pcb.owner = THIS_MODULE;
177179
pcb.unuse = dummy_unuse;

‎sound/core/seq/seq_midi.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,9 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev)
376376
if ((port->capability & (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_READ)) == (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_READ) &&
377377
info->flags & SNDRV_RAWMIDI_INFO_DUPLEX)
378378
port->capability |= SNDRV_SEQ_PORT_CAP_DUPLEX;
379-
port->type = SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC;
379+
port->type = SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC
380+
| SNDRV_SEQ_PORT_TYPE_HARDWARE
381+
| SNDRV_SEQ_PORT_TYPE_PORT;
380382
port->midi_channels = 16;
381383
memset(&pcallbacks, 0, sizeof(pcallbacks));
382384
pcallbacks.owner = THIS_MODULE;

‎sound/core/seq/seq_virmidi.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev)
390390
pinfo->capability |= SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SYNC_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE;
391391
pinfo->capability |= SNDRV_SEQ_PORT_CAP_READ | SNDRV_SEQ_PORT_CAP_SYNC_READ | SNDRV_SEQ_PORT_CAP_SUBS_READ;
392392
pinfo->capability |= SNDRV_SEQ_PORT_CAP_DUPLEX;
393-
pinfo->type = SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC;
393+
pinfo->type = SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC
394+
| SNDRV_SEQ_PORT_TYPE_SOFTWARE
395+
| SNDRV_SEQ_PORT_TYPE_PORT;
394396
pinfo->midi_channels = 16;
395397
memset(&pcallbacks, 0, sizeof(pcallbacks));
396398
pcallbacks.owner = THIS_MODULE;

‎sound/drivers/opl3/opl3_oss.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ static int snd_opl3_oss_create_port(struct snd_opl3 * opl3)
9999
opl3->oss_chset->port = snd_seq_event_port_attach(opl3->seq_client, &callbacks,
100100
SNDRV_SEQ_PORT_CAP_WRITE,
101101
SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
102-
SNDRV_SEQ_PORT_TYPE_MIDI_GM,
102+
SNDRV_SEQ_PORT_TYPE_MIDI_GM |
103+
SNDRV_SEQ_PORT_TYPE_HARDWARE |
104+
SNDRV_SEQ_PORT_TYPE_SYNTHESIZER,
103105
voices, voices,
104106
name);
105107
if (opl3->oss_chset->port < 0) {

‎sound/drivers/opl3/opl3_seq.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ static int snd_opl3_synth_create_port(struct snd_opl3 * opl3)
203203
SNDRV_SEQ_PORT_CAP_SUBS_WRITE,
204204
SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
205205
SNDRV_SEQ_PORT_TYPE_MIDI_GM |
206-
SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE,
206+
SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE |
207+
SNDRV_SEQ_PORT_TYPE_HARDWARE |
208+
SNDRV_SEQ_PORT_TYPE_SYNTHESIZER,
207209
16, voices,
208210
name);
209211
if (opl3->chset->port < 0) {

‎sound/drivers/opl4/opl4_seq.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ static int snd_opl4_seq_new_device(struct snd_seq_device *dev)
164164
SNDRV_SEQ_PORT_CAP_WRITE |
165165
SNDRV_SEQ_PORT_CAP_SUBS_WRITE,
166166
SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
167-
SNDRV_SEQ_PORT_TYPE_MIDI_GM,
167+
SNDRV_SEQ_PORT_TYPE_MIDI_GM |
168+
SNDRV_SEQ_PORT_TYPE_HARDWARE |
169+
SNDRV_SEQ_PORT_TYPE_SYNTHESIZER,
168170
16, 24,
169171
"OPL4 Wavetable Port");
170172
if (opl4->chset->port < 0) {

‎sound/isa/gus/gus_synth.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ static int snd_gus_synth_create_port(struct snd_gus_card * gus, int idx)
194194
&callbacks,
195195
SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE,
196196
SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE |
197-
SNDRV_SEQ_PORT_TYPE_SYNTH,
197+
SNDRV_SEQ_PORT_TYPE_SYNTH |
198+
SNDRV_SEQ_PORT_TYPE_HARDWARE |
199+
SNDRV_SEQ_PORT_TYPE_SYNTHESIZER,
198200
16, 0,
199201
name);
200202
if (p->chset->port < 0) {

‎sound/pci/trident/trident_synth.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,9 @@ static int snd_trident_synth_create_port(struct snd_trident * trident, int idx)
914914
&callbacks,
915915
SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE,
916916
SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE |
917-
SNDRV_SEQ_PORT_TYPE_SYNTH,
917+
SNDRV_SEQ_PORT_TYPE_SYNTH |
918+
SNDRV_SEQ_PORT_TYPE_HARDWARE |
919+
SNDRV_SEQ_PORT_TYPE_SYNTHESIZER,
918920
16, 0,
919921
name);
920922
if (p->chset->port < 0) {

‎sound/synth/emux/emux_seq.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ static struct snd_midi_op emux_ops = {
5454
#define DEFAULT_MIDI_TYPE (SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |\
5555
SNDRV_SEQ_PORT_TYPE_MIDI_GM |\
5656
SNDRV_SEQ_PORT_TYPE_MIDI_GS |\
57-
SNDRV_SEQ_PORT_TYPE_MIDI_XG)
57+
SNDRV_SEQ_PORT_TYPE_MIDI_XG |\
58+
SNDRV_SEQ_PORT_TYPE_HARDWARE |\
59+
SNDRV_SEQ_PORT_TYPE_SYNTHESIZER)
5860

5961
/*
6062
* Initialise the EMUX Synth by creating a client and registering

0 commit comments

Comments
 (0)