shithub: neindaw

Download patch

ref: 655a5655af3bd3549bd6a8fc22e6b882aae3d533
parent: f1652d3fffe4457db7bf025bdb4ab1201065d923
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Aug 7 13:23:40 EDT 2020

piper: add -r (rate) parameter, rename recording to -t; check -m vs -t

--- a/piper/piper.c
+++ b/piper/piper.c
@@ -43,7 +43,7 @@
 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 @@
 		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:
@@ -281,6 +286,11 @@
 
 	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");