Lines Matching refs:msynth
64 struct seq_midisynth *msynth; in snd_midi_input_event() local
72 msynth = runtime->private_data; in snd_midi_input_event()
73 if (msynth == NULL) in snd_midi_input_event()
80 if (msynth->parser == NULL) in snd_midi_input_event()
84 if (!snd_midi_event_encode_byte(msynth->parser, in snd_midi_input_event()
87 ev.source.port = msynth->seq_port; in snd_midi_input_event()
89 snd_seq_kernel_client_dispatch(msynth->seq_client, &ev, 1, 0); in snd_midi_input_event()
117 struct seq_midisynth *msynth = private_data; in event_process_midi() local
122 if (snd_BUG_ON(!msynth)) in event_process_midi()
124 substream = msynth->output_rfile.output; in event_process_midi()
134 snd_midi_event_reset_decode(msynth->parser); in event_process_midi()
136 if (msynth->parser == NULL) in event_process_midi()
138 len = snd_midi_event_decode(msynth->parser, msg, sizeof(msg), ev); in event_process_midi()
142 snd_midi_event_reset_decode(msynth->parser); in event_process_midi()
148 static int snd_seq_midisynth_new(struct seq_midisynth *msynth, in snd_seq_midisynth_new() argument
153 if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &msynth->parser) < 0) in snd_seq_midisynth_new()
155 msynth->card = card; in snd_seq_midisynth_new()
156 msynth->device = device; in snd_seq_midisynth_new()
157 msynth->subdevice = subdevice; in snd_seq_midisynth_new()
165 struct seq_midisynth *msynth = private_data; in midisynth_subscribe() local
170 if ((err = snd_rawmidi_kernel_open(msynth->card, msynth->device, in midisynth_subscribe()
171 msynth->subdevice, in midisynth_subscribe()
173 &msynth->input_rfile)) < 0) { in midisynth_subscribe()
177 runtime = msynth->input_rfile.input->runtime; in midisynth_subscribe()
181 if ((err = snd_rawmidi_input_params(msynth->input_rfile.input, ¶ms)) < 0) { in midisynth_subscribe()
182 snd_rawmidi_kernel_release(&msynth->input_rfile); in midisynth_subscribe()
185 snd_midi_event_reset_encode(msynth->parser); in midisynth_subscribe()
187 runtime->private_data = msynth; in midisynth_subscribe()
188 snd_rawmidi_kernel_read(msynth->input_rfile.input, NULL, 0); in midisynth_subscribe()
196 struct seq_midisynth *msynth = private_data; in midisynth_unsubscribe() local
198 if (snd_BUG_ON(!msynth->input_rfile.input)) in midisynth_unsubscribe()
200 err = snd_rawmidi_kernel_release(&msynth->input_rfile); in midisynth_unsubscribe()
208 struct seq_midisynth *msynth = private_data; in midisynth_use() local
212 if ((err = snd_rawmidi_kernel_open(msynth->card, msynth->device, in midisynth_use()
213 msynth->subdevice, in midisynth_use()
215 &msynth->output_rfile)) < 0) { in midisynth_use()
223 if ((err = snd_rawmidi_output_params(msynth->output_rfile.output, ¶ms)) < 0) { in midisynth_use()
224 snd_rawmidi_kernel_release(&msynth->output_rfile); in midisynth_use()
227 snd_midi_event_reset_decode(msynth->parser); in midisynth_use()
234 struct seq_midisynth *msynth = private_data; in midisynth_unuse() local
236 if (snd_BUG_ON(!msynth->output_rfile.output)) in midisynth_unuse()
238 snd_rawmidi_drain_output(msynth->output_rfile.output); in midisynth_unuse()
239 return snd_rawmidi_kernel_release(&msynth->output_rfile); in midisynth_unuse()
243 static void snd_seq_midisynth_delete(struct seq_midisynth *msynth) in snd_seq_midisynth_delete() argument
245 if (msynth == NULL) in snd_seq_midisynth_delete()
248 if (msynth->seq_client > 0) { in snd_seq_midisynth_delete()
250 snd_seq_event_port_detach(msynth->seq_client, msynth->seq_port); in snd_seq_midisynth_delete()
253 snd_midi_event_free(msynth->parser); in snd_seq_midisynth_delete()
262 struct seq_midisynth *msynth, *ms; in snd_seq_midisynth_probe() local
319 msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL); in snd_seq_midisynth_probe()
321 if (msynth == NULL || port == NULL) in snd_seq_midisynth_probe()
325 ms = &msynth[p]; in snd_seq_midisynth_probe()
386 client->ports[device] = msynth; in snd_seq_midisynth_probe()
396 if (msynth != NULL) { in snd_seq_midisynth_probe()
398 snd_seq_midisynth_delete(&msynth[p]); in snd_seq_midisynth_probe()
399 kfree(msynth); in snd_seq_midisynth_probe()
417 struct seq_midisynth *msynth; in snd_seq_midisynth_remove() local
429 msynth = client->ports[device]; in snd_seq_midisynth_remove()
432 snd_seq_midisynth_delete(&msynth[p]); in snd_seq_midisynth_remove()
433 kfree(msynth); in snd_seq_midisynth_remove()