Add play-waveform and play-sine to openal.examples

db4
Jon Harper 2013-09-29 18:58:16 +02:00
parent ff96ad9475
commit 9f58b3ca62
1 changed files with 12 additions and 0 deletions

View File

@ -10,6 +10,18 @@ IN: openal.example
source-play source-play
1000 milliseconds sleep ; 1000 milliseconds sleep ;
: play-waveform ( waveshape freq phase duration -- )
init-openal
[
[ 1 gen-sources first dup AL_BUFFER ] 4dip
alutCreateBufferWaveform
set-source-param
source-play
] [ seconds sleep ] bi ;
: play-sine ( freq duration -- )
[ ALUT_WAVEFORM_SINE ] 2dip [ 0 ] dip play-waveform ;
: (play-file) ( source -- ) : (play-file) ( source -- )
100 milliseconds sleep 100 milliseconds sleep
dup source-playing? [ (play-file) ] [ drop ] if ; dup source-playing? [ (play-file) ] [ drop ] if ;