Lines Matching refs:msynth
78 struct seq_midisynth *msynth; in snd_midi_input_event() local
86 msynth = runtime->private_data; in snd_midi_input_event()
87 if (msynth == NULL) in snd_midi_input_event()
94 if (msynth->parser == NULL) in snd_midi_input_event()
98 if (!snd_midi_event_encode_byte(msynth->parser, in snd_midi_input_event()
101 ev.source.port = msynth->seq_port; in snd_midi_input_event()
103 snd_seq_kernel_client_dispatch(msynth->seq_client, &ev, 1, 0); in snd_midi_input_event()
131 struct seq_midisynth *msynth = private_data; in event_process_midi() local
136 if (snd_BUG_ON(!msynth)) in event_process_midi()
138 substream = msynth->output_rfile.output; in event_process_midi()
148 snd_midi_event_reset_decode(msynth->parser); in event_process_midi()
150 if (msynth->parser == NULL) in event_process_midi()
152 len = snd_midi_event_decode(msynth->parser, msg, sizeof(msg), ev); in event_process_midi()
156 snd_midi_event_reset_decode(msynth->parser); in event_process_midi()
162 static int snd_seq_midisynth_new(struct seq_midisynth *msynth, in snd_seq_midisynth_new() argument
167 if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &msynth->parser) < 0) in snd_seq_midisynth_new()
169 msynth->card = card; in snd_seq_midisynth_new()
170 msynth->device = device; in snd_seq_midisynth_new()
171 msynth->subdevice = subdevice; in snd_seq_midisynth_new()
179 struct seq_midisynth *msynth = private_data; in midisynth_subscribe() local
184 if ((err = snd_rawmidi_kernel_open(msynth->card, msynth->device, in midisynth_subscribe()
185 msynth->subdevice, in midisynth_subscribe()
187 &msynth->input_rfile)) < 0) { in midisynth_subscribe()
191 runtime = msynth->input_rfile.input->runtime; in midisynth_subscribe()
195 if ((err = snd_rawmidi_input_params(msynth->input_rfile.input, ¶ms)) < 0) { in midisynth_subscribe()
196 snd_rawmidi_kernel_release(&msynth->input_rfile); in midisynth_subscribe()
199 snd_midi_event_reset_encode(msynth->parser); in midisynth_subscribe()
201 runtime->private_data = msynth; in midisynth_subscribe()
202 snd_rawmidi_kernel_read(msynth->input_rfile.input, NULL, 0); in midisynth_subscribe()
210 struct seq_midisynth *msynth = private_data; in midisynth_unsubscribe() local
212 if (snd_BUG_ON(!msynth->input_rfile.input)) in midisynth_unsubscribe()
214 err = snd_rawmidi_kernel_release(&msynth->input_rfile); in midisynth_unsubscribe()
222 struct seq_midisynth *msynth = private_data; in midisynth_use() local
226 if ((err = snd_rawmidi_kernel_open(msynth->card, msynth->device, in midisynth_use()
227 msynth->subdevice, in midisynth_use()
229 &msynth->output_rfile)) < 0) { in midisynth_use()
237 if ((err = snd_rawmidi_output_params(msynth->output_rfile.output, ¶ms)) < 0) { in midisynth_use()
238 snd_rawmidi_kernel_release(&msynth->output_rfile); in midisynth_use()
241 snd_midi_event_reset_decode(msynth->parser); in midisynth_use()
248 struct seq_midisynth *msynth = private_data; in midisynth_unuse() local
250 if (snd_BUG_ON(!msynth->output_rfile.output)) in midisynth_unuse()
252 snd_rawmidi_drain_output(msynth->output_rfile.output); in midisynth_unuse()
253 return snd_rawmidi_kernel_release(&msynth->output_rfile); in midisynth_unuse()
257 static void snd_seq_midisynth_delete(struct seq_midisynth *msynth) in snd_seq_midisynth_delete() argument
259 if (msynth == NULL) in snd_seq_midisynth_delete()
262 if (msynth->seq_client > 0) { in snd_seq_midisynth_delete()
264 snd_seq_event_port_detach(msynth->seq_client, msynth->seq_port); in snd_seq_midisynth_delete()
267 snd_midi_event_free(msynth->parser); in snd_seq_midisynth_delete()
276 struct seq_midisynth *msynth, *ms; in snd_seq_midisynth_probe() local
333 msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL); in snd_seq_midisynth_probe()
335 if (msynth == NULL || port == NULL) in snd_seq_midisynth_probe()
339 ms = &msynth[p]; in snd_seq_midisynth_probe()
400 client->ports[device] = msynth; in snd_seq_midisynth_probe()
410 if (msynth != NULL) { in snd_seq_midisynth_probe()
412 snd_seq_midisynth_delete(&msynth[p]); in snd_seq_midisynth_probe()
413 kfree(msynth); in snd_seq_midisynth_probe()
431 struct seq_midisynth *msynth; in snd_seq_midisynth_remove() local
443 msynth = client->ports[device]; in snd_seq_midisynth_remove()
446 snd_seq_midisynth_delete(&msynth[p]); in snd_seq_midisynth_remove()
447 kfree(msynth); in snd_seq_midisynth_remove()