[alsa-devel] [PATCH v2 1/2] amidi: add delay option

Felipe Ferreri Tonello eu at felipetonello.com
Mon Aug 15 17:34:26 CEST 2016


Hi Clemens,

On 13/08/16 12:51, Clemens Ladisch wrote:
> 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.

Right..

> 
>> +		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.

Ok, but it will sleep on malformed SysEx messages, though.

> 
> And the search can be simplified with memchr().

Ok.

-- 
Felipe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x92698E6A.asc
Type: application/pgp-keys
Size: 7195 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160815/bd744291/attachment-0001.bin>


More information about the Alsa-devel mailing list