aboutsummaryrefslogtreecommitdiff
path: root/sound.scm
diff options
context:
space:
mode:
Diffstat (limited to 'sound.scm')
-rw-r--r--sound.scm88
1 files changed, 44 insertions, 44 deletions
diff --git a/sound.scm b/sound.scm
index 2292520..bc82382 100644
--- a/sound.scm
+++ b/sound.scm
@@ -1,45 +1,45 @@
(module (downstroke sound) *
-(import scheme
- (chicken base)
- (only srfi-1 for-each)
- (downstroke mixer))
-
-(define *sound-registry* '())
-(define *music* #f)
-
-(define (init-audio!)
- (mix-open-audio! 44100 mix-default-format 2 512))
-
-(define (load-sounds! sound-alist)
- (set! *sound-registry*
- (map (lambda (pair)
- (cons (car pair) (mix-load-chunk (cdr pair))))
- sound-alist)))
-
-(define (play-sound sym)
- (let ((entry (assq sym *sound-registry*)))
- (when (and entry (cdr entry))
- (mix-play-channel -1 (cdr entry) 0))))
-
-(define (load-music! path)
- (set! *music* (mix-load-mus path)))
-
-(define (play-music! volume)
- (when *music*
- (mix-play-music *music* -1)
- (mix-volume-music (inexact->exact (round (* volume 128))))))
-
-(define (stop-music!) (mix-halt-music))
-
-(define (set-music-volume! volume)
- (mix-volume-music (inexact->exact (round (* volume 128)))))
-
-(define (cleanup-audio!)
- (when *music*
- (mix-halt-music)
- (mix-free-music! *music*)
- (set! *music* #f))
- (for-each (lambda (pair) (mix-free-chunk! (cdr pair)))
- *sound-registry*)
- (set! *sound-registry* '())
- (mix-close-audio!)))
+ (import scheme
+ (chicken base)
+ (only srfi-1 for-each)
+ (downstroke mixer))
+
+ (define *sound-registry* '())
+ (define *music* #f)
+
+ (define (init-audio!)
+ (mix-open-audio! 44100 mix-default-format 2 512))
+
+ (define (load-sounds! sound-alist)
+ (set! *sound-registry*
+ (map (lambda (pair)
+ (cons (car pair) (mix-load-chunk (cdr pair))))
+ sound-alist)))
+
+ (define (play-sound sym)
+ (let ((entry (assq sym *sound-registry*)))
+ (when (and entry (cdr entry))
+ (mix-play-channel -1 (cdr entry) 0))))
+
+ (define (load-music! path)
+ (set! *music* (mix-load-mus path)))
+
+ (define (play-music! volume)
+ (when *music*
+ (mix-play-music *music* -1)
+ (mix-volume-music (inexact->exact (round (* volume 128))))))
+
+ (define (stop-music!) (mix-halt-music))
+
+ (define (set-music-volume! volume)
+ (mix-volume-music (inexact->exact (round (* volume 128)))))
+
+ (define (cleanup-audio!)
+ (when *music*
+ (mix-halt-music)
+ (mix-free-music! *music*)
+ (set! *music* #f))
+ (for-each (lambda (pair) (mix-free-chunk! (cdr pair)))
+ *sound-registry*)
+ (set! *sound-registry* '())
+ (mix-close-audio!)))