groworld/plant-eyes/scripts/sound.ss

32 lines
1.4 KiB
Scheme
Raw Normal View History

2009-09-28 08:57:29 +00:00
;; p l a n t e y e s [ copyright (c) 2009 foam vzw : gpl v3 ]
#lang scheme/base
(require scheme/class fluxus-016/fluxus)
(provide (all-defined-out))
2009-10-21 18:07:30 +00:00
(define audio-on #t)
(when audio-on (oa-start)) ;; start openAL audio
2009-10-22 13:13:09 +00:00
(oa-set-acoustics 1 10000 1 5) ; args: unused, max distance, reference distance, rolloff
(oa-set-cull-dist 100) ; sounds further away than this won't be played
2009-10-22 13:13:09 +00:00
(define (make-noise sound pos freq vol)
(oa-play (oa-load-sample (fullpath sound)) pos freq vol))
(define (play-sound type pos)
;(printf "playing ~a at ~a~n" type pos)
(cond
((eq? type 'worm-idle) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'spider-idle) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'butterfly-idle) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'place-marker) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'twig-start-growing) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'twig-start-decay) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'twig-new-ornament) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'going-above-ground) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'going-below-ground) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'growth-collide-with-stone) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'back-in-seed) (make-noise "snd/event01.wav" pos 1 1))
((eq? type 'finished-growing-twig) (make-noise "snd/event01.wav" pos 1 1))
))