[alsa-devel] [PATCH v2 1/2] amidi: add delay option
Clemens Ladisch
clemens at ladisch.de
Sat Aug 13 13:51:05 CEST 2016
Felipe F. Tonello wrote:
> This patch adds a new options to amidi tool to add a delay (in milliseconds)
> to each MIDI message.
^^^^
Not anymore.
> + if (!delay) {
> + if ((err = snd_rawmidi_write(output, send_data, send_data_length)) < 0) {
> + error("cannot send data: %s", snd_strerror(err));
> + return err;
> + }
> + } else {
Too much indentation.
> + /* find beginning of SysEx and its end */
> + while((unsigned char)data[len] != 0xf0 &&
> + (data + len) < (send_data + send_data_length))
> + len++;
> +
> + while((unsigned char)data[len] != 0xf7 &&
> + (data + len) < (send_data + send_data_length))
> + len++;
> + len++;
It is not necessary to search for both beginning and end.
And the search can be simplified with memchr().
Regards,
Clemens
More information about the Alsa-devel
mailing list