summaryrefslogtreecommitdiff
path: root/chickadee.scm
diff options
context:
space:
mode:
Diffstat (limited to 'chickadee.scm')
-rw-r--r--chickadee.scm9
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)))))