summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-01-22 20:09:41 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-01-22 20:09:41 -0500
commit6a8777e4d920b299b1efd49ab7152a409200bb3f (patch)
tree1080e070f13091cd53469c23f44233a265ba422e
parent87bdccb3b3b4f7cd3c63b0cea5ab4e73b31ac863 (diff)
Clean up audio API a bit.
* 2d/audio.scm: Clean up procedures.
-rw-r--r--2d/audio.scm62
1 files changed, 31 insertions, 31 deletions
diff --git a/2d/audio.scm b/2d/audio.scm
index 15eaaa5..84b7a99 100644
--- a/2d/audio.scm
+++ b/2d/audio.scm
@@ -35,31 +35,31 @@
(audio sample-audio))
(define (load-sample filename)
- "Load audio sample from FILENAME. Return #f on failure."
+ "Load audio sample from FILENAME or return #f if the file cannot be
+loaded"
(let ((audio (SDL:load-wave filename)))
- (if audio
- (make-sample audio)
- #f)))
-
-(define (sample-play sample)
- "Play audio SAMPLE."
- (SDL:play-channel (sample-audio sample)))
+ (if audio (make-sample audio) #f)))
(define (sample-volume)
- "Return volume that samples are played at."
+ "Return the volume that all samples are played at."
(SDL:volume))
(define (set-sample-volume volume)
- "Set the volume that samples are played at to VOLUME."
- (SDL:volume volume))
+ "Set the volume that all samples are played at to VOLUME."
+ (SDL:volume volume)
+ *unspecified*)
+
+(define (play-sample sample)
+ "Play the given audio SAMPLE."
+ (SDL:play-channel (sample-audio sample))
+ *unspecified*)
-(export make-sample
- load-sample
+(export load-sample
sample?
sample-audio
- sample-play
sample-volume
- set-sample-volume)
+ set-sample-volume
+ play-sample)
;; Wrapper over SDL music objects.
(define-record-type <music>
@@ -68,15 +68,10 @@
(audio music-audio))
(define (load-music filename)
- "Load music from FILENAME. Return #f on failure."
+ "Load music from FILENAME or return #f if the file cannot be
+loaded."
(let ((audio (SDL:load-music filename)))
- (if audio
- (make-music audio)
- #f)))
-
-(define (music-play music)
- "Play MUSIC."
- (SDL:play-music (music-audio music)))
+ (if audio (make-music audio) #f)))
(define (music-volume)
"Return the volume that music is played at."
@@ -84,19 +79,24 @@
(define (set-music-volume volume)
"Set the volume that music is played at."
- (SDL:volume volume))
+ (SDL:volume volume)
+ *unspecified*)
+
+(define (play-music music)
+ "Play the given MUSIC."
+ (SDL:play-music (music-audio music))
+ *unspecified*)
-(export make-music
- load-music
+(export load-music
music?
music-audio
- music-play
music-volume
+ play-music
set-music-volume)
-(re-export (SDL:pause-music . music-pause)
- (SDL:resume-music . music-resume)
- (SDL:rewind-music . music-rewind)
- (SDL:halt-music . music-stop)
+(re-export (SDL:pause-music . pause-music)
+ (SDL:resume-music . resume-music)
+ (SDL:rewind-music . rewind-music)
+ (SDL:halt-music . stop-music)
(SDL:paused-music? . music-paused?)
(SDL:playing-music? . music-playing?))