shithub: neindaw

Download patch

ref: f64d791dc28dd6959085d87a97247ed3b3b1363d
parent: 6ea764ff9cc93aab462e4a7db6796d149175e5d2
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu May 14 03:54:18 EDT 2020

piper: print error message when audio or recording fails

--- a/piper/piper.c
+++ b/piper/piper.c
@@ -246,10 +246,14 @@
 				f = -32767.0;
 			pcm[n] = f;
 		}
-		if (write(audio, pcm, 2*Bufframes*sizeof(*pcm)) < 0)
+		if (write(audio, pcm, 2*Bufframes*sizeof(*pcm)) < 0) {
+			fprint(2, "audio: %r\n");
 			break;
-		if (record >= 0 && write(record, pcm, 2*Bufframes*sizeof(*pcm)) < 0)
+		}
+		if (record >= 0 && write(record, pcm, 2*Bufframes*sizeof(*pcm)) < 0) {
+			fprint(2, "record: %r\n");
 			break;
+		}
 	}
 
 	threadexits(nil);