Lines Matching defs:msynth
68 struct seq_midisynth *msynth;
76 msynth = runtime->private_data;
77 if (msynth == NULL)
84 if (msynth->parser == NULL)
88 if (!snd_midi_event_encode_byte(msynth->parser,
91 ev.source.port = msynth->seq_port;
93 snd_seq_kernel_client_dispatch(msynth->seq_client, &ev, 1, 0);
128 struct seq_midisynth *msynth = private_data;
134 if (snd_BUG_ON(!msynth))
137 scoped_guard(spinlock_irqsave, &msynth->output_lock) {
138 substream = msynth->output_rfile.output;
141 snd_use_lock_use(&msynth->output_use_lock);
151 snd_midi_event_reset_decode(msynth->parser);
153 if (!msynth->parser) {
157 len = snd_midi_event_decode(msynth->parser, msg, sizeof(msg), ev);
161 snd_midi_event_reset_decode(msynth->parser);
165 snd_use_lock_free(&msynth->output_use_lock);
170 static int snd_seq_midisynth_new(struct seq_midisynth *msynth,
175 if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &msynth->parser) < 0)
177 msynth->card = card;
178 msynth->device = device;
179 msynth->subdevice = subdevice;
180 spin_lock_init(&msynth->output_lock);
181 snd_use_lock_init(&msynth->output_use_lock);
189 struct seq_midisynth *msynth = private_data;
194 err = snd_rawmidi_kernel_open(msynth->rmidi, msynth->subdevice,
196 &msynth->input_rfile);
201 runtime = msynth->input_rfile.input->runtime;
205 err = snd_rawmidi_input_params(msynth->input_rfile.input, ¶ms);
207 snd_rawmidi_kernel_release(&msynth->input_rfile);
210 snd_midi_event_reset_encode(msynth->parser);
212 runtime->private_data = msynth;
213 snd_rawmidi_kernel_read(msynth->input_rfile.input, NULL, 0);
221 struct seq_midisynth *msynth = private_data;
223 if (snd_BUG_ON(!msynth->input_rfile.input))
225 err = snd_rawmidi_kernel_release(&msynth->input_rfile);
233 struct seq_midisynth *msynth = private_data;
238 err = snd_rawmidi_kernel_open(msynth->rmidi, msynth->subdevice,
254 snd_midi_event_reset_decode(msynth->parser);
255 scoped_guard(spinlock_irqsave, &msynth->output_lock)
256 msynth->output_rfile = rfile;
263 struct seq_midisynth *msynth = private_data;
266 scoped_guard(spinlock_irqsave, &msynth->output_lock) {
267 rfile = msynth->output_rfile;
268 msynth->output_rfile = (struct snd_rawmidi_file){};
274 snd_use_lock_sync(&msynth->output_use_lock);
280 static void snd_seq_midisynth_delete(struct seq_midisynth *msynth)
282 if (msynth == NULL)
285 if (msynth->seq_client > 0) {
287 snd_seq_event_port_detach(msynth->seq_client, msynth->seq_port);
290 snd_midi_event_free(msynth->parser);
298 struct seq_midisynth *msynth, *ms;
348 msynth = kzalloc_objs(struct seq_midisynth, ports);
352 if (msynth == NULL || port == NULL)
356 ms = &msynth[p];
422 client->ports[device] = msynth;
429 if (msynth != NULL) {
431 snd_seq_midisynth_delete(&msynth[p]);
432 kfree(msynth);
446 struct seq_midisynth *msynth;
456 msynth = client->ports[device];
459 snd_seq_midisynth_delete(&msynth[p]);
460 kfree(msynth);