diff options
author | David Thompson <dthompson2@worcester.edu> | 2019-01-09 21:25:42 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2020-04-07 16:17:02 -0400 |
commit | 78c23526d227dc14b3380988562be7ea5fd0010e (patch) | |
tree | 474f2082a2c0792baca026ee2729cc52c1892f87 /chickadee.scm | |
parent | 159c35f706de14f3e3c6942934532011a1d77277 (diff) |
Integrate new audio module into game loop.
* chickadee.scm (run-game): Replace SDL mixer with OpenAL audio system.
Diffstat (limited to 'chickadee.scm')
-rw-r--r-- | chickadee.scm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/chickadee.scm b/chickadee.scm index 0a9b0b3..876c59e 100644 --- a/chickadee.scm +++ b/chickadee.scm @@ -22,6 +22,7 @@ ;;; Code: (define-module (chickadee) + #:use-module (chickadee audio) #:use-module (chickadee config) #:use-module (chickadee game-loop) #:use-module (chickadee math matrix) @@ -41,7 +42,6 @@ #:use-module ((sdl2 input keyboard) #:prefix sdl2:) #:use-module ((sdl2 input mouse) #:prefix sdl2:) #:use-module (sdl2 input text) - #:use-module (sdl2 mixer) #:use-module ((sdl2 video) #:prefix sdl2:) #:use-module (srfi srfi-9) #:export (current-window @@ -227,9 +227,8 @@ border is disabled, otherwise it is enabled.") (controller-move (const #t)) error) (sdl-init) - (false-if-exception (mixer-init)) - (open-audio) (start-text-input) + (init-audio) (let* ((window (sdl2:make-window #:opengl? #t #:title window-title #:size (list window-width window-height) @@ -311,6 +310,9 @@ border is disabled, otherwise it is enabled.") (define (update-sdl dt) (input-sdl) (update dt) + ;; Update audio after updating game state so that any sounds + ;; that were queued to play this frame start playing immediately. + (update-audio) ;; Free any GPU resources that have been GC'd. (gpu-reap!)) (define (render-sdl-opengl alpha) @@ -343,5 +345,6 @@ border is disabled, otherwise it is enabled.") #:time sdl-ticks #:update-hz update-hz))) (lambda () + (quit-audio) (sdl2:delete-gl-context! gl-context) (sdl2:close-window! window))))) |