~ft/neindaw

655a5655af3bd3549bd6a8fc22e6b882aae3d533 — Sigrid Haflínudóttir a month ago f1652d3 master
piper: add -r (rate) parameter, rename recording to -t; check -m vs -t
1 files changed, 11 insertions(+), 1 deletions(-)

M piper/piper.c
M piper/piper.c => piper/piper.c +11 -1
@@ 43,7 43,7 @@ static Synth *synths[] = {
static void
usage(void)
{
	print("usage: %s [-m] [-r FILE] DIR...\n", argv0);
	print("usage: %s [-m] [-r rate] [-t FILE] DIR...\n", argv0);
	threadexitsall("usage");
}



@@ 273,6 273,11 @@ threadmain(int argc, char **argv)
		nomixer = 1;
		break;
	case 'r':
		rate = atoi(EARGF(usage()));
		if (rate < 1)
			sysfatal("invalid rate %d", rate);
		break;
	case 't':
		to = EARGF(usage());
		break;
	default:


@@ 282,6 287,11 @@ threadmain(int argc, char **argv)
	if (argc < 1)
		usage();

	if (!nomixer && to != nil) {
		fprint(2, "can't record with the mixer disabled\n");
		threadexitsall("fail");
	}

	if (!nomixer && (audio = open("/dev/audio", OWRITE)) < 0)
		sysfatal("%r");
	if (to != nil && (record = create(to, OWRITE|OTRUNC, 0644)) < 0)