<audio-engine> ( device-name voice-count -- engine )
Audio playback engine

Prev:audio-engine
Next:<standard-audio-engine> ( -- engine )


Vocabulary
audio.engine

Inputs
device-namea string or f
voice-countan integer


Outputs
enginean audio-engine


Word description
Constructs an audio-engine instance capable of playing voice-count simultaneous clips. The OpenAL device named device-name will be used, or the default device if device-name is f. An error will be thrown if the engine cannot be initialized. The engine is returned in the stopped state; to start audio processing, use start-audio or start-audio*.

Definition


:: <audio-engine> ( device-name voice-count -- engine )
[
device-name alcOpenDevice :> al-device al-device
[ device-name audio-device-not-found ] unless
al-device |alcCloseDevice* drop
al-device f alcCreateContext :> al-context al-context
[ device-name audio-context-not-available ] unless
al-context |alcDestroyContext drop
al-context alcSuspendContext
audio-engine new-disposable voice-count >>voice-count
al-device >>al-device al-context >>al-context
] with-destructors ;