From 6983a70c175659ca48df89bc4282c068d09ab430 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 4 May 2021 07:39:12 -0400 Subject: Use background music functionality of the class. --- test-subject/game.scm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'test-subject') diff --git a/test-subject/game.scm b/test-subject/game.scm index cb89559..0540215 100644 --- a/test-subject/game.scm +++ b/test-subject/game.scm @@ -49,8 +49,7 @@ (terminal-locked? #:accessor terminal-locked? #:init-value #t) (terminal-channel #:accessor terminal-channel #:init-thunk make-channel) (terminal-lines #:accessor terminal-lines #:init-form (make-ring-buffer 17)) - (key-pad-locked? #:accessor key-pad-locked? #:init-value #t) - (audio-source #:accessor audio-source #:init-thunk make-source)) + (key-pad-locked? #:accessor key-pad-locked? #:init-value #t)) (define-method (subject-name (game )) (if (subject-name-known? game) @@ -67,6 +66,7 @@ (audio-play (asset-ref device-sound))) (define-method (reset-game (game )) + (set! (background-music game) #f) (set! (subject-name-known? game) #f) (set! (has-fridge-key? game) #f) (set! (opened-notebook? game) #f) @@ -962,9 +962,8 @@ if you would just open the door.") #:position (vec2 109.0 40.0) #:listeners `((click . ,(run-on-left-click* game open-terminal))))))) - (set-source-loop! (audio-source game) #t) - (set-source-audio! (audio-source game) (asset-ref gameplay-music)) - (source-play (audio-source game)) + (set! (background-music game) gameplay-music) + (set! (background-music-loop? game) #t) (fade-in)) (define-method (good-ending (game )) @@ -1040,9 +1039,8 @@ time?") (set! (text (& game credits)) line) (sleep 120)) (set! (state game) 'credits) - (set-source-loop! (audio-source game) #f) - (set-source-audio! (audio-source game) (asset-ref credits-music)) - (source-play (audio-source game)) + (set! (background-music game) credits-music) + (set! (background-music-loop? game) #f) (attach-to game (make #:name 'background @@ -1075,7 +1073,6 @@ time?") (set! (tint (& game background)) color)) #:interpolate color-lerp) (detach-all game) - (source-stop (audio-source game)) (reset-game game) (intro game)) -- cgit v1.2.3