chickadee » openal

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

openal

This extension provides bindings for the OpenAL sound API, version 1.1.

See alut for a binding for ALUT, a utility library for OpenAL.

Currently this has only been tested on Mac OS X with the binary release and with Linux. Windows support should be trivial, but needs modification of the openal.setup script.

Functionality is split into several sub-extensions:

al

Usage: (require-extension al)

al:BITSconstant
al:BUFFERconstant
al:BUFFERS_PROCESSEDconstant
al:BUFFERS_QUEUEDconstant
al:CHANNELSconstant
al:CONE_INNER_ANGLEconstant
al:CONE_OUTER_ANGLEconstant
al:CONE_OUTER_GAINconstant
al:DATAconstant
al:DIRECTIONconstant
al:DISTANCE_MODELconstant
al:DOPPLER_FACTORconstant
al:DOPPLER_VELOCITYconstant
al:EXTENSIONSconstant
al:FALSEconstant
al:FORMAT_MONO16constant
al:FORMAT_MONO8constant
al:FORMAT_STEREO16constant
al:FORMAT_STEREO8constant
al:FREQUENCYconstant
al:GAINconstant
al:INITIALconstant
al:INVALIDconstant
al:INVALID_ENUMconstant
al:INVALID_NAMEconstant
al:INVALID_OPERATIONconstant
al:INVALID_VALUEconstant
al:INVERSE_DISTANCEconstant
al:INVERSE_DISTANCE_CLAMPEDconstant
al:LOOPINGconstant
al:MAX_DISTANCEconstant
al:MAX_GAINconstant
al:MIN_GAINconstant
al:NO_ERRORconstant
al:NONEconstant
al:ORIENTATIONconstant
al:OUT_OF_MEMORYconstant
al:PAUSEDconstant
al:PENDINGconstant
al:PITCHconstant
al:PLAYINGconstant
al:POSITIONconstant
al:PROCESSEDconstant
al:REFERENCE_DISTANCEconstant
al:RENDERERconstant
al:ROLLOFF_FACTORconstant
al:SIZEconstant
al:SOURCE_ABSOLUTEconstant
al:SOURCE_RELATIVEconstant
al:SOURCE_STATEconstant
al:SOURCE_TYPEconstant
al:STOPPEDconstant
al:TRUEconstant
al:UNUSEDconstant
al:VELOCITYconstant
al:VENDORconstant
al:VERSIONconstant
al:BufferData INT INT C-POINTER INT INTprocedure
al:DeleteBuffers INT U32VECTORprocedure
al:DeleteSources INT U32VECTORprocedure
al:Disable INTprocedure
al:DistanceModel INTprocedure
al:DopplerFactor FLOATprocedure
al:DopplerVelocity FLOATprocedure
al:Enable INTprocedure
al:GenBuffers INT U32VECTORprocedure
al:GenSources INT U32VECTORprocedure
al:GetBoolean INTprocedure
al:GetBooleanv INT U8VECTORprocedure
al:GetBufferf INT INT S32VECTORprocedure
al:GetBufferi INT INT F32VECTORprocedure
al:GetDouble INTprocedure
al:GetDoublev INT F64VECTORprocedure
al:GetEnumValue STRINGprocedure
al:GetErrorprocedure
al:GetFloat INTprocedure
al:GetFloatv INT F32VECTORprocedure
al:GetInteger INTprocedure
al:GetIntegerv INT S32VECTORprocedure
al:GetListener3f INTprocedure
al:GetListenerf INTprocedure
al:GetListenerfv INT F32VECTORprocedure
al:GetListeneri INTprocedure
al:GetProcAddress STRINGprocedure
al:GetSource3f INT INTprocedure
al:GetSourcef INT INTprocedure
al:GetSourcefv INT INT F32VECTORprocedure
al:GetSourcei INT INTprocedure
al:GetString INTprocedure
al:IsBuffer INTprocedure
al:IsEnabled INTprocedure
al:IsExtensionPresent STRINGprocedure
al:IsSource INTprocedure
al:Listener3f INT FLOAT FLOAT FLOATprocedure
al:Listenerf INT FLOATprocedure
al:Listenerfv INT F32VECTORprocedure
al:Listeneri INT INTprocedure
al:SetDouble INT DOUBLEprocedure
al:SetInteger INT INTprocedure
al:Source3f INT INT FLOAT FLOAT FLLOATprocedure
al:Sourcef INT INT FLOATprocedure
al:Sourcefv INT INT F32VECTORprocedure
al:Sourcei INT INT INTprocedure
al:SourcePause INTprocedure
al:SourcePausev INT U32VECTORprocedure
al:SourcePlay INTprocedure
al:SourcePlayv INT U32VECTORprocedure
al:SourceQueueBuffers INT INT U32VECTORprocedure
al:SourceRewind INTprocedure
al:SourceRewindv INT U32VECTORprocedure
al:SourceStop INTprocedure
al:SourceStopv INT U32VECTORprocedure
al:SourceUnqueueBuffers INT INT U32VECTORprocedure

