aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/seq/seq_midi.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 08:04:02 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:17:52 -0500
commitc7e0b5bf9fff1b726495081447c107a2333fb82c (patch)
treef4d9ec9a6446f8e2afde4c94e10a39f2b86a0bc9 /sound/core/seq/seq_midi.c
parent6ac77bc180fbd985988015020c2e2347e802959d (diff)
[ALSA] Remove xxx_t typedefs: Sequencer
Modules: ALSA sequencer Remove xxx_t typedefs from the core sequencer codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/seq/seq_midi.c')
-rw-r--r--sound/core/seq/seq_midi.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
index f89f40f4487..f88d2e3ee66 100644
--- a/sound/core/seq/seq_midi.c
+++ b/sound/core/seq/seq_midi.c
@@ -51,40 +51,40 @@ module_param(input_buffer_size, int, 0644);
51MODULE_PARM_DESC(input_buffer_size, "Input buffer size in bytes."); 51MODULE_PARM_DESC(input_buffer_size, "Input buffer size in bytes.");
52 52
53/* data for this midi synth driver */ 53/* data for this midi synth driver */
54typedef struct { 54struct seq_midisynth {
55 snd_card_t *card; 55 struct snd_card *card;
56 int device; 56 int device;
57 int subdevice; 57 int subdevice;
58 snd_rawmidi_file_t input_rfile; 58 struct snd_rawmidi_file input_rfile;
59 snd_rawmidi_file_t output_rfile; 59 struct snd_rawmidi_file output_rfile;
60 int seq_client; 60 int seq_client;
61 int seq_port; 61 int seq_port;
62 snd_midi_event_t *parser; 62 struct snd_midi_event *parser;
63} seq_midisynth_t; 63};
64 64
65typedef struct { 65struct seq_midisynth_client {
66 int seq_client; 66 int seq_client;
67 int num_ports; 67 int num_ports;
68 int ports_per_device[SNDRV_RAWMIDI_DEVICES]; 68 int ports_per_device[SNDRV_RAWMIDI_DEVICES];
69 seq_midisynth_t *ports[SNDRV_RAWMIDI_DEVICES]; 69 struct seq_midisynth *ports[SNDRV_RAWMIDI_DEVICES];
70} seq_midisynth_client_t; 70};
71 71
72static seq_midisynth_client_t *synths[SNDRV_CARDS]; 72static struct seq_midisynth_client *synths[SNDRV_CARDS];
73static DECLARE_MUTEX(register_mutex); 73static DECLARE_MUTEX(register_mutex);
74 74
75/* handle rawmidi input event (MIDI v1.0 stream) */ 75/* handle rawmidi input event (MIDI v1.0 stream) */
76static void snd_midi_input_event(snd_rawmidi_substream_t * substream) 76static void snd_midi_input_event(struct snd_rawmidi_substream *substream)
77{ 77{
78 snd_rawmidi_runtime_t *runtime; 78 struct snd_rawmidi_runtime *runtime;
79 seq_midisynth_t *msynth; 79 struct seq_midisynth *msynth;
80 snd_seq_event_t ev; 80 struct snd_seq_event ev;
81 char buf[16], *pbuf; 81 char buf[16], *pbuf;
82 long res, count; 82 long res, count;
83 83
84 if (substream == NULL) 84 if (substream == NULL)
85 return; 85 return;
86 runtime = substream->runtime; 86 runtime = substream->runtime;
87 msynth = (seq_midisynth_t *) runtime->private_data; 87 msynth = runtime->private_data;
88 if (msynth == NULL) 88 if (msynth == NULL)
89 return; 89 return;
90 memset(&ev, 0, sizeof(ev)); 90 memset(&ev, 0, sizeof(ev));
@@ -112,9 +112,9 @@ static void snd_midi_input_event(snd_rawmidi_substream_t * substream)
112 } 112 }
113} 113}
114 114
115static int dump_midi(snd_rawmidi_substream_t *substream, const char *buf, int count) 115static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, int count)
116{ 116{
117 snd_rawmidi_runtime_t *runtime; 117 struct snd_rawmidi_runtime *runtime;
118 int tmp; 118 int tmp;
119 119
120 snd_assert(substream != NULL || buf != NULL, return -EINVAL); 120 snd_assert(substream != NULL || buf != NULL, return -EINVAL);
@@ -128,12 +128,12 @@ static int dump_midi(snd_rawmidi_substream_t *substream, const char *buf, int co
128 return 0; 128 return 0;
129} 129}
130 130
131static int event_process_midi(snd_seq_event_t * ev, int direct, 131static int event_process_midi(struct snd_seq_event *ev, int direct,
132 void *private_data, int atomic, int hop) 132 void *private_data, int atomic, int hop)
133{ 133{
134 seq_midisynth_t *msynth = (seq_midisynth_t *) private_data; 134 struct seq_midisynth *msynth = private_data;
135 unsigned char msg[10]; /* buffer for constructing midi messages */ 135 unsigned char msg[10]; /* buffer for constructing midi messages */
136 snd_rawmidi_substream_t *substream; 136 struct snd_rawmidi_substream *substream;
137 int len; 137 int len;
138 138
139 snd_assert(msynth != NULL, return -EINVAL); 139 snd_assert(msynth != NULL, return -EINVAL);
@@ -161,8 +161,8 @@ static int event_process_midi(snd_seq_event_t * ev, int direct,
161} 161}
162 162
163 163
164static int snd_seq_midisynth_new(seq_midisynth_t *msynth, 164static int snd_seq_midisynth_new(struct seq_midisynth *msynth,
165 snd_card_t *card, 165 struct snd_card *card,
166 int device, 166 int device,
167 int subdevice) 167 int subdevice)
168{ 168{
@@ -175,12 +175,12 @@ static int snd_seq_midisynth_new(seq_midisynth_t *msynth,
175} 175}
176 176
177/* open associated midi device for input */ 177/* open associated midi device for input */
178static int midisynth_subscribe(void *private_data, snd_seq_port_subscribe_t *info) 178static int midisynth_subscribe(void *private_data, struct snd_seq_port_subscribe *info)
179{ 179{
180 int err; 180 int err;
181 seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; 181 struct seq_midisynth *msynth = private_data;
182 snd_rawmidi_runtime_t *runtime; 182 struct snd_rawmidi_runtime *runtime;
183 snd_rawmidi_params_t params; 183 struct snd_rawmidi_params params;
184 184
185 /* open midi port */ 185 /* open midi port */
186 if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_INPUT, &msynth->input_rfile)) < 0) { 186 if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_INPUT, &msynth->input_rfile)) < 0) {
@@ -203,10 +203,10 @@ static int midisynth_subscribe(void *private_data, snd_seq_port_subscribe_t *inf
203} 203}
204 204
205/* close associated midi device for input */ 205/* close associated midi device for input */
206static int midisynth_unsubscribe(void *private_data, snd_seq_port_subscribe_t *info) 206static int midisynth_unsubscribe(void *private_data, struct snd_seq_port_subscribe *info)
207{ 207{
208 int err; 208 int err;
209 seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; 209 struct seq_midisynth *msynth = private_data;
210 210
211 snd_assert(msynth->input_rfile.input != NULL, return -EINVAL); 211 snd_assert(msynth->input_rfile.input != NULL, return -EINVAL);
212 err = snd_rawmidi_kernel_release(&msynth->input_rfile); 212 err = snd_rawmidi_kernel_release(&msynth->input_rfile);
@@ -214,11 +214,11 @@ static int midisynth_unsubscribe(void *private_data, snd_seq_port_subscribe_t *i
214} 214}
215 215
216/* open associated midi device for output */ 216/* open associated midi device for output */
217static int midisynth_use(void *private_data, snd_seq_port_subscribe_t *info) 217static int midisynth_use(void *private_data, struct snd_seq_port_subscribe *info)
218{ 218{
219 int err; 219 int err;
220 seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; 220 struct seq_midisynth *msynth = private_data;
221 snd_rawmidi_params_t params; 221 struct snd_rawmidi_params params;
222 222
223 /* open midi port */ 223 /* open midi port */
224 if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_OUTPUT, &msynth->output_rfile)) < 0) { 224 if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_OUTPUT, &msynth->output_rfile)) < 0) {
@@ -237,9 +237,9 @@ static int midisynth_use(void *private_data, snd_seq_port_subscribe_t *info)
237} 237}
238 238
239/* close associated midi device for output */ 239/* close associated midi device for output */
240static int midisynth_unuse(void *private_data, snd_seq_port_subscribe_t *info) 240static int midisynth_unuse(void *private_data, struct snd_seq_port_subscribe *info)
241{ 241{
242 seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; 242 struct seq_midisynth *msynth = private_data;
243 unsigned char buf = 0xff; /* MIDI reset */ 243 unsigned char buf = 0xff; /* MIDI reset */
244 244
245 snd_assert(msynth->output_rfile.output != NULL, return -EINVAL); 245 snd_assert(msynth->output_rfile.output != NULL, return -EINVAL);
@@ -250,7 +250,7 @@ static int midisynth_unuse(void *private_data, snd_seq_port_subscribe_t *info)
250} 250}
251 251
252/* delete given midi synth port */ 252/* delete given midi synth port */
253static void snd_seq_midisynth_delete(seq_midisynth_t *msynth) 253static void snd_seq_midisynth_delete(struct seq_midisynth *msynth)
254{ 254{
255 if (msynth == NULL) 255 if (msynth == NULL)
256 return; 256 return;
@@ -265,10 +265,10 @@ static void snd_seq_midisynth_delete(seq_midisynth_t *msynth)
265} 265}
266 266
267/* set our client name */ 267/* set our client name */
268static int set_client_name(seq_midisynth_client_t *client, snd_card_t *card, 268static int set_client_name(struct seq_midisynth_client *client, struct snd_card *card,
269 snd_rawmidi_info_t *rmidi) 269 struct snd_rawmidi_info *rmidi)
270{ 270{
271 snd_seq_client_info_t cinfo; 271 struct snd_seq_client_info cinfo;
272 const char *name; 272 const char *name;
273 273
274 memset(&cinfo, 0, sizeof(cinfo)); 274 memset(&cinfo, 0, sizeof(cinfo));
@@ -281,17 +281,17 @@ static int set_client_name(seq_midisynth_client_t *client, snd_card_t *card,
281 281
282/* register new midi synth port */ 282/* register new midi synth port */
283static int 283static int
284snd_seq_midisynth_register_port(snd_seq_device_t *dev) 284snd_seq_midisynth_register_port(struct snd_seq_device *dev)
285{ 285{
286 seq_midisynth_client_t *client; 286 struct seq_midisynth_client *client;
287 seq_midisynth_t *msynth, *ms; 287 struct seq_midisynth *msynth, *ms;
288 snd_seq_port_info_t *port; 288 struct snd_seq_port_info *port;
289 snd_rawmidi_info_t *info; 289 struct snd_rawmidi_info *info;
290 int newclient = 0; 290 int newclient = 0;
291 unsigned int p, ports; 291 unsigned int p, ports;
292 snd_seq_client_callback_t callbacks; 292 struct snd_seq_client_callback callbacks;
293 snd_seq_port_callback_t pcallbacks; 293 struct snd_seq_port_callback pcallbacks;
294 snd_card_t *card = dev->card; 294 struct snd_card *card = dev->card;
295 int device = dev->device; 295 int device = dev->device;
296 unsigned int input_count = 0, output_count = 0; 296 unsigned int input_count = 0, output_count = 0;
297 297
@@ -342,7 +342,7 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
342 } else if (device == 0) 342 } else if (device == 0)
343 set_client_name(client, card, info); /* use the first device's name */ 343 set_client_name(client, card, info); /* use the first device's name */
344 344
345 msynth = kcalloc(ports, sizeof(seq_midisynth_t), GFP_KERNEL); 345 msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL);
346 port = kmalloc(sizeof(*port), GFP_KERNEL); 346 port = kmalloc(sizeof(*port), GFP_KERNEL);
347 if (msynth == NULL || port == NULL) 347 if (msynth == NULL || port == NULL)
348 goto __nomem; 348 goto __nomem;
@@ -432,11 +432,11 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
432 432
433/* release midi synth port */ 433/* release midi synth port */
434static int 434static int
435snd_seq_midisynth_unregister_port(snd_seq_device_t *dev) 435snd_seq_midisynth_unregister_port(struct snd_seq_device *dev)
436{ 436{
437 seq_midisynth_client_t *client; 437 struct seq_midisynth_client *client;
438 seq_midisynth_t *msynth; 438 struct seq_midisynth *msynth;
439 snd_card_t *card = dev->card; 439 struct snd_card *card = dev->card;
440 int device = dev->device, p, ports; 440 int device = dev->device, p, ports;
441 441
442 down(&register_mutex); 442 down(&register_mutex);
@@ -465,7 +465,7 @@ snd_seq_midisynth_unregister_port(snd_seq_device_t *dev)
465 465
466static int __init alsa_seq_midi_init(void) 466static int __init alsa_seq_midi_init(void)
467{ 467{
468 static snd_seq_dev_ops_t ops = { 468 static struct snd_seq_dev_ops ops = {
469 snd_seq_midisynth_register_port, 469 snd_seq_midisynth_register_port,
470 snd_seq_midisynth_unregister_port, 470 snd_seq_midisynth_unregister_port,
471 }; 471 };