]> gitweb.factorcode.org Git - factor.git/blob - extra/jamshred/sound/sound.factor
Remove with-malloc, use destructors instead
[factor.git] / extra / jamshred / sound / sound.factor
1 ! Copyright (C) 2008 Alex Chapman
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors io.files kernel openal sequences ;
4 IN: jamshred.sound
5
6 TUPLE: sounds bang ;
7
8 : assign-sound ( source wav-path -- )
9     resource-path create-buffer-from-wav AL_BUFFER swap set-source-param ;
10
11 : <sounds> ( -- sounds )
12     init-openal 1 gen-sources first sounds boa
13     dup bang>> "extra/jamshred/sound/bang.wav" assign-sound ;
14
15 : bang ( sounds -- ) bang>> source-play check-error ;