1 ! Copyright (C) 2010 Joe Groff.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien arrays combinators kernel math openal ;
8 { sample-bits integer }
9 { sample-rate integer }
15 ERROR: format-unsupported-by-openal audio ;
17 : openal-format ( audio -- format )
18 dup [ channels>> ] [ sample-bits>> ] bi 2array {
19 { { 1 8 } [ drop AL_FORMAT_MONO8 ] }
20 { { 1 16 } [ drop AL_FORMAT_MONO16 ] }
21 { { 2 8 } [ drop AL_FORMAT_STEREO8 ] }
22 { { 2 16 } [ drop AL_FORMAT_STEREO16 ] }
23 [ drop format-unsupported-by-openal ]