Browse Source

kmxtool: Add a --local-control option

Add an option to kmxtool to enable or disable the Local Control
setting on the microX.
develop
Damien Goutte-Gattat 5 years ago
parent
commit
c2fde9639f
  1. 6
      man/kmxtool.1.in
  2. 18
      src/kmxtool.c

6
man/kmxtool.1.in

@ -15,6 +15,8 @@ kmxtool - KORG microX Utility
.IR id ]
.RB [ \-l | --load-data
.IR id ]
.RB [ \-c | --local-control
.IR on | off ]
.YS
.SH DESCRIPTION
@ -57,6 +59,10 @@ Dump the specified memory slot to standard output.
.BR -l ", " --load-data " " \fIid\fR
Load data read from standard input to the specified
memory slot.
.TP
.BR -c ", " --local-control " " \fIon\fR " | " \fIoff\fR
Enable or disable the Local Control setting on the
synthesizer.
.SH MEMORY SLOT NAMES
.PP

18
src/kmxtool.c

@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <getopt.h>
#include <err.h>
@ -34,6 +35,7 @@
#define MODE_DATA_DUMP 0x1
#define MODE_DATA_LOAD 0x2
#define MODE_PROGRAM_LIST 0x4
#define MODE_SET_LOCAL_CTRL 0x8
/* Globals. */
@ -68,6 +70,8 @@ Send/receive data to/from a connected microX synthesizer.\n");
-d, --dump-data ID Dump the specified slot.\n\
-l, --load-data ID Load data read from standard\n\
input into the specified slot.\n\
-c, --local-control on|off\n\
Enable or disable Local Control.\n\
");
printf("Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
@ -231,6 +235,7 @@ main(int argc, char **argv)
{ "dump-data", 1, NULL, 'd' },
{ "load-data", 1, NULL, 'l' },
{ "list-programs", 0, NULL, 'L' },
{ "local-control", 1, NULL, 'c' },
{ NULL, 0, NULL, 0 }
};
@ -241,7 +246,7 @@ main(int argc, char **argv)
port = param = NULL;
mode = MODE_STATUS;
while ( (c = getopt_long(argc, argv, "hvp:sd:l:L",
while ( (c = getopt_long(argc, argv, "hvp:sd:l:Lc",
options, NULL)) != -1 ) {
switch ( c ) {
case 'h':
@ -277,6 +282,11 @@ main(int argc, char **argv)
case 'L':
mode = MODE_PROGRAM_LIST;
break;
case 'c':
mode = MODE_SET_LOCAL_CTRL;
param = optarg;
break;
}
}
@ -350,6 +360,12 @@ main(int argc, char **argv)
else if ( mode == MODE_PROGRAM_LIST ) {
do_list_programs(midi);
}
else if ( mode == MODE_SET_LOCAL_CTRL ) {
unsigned char value;
value = strncmp(param, "on", 2) == 0 ? 0x7F : 0x00;
midi_set_controller(midi, channel, 0x7A, value);
}
return EXIT_SUCCESS;
}

Loading…
Cancel
Save