ref: 4c06284d5e66f17c06ec132607c0237ee26ce235
parent: dbc1606be9d9224c3a9ee7b3fa7dddc5ebfb2617
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Feb 22 07:39:34 EST 2020
plan9: remove "inverse" option, add ip/udp/midi command line options instead
--- a/orca.man
+++ b/orca.man
@@ -34,13 +34,16 @@
There are a number of options:
.TP
.B -i
-By default Orca uses "dark" theme.
-Use
-.B -i
-to invert the colors.
+Destination IP address for UDP and OSC messages.
.TP
+.B -u
+Port number for UDP messages to be delivered to.
+.TP
+.B -m
+Path to MIDI device for output.
+.TP
.B -s
-Sets the initial dimensions of the grid to
+Set initial dimensions of the grid to
.IR W
x
.IR H .
@@ -57,7 +60,7 @@
Sets initial "beats per minute" value.
.TP
.B -c
-Set the cursor character.
+Sets the cursor character.
.PP
.SH KEYS
.TP
--- a/plan9.c
+++ b/plan9.c
@@ -275,8 +275,10 @@
close(midi);
midi = -1;
}
- free(midipath);
- midipath = strdup(path);
+ if (path != nil) {
+ free(midipath);
+ midipath = strdup(path);
+ }
if (midi < 0 && midipath[0] && (midi = open(midipath, OWRITE)) < 0) {
fprint(2, "midi failed: %r\n");
/* FIXME display error */
@@ -1010,7 +1012,7 @@
static void
usage(void)
{
- print("usage: %s [-i] [-p] [-b bpm] [-s WxH] [-r random_seed] [-c cursor] [file]\n", argv0);
+ print("usage: %s [-p] [-b bpm] [-c cursor] [-s WxH] [-r random_seed] [-i ip_address] [-u udp_port] [-m midi_path] [file]\n", argv0);
threadexitsall("usage");
}
@@ -1024,7 +1026,7 @@
char tmp[256];
int oldw, oldh, w, h, n, oldbuttons;
long seed;
- bool inverse, complete;
+ bool complete;
Alt a[Numchan+1] = {
[Ckey] = { nil, &r, CHANRCV },
[Cmouse] = { nil, &m, CHANRCV },
@@ -1033,14 +1035,13 @@
{ nil, nil, CHANEND },
};
- inverse = false;
srand(time(0));
w = h = 0;
+ ip = strdup("127.0.0.1");
+ udpport = strdup("41960");
+ midipath = strdup("");
ARGBEGIN{
- case 'i':
- inverse = true;
- break;
case 'p':
pause = true;
break;
@@ -1072,6 +1073,18 @@
threadexitsall("args");
}
break;
+ case 'i':
+ free(ip);
+ ip = EARGF(usage());
+ break;
+ case 'u':
+ free(udpport);
+ udpport = EARGF(usage());
+ break;
+ case 'm':
+ free(midipath);
+ midipath = EARGF(usage());
+ break;
default:
usage();
}ARGEND
@@ -1109,11 +1122,8 @@
proccreate(stdinproc, nil, mainstacksize);
- for (n = 0; n < Numcolors; n++) {
- if (inverse)
- theme[n] = ~theme[n] | 0xff;
+ for (n = 0; n < Numcolors; n++)
color[n] = allocimage(display, Rect(0, 0, 1, 1), RGB24, 1, theme[n]);
- }
glyphsz.x = stringwidth(font, "@");
glyphsz.y = font->height;
@@ -1144,7 +1154,8 @@
move.y = 1;
oldbuttons = 0;
- netdial("127.0.0.1", "49160");
+ netdial(nil, nil);
+ midiopen(nil);
for (;;) {
redraw(complete);