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 count = snd_midi_event_encode(msynth->parser, pbuf, res, &ev); in snd_midi_input_event()
104 ev.source.port = msynth->seq_port; in snd_midi_input_event()
106 snd_seq_kernel_client_dispatch(msynth->seq_client, &ev, 1, 0); in snd_midi_input_event()
135 struct seq_midisynth *msynth = private_data; in event_process_midi() local
140 if (snd_BUG_ON(!msynth)) in event_process_midi()
142 substream = msynth->output_rfile.output; in event_process_midi()
152 snd_midi_event_reset_decode(msynth->parser); in event_process_midi()
154 if (msynth->parser == NULL) in event_process_midi()
156 len = snd_midi_event_decode(msynth->parser, msg, sizeof(msg), ev); in event_process_midi()
160 snd_midi_event_reset_decode(msynth->parser); in event_process_midi()
166 static int snd_seq_midisynth_new(struct seq_midisynth *msynth, in snd_seq_midisynth_new() argument
171 if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &msynth->parser) < 0) in snd_seq_midisynth_new()
173 msynth->card = card; in snd_seq_midisynth_new()
174 msynth->device = device; in snd_seq_midisynth_new()
175 msynth->subdevice = subdevice; in snd_seq_midisynth_new()
183 struct seq_midisynth *msynth = private_data; in midisynth_subscribe() local
188 if ((err = snd_rawmidi_kernel_open(msynth->card, msynth->device, in midisynth_subscribe()
189 msynth->subdevice, in midisynth_subscribe()
191 &msynth->input_rfile)) < 0) { in midisynth_subscribe()
195 runtime = msynth->input_rfile.input->runtime; in midisynth_subscribe()
199 if ((err = snd_rawmidi_input_params(msynth->input_rfile.input, ¶ms)) < 0) { in midisynth_subscribe()
200 snd_rawmidi_kernel_release(&msynth->input_rfile); in midisynth_subscribe()
203 snd_midi_event_reset_encode(msynth->parser); in midisynth_subscribe()
205 runtime->private_data = msynth; in midisynth_subscribe()
206 snd_rawmidi_kernel_read(msynth->input_rfile.input, NULL, 0); in midisynth_subscribe()
214 struct seq_midisynth *msynth = private_data; in midisynth_unsubscribe() local
216 if (snd_BUG_ON(!msynth->input_rfile.input)) in midisynth_unsubscribe()
218 err = snd_rawmidi_kernel_release(&msynth->input_rfile); in midisynth_unsubscribe()
226 struct seq_midisynth *msynth = private_data; in midisynth_use() local
230 if ((err = snd_rawmidi_kernel_open(msynth->card, msynth->device, in midisynth_use()
231 msynth->subdevice, in midisynth_use()
233 &msynth->output_rfile)) < 0) { in midisynth_use()
241 if ((err = snd_rawmidi_output_params(msynth->output_rfile.output, ¶ms)) < 0) { in midisynth_use()
242 snd_rawmidi_kernel_release(&msynth->output_rfile); in midisynth_use()
245 snd_midi_event_reset_decode(msynth->parser); in midisynth_use()
252 struct seq_midisynth *msynth = private_data; in midisynth_unuse() local
254 if (snd_BUG_ON(!msynth->output_rfile.output)) in midisynth_unuse()
256 snd_rawmidi_drain_output(msynth->output_rfile.output); in midisynth_unuse()
257 return snd_rawmidi_kernel_release(&msynth->output_rfile); in midisynth_unuse()
261 static void snd_seq_midisynth_delete(struct seq_midisynth *msynth) in snd_seq_midisynth_delete() argument
263 if (msynth == NULL) in snd_seq_midisynth_delete()
266 if (msynth->seq_client > 0) { in snd_seq_midisynth_delete()
268 snd_seq_event_port_detach(msynth->seq_client, msynth->seq_port); in snd_seq_midisynth_delete()
271 snd_midi_event_free(msynth->parser); in snd_seq_midisynth_delete()
280 struct seq_midisynth *msynth, *ms; in snd_seq_midisynth_probe() local
337 msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL); in snd_seq_midisynth_probe()
339 if (msynth == NULL || port == NULL) in snd_seq_midisynth_probe()
343 ms = &msynth[p]; in snd_seq_midisynth_probe()
404 client->ports[device] = msynth; in snd_seq_midisynth_probe()
414 if (msynth != NULL) { in snd_seq_midisynth_probe()
416 snd_seq_midisynth_delete(&msynth[p]); in snd_seq_midisynth_probe()
417 kfree(msynth); in snd_seq_midisynth_probe()
435 struct seq_midisynth *msynth; in snd_seq_midisynth_remove() local
447 msynth = client->ports[device]; in snd_seq_midisynth_remove()
450 snd_seq_midisynth_delete(&msynth[p]); in snd_seq_midisynth_remove()
451 kfree(msynth); in snd_seq_midisynth_remove()