[alsa-devel] [PATCH 05/44] firewire-lib: Add support for MIDI capture/playback

Clemens Ladisch clemens at ladisch.de
Wed Apr 2 21:29:20 CEST 2014


Takashi Sakamoto wrote:
> For capturing/playbacking MIDI messages, this commit adds one MIDI conformant
> data channel.
>
> +++ b/sound/firewire/amdtp.c
> +static void amdtp_pull_midi(struct amdtp_stream *s,
> +			    __be32 *buffer, unsigned int frames)
> +{
> +	unsigned int f, port;
> +	int len;
> +	u8 *b;
> +
> +	for (f = 0; f < frames; f++) {
> +		port = (s->data_block_counter + f) % 8;
> +		b = (u8 *)&buffer[s->pcm_channels + 1];
>
> +		len = b[0] - 0x80;
> +		if ((len > 1) &&  (3 < len) && (s->midi[port]))

This condition is true only for len==2.

> +			snd_rawmidi_receive(s->midi[port], b + 1, len);
> +
> +		buffer += s->data_block_quadlets;
> +	}
>  }


Regards,
Clemens


More information about the Alsa-devel mailing list