diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-04-25 14:24:07 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-04-25 14:24:07 -0400 |
commit | d4f19639bd4c7094a8e146f27427b8ebe033a499 (patch) | |
tree | 2e3ecdddb0d715f845bb804815aaaf90a2da4469 | |
parent | bcab7eab46974ddcf1094898e7652757b7361c7c (diff) |
audio: Fix looping of streaming sources.
This was completely broken before.
-rw-r--r-- | chickadee/audio.scm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/chickadee/audio.scm b/chickadee/audio.scm index 61d033b..86b52b2 100644 --- a/chickadee/audio.scm +++ b/chickadee/audio.scm @@ -377,7 +377,9 @@ data." (unless (source-playing? source) (openal:source-play (source-openal-source source)) (when (streaming-source? source) - (add-streaming-source (current-sound-system) source)))) + (add-streaming-source (current-sound-system) source)) + (openal:set-source-looping! (source-openal-source source) + (and (static-source? source) (source-loop? source))))) (define (source-pause source) "Pause playback of SOURCE." @@ -423,8 +425,7 @@ sources." (define (set-source-loop! source loop?) "Configure whether or not SOURCE should loop the audio stream." - (%set-source-pitch! source loop?) - (openal:set-source-looping! (source-openal-source source) loop?)) + (%set-source-loop! source loop?)) (define (set-source-pitch! source pitch) "Set the pitch multiplier for SOURCE to PITCH." @@ -544,7 +545,7 @@ listener. Otherwise, the position is in absolute coordinates." (openal:set-buffer-data! buffer chunk length format sample-rate) (openal:source-queue-buffer (source-openal-source source) buffer) (when (source-stopped? source) - (source-play source)) + (openal:source-play (source-openal-source source))) #t)) ((source-loop? source) ;; Reset back to the beginning and try again. |