commit cdc637caf729cc91d39ff9228e97357e9190f65d
parent ba5fa866087b93fae966640eed37387ea5a74e32
Author: Yuval Langer <yuval.langer@gmail.com>
Date: Sat, 6 Jan 2024 05:25:50 +0200
Replace a define inside a procedure with a let.
Diffstat:
1 file changed, 24 insertions(+), 29 deletions(-)
diff --git a/clipboard-speaker.scm b/clipboard-speaker.scm
@@ -61,10 +61,6 @@
(define *espeak-ng-pid* #f)
(define (dp x)
- ;; Debug print.
- (display x) (newline))
-
- (define (dp-id x)
;; Debug print, but it's just like the identity procedure.
(display x) (newline)
x)
@@ -250,31 +246,30 @@
(values fifo-port-read fifo-port-write)))
(define (espeak-loop fifo-read-port words-per-minute)
- (define espeak-ng-input-pipe (pipe))
-
- (set! *espeak-ng-pid*
- (spawn "espeak-ng"
- (list "espeak-ng"
- "-s"
- (number->string words-per-minute))
- #:input (car espeak-ng-input-pipe)))
-
- (let loop ((text-to-speak (get-line fifo-read-port)))
- (format #t "Server received: ~A\n" text-to-speak)
-
- (put-string (cdr espeak-ng-input-pipe)
- text-to-speak)
- ;; XXX: These ports are line buffered(?). Always write to ports
- ;; with a newline at their end if you want the other side to read
- ;; them now.
- (put-char (cdr espeak-ng-input-pipe)
- #\newline)
-
- ;; XXX: You also have you flush the port, otherwise the TTS keeps
- ;; silent. Please someone explain this to me.
- (force-output (cdr espeak-ng-input-pipe))
-
- (loop (get-line fifo-read-port))))
+ (let ((espeak-ng-input-pipe (pipe)))
+ (set! *espeak-ng-pid*
+ (spawn "espeak-ng"
+ (list "espeak-ng"
+ "-s"
+ (number->string words-per-minute))
+ #:input (car espeak-ng-input-pipe)))
+
+ (let loop ((text-to-speak (get-line fifo-read-port)))
+ (format #t "Server received: ~A\n" text-to-speak)
+
+ (put-string (cdr espeak-ng-input-pipe)
+ text-to-speak)
+ ;; XXX: These ports are line buffered(?). Always write to ports
+ ;; with a newline at their end if you want the other side to read
+ ;; them now.
+ (put-char (cdr espeak-ng-input-pipe)
+ #\newline)
+
+ ;; XXX: You also have you flush the port, otherwise the TTS keeps
+ ;; silent. Please someone explain this to me.
+ (force-output (cdr espeak-ng-input-pipe))
+
+ (loop (get-line fifo-read-port)))))
(define (make-pipes buffering-type)
(define pipes (pipe))