]> gitweb.factorcode.org Git - factor.git/blob - extra/audio/audio.factor
change ERROR: words from throw-foo back to foo.
[factor.git] / extra / audio / audio.factor
1 ! (c)2010 Joe Groff bsd license
2 USING: accessors alien arrays combinators kernel math openal ;
3 IN: audio
4
5 TUPLE: audio
6     { channels integer }
7     { sample-bits integer }
8     { sample-rate integer }
9     { size integer }
10     { data c-ptr } ;
11
12 C: <audio> audio
13
14 ERROR: format-unsupported-by-openal audio ;
15
16 : openal-format ( audio -- format )
17     dup [ channels>> ] [ sample-bits>> ] bi 2array {
18         { { 1  8 } [ drop AL_FORMAT_MONO8    ] }
19         { { 1 16 } [ drop AL_FORMAT_MONO16   ] }
20         { { 2  8 } [ drop AL_FORMAT_STEREO8  ] }
21         { { 2 16 } [ drop AL_FORMAT_STEREO16 ] }
22         [ drop format-unsupported-by-openal ]
23     } case ;