This commit is contained in:
2026-02-23 00:58:54 +01:00
parent 6868138754
commit af319b7bd3
9 changed files with 119 additions and 52 deletions

View File

@@ -4,13 +4,21 @@
data/queue
)
(define test-file3 #f)
(let ((os (system-type 'os)))
(when (eq? os 'unix)
(set! test-file3 "/muziek/Klassiek-Viool/Alina Ibragimova/Paganini_24 Caprices (2021)/24. 24 Caprices, Op 1 - No. 24 in A minor- Tema con variazioni. Quasi presto.flac"))
(when (eq? os 'windows)
(set! test-file3 "C:\\Muziek\\Klassiek-Strijkkwartet\\Quatuor Zaïde\\Franz\\01 Erlkönig, D. 328 (Arr. For String Quartet by Eric Mouret).flac")
;(set! test-file3 "C:\\Muziek\\Klassiek-Viool\\Janine Jansen\\Janine Jansen - Sibelius en Prokovief 1 (2024)\\02 - Violin Concerto in D Minor, Op. 47 II. Adagio di molto.flac")
)
)
(define test-file3 "/muziek/Klassiek-Viool/Alina Ibragimova/Paganini_24 Caprices (2021)/24. 24 Caprices, Op 1 - No. 24 in A minor- Tema con variazioni. Quasi presto.flac")
(define fmt (ao-mk-format 24 48000 2 'big-endian))
(define ao-h (ao-open-live #f fmt))
;(define fmt (ao-mk-format 24 48000 2 'big-endian))
;(define ao-h (ao-open-live #f fmt))
(define current-seconds 0)
(define ao-h #f)
(define (flac-play frame buffer)
(let* ((sample (hash-ref frame 'number))
@@ -21,12 +29,17 @@
(channels (hash-ref frame 'channels))
(bytes-per-sample-all-channels (* channels bytes-per-sample))
)
(when (eq? ao-h #f)
(let ((fmt (ao-mk-format bits-per-sample rate channels 'big-endian)))
(set! ao-h (ao-open-live #f fmt))))
(ao-play ao-h second buffer)
(let ((second-printer (λ ()
(let ((s (inexact->exact (round (ao-at-second ao-h)))))
(when (> s current-seconds)
(set! current-seconds s)
(displayln (format "At second: ~a" s)))))))
(let ((minutes (quotient s 60))
(seconds (remainder s 60)))
(displayln (format "At time: ~a:~a" minutes seconds))))))))
(let* ((buf-size (ao-bufsize-async ao-h))
(buf-seconds (exact->inexact (/ buf-size bytes-per-sample-all-channels rate))))
(second-printer)