Re: [PATCH v2 1/2] amidi: add delay option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: 0x92698E6A.asc
Description: application/pgp-keys

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux