source: project/wiki/eggref/3/openal @ 13621

Last change on this file since 13621 was 13621, checked in by sjamaan, 11 years ago

Move old chicken 3 eggs over to eggref/3

File size: 9.6 KB
Line 
1[[toc:]]
2[[tags: egg]]
3
4== openal
5
6This extension provides bindings for the [[http://www.openal.org|OpenAL]] sound API, version 1.1.
7
8''Currently this has only been tested on Mac OS X with the
9[[http://developer.creative.com/articles/article.asp?cat=1&sbcat=31&top=38&aid=97|binary release]]
10and with Linux. Windows support should be trivial, but needs modification of the {{openal.setup}} script.''
11
12Functionality is split into several sub-extensions:
13
14=== al
15
16Usage: {{(require-extension al)}}
17
18 [constant] al:BITS -> INT
19 [constant] al:BUFFER -> INT
20 [constant] al:BUFFERS_PROCESSED -> INT
21 [constant] al:BUFFERS_QUEUED -> INT
22 [constant] al:CHANNELS -> INT
23 [constant] al:CONE_INNER_ANGLE -> INT
24 [constant] al:CONE_OUTER_ANGLE -> INT
25 [constant] al:CONE_OUTER_GAIN -> INT
26 [constant] al:DATA -> INT
27 [constant] al:DIRECTION -> INT
28 [constant] al:DISTANCE_MODEL -> INT
29 [constant] al:DOPPLER_FACTOR -> INT
30 [constant] al:DOPPLER_VELOCITY -> INT
31 [constant] al:EXTENSIONS -> INT
32 [constant] al:FALSE -> INT
33 [constant] al:FORMAT_MONO16 -> INT
34 [constant] al:FORMAT_MONO8 -> INT
35 [constant] al:FORMAT_STEREO16 -> INT
36 [constant] al:FORMAT_STEREO8 -> INT
37 [constant] al:FREQUENCY -> INT
38 [constant] al:GAIN -> INT
39 [constant] al:INITIAL -> INT
40 [constant] al:INVALID -> INT
41 [constant] al:INVALID_ENUM -> INT
42 [constant] al:INVALID_NAME -> INT
43 [constant] al:INVALID_OPERATION -> INT
44 [constant] al:INVALID_VALUE -> INT
45 [constant] al:INVERSE_DISTANCE -> INT
46 [constant] al:INVERSE_DISTANCE_CLAMPED -> INT
47 [constant] al:LOOPING -> INT
48 [constant] al:MAX_DISTANCE -> INT
49 [constant] al:MAX_GAIN -> INT
50 [constant] al:MIN_GAIN -> INT
51 [constant] al:NO_ERROR -> INT
52 [constant] al:NONE -> INT
53 [constant] al:ORIENTATION -> INT
54 [constant] al:OUT_OF_MEMORY -> INT
55 [constant] al:PAUSED -> INT
56 [constant] al:PENDING -> INT
57 [constant] al:PITCH -> INT
58 [constant] al:PLAYING -> INT
59 [constant] al:POSITION -> INT
60 [constant] al:PROCESSED -> INT
61 [constant] al:REFERENCE_DISTANCE -> INT
62 [constant] al:RENDERER -> INT
63 [constant] al:ROLLOFF_FACTOR -> INT
64 [constant] al:SIZE -> INT
65 [constant] al:SOURCE_ABSOLUTE -> INT
66 [constant] al:SOURCE_RELATIVE -> INT
67 [constant] al:SOURCE_STATE -> INT
68 [constant] al:SOURCE_TYPE -> INT
69 [constant] al:STOPPED -> INT
70 [constant] al:TRUE -> INT
71 [constant] al:UNUSED -> INT
72 [constant] al:VELOCITY -> INT
73 [constant] al:VENDOR -> INT
74 [constant] al:VERSION -> INT
75
76 [procedure] (al:BufferData INT INT C-POINTER INT INT)
77 [procedure] (al:DeleteBuffers INT U32VECTOR)
78 [procedure] (al:DeleteSources INT U32VECTOR)
79 [procedure] (al:Disable INT)
80 [procedure] (al:DistanceModel INT)
81 [procedure] (al:DopplerFactor FLOAT)
82 [procedure] (al:DopplerVelocity FLOAT)
83 [procedure] (al:Enable INT)
84 [procedure] (al:GenBuffers INT U32VECTOR)
85 [procedure] (al:GenSources INT U32VECTOR)
86 [procedure] (al:GetBoolean INT) -> BOOL
87 [procedure] (al:GetBooleanv INT U8VECTOR)
88 [procedure] (al:GetBufferf INT INT S32VECTOR)
89 [procedure] (al:GetBufferi INT INT F32VECTOR)
90 [procedure] (al:GetDouble INT) -> FLOAT
91 [procedure] (al:GetDoublev INT F64VECTOR)
92 [procedure] (al:GetEnumValue STRING) -> INT
93 [procedure] (al:GetError) -> INT
94 [procedure] (al:GetFloat INT) -> FLOAT
95 [procedure] (al:GetFloatv INT F32VECTOR)
96 [procedure] (al:GetInteger INT) -> INT
97 [procedure] (al:GetIntegerv INT S32VECTOR)
98 [procedure] (al:GetListener3f INT) -> FLOAT FLOAT FLOAT
99 [procedure] (al:GetListenerf INT) -> FLOAT
100 [procedure] (al:GetListenerfv INT F32VECTOR)
101 [procedure] (al:GetListeneri INT) -> INT
102 [procedure] (al:GetProcAddress STRING) -> C-POINTER
103 [procedure] (al:GetSource3f INT INT) -> FLLOAT FLOAT FLOAT
104 [procedure] (al:GetSourcef INT INT) -> FLOAT
105 [procedure] (al:GetSourcefv INT INT F32VECTOR)
106 [procedure] (al:GetSourcei INT INT) -> INT
107 [procedure] (al:GetString INT) -> STRING
108 [procedure] (al:IsBuffer INT) -> BOOL
109 [procedure] (al:IsEnabled INT) -> BOOL
110 [procedure] (al:IsExtensionPresent STRING) -> BOOL
111 [procedure] (al:IsSource INT) -> BOOL
112 [procedure] (al:Listener3f INT FLOAT FLOAT FLOAT)
113 [procedure] (al:Listenerf INT FLOAT)
114 [procedure] (al:Listenerfv INT F32VECTOR)
115 [procedure] (al:Listeneri INT INT)
116 [procedure] (al:SetDouble INT DOUBLE)
117 [procedure] (al:SetInteger INT INT)
118 [procedure] (al:Source3f INT INT FLOAT FLOAT FLLOAT)
119 [procedure] (al:Sourcef INT INT FLOAT)
120 [procedure] (al:Sourcefv INT INT F32VECTOR)
121 [procedure] (al:Sourcei INT INT INT)
122 [procedure] (al:SourcePause INT)
123 [procedure] (al:SourcePausev INT U32VECTOR)
124 [procedure] (al:SourcePlay INT)
125 [procedure] (al:SourcePlayv INT U32VECTOR)
126 [procedure] (al:SourceQueueBuffers INT INT U32VECTOR)
127 [procedure] (al:SourceRewind INT)
128 [procedure] (al:SourceRewindv INT U32VECTOR)
129 [procedure] (al:SourceStop INT)
130 [procedure] (al:SourceStopv INT U32VECTOR)
131 [procedure] (al:SourceUnqueueBuffers INT INT U32VECTOR)
132
133=== alc
134
135Usage: {{(require-extension alc)}}
136
137 [constant] alc:ALL_ATTRIBUTES -> INT
138 [constant] alc:ATTRIBUTES_SIZE -> INT
139 [constant] alc:CONVERT_DATA_UPON_LOADING -> INT
140 [constant] alc:DEFAULT_DEVICE_SPECIFIER -> INT
141 [constant] alc:DEVICE_SPECIFIER -> INT
142 [constant] alc:EXTENSIONS -> INT
143 [constant] alc:FALSE -> INT
144 [constant] alc:FREQUENCY -> INT
145 [constant] alc:INVALID -> INT
146 [constant] alc:INVALID_CONTEXT -> INT
147 [constant] alc:INVALID_DEVICE -> INT
148 [constant] alc:INVALID_ENUM -> INT
149 [constant] alc:INVALID_VALUE -> INT
150 [constant] alc:MAJOR_VERSION -> INT
151 [constant] alc:MINOR_VERSION -> INT
152 [constant] alc:MIXER_MAXIMUM_BUSSES -> INT
153 [constant] alc:MIXER_OUTPUT_RATE -> INT
154 [constant] alc:NO_ERROR -> INT
155 [constant] alc:OUT_OF_MEMORY -> INT
156 [constant] alc:REFRESH -> INT
157 [constant] alc:RENDER_CHANNEL_COUNT -> INT
158 [constant] alc:SPATIAL_RENDERING_QUALITY -> INT
159 [constant] alc:SYNC -> INT
160 [constant] alc:TRUE -> INT
161
162 [procedure] (alc:CloseDevice C-POINTER)
163 [procedure] (alc:CreateContext C-POINTER S32VECTOR) -> C-POINTER
164 [procedure] (alc:DestroyContext C-POINTER)
165 [procedure] (alc:GetContextsDevice C-POINTER) -> C-POINTER
166 [procedure] (alc:GetCurrentContext) -> C-POINTER
167 [procedure] (alc:GetEnumValue C-POINTER STRING) -> INT
168 [procedure] (alc:GetError C-POINTER) -> INT
169 [procedure] (alc:GetIntegerv C-POINTER INT INT S32VECTOR)
170 [procedure] (alc:GetProcAddress C-POINTER STRING) -> C-POINTER
171 [procedure] (alc:GetString C-POINTER INT) -> STRING
172 [procedure] (alc:IsExtensionPresent C-POINTER STRING) -> BOOL
173 [procedure] (alc:MakeContextCurrent C-POINTER) -> BOOL
174 [procedure] (alc:OpenDevice STRING) -> C-POINTER
175 [procedure] (alc:ProcessContext C-POINTER)
176 [procedure] (alc:SuspendContext C-POINTER)
177
178=== alut
179
180Usage: {{(require-extension alut)}}
181
182 [procedure] (alut:Exit)
183 [procedure] (alut:Init INT C-POINTER)
184 [procedure] (alut:LoadWAVFile STRING) -> INT C-POINTER INT INT BOOL
185 [procedure] (alut:LoadWAVMemory C-POINTER) -> INT C-POINTER INT INT BOOL
186 [procedure] (alut:UnloadWAV INT C-POINTER INT INT)
187
188=== openal
189
190Usage: {{(require-extension openal)}}
191
192This extension loads {{al}}, {{alc}} and {{alut}} and provides few higher-level operations.
193Note that loading this unit automatically calls {{alut:Init}}.
194
195 [procedure] (openal:make-source INT) -> INT
196
197Creates a source from a given buffer identifier and returns the source identifier.
198
199 [procedure] (openal:device-list) -> (STRING ...)
200
201Returns a list of available device names.
202
203 [procedure] (openal:make-buffer DATA STEREO? FREQ)
204
205Creates a buffer from sound data (either a {{u8vector}}, a {{s16vector}} or a foreign pointer object.
206Returns a buffer identifier.
207
208 [procedure] (openal:load-buffer FILENAME)
209 
210Loads sound data in WAV format from {{FILENAME}} and returns a buffer identifier.
211
212=== Example
213
214 (use openal)
215
216 ;; this code does no error checking
217
218 (define device (alc:OpenDevice #f))
219 (define context (alc:CreateContext device #f))
220
221 (alc:MakeContextCurrent context)
222
223 (define buf (openal:load-buffer "example.wav"))
224 (define source (openal:make-source buf))
225
226 (al:Sourcei source al:LOOPING 1)
227 (al:SourcePlay source)
228 (read-line)
229 (alc:MakeContextCurrent #f)
230 (alc:DestroyContext context)
231 (alc:CloseDevice device)
232
233=== Author
234
235[[felix winkelmann]]
236
237=== License
238
239 Copyright (c) 2006, Felix L. Winkelmann
240 All rights reserved.
241
242 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
243 conditions are met:
244
245   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
246     disclaimer.
247   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
248     disclaimer in the documentation and/or other materials provided with the distribution.
249   Neither the name of the author nor the names of its contributors may be used to endorse or promote
250     products derived from this software without specific prior written permission.
251
252 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
253 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
254 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
255 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
256 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
257 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
258 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
259 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
260 POSSIBILITY OF SUCH DAMAGE.
261
262== Version History
263
264; 0.3 : fixed easyffi requirement in meta file (thanks to [[mario domenech goulart]])
265; 0.2 : fixed invalid references to obsolete {{openal-check}} procedure
266; 0.1 : initial release
Note: See TracBrowser for help on using the repository browser.