/* * number of MIDI channels
*/ #define MIDI_CHANNELS 16
/* * type flags for MIDI sequencer port
*/ #define DEFAULT_MIDI_TYPE (SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |\
SNDRV_SEQ_PORT_TYPE_MIDI_GM |\
SNDRV_SEQ_PORT_TYPE_MIDI_GS |\
SNDRV_SEQ_PORT_TYPE_MIDI_XG |\
SNDRV_SEQ_PORT_TYPE_HARDWARE |\
SNDRV_SEQ_PORT_TYPE_SYNTHESIZER)
/* * Initialise the EMUX Synth by creating a client and registering * a series of ports. * Each of the ports will contain the 16 midi channels. Applications * can connect to these ports to play midi data.
*/ int
snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
{ int i; struct snd_seq_port_callback pinfo; char tmpname[64];
/* * Detach from the ports that were set up for this synthesizer and * destroy the kernel client.
*/ void
snd_emux_detach_seq(struct snd_emux *emu)
{ if (emu->voices)
snd_emux_terminate_all(emu);
cap = SNDRV_SEQ_PORT_CAP_WRITE; if (oss_port) {
type = SNDRV_SEQ_PORT_TYPE_SPECIFIC;
} else {
type = DEFAULT_MIDI_TYPE;
cap |= SNDRV_SEQ_PORT_CAP_SUBS_WRITE;
}
/* set port specific control parameters */
port->ctrls[EMUX_MD_DEF_BANK] = 0;
port->ctrls[EMUX_MD_DEF_DRUM] = 0;
port->ctrls[EMUX_MD_REALTIME_PAN] = 1;
for (i = 0; i < port->chset.max_channels; i++) { struct snd_midi_channel *chan = port->chset.channels + i;
chan->drum_channel = ((port->drum_flags >> i) & 1) ? 1 : 0;
}
}
/* * input sequencer event
*/ int
snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop)
{ struct snd_emux_port *port;
port = private_data; if (snd_BUG_ON(!port || !ev)) return -EINVAL;
/* * Routine that is called upon a first use of a particular port
*/ staticint
snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info)
{ struct snd_emux_port *p; struct snd_emux *emu;
p = private_data; if (snd_BUG_ON(!p)) return -EINVAL;
emu = p->emu; if (snd_BUG_ON(!emu)) return -EINVAL;
/* * Routine that is called upon the last unuse() of a particular port.
*/ staticint
snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info)
{ struct snd_emux_port *p; struct snd_emux *emu;
p = private_data; if (snd_BUG_ON(!p)) return -EINVAL;
emu = p->emu; if (snd_BUG_ON(!emu)) return -EINVAL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.