aboutsummaryrefslogtreecommitdiff
path: root/sound/synth/emux/emux_seq.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/synth/emux/emux_seq.c')
-rw-r--r--sound/synth/emux/emux_seq.c101
1 files changed, 35 insertions, 66 deletions
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
index 8ccd33f4aa5..1a973d7a90f 100644
--- a/sound/synth/emux/emux_seq.c
+++ b/sound/synth/emux/emux_seq.c
@@ -25,15 +25,14 @@
/* Prototypes for static functions */
static void free_port(void *private);
-static void snd_emux_init_port(snd_emux_port_t *p);
-static int snd_emux_use(void *private_data, snd_seq_port_subscribe_t *info);
-static int snd_emux_unuse(void *private_data, snd_seq_port_subscribe_t *info);
-static int get_client(snd_card_t *card, int index, char *name);
+static void snd_emux_init_port(struct snd_emux_port *p);
+static int snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info);
+static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info);
/*
* MIDI emulation operators
*/
-static snd_midi_op_t emux_ops = {
+static struct snd_midi_op emux_ops = {
snd_emux_note_on,
snd_emux_note_off,
snd_emux_key_press,
@@ -65,14 +64,14 @@ static snd_midi_op_t emux_ops = {
* can connect to these ports to play midi data.
*/
int
-snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index)
+snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
{
int i;
- snd_seq_port_callback_t pinfo;
+ struct snd_seq_port_callback pinfo;
char tmpname[64];
- sprintf(tmpname, "%s WaveTable", emu->name);
- emu->client = get_client(card, index, tmpname);
+ emu->client = snd_seq_create_kernel_client(card, index,
+ "%s WaveTable", emu->name);
if (emu->client < 0) {
snd_printk("can't create client\n");
return -ENODEV;
@@ -94,7 +93,7 @@ snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index)
pinfo.event_input = snd_emux_event_input;
for (i = 0; i < emu->num_ports; i++) {
- snd_emux_port_t *p;
+ struct snd_emux_port *p;
sprintf(tmpname, "%s Port %d", emu->name, i);
p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS,
@@ -119,7 +118,7 @@ snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index)
* destroy the kernel client.
*/
void
-snd_emux_detach_seq(snd_emux_t *emu)
+snd_emux_detach_seq(struct snd_emux *emu)
{
if (emu->voices)
snd_emux_terminate_all(emu);
@@ -137,12 +136,12 @@ snd_emux_detach_seq(snd_emux_t *emu)
* create a sequencer port and channel_set
*/
-snd_emux_port_t *
-snd_emux_create_port(snd_emux_t *emu, char *name,
- int max_channels, int oss_port,
- snd_seq_port_callback_t *callback)
+struct snd_emux_port *
+snd_emux_create_port(struct snd_emux *emu, char *name,
+ int max_channels, int oss_port,
+ struct snd_seq_port_callback *callback)
{
- snd_emux_port_t *p;
+ struct snd_emux_port *p;
int i, type, cap;
/* Allocate structures for this channel */
@@ -150,7 +149,7 @@ snd_emux_create_port(snd_emux_t *emu, char *name,
snd_printk("no memory\n");
return NULL;
}
- p->chset.channels = kcalloc(max_channels, sizeof(snd_midi_channel_t), GFP_KERNEL);
+ p->chset.channels = kcalloc(max_channels, sizeof(struct snd_midi_channel), GFP_KERNEL);
if (p->chset.channels == NULL) {
snd_printk("no memory\n");
kfree(p);
@@ -190,7 +189,7 @@ snd_emux_create_port(snd_emux_t *emu, char *name,
static void
free_port(void *private_data)
{
- snd_emux_port_t *p;
+ struct snd_emux_port *p;
p = private_data;
if (p) {
@@ -209,7 +208,7 @@ free_port(void *private_data)
* initialize the port specific parameters
*/
static void
-snd_emux_init_port(snd_emux_port_t *p)
+snd_emux_init_port(struct snd_emux_port *p)
{
p->drum_flags = DEFAULT_DRUM_FLAGS;
p->volume_atten = 0;
@@ -222,7 +221,7 @@ snd_emux_init_port(snd_emux_port_t *p)
* reset port
*/
void
-snd_emux_reset_port(snd_emux_port_t *port)
+snd_emux_reset_port(struct snd_emux_port *port)
{
int i;
@@ -241,7 +240,7 @@ snd_emux_reset_port(snd_emux_port_t *port)
port->ctrls[EMUX_MD_REALTIME_PAN] = 1;
for (i = 0; i < port->chset.max_channels; i++) {
- snd_midi_channel_t *chan = port->chset.channels + i;
+ struct snd_midi_channel *chan = port->chset.channels + i;
chan->drum_channel = ((port->drum_flags >> i) & 1) ? 1 : 0;
}
}
@@ -251,10 +250,10 @@ snd_emux_reset_port(snd_emux_port_t *port)
* input sequencer event
*/
int
-snd_emux_event_input(snd_seq_event_t *ev, int direct, void *private_data,
+snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private_data,
int atomic, int hop)
{
- snd_emux_port_t *port;
+ struct snd_emux_port *port;
port = private_data;
snd_assert(port != NULL && ev != NULL, return -EINVAL);
@@ -269,7 +268,7 @@ snd_emux_event_input(snd_seq_event_t *ev, int direct, void *private_data,
* increment usage count
*/
int
-snd_emux_inc_count(snd_emux_t *emu)
+snd_emux_inc_count(struct snd_emux *emu)
{
emu->used++;
if (!try_module_get(emu->ops.owner))
@@ -288,7 +287,7 @@ snd_emux_inc_count(snd_emux_t *emu)
* decrease usage count
*/
void
-snd_emux_dec_count(snd_emux_t *emu)
+snd_emux_dec_count(struct snd_emux *emu)
{
module_put(emu->card->module);
emu->used--;
@@ -302,10 +301,10 @@ snd_emux_dec_count(snd_emux_t *emu)
* Routine that is called upon a first use of a particular port
*/
static int
-snd_emux_use(void *private_data, snd_seq_port_subscribe_t *info)
+snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info)
{
- snd_emux_port_t *p;
- snd_emux_t *emu;
+ struct snd_emux_port *p;
+ struct snd_emux *emu;
p = private_data;
snd_assert(p != NULL, return -EINVAL);
@@ -323,10 +322,10 @@ snd_emux_use(void *private_data, snd_seq_port_subscribe_t *info)
* Routine that is called upon the last unuse() of a particular port.
*/
static int
-snd_emux_unuse(void *private_data, snd_seq_port_subscribe_t *info)
+snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info)
{
- snd_emux_port_t *p;
- snd_emux_t *emu;
+ struct snd_emux_port *p;
+ struct snd_emux *emu;
p = private_data;
snd_assert(p != NULL, return -EINVAL);
@@ -342,39 +341,9 @@ snd_emux_unuse(void *private_data, snd_seq_port_subscribe_t *info)
/*
- * Create a sequencer client
- */
-static int
-get_client(snd_card_t *card, int index, char *name)
-{
- snd_seq_client_callback_t callbacks;
- snd_seq_client_info_t cinfo;
- int client;
-
- memset(&callbacks, 0, sizeof(callbacks));
- callbacks.private_data = NULL;
- callbacks.allow_input = 1;
- callbacks.allow_output = 1;
-
- /* Find a free client, start from 1 as the MPU expects to use 0 */
- client = snd_seq_create_kernel_client(card, index, &callbacks);
- if (client < 0)
- return client;
-
- memset(&cinfo, 0, sizeof(cinfo));
- cinfo.client = client;
- cinfo.type = KERNEL_CLIENT;
- strcpy(cinfo.name, name);
- snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo);
-
- return client;
-}
-
-
-/*
* attach virtual rawmidi devices
*/
-int snd_emux_init_virmidi(snd_emux_t *emu, snd_card_t *card)
+int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card)
{
int i;
@@ -382,13 +351,13 @@ int snd_emux_init_virmidi(snd_emux_t *emu, snd_card_t *card)
if (emu->midi_ports <= 0)
return 0;
- emu->vmidi = kcalloc(emu->midi_ports, sizeof(snd_rawmidi_t*), GFP_KERNEL);
+ emu->vmidi = kcalloc(emu->midi_ports, sizeof(struct snd_rawmidi *), GFP_KERNEL);
if (emu->vmidi == NULL)
return -ENOMEM;
for (i = 0; i < emu->midi_ports; i++) {
- snd_rawmidi_t *rmidi;
- snd_virmidi_dev_t *rdev;
+ struct snd_rawmidi *rmidi;
+ struct snd_virmidi_dev *rdev;
if (snd_virmidi_new(card, emu->midi_devidx + i, &rmidi) < 0)
goto __error;
rdev = rmidi->private_data;
@@ -411,7 +380,7 @@ __error:
return -ENOMEM;
}
-int snd_emux_delete_virmidi(snd_emux_t *emu)
+int snd_emux_delete_virmidi(struct snd_emux *emu)
{
int i;