Debian Codegraph @

sndlib/ssl_lib.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/lib/ssl_lib.h $
21 * $Revision: 57 $
22 * $Date: 3/20/00 12:27p $
23 * $Author: Matt $
24 *
25 * Header for shared sound library
26 *
27 * $Log: /DescentIII/Main/lib/ssl_lib.h $
28 *
29 * 57 3/20/00 12:27p Matt
30 * Merge of Duane's post-1.3 changes.
31 * Lower MAX_SOUNDS and MAX_SOUND_FILES for Mac.
32 *
33 * 56 10/23/99 3:24p 3dsmax
34 *
35 * 55 10/21/99 4:05p Chris
36 * Removed a bad thing
37 *
38 * 54 10/21/99 1:48p Kevin
39 * Mac Merge
40 *
41 * 53 10/08/99 4:29p Chris
42 * Added the forcefield and glass breaking override options
43 *
44 * 52 8/23/99 5:29p Samir
45 * incremental EAX 2.0 checkin
46 *
47 * 51 8/10/99 2:08p Gwar
48 * added sound support to neweditor
49 *
50 * 50 5/20/99 1:00a Samir
51 * changes in ordering of EAX and NONE mixers.
52 *
53 * 49 5/11/99 2:08a 3dsmax
54 *
55 * 48 5/11/99 2:05a 3dsmax
56 * Increased MAX_SOUNDS so we can work
57 *
58 * 47 4/30/99 12:56p Kevin
59 * Lowered values for MAX_SOUNDS, MAX_ROOMS, MAX_TEXTURES and MAX_OBJIDS.
60 * Talk to me before changing any of these again.
61 *
62 * 46 4/27/99 2:10p Samir
63 * added code to set the desired sound card given the descriptive name of
64 * a sound card.
65 *
66 * 45 4/14/99 3:43p Matt
67 * Increased the number of sounds from 700 to 750. When I lowered this
68 * number to 700 recently, I counted that we were using around 600 sounds.
69 * Either I miscounted or we added a lot of sounds in the last few days.
70 *
71 * 44 4/11/99 5:04p Matt
72 * Reduced the maximum number of sounds from 1000 to 700. Currently we're
73 * only using 607 sounds, and the new static sound remapping code doesn't
74 * require any extra space, so 700 is probably ok for now at least.
75 *
76 * 43 4/10/99 5:09p Samir
77 * beginning to add prioritization of sounds code. currently non
78 * functional, but allows me to change all calls to Play3dSound so that I
79 * can test later.
80 *
81 * 42 4/06/99 8:29p Samir
82 * added error check system.
83 *
84 * 41 3/30/99 4:44p Matt
85 * Increased max sounds from 700 to 1000
86 *
87 * 40 3/29/99 11:01a Samir
88 * added prototypes for 3d sound environment options.
89 *
90 * 39 3/17/99 4:20p Samir
91 * added functions to pause and resume individual sounds.
92 *
93 * 38 1/14/99 6:10p Samir
94 * added DirectSound buffer duplication code.
95 *
96 * 37 1/11/99 5:51p Samir
97 * reverb on the buffer level.
98 *
99 * 36 1/08/99 6:31p Samir
100 * added reverb
101 *
102 * 35 12/23/98 11:49a Samir
103 * added EAX mixer.
104 *
105 * 34 10/28/98 3:56p Chris
106 *
107 * 33 10/28/98 3:55p Chris
108 * Resized the buffers
109 *
110 * 32 10/19/98 11:57a Chris
111 * Update the sound system to use the import volume
112 *
113 * 31 10/14/98 5:12p Samir
114 * added a null SOUND_MIXER.
115 *
116 * 30 8/10/98 5:55p Samir
117 * added element in play_info to specify streaming buffer size.
118 *
119 * 29 7/24/98 5:23p Samir
120 * moved sound variables from soundload to ssl_lib.h (and WAV file stuff)
121 *
122 * 28 7/09/98 8:34p Samir
123 * added parameter to play_information.
124 *
125 * 27 7/06/98 1:49p Samir
126 * added some error checking.
127 *
128 * 26 6/29/98 10:44p Chris
129 * Added support for SIF_ONCE_PER_OBJ
130 *
131 * 25 6/29/98 7:35p Chris
132 * Increased sound buffer size
133 *
134 * 24 6/29/98 4:15p Chris
135 * Streaming audio works
136 *
137 * 23 6/29/98 9:29a Chris
138 * Added some support for Direct Sound 3d
139 *
140 * 22 6/25/98 11:28a Chris
141 * Added some DS3d support
142 *
143 * 21 6/24/98 6:43p Chris
144 * Furthered the endless work on the sound system
145 *
146 * 20 6/22/98 12:00p Chris
147 * Working on sound system to make it in a nice shape.
148 *
149 * 19 6/19/98 3:09p Chris
150 * Improved IsSoundPlaying
151 *
152 * 18 6/19/98 3:03p Chris
153 * Made CheckAndForceSoundDataAlloc a SoundSystem function - useful for
154 * multiple mixers. Added IsSoundPlaying to the high level sound lib.
155 *
156 * 17 6/17/98 7:04p Chris
157 * Added support for 8bit stream data to be played by our 16bit sound
158 * mixer
159 *
160 * 16 6/17/98 4:39p Chris
161 * Added the playing of 8bit samples with the 16 bit sound mixer
162 *
163 * 15 6/16/98 4:46p Chris
164 * Revision 2 of the stream audio stuff
165 *
166 * 14 6/16/98 3:48p Chris
167 * Updated the sound system and added the start of sound streaming
168 *
169 * 13 2/15/98 7:12p Chris
170 * More improvements to the sound lib
171 *
172 * 12 2/04/98 6:09p Matt
173 * Changed object room number to indicate a terrain cell via a flag. Got
174 * rid of the object flag which used to indicate terrain.
175 *
176 * 11 1/06/98 2:12p Chris
177 * Added muffled sounds v.1 and made 3d sounds keep their roomnum.
178 *
179 * 10 1/05/98 3:54p Chris
180 * Added ambient and explosion sounds
181 *
182 * 9 1/02/98 5:32p Chris
183 * More radical changes to the sound system
184 *
185 * 8 12/31/97 2:58a Chris
186 * Another major revision to the SoundLib. This cleaned up the code after
187 * removing the direct sound secondary buffers.
188 *
189 * 7 12/30/97 2:15p Chris
190 * Adding further support for software 3d stuff
191 *
192 * 6 12/29/97 4:50p Chris
193 * Added SPF_NO_UPDATE
194 *
195 * 5 12/22/97 6:19p Chris
196 * Working on new mixer functionality
197 *
198 * 4 12/18/97 12:26p Chris
199 * Incremental new lib improvements
200 *
201 * 3 12/10/97 4:47p Chris
202 * Revision 1.0 of new sound library (no hardware -- uses primary buffer
203 * streaming)
204 *
205 * 2 11/21/97 1:10p Chris
206 * Incremental Improvements
207 *
208 * 18 6/11/97 2:31p Samir
209 * Incorporated changes in gameos to new system
210 *
211 * 17 5/22/97 5:15p Chris
212 *
213 * 16 5/05/97 5:41a Chris
214 * Changed an include for MacMAN!
215 *
216 * 15 4/29/97 8:03a Chris
217 * Improved the sound code. High-level sound now
218 * fully uses the flags in the sound page and it
219 * resulted in a simpilier coding interface :)
220 *
221 * 14 4/28/97 11:21a Chris
222 * Incremental improvements is the sound system
223 *
224 * 13 4/24/97 4:19a Chris
225 * Modified the pos_state struct to be more compact.
226 *
227 * 12 4/24/97 3:25a Chris
228 * // Added some more support for 3d sounds
229 *
230 * 11 4/03/97 8:37p Chris
231 * Added the Main_OS object pass in the sound library
232 * initialization code.
233 *
234 * 10 4/01/97 2:13p Jason
235 * changes for sound page functionality
236 *
237 * 9 4/01/97 10:00a Chris
238 *
239 * 8 3/17/97 5:12p Chris
240 * Allowed new sound code to be demo'ed.
241 *
242 * 7 3/14/97 12:10p Chris
243 * Made a nice C++ abstract type for the low-level. It should make the
244 * MacMan very joyful. :)
245 *
246 * 6 2/07/97 5:48p Matt
247 * Renamed vector.h to vecmat.h to fix DevStudio problem
248 *
249 * $NoKeywords: $
250 */
251
252 #ifndef __SSL_LIB_H__
253 #define __SSL_LIB_H__cxx . . $ `sndlib/ssl_lib.h:253:9`!
254
255 #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/
256
257 #ifndef NEWEDITOR
258 #include "manage.h"cxx . . $ `<file>/lib/manage.h`/
259 #else
260 #include "..\neweditor\ned_TableFile.h"
261 #endif
262
263 class oeApplicationcxx . . $ oeApplication#; // reference to oeApplication class.
264
265 #define MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! 1.0f // helps against clipping
266
267 // Size of streaming buffers
268 #define STREAM_BUFFER_SIZEcxx . . $ `sndlib/ssl_lib.h:268:9`! 4096 //(4 * 1024)
269
270 // object information needed by the sound code. Calling code should copy data into here & pass to sound
271 struct pos_statecxx . . $ pos_state# {
272 vectorcxx . . $ vector# *positioncxx . . $ pos_state#position.; // Where in the world is this object
273 matrixcxx . . $ matrix# *orientcxx . . $ pos_state#orient.;
274 vectorcxx . . $ vector# *velocitycxx . . $ pos_state#velocity.;
275 int roomnumcxx . . $ pos_state#roomnum.;
276 };
277
278 // #define MAX_EFFECT_OFFSETS 5
279
280 // sound priority values.
281 #define SND_PRIORITY_CRITICALcxx . . $ `sndlib/ssl_lib.h:281:9`! 5 // usually streams have this priority, bumps off any other sounds.
282 #define SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`! 4
283 #define SND_PRIORITY_HIGHcxx . . $ `sndlib/ssl_lib.h:283:9`! 3
284 #define SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`! 2
285 #define SND_PRIORITY_LOWcxx . . $ `sndlib/ssl_lib.h:285:9`! 1
286 #define SND_PRIORITY_LOWESTcxx . . $ `sndlib/ssl_lib.h:286:9`! 0
287
288 struct play_informationcxx . . $ play_information# {
289
290 void *(*m_stream_cbackcxx . . $ play_information#m_stream_cback.)(void *user_data, int handle, int *size); // Streaming callback
291 void *m_stream_datacxx . . $ play_information#m_stream_data.; // passed in
292 int m_stream_sizecxx . . $ play_information#m_stream_size.; // passed in
293 int m_stream_handlecxx . . $ play_information#m_stream_handle.; // passed in
294 int m_stream_bufsizecxx . . $ play_information#m_stream_bufsize.; // passed in
295 void *user_datacxx . . $ play_information#user_data.; // this is passed to the stream callback by the caller that defined this.
296
297 uint8_tcxx . . $ uint8_t# sample_skip_intervalcxx . . $ play_information#sample_skip_interval.; // Allows us to skip samples (i.e. simulate lower sampling rates)
298 uint8_tcxx . . $ uint8_t# prioritycxx . . $ play_information#priority.; // priority of sound.
299 uint16_tcxx . . $ uint16_t# m_stream_formatcxx . . $ play_information#m_stream_format.; // passed in
300
301 // internal data.
302 int m_samples_playedcxx . . $ play_information#m_samples_played.;
303
304 float samples_per_22khz_samplecxx . . $ play_information#samples_per_22khz_sample.; // passed in
305 float left_volumecxx . . $ play_information#left_volume.;
306 float right_volumecxx . . $ play_information#right_volume.;
307
308 float m_tickscxx . . $ play_information#m_ticks.;
309 };
310
311 struct sound_file_infocxx . . $ sound_file_info# {
312 char namecxx . . $ sound_file_info#name.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!];
313 char usedcxx . . $ sound_file_info#used.;
314 int use_countcxx . . $ sound_file_info#use_count.; // how many buffers does this sound take up.
315
316 uint8_tcxx . . $ uint8_t# *sample_8bitcxx . . $ sound_file_info#sample_8bit.; // 8bit sound data
317 int16_tcxx . . $ int16_t# *sample_16bitcxx . . $ sound_file_info#sample_16bit.; // 16bit sound data
318
319 int sample_lengthcxx . . $ sound_file_info#sample_length.; // Length of sound in samples
320 int np_sample_lengthcxx . . $ sound_file_info#np_sample_length.; // non-padded
321
322 };
323
324 struct sound_infocxx . . $ sound_info# {
325 char namecxx . . $ sound_info#name.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!];
326 char usedcxx . . $ sound_info#used.;
327
328 int sample_indexcxx . . $ sound_info#sample_index.;
329
330 int loop_startcxx . . $ sound_info#loop_start.; // Start byte of repeated loop for looping samples
331 int loop_endcxx . . $ sound_info#loop_end.; // End byte of repeating loop for looping samples
332 uint32_tcxx . . $ uint32_t# flagscxx . . $ sound_info#flags.; // 2d/3d, variable frequency
333 float max_distancecxx . . $ sound_info#max_distance.; // Maximum distance in which a sound is heard
334 float min_distancecxx . . $ sound_info#min_distance.; // Sound gets no louder at min_distance
335 int inner_cone_anglecxx . . $ sound_info#inner_cone_angle.; // Angle in which sound is played at full base volume
336 int outer_cone_anglecxx . . $ sound_info#outer_cone_angle.; // Angle in which sound is at its lowest base volume
337 float outer_cone_volumecxx . . $ sound_info#outer_cone_volume.; // A sounds lowest base volume level
338 float import_volumecxx . . $ sound_info#import_volume.; // Volume multiplier
339 };
340
341 // Supported sound mixers
342 #define SOUND_MIXER_SOFTWARE_16cxx . . $ `sndlib/ssl_lib.h:342:9`! 0
343 #define SOUND_MIXER_DS_16cxx . . $ `sndlib/ssl_lib.h:343:9`! 1
344 #define SOUND_MIXER_DS_8cxx . . $ `sndlib/ssl_lib.h:344:9`! 2
345 #define SOUND_MIXER_DS3D_16cxx . . $ `sndlib/ssl_lib.h:345:9`! 3
346 #define SOUND_MIXER_AUREALcxx . . $ `sndlib/ssl_lib.h:346:9`! 4 // Unused, outdated 3D sound technology
347 #define SOUND_MIXER_CREATIVE_EAXcxx . . $ `sndlib/ssl_lib.h:347:9`! 6 // switched because launcher uses 5 as NONE.
348 #define SOUND_MIXER_NONEcxx . . $ `sndlib/ssl_lib.h:348:9`! 5
349
350 // Support sound qualities
351 #define SQT_NORMALcxx . . $ `sndlib/ssl_lib.h:351:9`! 0
352 #define SQT_HIGHcxx . . $ `sndlib/ssl_lib.h:352:9`! 1
353 // Parameters of the sound library
354 #define SLF_USE_3Dcxx . . $ `sndlib/ssl_lib.h:354:9`! 1 // Use 3d effects
355 #define SLF_DELTA_FREQcxx . . $ `sndlib/ssl_lib.h:355:9`! 2 // Use frequency shifts (i.e. water effects)
356 #define SLF_USE_16_BITcxx . . $ `sndlib/ssl_lib.h:356:9`! 4 // Use 16bit samples (else 8bit)
357 #define SLF_USE_22_KHZcxx . . $ `sndlib/ssl_lib.h:357:9`! 8 // Use 22khz (else 44khz)
358 #define SLF_PAUSEDcxx . . $ `sndlib/ssl_lib.h:358:9`! 16 // Sound library is currently paused
359 #define SLF_FULL_3Dcxx . . $ `sndlib/ssl_lib.h:359:9`! 32 // Full 3d hardware support
360 #define SLF_MOST_3Dcxx . . $ `sndlib/ssl_lib.h:360:9`! 64 // No fully static 3d -- i.e. cockpit type stuff (use 2d instead)
361 #define SLF_LIGHT_3Dcxx . . $ `sndlib/ssl_lib.h:361:9`! 128 // Dynamically updating 3d sounds if sound is longer than a given threshold
362 #define SLF_GOOD_2Dcxx . . $ `sndlib/ssl_lib.h:362:9`! 256 // all linked sounds update position
363 #define SLF_OK_2Dcxx . . $ `sndlib/ssl_lib.h:363:9`! 512 // if a sound is longer than a threshold, it updates
364
365 // Sound Properties Flags
366 #define SPF_LOOPEDcxx . . $ `sndlib/ssl_lib.h:366:9`! 1 // Sound is looped
367 #define SPF_FIXED_FREQcxx . . $ `sndlib/ssl_lib.h:367:9`! 2 // No doppler shift
368 #define SPF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:368:9`! 4 // Sound updates with attached object movements
369 #define SPF_FOREVERcxx . . $ `sndlib/ssl_lib.h:369:9`! 8 // Always plays in high-level, this flag should be ignored in low-level
370 #define SPF_PLAYS_EXCLUSIVELYcxx . . $ `sndlib/ssl_lib.h:370:9`! 16
371 #define SPF_PLAYS_ONCEcxx . . $ `sndlib/ssl_lib.h:371:9`! 32
372 #define SPF_USE_CONEcxx . . $ `sndlib/ssl_lib.h:372:9`! 64
373 #define SPF_LISTENER_UPDATEcxx . . $ `sndlib/ssl_lib.h:373:9`! 128 // Sound updates with listener movements
374 #define SPF_ONCE_PER_OBJcxx . . $ `sndlib/ssl_lib.h:374:9`! 256
375
376 // Sound Instance flags (Move this out of here)
377 #define SIF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:377:9`! 0 // Not a valid sound item
378 #define SIF_PLAYING_2Dcxx . . $ `sndlib/ssl_lib.h:378:9`! 1 // Sound is currently playing
379 #define SIF_PLAYING_3Dcxx . . $ `sndlib/ssl_lib.h:379:9`! 2
380 #define SIF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:380:9`! 4
381 #define SIF_TOO_FARcxx . . $ `sndlib/ssl_lib.h:381:9`! 8 // We will play it, but it currently too far away(stop sound in low-level)
382 #define SIF_NO_3D_EFFECTScxx . . $ `sndlib/ssl_lib.h:382:9`! 16
383 #define SIF_LOOPINGcxx . . $ `sndlib/ssl_lib.h:383:9`! 32
384 #define SIF_STREAMING_8_Mcxx . . $ `sndlib/ssl_lib.h:384:9`! 64
385 #define SIF_STREAMING_16_Mcxx . . $ `sndlib/ssl_lib.h:385:9`! 128
386 #define SIF_STREAMING_8_Scxx . . $ `sndlib/ssl_lib.h:386:9`! 256
387 #define SIF_STREAMING_16_Scxx . . $ `sndlib/ssl_lib.h:387:9`! 512
388 #define SIF_STREAMINGcxx . . $ `sndlib/ssl_lib.h:388:9`! (64 | 128 | 256 | 512)
389
390 // What is the sound cone linked to (and mask to make it else to look at the important bits)
391 #define SPFT_CONE_LINK_MASKcxx . . $ `sndlib/ssl_lib.h:391:9`! 0x00000300
392 #define SPFT_CONE_LINK_OBJECTcxx . . $ `sndlib/ssl_lib.h:392:9`! 0x00000000
393 #define SPFT_CONE_LINK_TURRET1cxx . . $ `sndlib/ssl_lib.h:393:9`! 0x00000100
394 #define SPFT_CONE_LINK_TURRET2cxx . . $ `sndlib/ssl_lib.h:394:9`! 0x00000200
395 #define SPFT_CONE_LINK_TURRET3cxx . . $ `sndlib/ssl_lib.h:395:9`! 0x00000300
396
397 // Direction of the sound cone relative to its link (and mask to make it else to look at the important bits)
398 #define SPFT_CONE_DIR_MASKcxx . . $ `sndlib/ssl_lib.h:398:9`! 0x00000C00
399 #define SPFT_CONE_DIR_FORWARDcxx . . $ `sndlib/ssl_lib.h:399:9`! 0x00000000
400 #define SPFT_CONE_DIR_BACKWARDcxx . . $ `sndlib/ssl_lib.h:400:9`! 0x00000400
401 #define SPFT_CONE_DIR_UPWARDcxx . . $ `sndlib/ssl_lib.h:401:9`! 0x00000800
402 #define SPFT_CONE_DIR_DOWNWARDcxx . . $ `sndlib/ssl_lib.h:402:9`! 0x00000C00
403
404 // Sound kill types
405 #define SKT_STOP_AFTER_LOOPcxx . . $ `sndlib/ssl_lib.h:405:9`! 0 // Allows a looping sample to play until the end of the sample
406 #define SKT_STOP_IMMEDIATELYcxx . . $ `sndlib/ssl_lib.h:406:9`! 1 // Stops and cleans up after a sound (For StopAllSounds)
407 #define SKT_HOLD_UNTIL_STOPcxx . . $ `sndlib/ssl_lib.h:407:9`! 2 // Hold until sound stops.
408
409 // Sound Library Internal Error Codes
410 #define SSL_OKcxx . . $ `sndlib/ssl_lib.h:410:9`! 0
411 #define SSL_ERROR_GENERICcxx . . $ `sndlib/ssl_lib.h:411:9`! (-1)
412 #define SSL_ERROR_SAMPLE_NODATAcxx . . $ `sndlib/ssl_lib.h:412:9`! (-2)
413 #define SSL_ERROR_STREAMMIXERcxx . . $ `sndlib/ssl_lib.h:413:9`! (-3)
414
415 // Sound Status
416 #define SSF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:416:9`! 0
417 #define SSF_PLAY_NORMALcxx . . $ `sndlib/ssl_lib.h:417:9`! 1
418 #define SSF_PLAY_LOOPINGcxx . . $ `sndlib/ssl_lib.h:418:9`! 2
419 #define SSF_PAUSEDcxx . . $ `sndlib/ssl_lib.h:419:9`! 4
420 #define SSF_PLAY_STREAMINGcxx . . $ `sndlib/ssl_lib.h:420:9`! 8
421 #define SSF_BUFFERED_LOOPcxx . . $ `sndlib/ssl_lib.h:421:9`! 64
422 #define SSF_BUFFERED_STRMcxx . . $ `sndlib/ssl_lib.h:422:9`! 128
423
424 #define SBT_PRIMARYcxx . . $ `sndlib/ssl_lib.h:424:9`! 0
425 #define SBT_2Dcxx . . $ `sndlib/ssl_lib.h:425:9`! 1
426 #define SBT_3Dcxx . . $ `sndlib/ssl_lib.h:426:9`! 2
427
428 // looping methods
429 #define DSLOOP_SMART_METHODcxx . . $ `sndlib/ssl_lib.h:429:9`! 0
430 #define DSLOOP_BUFFER_METHODcxx . . $ `sndlib/ssl_lib.h:430:9`! 1
431 #define DSLOOP_STREAM_METHODcxx . . $ `sndlib/ssl_lib.h:431:9`! 2
432
433 #define DSBUFLOOP_INIT_STEPcxx . . $ `sndlib/ssl_lib.h:433:9`! (-1)
434 #define DSBUFLOOP_LOOP_STEPcxx . . $ `sndlib/ssl_lib.h:434:9`! 0
435 #define DSBUFLOOP_FINISH_STEPcxx . . $ `sndlib/ssl_lib.h:435:9`! 1
436
437 // used to time threads.
438
439 // This is the update rate at which to call sound_mixer::DoFrame()
440 // (sleep this amount each frame of the thread)
441 #define DSPB_TICK_INTERVALcxx . . $ `sndlib/ssl_lib.h:441:9`! .01 // Primary buffer update rate (in seconds)
442 #define DSPB_TICK_MILLISECONDScxx . . $ `sndlib/ssl_lib.h:442:9`! (DSPB_TICK_INTERVAL * 1000)
443
444
445 // structure to get and set environment values
446 #define ENV3DVALF_DOPPLERcxx . . $ `sndlib/ssl_lib.h:446:9`! 1
447 #define ENV3DVALF_GEOMETRYcxx . . $ `sndlib/ssl_lib.h:447:9`! 2
448
449 struct t3dEnvironmentValuescxx . . $ t3dEnvironmentValues# {
450 int flagscxx . . $ t3dEnvironmentValues#flags.; // use flags above
451
452 float doppler_scalarcxx . . $ t3dEnvironmentValues#doppler_scalar.; // values from 0.0f to ???? (1.0f = normal)
453 };
454
455 struct t3dEnvironmentTogglescxx . . $ t3dEnvironmentToggles# {
456 int flagscxx . . $ t3dEnvironmentToggles#flags.; // use flags above
457 int supportedcxx . . $ t3dEnvironmentToggles#supported.; // returns flag values to inform caller of supported features (doppler, ie.)
458
459 bool dopplercxx . . $ t3dEnvironmentToggles#doppler.; // state of doppler effects
460 bool geometrycxx . . $ t3dEnvironmentToggles#geometry.; // support hardware geometry
461 };
462
463 /////////////////////////////////////////////////////////////////////////////////
464 // Looping constants
465
466 class llsGeometrycxx . . $ llsGeometry#;
467
468 class llsSystemcxx . . $ llsSystem# {
469 protected:
470 llsGeometrycxx . . $ llsGeometry# *m_geometrycxx . . $ llsSystem#m_geometry.; // geometry object.
471 int m_lib_error_codecxx . . $ llsSystem#m_lib_error_code.; // library error code
472 char m_error_textcxx . . $ llsSystem#m_error_text.[512]; // text for error.
473
474 protected:
475 void SetErrorcxx . . $ llsSystem#SetError(d4f767463ce0a6b3).(int code) { m_lib_error_codecxx . . $ llsSystem#m_lib_error_code. = code; };
476 void ErrorTextcxx . . $ llsSystem#ErrorText(326aeb464d16410c).(const char *fmt, ...); // error text function called inside library. a stack is kept of errors
477 virtual void CheckForErrorscxx . . $ llsSystem#CheckForErrors(49f6e7a06ebc5aa8).(); // called by sound library every frame to reset error count.
478
479 // Public functions
480 public:
481 llsSystemcxx . . $ llsSystem#llsSystem(49f6e7a06ebc5aa8).();
482 virtual ~cxx . . $ llsSystem#`~llsSystem`(49f6e7a06ebc5aa8).llsSystemcxx . . $ llsSystem#() = default;
483
484 // may be called before init (must be to be valid, the card passed here will be initialized in InitSoundLib)
485 virtual void SetSoundCardcxx . . $ llsSystem#SetSoundCard(85c52e162fed56f9).(const char *name) = 0;
486
487 // Starts the sound library, maybe have it send back some information -- 3d support?
488 virtual int InitSoundLibcxx . . $ llsSystem#InitSoundLib(964874524976ed1).(char mixer_type, oeApplicationcxx . . $ oeApplication# *sos, uint8_tcxx . . $ uint8_t# max_sounds_played) = 0;
489 // Cleans up after the Sound Library
490 virtual void DestroySoundLibcxx . . $ llsSystem#DestroySoundLib(49f6e7a06ebc5aa8).() = 0;
491
492 // Locks and unlocks sounds (used when changing play_info data)
493 virtual bool LockSoundcxx . . $ llsSystem#LockSound(83c267b20bac841a).(int sound_uid) = 0;
494 virtual bool UnlockSoundcxx . . $ llsSystem#UnlockSound(83c267b20bac841a).(int sound_uid) = 0;
495
496 virtual bool SetSoundQualitycxx . . $ llsSystem#SetSoundQuality(b5fd09639b7a0261).(char quality) = 0;
497 virtual char GetSoundQualitycxx . . $ llsSystem#GetSoundQuality(6e9c618e4dd2eafc).() = 0;
498 virtual bool SetSoundMixercxx . . $ llsSystem#SetSoundMixer(b5fd09639b7a0261).(char mixer_type) = 0;
499 virtual char GetSoundMixercxx . . $ llsSystem#GetSoundMixer(6e9c618e4dd2eafc).() = 0;
500
501 // Plays a 2d sound
502 virtual int PlaySound2dcxx . . $ llsSystem#PlaySound2d(8751acdd249a09c0).(play_informationcxx . . $ play_information# *play_info, int sound_index, float volume, float pan, bool f_looped) = 0;
503 virtual int PlayStreamcxx . . $ llsSystem#PlayStream(c3f562479373c168).(play_informationcxx . . $ play_information# *play_info) = 0;
504
505 virtual void SetListenercxx . . $ llsSystem#SetListener(c7791b6699e1fa9e).(pos_statecxx . . $ pos_state# *cur_pos) = 0;
506 virtual int PlaySound3dcxx . . $ llsSystem#PlaySound3d(112e06fe9f197cc1).(play_informationcxx . . $ play_information# *play_info, int sound_index, pos_statecxx . . $ pos_state# *cur_pos, float master_volume,
507 bool f_looped, float reverb = 0.5f) = 0; //, uint16_t frequency)
508 virtual void AdjustSoundcxx . . $ llsSystem#AdjustSound(96ebaef3518743f8).(int sound_uid, float f_volume, float f_pan, uint16_tcxx . . $ uint16_t# frequency) = 0;
509 virtual void AdjustSoundcxx . . $ llsSystem#AdjustSound(f041466fe69f6310).(int sound_uid, pos_statecxx . . $ pos_state# *cur_pos, float adjusted_volume, float reverb = 0.5f) = 0;
510
511 virtual void StopAllSoundscxx . . $ llsSystem#StopAllSounds(49f6e7a06ebc5aa8).() = 0;
512
513 // Checks if a sound is playing (removes finished sound);
514 virtual bool IsSoundInstancePlayingcxx . . $ llsSystem#IsSoundInstancePlaying(83c267b20bac841a).(int sound_uid) = 0;
515 virtual int IsSoundPlayingcxx . . $ llsSystem#IsSoundPlaying(7864480464b09eea).(int sound_index) = 0;
516
517 // virtual void AdjustSound(int sound_uid, play_information *play_info) = 0;
518
519 // Stops 2d and 3d sounds
520 virtual void StopSoundcxx . . $ llsSystem#StopSound(9633529ce3c4ff50).(int sound_uid, uint8_tcxx . . $ uint8_t# f_immediately = SKT_STOP_IMMEDIATELYcxx . . $ `sndlib/ssl_lib.h:406:9`!) = 0;
521
522 // Pause all sounds/resume all sounds
523 virtual void PauseSoundscxx . . $ llsSystem#PauseSounds(49f6e7a06ebc5aa8).() = 0;
524 virtual void ResumeSoundscxx . . $ llsSystem#ResumeSounds(49f6e7a06ebc5aa8).() = 0;
525 virtual void PauseSoundcxx . . $ llsSystem#PauseSound(d4f767463ce0a6b3).(int sound_uid) = 0;
526 virtual void ResumeSoundcxx . . $ llsSystem#ResumeSound(d4f767463ce0a6b3).(int sound_uid) = 0;
527
528 virtual bool CheckAndForceSoundDataAlloccxx . . $ llsSystem#CheckAndForceSoundDataAlloc(83c267b20bac841a).(int sound_file_index) = 0;
529
530 // Begin sound frame
531 virtual void SoundStartFramecxx . . $ llsSystem#SoundStartFrame(49f6e7a06ebc5aa8).() = 0;
532
533 // End sound frame
534 virtual void SoundEndFramecxx . . $ llsSystem#SoundEndFrame(49f6e7a06ebc5aa8).() = 0;
535
536 // Returns current error code
537 int GetLastErrorcxx . . $ llsSystem#GetLastError(b126dc7c1de90089).() {
538 int code = m_lib_error_codecxx . . $ llsSystem#m_lib_error_code.;
539 m_lib_error_codecxx . . $ llsSystem#m_lib_error_code. = 0;
540 return code;
541 };
542
543 // environmental sound interface
544 // volume modifier (0-1), damping(0-1), 1 = complete, 0 = none
545 // decay 0.1 to 100 seconds, how long it takes for a sound to die.
546 virtual bool SetGlobalReverbPropertiescxx . . $ llsSystem#SetGlobalReverbProperties(5f279dd7f821a414).(float volume, float damping, float decay) = 0;
547
548 // set special parameters for the 3d environment.
549 // of strcuture passed, you must set the appropriate 'flags' value for values you wish to modify
550 virtual void SetEnvironmentValuescxx . . $ llsSystem#SetEnvironmentValues(9789f8e644620ab0).(const t3dEnvironmentValuescxx . . $ t3dEnvironmentValues# *env) = 0;
551
552 // get special parameters for the 3d environment.
553 // of strcuture passed, you must set the appropriate 'flags' value for values you wish to modify
554 virtual void GetEnvironmentValuescxx . . $ llsSystem#GetEnvironmentValues(f6503759d22bce78).(t3dEnvironmentValuescxx . . $ t3dEnvironmentValues# *env) = 0;
555
556 // enable special parameters for the 3d environment.
557 // of strcuture passed, you must set the appropriate 'flags' value for values you wish to modify
558 virtual void SetEnvironmentTogglescxx . . $ llsSystem#SetEnvironmentToggles(4f564680f5be55d7).(const t3dEnvironmentTogglescxx . . $ t3dEnvironmentToggles# *env) = 0;
559
560 // get states of special parameters for the 3d environment.
561 // of strcuture passed, you must set the appropriate 'flags' value for values you wish to modify
562 virtual void GetEnvironmentTogglescxx . . $ llsSystem#GetEnvironmentToggles(3d0214c48b4fff80).(t3dEnvironmentTogglescxx . . $ t3dEnvironmentToggles# *env) = 0;
563
564 // returns interface to sound geometry manipulation if available.
565 virtual llsGeometrycxx . . $ llsGeometry# *GetGeometryInterfacecxx . . $ llsSystem#GetGeometryInterface(d4b170b416b3ba56).() { return m_geometrycxx . . $ llsSystem#m_geometry.; };
566 /////////////////////////////////////////////////////////////////////////////////
567 // set auxillary 3d sound properties
568 virtual bool SoundPropertySupportcxx . . $ llsSystem#SoundPropertySupport(50ce9a9e25b4a850).() const { return false; };
569
570 // sound obstruction from 0 to 1.0 (1.0 = fully obstructed)
571 virtual void SetSoundPropertiescxx . . $ llsSystem#SetSoundProperties(43c79ee2f1b9aefe).(int sound_uid, float obstruction){};
572 };
573
574 // TAKEN FROM SNDLIB SOUNDLOAD.CPP TO SEPARATE CODE REQUIRED BY THE LOWLEVEL SYSTEM AND THE
575 // HIGH LEVEL SYSTEM - Samir
576
577 #ifndef NEWEDITOR
578 #define MAX_SOUNDScxx . . $ `sndlib/ssl_lib.h:578:9`! 1000
579 #define MAX_SOUND_FILEScxx . . $ `sndlib/ssl_lib.h:579:9`! 1000
580 extern sound_infocxx . . $ sound_info# Soundscxx . . $ Sounds.[MAX_SOUNDScxx . . $ `sndlib/ssl_lib.h:578:9`!];
581 #else
582 #include "..\neweditor\ned_Sound.h"
583 #endif
584
585 extern sound_file_infocxx . . $ sound_file_info# SoundFilescxx . . $ SoundFiles.[MAX_SOUND_FILEScxx . . $ `sndlib/ssl_lib.h:579:9`!];
586
587 // loads a sound from a wavefile.
588 char SoundLoadWaveFilecxx . . $ SoundLoadWaveFile(a6965b2b334606ff).(const char *filename, float percent_volume, int sound_file_index, bool f_high_quality,
589 bool f_load_sample_data, int *e_type = nullptr);
590
591 void SoundLoadFreecxx . . $ SoundLoadFree(d4f767463ce0a6b3).(int sound_file_index);
592
593 #endif