alc

Usage: (require-extension alc)

alc:ALL_ATTRIBUTESconstant
alc:ATTRIBUTES_SIZEconstant
alc:CONVERT_DATA_UPON_LOADINGconstant
alc:DEFAULT_DEVICE_SPECIFIERconstant
alc:DEVICE_SPECIFIERconstant
alc:EXTENSIONSconstant
alc:FALSEconstant
alc:FREQUENCYconstant
alc:INVALIDconstant
alc:INVALID_CONTEXTconstant
alc:INVALID_DEVICEconstant
alc:INVALID_ENUMconstant
alc:INVALID_VALUEconstant
alc:MAJOR_VERSIONconstant
alc:MINOR_VERSIONconstant
alc:MIXER_MAXIMUM_BUSSESconstant
alc:MIXER_OUTPUT_RATEconstant
alc:NO_ERRORconstant
alc:OUT_OF_MEMORYconstant
alc:REFRESHconstant
alc:RENDER_CHANNEL_COUNTconstant
alc:SPATIAL_RENDERING_QUALITYconstant
alc:SYNCconstant
alc:TRUEconstant
alc:CloseDevice C-POINTERprocedure
alc:CreateContext C-POINTER S32VECTORprocedure
alc:DestroyContext C-POINTERprocedure
alc:GetContextsDevice C-POINTERprocedure
alc:GetCurrentContextprocedure
alc:GetEnumValue C-POINTER STRINGprocedure
alc:GetError C-POINTERprocedure
alc:GetIntegerv C-POINTER INT INT S32VECTORprocedure
alc:GetProcAddress C-POINTER STRINGprocedure
alc:GetString C-POINTER INTprocedure
alc:IsExtensionPresent C-POINTER STRINGprocedure
alc:MakeContextCurrent C-POINTERprocedure
alc:OpenDevice STRINGprocedure
alc:ProcessContext C-POINTERprocedure
alc:SuspendContext C-POINTERprocedure

openal

Usage: (require-extension openal)

This extension loads al, alc and alut and provides few higher-level operations. Note that loading this unit automatically calls alut:Init.

openal:make-source INTprocedure

Creates a source from a given buffer identifier and returns the source identifier.

openal:device-listprocedure

Returns a list of available device names.

openal:make-buffer DATA STEREO? FREQprocedure

Creates a buffer from sound data (either a u8vector, a s16vector or a foreign pointer object. Returns a buffer identifier.

Examples

Generating a triangle wave:

(use openal al alc srfi-4 extras)

(define device (alc:OpenDevice #f))
(define context (alc:CreateContext device #f))
(define data (make-u8vector 600000))

(define (sound i)
  (/ (modulo i 60) 60))

(let loop ((i 0))
  (unless (>= i 600000)
  (u8vector-set! data i (inexact->exact (floor (max 0 (min 256 (* 256 (sound i)))))))
  (loop (+ 1 i))))

(alc:MakeContextCurrent context)
(define buffer (openal:make-buffer data #f 44100))
(define source (openal:make-source buffer))
(al:Sourcei source al:LOOPING 1)
(al:SourcePlay source)
(read-line)
(alc:MakeContextCurrent #f)
(alc:DestroyContext context)
(alc:CloseDevice device)

Author

felix winkelmann

License

Copyright (c) 2006-2015, Felix L. Winkelmann
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
conditions are met:

  Redistributions of source code must retain the above copyright notice, this list of conditions and the following
    disclaimer. 
  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
    disclaimer in the documentation and/or other materials provided with the distribution. 
  Neither the name of the author nor the names of its contributors may be used to endorse or promote
    products derived from this software without specific prior written permission. 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

Version History

0.9
moved alut stuff into a separate egg (alut)
0.7
test runs only for limited time when invoked over chicken-install
0.6
fixed missing libraries for non-Mac platforms
0.5
ported to CHICKEN 4
0.3
fixed easyffi requirement in meta file (thanks to mario domenech goulart)
0.2
fixed invalid references to obsolete openal-check procedure
0.1
initial release

Contents »