Skip to contentSkip to conversation

amidi delay option

PATCH Superseded Felipe F. Tonello 1 participant 4 messages Aug 15, 2016

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover amidi delay option

Small improvement to amidi, adding useful functionality.

changes from v3:
* fixed a bug if memchr() returns NULL

changes from v2:
* only check of end of sysex (0xf7)
* use memchr() instead of direct loop approach
* fixed commit message

changes from v1:
* remove delay in between any MIDI message, only SysEx
* added patch to use getopt_long() arguments

Felipe F. Tonello (2):
amidi: add delay option
amidi: use GNU getopt_long() proper argument names

 amidi/amidi.1 | 14 +++++++++++++
 amidi/amidi.c | 63 ++++++++++++++++++++++++++++++++++++++++++++---------------
 2 files changed, 61 insertions(+), 16 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH v4 1/2 amidi: add delay option

This patch adds a new options to amidi tool to add a delay (in milliseconds) to each SysEx message.

This is very useful when sending firmware updates to a remote device via SysEx or any other use that requires this delay in between messages.

---
 amidi/amidi.1 | 14 ++++++++++++++
 amidi/amidi.c | 41 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 50 insertions(+), 5 deletions(-)
amidi/amidi.1 +14 -0
index 1b4cfb1ea956..391008177610 100644
@@ -111,6 +111,12 @@ to stop receiving data.
 Does not ignore Active Sensing bytes (FEh) when saving or printing
 received MIDI commands.
 
+.TP
+.I \-D, \-\-delay=mseconds
+Adds a delay in between each SysEx message sent to a device. It is
+useful when sending firmware updates via SysEx messages to a remote
+device.
+
 .SH EXAMPLES
 
 .TP
@@ -121,6 +127,14 @@ to port
 .I hw:0.
 
 .TP
+.B amidi \-p hw:1,0,0 -s firmware.syx \-D 100
+will send the MIDI commands in
+.I firmware.syx
+to port
+.I hw:1,0,0
+with 100 milliseconds delay in between each SysEx message.
+
+.TP
 .B amidi \-S 'F0 43 10 4C 00 00 7E 00 F7'
 sends an XG Reset to the default port.
 
amidi/amidi.c +36 -5

77 lines not on this page · raw message

Signature · 1 line
2.9.3
#2 lore raw

PATCH v4 2/2 amidi: use GNU getopt_long() proper argument names

In reply to Felipe F. Tonello

This has no affect besides more clarity to the code.

---
 amidi/amidi.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
amidi/amidi.c +12 -12
index 8dc3cb492651..e1a302cdc909 100644
@@ -410,18 +410,18 @@ int main(int argc, char *argv[])
 {
 	static const char short_options[] = "hVlLp:s:r:S::dt:aD:";
 	static const struct option long_options[] = {
-		{"help", 0, NULL, 'h'},
-		{"version", 0, NULL, 'V'},
-		{"list-devices", 0, NULL, 'l'},
-		{"list-rawmidis", 0, NULL, 'L'},
-		{"port", 1, NULL, 'p'},
-		{"send", 1, NULL, 's'},
-		{"receive", 1, NULL, 'r'},
-		{"send-hex", 2, NULL, 'S'},
-		{"dump", 0, NULL, 'd'},
-		{"timeout", 1, NULL, 't'},
-		{"active-sensing", 0, NULL, 'a'},
-		{"delay", 1, NULL, 'D'},
+		{"help", no_argument, NULL, 'h'},
+		{"version", no_argument, NULL, 'V'},
+		{"list-devices", no_argument, NULL, 'l'},
+		{"list-rawmidis", no_argument, NULL, 'L'},
+		{"port", required_argument, NULL, 'p'},
+		{"send", required_argument, NULL, 's'},
+		{"receive", required_argument, NULL, 'r'},
+		{"send-hex", optional_argument, NULL, 'S'},
+		{"dump", no_argument, NULL, 'd'},
+		{"timeout", required_argument, NULL, 't'},
+		{"active-sensing", no_argument, NULL, 'a'},
+		{"delay", required_argument, NULL, 'D'},
 		{ }
 	};
 	int c, err, ok = 0;
Signature · 1 line
2.9.3
#3 lore raw
In reply to Felipe F. Tonello

Sorry for the flood, but please ignore this one too..

Quoted 22 lines · Felipe F. Tonello

Small improvement to amidi, adding useful functionality.

changes from v3:
* fixed a bug if memchr() returns NULL

changes from v2:
* only check of end of sysex (0xf7)
* use memchr() instead of direct loop approach
* fixed commit message

changes from v1:
* remove delay in between any MIDI message, only SysEx
* added patch to use getopt_long() arguments

Felipe F. Tonello (2):
amidi: add delay option
amidi: use GNU getopt_long() proper argument names

 amidi/amidi.1 | 14 +++++++++++++
 amidi/amidi.c | 63 ++++++++++++++++++++++++++++++++++++++++++++---------------
 2 files changed, 61 insertions(+), 16 deletions(-)
Signature · 1 line
Felipe