コード例 #1
0
ファイル: seq_midi.c プロジェクト: 12rafael/jellytimekernel
/* open associated midi device for output */
static int midisynth_use(void *private_data, struct snd_seq_port_subscribe *info)
{
	int err;
	struct seq_midisynth *msynth = private_data;
	struct snd_rawmidi_params params;

	/* open midi port */
	if ((err = snd_rawmidi_kernel_open(msynth->card, msynth->device,
					   msynth->subdevice,
					   SNDRV_RAWMIDI_LFLG_OUTPUT,
					   &msynth->output_rfile)) < 0) {
		snd_printd("midi output open failed!!!\n");
		return err;
	}
	memset(&params, 0, sizeof(params));
	params.avail_min = 1;
	params.buffer_size = output_buffer_size;
	params.no_active_sensing = 1;
	if ((err = snd_rawmidi_output_params(msynth->output_rfile.output, &params)) < 0) {
		snd_rawmidi_kernel_release(&msynth->output_rfile);
		return err;
	}
	snd_midi_event_reset_decode(msynth->parser);
	return 0;
}
コード例 #2
0
ファイル: seq_midi.c プロジェクト: OS2World/DRV-UNIAUD
/* open associated midi device for input */
static int midisynth_subscribe(void *private_data, snd_seq_port_subscribe_t *info)
{
	int err;
	seq_midisynth_t *msynth = (seq_midisynth_t *)private_data;
	snd_rawmidi_runtime_t *runtime;
	snd_rawmidi_params_t params;

	/* open midi port */
	if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_INPUT, &msynth->input_rfile)) < 0) {
		snd_printd("midi input open failed!!!\n");
		return err;
	}
	runtime = msynth->input_rfile.input->runtime;
	memset(&params, 0, sizeof(params));
	params.avail_min = 1;
	params.buffer_size = input_buffer_size;
	if ((err = snd_rawmidi_input_params(msynth->input_rfile.input, &params)) < 0) {
		snd_rawmidi_kernel_release(&msynth->input_rfile);
		return err;
	}
	runtime->event = snd_midi_input_event;
	runtime->private_data = msynth;
	snd_rawmidi_kernel_read(msynth->input_rfile.input, NULL, 0);
	return 0;
}
コード例 #3
0
/* open associated midi device for input */
static int midisynth_subscribe(void *private_data, struct snd_seq_port_subscribe *info)
{
    int err;
    struct seq_midisynth *msynth = private_data;
    struct snd_rawmidi_runtime *runtime;
    struct snd_rawmidi_params params;

    /* open midi port */
    if ((err = snd_rawmidi_kernel_open(msynth->card, msynth->device,
                                       msynth->subdevice,
                                       SNDRV_RAWMIDI_LFLG_INPUT,
                                       &msynth->input_rfile)) < 0) {
        pr_debug("ALSA: seq_midi: midi input open failed!!!\n");
        return err;
    }
    runtime = msynth->input_rfile.input->runtime;
    memset(&params, 0, sizeof(params));
    params.avail_min = 1;
    params.buffer_size = input_buffer_size;
    if ((err = snd_rawmidi_input_params(msynth->input_rfile.input, &params)) < 0) {
        snd_rawmidi_kernel_release(&msynth->input_rfile);
        return err;
    }
    snd_midi_event_reset_encode(msynth->parser);
    runtime->event = snd_midi_input_event;
    runtime->private_data = msynth;
    snd_rawmidi_kernel_read(msynth->input_rfile.input, NULL, 0);
    return 0;
}
コード例 #4
0
ファイル: seq_midi.c プロジェクト: OS2World/DRV-UNIAUD
/* open associated midi device for output */
static int midisynth_use(void *private_data, snd_seq_port_subscribe_t *info)
{
	int err;
	seq_midisynth_t *msynth = (seq_midisynth_t *)private_data;
	snd_rawmidi_params_t params;

	/* open midi port */
	if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_OUTPUT, &msynth->output_rfile)) < 0) {
		snd_printd("midi output open failed!!!\n");
		return err;
	}
	memset(&params, 0, sizeof(params));
	params.avail_min = 1;
	params.buffer_size = output_buffer_size;
	if ((err = snd_rawmidi_output_params(msynth->output_rfile.output, &params)) < 0) {
		snd_rawmidi_kernel_release(&msynth->output_rfile);
		return err;
	}
	return 0;
}