| 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/sndlib/hlsoundlib.cpp $ |
| 21 | * $Revision: 116 $ |
| 22 | * $Date: 4/19/00 5:07p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * High level sound library for Descent 3 |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/sndlib/hlsoundlib.cpp $ |
| 28 | * |
| 29 | * 116 4/19/00 5:07p Matt |
| 30 | * From Duane for 1.4 |
| 31 | * Added checks, asserts, and fixes for bad return values |
| 32 | * |
| 33 | * 115 3/20/00 12:30p Matt |
| 34 | * Merge of Duane's post-1.3 changes. |
| 35 | * Optimizations. |
| 36 | * A bunch of 3D sound code ifdef'd out for Mac. |
| 37 | * |
| 38 | * 114 2/09/00 4:59p Jason |
| 39 | * fixed access violation in VerifyUniqueID |
| 40 | * |
| 41 | * 113 10/22/99 10:40p Jeff |
| 42 | * commented out an mprintf put in by mac merge |
| 43 | * |
| 44 | * 112 10/21/99 3:27p Kevin |
| 45 | * Mac merge! |
| 46 | * |
| 47 | * 111 8/23/99 5:29p Samir |
| 48 | * incremental EAX 2.0 checkin |
| 49 | * |
| 50 | * 110 8/19/99 7:10p Jeff |
| 51 | * hooked in linux sound lib |
| 52 | * |
| 53 | * 109 8/13/99 2:00p Samir |
| 54 | * more aureal and geometry fixes. |
| 55 | * |
| 56 | * 108 8/11/99 3:12p Samir |
| 57 | * fixes for aureal support. |
| 58 | * |
| 59 | * 107 7/28/99 2:05p Kevin |
| 60 | * Macintosh Changes |
| 61 | * |
| 62 | * 106 5/07/99 1:32p Jeff |
| 63 | * kill a sound if the object is ghosted (aka OBJ_DUMMY) |
| 64 | * |
| 65 | * 105 4/27/99 2:10p Samir |
| 66 | * added code to set the desired sound card given the descriptive name of |
| 67 | * a sound card. |
| 68 | * |
| 69 | * 104 4/23/99 7:50p Samir |
| 70 | * looping fixes for directsound. |
| 71 | * |
| 72 | * 103 4/14/99 1:46a Jeff |
| 73 | * fixed case mismatched #includes |
| 74 | * |
| 75 | * 102 4/12/99 7:14p Samir |
| 76 | * prioritization code added. |
| 77 | * |
| 78 | * 101 4/10/99 5:09p Samir |
| 79 | * beginning to add prioritization of sounds code. currently non |
| 80 | * functional, but allows me to change all calls to Play3dSound so that I |
| 81 | * can test later. |
| 82 | * |
| 83 | * 100 4/06/99 8:31p Samir |
| 84 | * moved free memory code to low level library. |
| 85 | * |
| 86 | * 99 4/03/99 6:24p Nate |
| 87 | * ? Fixed a editor sound crash ? |
| 88 | * |
| 89 | * 98 4/01/99 4:28p Samir |
| 90 | * hardware geometry integration if it's available. |
| 91 | * |
| 92 | * 97 4/01/99 11:57a Chris |
| 93 | * Made the holy cow messed print the name of the sound that couldn't be |
| 94 | * played |
| 95 | * |
| 96 | * 96 3/03/99 5:07p Samir |
| 97 | * music volume will shutoff music if 0, restart if greater only after a |
| 98 | * change in vollume. |
| 99 | * |
| 100 | * 95 3/03/99 5:44a Chris |
| 101 | * Sound is based on the viewer_object |
| 102 | * |
| 103 | * 94 2/24/99 12:27p Chris |
| 104 | * Fixed problems with GB finding robots/room he couldn't get to. Fixed |
| 105 | * problems with forcefields(sound prop. and path finding). Fixed |
| 106 | * problems with small portals. |
| 107 | * |
| 108 | * 93 2/21/99 5:48p Matt |
| 109 | * Added SetVolumeObject() |
| 110 | * |
| 111 | * 92 2/16/99 3:38p Chris |
| 112 | * FIXED: Ship sounds being all messed up. :) (3d dist = 0) So, use the |
| 113 | * rvec... So, sounds could get muffled |
| 114 | * |
| 115 | * 91 2/14/99 3:27p Chris |
| 116 | * FIxed a load/save bug... hehe |
| 117 | * |
| 118 | * 90 2/12/99 2:10p Chris |
| 119 | * |
| 120 | * 89 2/12/99 1:54p Sean |
| 121 | * |
| 122 | * 88 2/12/99 1:33p Sean |
| 123 | * |
| 124 | * 87 2/12/99 1:18p Sean |
| 125 | * |
| 126 | * 86 2/12/99 1:10p Sean |
| 127 | * Encapsulated the last_portal code |
| 128 | * |
| 129 | * 85 2/12/99 11:22a Chris |
| 130 | * Updated what BOA uses for BOA_cost_array. It is not just the distance |
| 131 | * from the center of the room to the center of the portal. It was this + |
| 132 | * the dist to the next room's center. The reason for this change was it |
| 133 | * makes it easier to compute the exact BOA_DIST for sounds. This is |
| 134 | * because the two distances are seperated (so from the start pos, we do a |
| 135 | * vm_Vect dist from the start point to the portal)... Hmmm.... |
| 136 | * |
| 137 | * 84 2/09/99 12:40p Chris |
| 138 | * More aipath stuff has been merged with the new BOA |
| 139 | * |
| 140 | * 83 2/09/99 9:59a Chris |
| 141 | * Massive BOA update :) Terrain happy now. Vis happy now. Sound happy |
| 142 | * now. |
| 143 | * |
| 144 | * 82 1/30/99 3:44p Chris |
| 145 | * Added support for time-offset'ed 3d sounds (like start at 1.2 seconds |
| 146 | * into the sound) |
| 147 | * |
| 148 | * 81 1/29/99 12:48p Matt |
| 149 | * Rewrote the doorway system |
| 150 | * |
| 151 | * 80 1/26/99 5:16p Matt |
| 152 | * Added StopObjectSound() |
| 153 | * |
| 154 | * 79 1/12/99 4:04p Samir |
| 155 | * added environmental audio on a per room basis. |
| 156 | * |
| 157 | * 78 1/08/99 6:31p Samir |
| 158 | * added reverb |
| 159 | * |
| 160 | * 77 12/22/98 11:08a Chris |
| 161 | * Improved algorithm for 3d sounds |
| 162 | * |
| 163 | * 76 12/02/98 4:34p Samir |
| 164 | * made high level playstream set a variable needed to call low level |
| 165 | * stream playback. |
| 166 | * |
| 167 | * 75 11/16/98 4:29p Chris |
| 168 | * Added pause new flag to the high level system |
| 169 | * |
| 170 | * 74 11/10/98 1:52p Jason |
| 171 | * added dedicated server support |
| 172 | * |
| 173 | * 73 10/23/98 7:05p Samir |
| 174 | * added pause and resume |
| 175 | * |
| 176 | * 72 10/22/98 8:31p Chris |
| 177 | * Sounds use GlobalAlloc and GlobalFree |
| 178 | * |
| 179 | * 71 10/22/98 9:22a Chris |
| 180 | * Fixes problems with hl-uids only being valid for the first 256 sounds |
| 181 | * |
| 182 | * 70 10/20/98 2:53a Kevin |
| 183 | * gunboy crap |
| 184 | * |
| 185 | * 69 10/19/98 11:57a Chris |
| 186 | * Update the sound system to use the import volume |
| 187 | * |
| 188 | * 68 10/17/98 12:46p Kevin |
| 189 | * Beta 4 fixes |
| 190 | * |
| 191 | * 67 10/14/98 5:12p Samir |
| 192 | * added a null SOUND_MIXER. |
| 193 | * |
| 194 | * 66 10/12/98 1:27p Jeff |
| 195 | * all mem_free's do set the value to NULL after they are complete |
| 196 | * |
| 197 | * 65 10/02/98 3:39p Chris |
| 198 | * Fixed a bug in Stopallsounds (it always acted like you where in the |
| 199 | * game) |
| 200 | * |
| 201 | * 64 9/14/98 6:28p Jason |
| 202 | * first pass at getting dedicated server working |
| 203 | * |
| 204 | * 63 9/11/98 3:08p Chris |
| 205 | * Enabled the production sound |
| 206 | * |
| 207 | * 62 9/08/98 12:05p Jason |
| 208 | * moved doorway.h out of room.h |
| 209 | * |
| 210 | * 61 8/26/98 1:48a Chris |
| 211 | * Fixed odd non-stopping sounds when ESC out of the game - etc. |
| 212 | * |
| 213 | * 60 8/18/98 12:18p Chris |
| 214 | * Added f_in_game |
| 215 | * |
| 216 | * 59 7/09/98 8:34p Samir |
| 217 | * added argument to callback for streams. |
| 218 | * |
| 219 | * 58 7/09/98 11:32a Samir |
| 220 | * close stream system after init check in KillSoundLib. |
| 221 | * |
| 222 | * 57 7/08/98 6:27p Samir |
| 223 | * stream library integrated with highlevel sound system. |
| 224 | * |
| 225 | * 56 6/29/98 10:44p Chris |
| 226 | * |
| 227 | * 55 6/29/98 10:44p Chris |
| 228 | * Added support for SIF_ONCE_PER_OBJ |
| 229 | * |
| 230 | * 54 6/29/98 10:12a Chris |
| 231 | * Further improved the sound system |
| 232 | * |
| 233 | * 53 6/29/98 9:29a Chris |
| 234 | * Added some support for Direct Sound 3d |
| 235 | * |
| 236 | * 52 6/24/98 12:09p Chris |
| 237 | * Update |
| 238 | * |
| 239 | * 51 6/22/98 12:00p Chris |
| 240 | * Working on sound system to make it in a nice shape. |
| 241 | * |
| 242 | * 50 6/19/98 3:09p Chris |
| 243 | * Improved IsSoundPlaying |
| 244 | * |
| 245 | * 49 6/19/98 3:03p Chris |
| 246 | * Made CheckAndForceSoundDataAlloc a SoundSystem function - useful for |
| 247 | * multiple mixers. Added IsSoundPlaying to the high level sound lib. |
| 248 | * |
| 249 | * 48 6/17/98 4:39p Chris |
| 250 | * Added the playing of 8bit samples with the 16 bit sound mixer |
| 251 | * |
| 252 | * 47 6/16/98 4:46p Chris |
| 253 | * Revision 2 of the stream audio stuff |
| 254 | * |
| 255 | * 46 6/16/98 3:48p Chris |
| 256 | * Updated the sound system and added the start of sound streaming |
| 257 | * |
| 258 | * 45 5/14/98 7:32p Samir |
| 259 | * Removed an ASSert and replaced with a mprintf |
| 260 | * |
| 261 | * 44 5/04/98 6:31p Craig |
| 262 | * Added more bug checking |
| 263 | * |
| 264 | * 43 4/24/98 3:02p Chris |
| 265 | * Removed GlobalAlloc and GlobalFree |
| 266 | * |
| 267 | * 42 4/23/98 12:00p Jeff |
| 268 | * Fixed the GlobalFree problem |
| 269 | * |
| 270 | * 41 4/22/98 6:19p Chris |
| 271 | * Fixed a lockup bug |
| 272 | * |
| 273 | * 40 4/22/98 4:31p Chris |
| 274 | * Added DebugBlockPrint |
| 275 | * |
| 276 | * 39 4/06/98 3:43p Jason |
| 277 | * Removed an ASSERT and make it an if-block |
| 278 | * |
| 279 | * 38 3/20/98 4:03p Chris |
| 280 | * Made non-looping non-audible 3d sounds not play. |
| 281 | * |
| 282 | * 37 3/20/98 3:06p Chris |
| 283 | * Removed some mprintf's |
| 284 | * |
| 285 | * 36 3/20/98 2:59p Chris |
| 286 | * Added a wall hit sound for the player and added support for a base |
| 287 | * volume for 3d sounds |
| 288 | * |
| 289 | * 35 2/27/98 5:31p Chris |
| 290 | * Changed how master_volume is set. |
| 291 | * |
| 292 | * 34 2/23/98 6:32p Chris |
| 293 | * Added support for a hlsoundlib unique id. This is what all the public |
| 294 | * functions use. Also, looping sounds are now correctly turned off and |
| 295 | * on. |
| 296 | * |
| 297 | * 33 2/23/98 5:03p Chris |
| 298 | * Added the global alloc calls (deifned them to malloc and free when not |
| 299 | * Win32) |
| 300 | * |
| 301 | * 32 2/17/98 1:17p Chris |
| 302 | * |
| 303 | * 31 2/17/98 1:11p Chris |
| 304 | * Bails on invalid sound indices |
| 305 | * |
| 306 | * 30 2/16/98 4:34a Chris |
| 307 | * |
| 308 | * 29 2/16/98 4:23a Chris |
| 309 | * |
| 310 | * 28 2/16/98 3:54a Chris |
| 311 | * |
| 312 | * 27 2/16/98 3:20a Luke |
| 313 | * |
| 314 | * 26 2/16/98 2:47a Chris |
| 315 | * Fixed problems with 3d looping sounds |
| 316 | * |
| 317 | * 25 2/15/98 8:13p Luke |
| 318 | * |
| 319 | * 24 2/15/98 7:12p Chris |
| 320 | * More improvements to the sound lib |
| 321 | * |
| 322 | * 23 2/15/98 6:41p Chris |
| 323 | * Added Update2dSound |
| 324 | * |
| 325 | * 22 2/13/98 5:15p Chris |
| 326 | * Fixed multiple problems with looping sounds not being able to be |
| 327 | * stopped |
| 328 | * |
| 329 | * 21 2/04/98 6:10p Matt |
| 330 | * Changed object room number to indicate a terrain cell via a flag. Got |
| 331 | * rid of the object flag which used to indicate terrain. |
| 332 | * |
| 333 | * 20 1/19/98 10:04a Matt |
| 334 | * Added new object handle system |
| 335 | * |
| 336 | * 19 1/14/98 7:56p Chris |
| 337 | * Fixed bugs dealing with llsound system being full. |
| 338 | * |
| 339 | * 18 1/14/98 5:40p Chris |
| 340 | * Fixed problem of the hlsound system crashing when the llsound lib |
| 341 | * filled up. |
| 342 | * |
| 343 | * 17 1/13/98 5:08p Chris |
| 344 | * Increased sound object limit |
| 345 | * |
| 346 | * 16 1/08/98 1:11p Chris |
| 347 | * Forgot to OR SND_OUTSIDE of some sounds |
| 348 | * |
| 349 | * 15 1/06/98 2:12p Chris |
| 350 | * Added muffled sounds v.1 and made 3d sounds keep their roomnum. |
| 351 | * |
| 352 | * 14 1/05/98 4:36p Chris |
| 353 | * Added working ambient sounds to objects. |
| 354 | * |
| 355 | * 13 1/05/98 3:58p Chris |
| 356 | * Further improvements to the high level sound lib |
| 357 | * |
| 358 | * 12 1/02/98 5:32p Chris |
| 359 | * More radical changes to the sound system |
| 360 | * |
| 361 | * 11 12/31/97 2:58a Chris |
| 362 | * Another major revision to the SoundLib. This cleaned up the code after |
| 363 | * removing the direct sound secondary buffers. |
| 364 | * |
| 365 | * 10 12/30/97 2:15p Chris |
| 366 | * Adding further support for software 3d stuff |
| 367 | * |
| 368 | * 9 12/22/97 6:19p Chris |
| 369 | * Moved weapon battery firing sound off the projectile (weapon) and into |
| 370 | * the weapon battery. |
| 371 | * |
| 372 | * 8 12/12/97 11:43a Chris |
| 373 | * Added support to toggle sndlib on/off |
| 374 | * |
| 375 | * 7 12/11/97 1:33p Chris |
| 376 | * Added support for fixed 3d position updating sounds. |
| 377 | * |
| 378 | * 6 12/10/97 4:47p Chris |
| 379 | * Revision 1.0 of new sound library (no hardware -- uses primary buffer |
| 380 | * streaming) |
| 381 | * |
| 382 | * 5 11/21/97 1:10p Chris |
| 383 | * Incremental Improvements |
| 384 | * |
| 385 | * 4 11/21/97 12:33p Chris |
| 386 | * Fixed memory leak when -nosound was added. |
| 387 | * |
| 388 | * 3 11/07/97 5:43p Jason |
| 389 | * added -nosound command switch |
| 390 | * |
| 391 | * 2 7/16/97 5:15p Chris |
| 392 | * Fixed use of updating 3d sounds |
| 393 | * |
| 394 | * 23 6/11/97 1:07p Samir |
| 395 | * The removal of gameos and replaced with oeApplication, oeDatabase |
| 396 | * |
| 397 | * 22 5/22/97 5:15p Chris |
| 398 | * |
| 399 | * 21 5/15/97 1:59a Chris |
| 400 | * |
| 401 | * 20 4/29/97 8:03a Chris |
| 402 | * Improved the sound code. High-level sound now |
| 403 | * fully uses the flags in the sound page and it |
| 404 | * resulted in a simpilier coding interface :) |
| 405 | * |
| 406 | * 19 4/28/97 11:21a Chris |
| 407 | * Incremental improvements is the sound system |
| 408 | * |
| 409 | * 18 4/24/97 3:41a Chris |
| 410 | * Improved 3d sound support. :) |
| 411 | * |
| 412 | * 17 4/23/97 5:38p Chris |
| 413 | * Updated some 3d sound code |
| 414 | * |
| 415 | * 16 4/03/97 8:37p Chris |
| 416 | * Added the Main_OS object pass in the sound library |
| 417 | * initialization code. |
| 418 | * |
| 419 | * 15 4/01/97 9:32a Chris |
| 420 | * Getting sounds to work with the paging system. |
| 421 | * |
| 422 | * 14 3/27/97 11:44a Chris |
| 423 | * On a re-initialize, I now make sure that the old initializaton is |
| 424 | * cleared out |
| 425 | * |
| 426 | * 13 3/21/97 7:02 PM Jeremy |
| 427 | * changed a "== SIF_UNUSED" to "= SIF_UNUSED" in StopAllSounds as it was |
| 428 | * not really doing an assignment as intended. |
| 429 | * |
| 430 | * 12 3/21/97 4:06 PM Jeremy |
| 431 | * changed name of low level mac sound header |
| 432 | * |
| 433 | * 11 3/14/97 5:22 PM Jeremy |
| 434 | * unincluded malloc.h, changed #include of <pserror.h> to "pserror.h" |
| 435 | * since it's not an ANSI header, but one of ours. |
| 436 | * |
| 437 | * 10 3/14/97 12:17p Chris |
| 438 | * Abstract type for the low level sound lib |
| 439 | * |
| 440 | * 9 2/07/97 5:48p Matt |
| 441 | * Renamed vector.h to vecmat.h to fix DevStudio problem |
| 442 | * |
| 443 | * $NoKeywords: $ |
| 444 | */ |
| 445 | // High level sound object. This code is 100% machine independant and |
| 446 | // completely encapsulates the lowel-level machine-dependant sound code. |
| 447 | |
| 448 | #include <cstring> |
| 449 | |
| 450 | #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/ |
| 451 | #include "ssl_lib.h"cxx . . $ `<file>/sndlib/ssl_lib.h`/ |
| 452 | #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/ |
| 453 | #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/ |
| 454 | #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/ |
| 455 | #include "args.h"cxx . . $ `<file>/Descent3/args.h`/ |
| 456 | #include "sounds.h"cxx . . $ `<file>/Descent3/sounds.h`/ |
| 457 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 458 | #include "room.h"cxx . . $ `<file>/Descent3/room.h`/ |
| 459 | #include "BOA.h"cxx . . $ `<file>/Descent3/BOA.h`/ |
| 460 | #include "streamaudio.h"cxx . . $ `<file>/stream_audio/streamaudio.h`/ |
| 461 | #include "doorway.h"cxx . . $ `<file>/Descent3/doorway.h`/ |
| 462 | #include "dedicated_server.h"cxx . . $ `<file>/lib/dedicated_server.h`/ |
| 463 | #include "sndrender.h"cxx . . $ `<file>/sndlib/sndrender.h`/ |
| 464 | #include "voice.h"cxx . . $ `<file>/Descent3/voice.h`/ |
| 465 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 466 | |
| 467 | #include "sdlsound.h"cxx . . $ `<file>/sndlib/sdlsound.h`/ |
| 468 | |
| 469 | hlsSystemcxx . . $ hlsSystem# Sound_systemcxx . . $ Sound_system.; |
| 470 | char Sound_qualitycxx . . $ Sound_quality. = SQT_NORMALcxx . . $ `sndlib/ssl_lib.h:351:9`!; |
| 471 | char Sound_mixercxx . . $ Sound_mixer. = SOUND_MIXER_SOFTWARE_16cxx . . $ `sndlib/ssl_lib.h:342:9`!; |
| 472 | char Sound_card_namecxx . . $ Sound_card_name.[256] = ""; |
| 473 | struct tEnvAudioPresetscxx . . $ tEnvAudioPresets# { |
| 474 | float volumecxx . . $ tEnvAudioPresets#volume.; |
| 475 | float decaycxx . . $ tEnvAudioPresets#decay.; |
| 476 | float dampingcxx . . $ tEnvAudioPresets#damping.; |
| 477 | } |
| 478 | EnvAudio_Presetscxx . . $ EnvAudio_Presets.[N_ENVAUDIO_PRESETScxx . . $ `sndlib/hlsoundlib.h:373:9`!] = { |
| 479 | {0.0F, 0.0F, 0.0F}, // Use for reverb off. |
| 480 | {0.25F, 0.1F, 0.0F}, {0.417F, 0.4F, 0.666F}, {0.653F, 1.499F, 0.166F}, {0.208F, 0.478F, 0.0F}, |
| 481 | {0.5F, 2.309F, 0.888F}, {0.403F, 4.279F, 0.5F}, {0.5F, 3.961F, 0.5F}, {0.5F, 2.886F, 1.304F}, |
| 482 | {0.361F, 7.284F, 0.332F}, {0.5F, 10.0F, 0.3F}, {0.153F, 0.259F, 2.0F}, {0.361F, 1.493F, 0.0F}, |
| 483 | {0.444F, 2.697F, 0.638F}, {0.25F, 1.752F, 0.776F}, {0.111F, 3.145F, 0.472F}, {0.111F, 2.767F, 0.224F}, |
| 484 | {0.194F, 7.841F, 0.472F}, {1.0F, 1.499F, 0.5F}, {0.097F, 2.767F, 0.224F}, {0.208F, 1.652F, 1.5F}, |
| 485 | {0.652F, 2.886F, 0.25F}, {1.0F, 1.499F, 0.0F}, {0.875F, 8.392F, 1.388F}, {0.139F, 17.234F, 0.666F}, |
| 486 | {0.486F, 7.563F, 0.806F}}; |
| 487 | |
| 488 | ////////////////////////////////////////////////////////////////////////////// |
| 489 | hlsSystemcxx . . $ hlsSystem#::hlsSystemcxx . . $ hlsSystem#hlsSystem(49f6e7a06ebc5aa8).() { |
| 490 | m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init. = 0; |
| 491 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 492 | m_sounds_playedcxx . . $ hlsSystem#m_sounds_played. = 0; |
| 493 | m_master_volumecxx . . $ hlsSystem#m_master_volume. = 1.0; |
| 494 | m_pause_newcxx . . $ hlsSystem#m_pause_new. = false; |
| 495 | n_lls_soundscxx . . $ hlsSystem#n_lls_sounds. = MAX_SOUNDS_MIXEDcxx . . $ `sndlib/hlsoundlib.h:215:9`!; |
| 496 | } |
| 497 | bool hlsSystemcxx . . $ hlsSystem#::IsActivecxx . . $ hlsSystem#IsActive(c9857a73d68e59ba).(void) { |
| 498 | if (m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 499 | return true; |
| 500 | return false; |
| 501 | } |
| 502 | void hlsSystemcxx . . $ hlsSystem#::SetLLSoundQuantitycxx . . $ hlsSystem#SetLLSoundQuantity(d4f767463ce0a6b3).(int n_sounds) { |
| 503 | if (n_sounds > MAX_SOUNDS_MIXEDcxx . . $ `sndlib/hlsoundlib.h:215:9`!) { |
| 504 | n_sounds = MAX_SOUNDS_MIXEDcxx . . $ `sndlib/hlsoundlib.h:215:9`!; |
| 505 | } |
| 506 | n_lls_soundscxx . . $ hlsSystem#n_lls_sounds. = n_sounds; |
| 507 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "SNDLIB: Allow %d sounds to be mixed.\n", n_sounds); |
| 508 | if (m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) { |
| 509 | InitSoundLibcxx . . $ hlsSystem#InitSoundLib(bc2f84f4176dee7e).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, Sound_mixercxx . . $ Sound_mixer., Sound_qualitycxx . . $ Sound_quality., false); |
| 510 | } |
| 511 | } |
| 512 | int hlsSystemcxx . . $ hlsSystem#::GetLLSoundQuantitycxx . . $ hlsSystem#GetLLSoundQuantity(b126dc7c1de90089).() { return n_lls_soundscxx . . $ hlsSystem#n_lls_sounds.; } |
| 513 | // Start and clean-up after the sound library |
| 514 | int hlsSystemcxx . . $ hlsSystem#::InitSoundLibcxx . . $ hlsSystem#InitSoundLib(bc2f84f4176dee7e).(oeApplicationcxx . . $ oeApplication# *sos, char mixer_type, char quality, bool f_kill_sound_list) { |
| 515 | int status; |
| 516 | // Turn off sound if desired |
| 517 | if ((FindArgcxx . . $ FindArg(5c4306d8553b3696).("-nosound")) || Dedicated_servercxx . . $ Dedicated_server.) { |
| 518 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 519 | return 0; |
| 520 | } |
| 521 | if (m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) { |
| 522 | KillSoundLibcxx . . $ hlsSystem#KillSoundLib(b45ddcbc8423892c).(f_kill_sound_list); |
| 523 | } |
| 524 | |
| 525 | // Create and initialize the low-level sound library |
| 526 | if (m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 527 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr. = new lnxsoundcxx . . $ lnxsound#; |
| 528 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(m_ll_sound_ptr); |
| 529 | if (m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 530 | return 0; |
| 531 | if (Sound_card_namecxx . . $ Sound_card_name.[0]) { |
| 532 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SetSoundCardcxx . . $ llsSystem#SetSoundCard(85c52e162fed56f9).(Sound_card_namecxx . . $ Sound_card_name.); |
| 533 | } else { |
| 534 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SetSoundCardcxx . . $ llsSystem#SetSoundCard(85c52e162fed56f9).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 535 | } |
| 536 | status = m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->InitSoundLibcxx . . $ llsSystem#InitSoundLib(964874524976ed1).(mixer_type, sos, n_lls_soundscxx . . $ hlsSystem#n_lls_sounds.); |
| 537 | // Initialize the high-level sound library |
| 538 | // Set the flag to initialized if all was o.k. |
| 539 | if (status) { |
| 540 | m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init. = 1; |
| 541 | SetSoundQualitycxx . . $ hlsSystem#SetSoundQuality(b5fd09639b7a0261).(quality); |
| 542 | Sound_qualitycxx . . $ Sound_quality. = GetSoundQualitycxx . . $ hlsSystem#GetSoundQuality(6e9c618e4dd2eafc).(); |
| 543 | Sound_mixercxx . . $ Sound_mixer. = GetSoundMixercxx . . $ hlsSystem#GetSoundMixer(6e9c618e4dd2eafc).(); |
| 544 | |
| 545 | // invoke high level stream system |
| 546 | AudioStreamcxx . . $ AudioStream#::InitSystemcxx . . $ AudioStream#InitSystem(81c6c6b1aaadc380).(this->m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.); |
| 547 | // set current environment |
| 548 | m_cur_environmentcxx . . $ hlsSystem#m_cur_environment. = ENVAUD_PRESET_NONEcxx . . $ `sndlib/hlsoundlib.h:375:9`!; |
| 549 | } |
| 550 | // All done |
| 551 | return status; |
| 552 | } |
| 553 | // Kills the sound library |
| 554 | void hlsSystemcxx . . $ hlsSystem#::KillSoundLibcxx . . $ hlsSystem#KillSoundLib(b45ddcbc8423892c).(bool f_kill_sound_list) { |
| 555 | int i; |
| 556 | if (m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) { |
| 557 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "m_sounds_played %d\n", m_sounds_played); |
| 558 | // clean up stream system |
| 559 | AudioStreamcxx . . $ AudioStream#::Shutdowncxx . . $ AudioStream#Shutdown(49f6e7a06ebc5aa8).(); |
| 560 | for (i = 0; i < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; i++) { |
| 561 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. = SIF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:377:9`!; |
| 562 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid. = -1; |
| 563 | } |
| 564 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->DestroySoundLibcxx . . $ llsSystem#DestroySoundLib(49f6e7a06ebc5aa8).(); |
| 565 | m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init. = 0; |
| 566 | } |
| 567 | if (m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.) { |
| 568 | delete m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.; |
| 569 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 570 | } |
| 571 | // This is independant of the actual sound_lib status. It happened because sounds |
| 572 | // use the manage system. |
| 573 | // moved this from beginning of function because won't the data freed here screw up streaming/looping sounds? |
| 574 | // before the sound library is closed? |
| 575 | if (f_kill_sound_list) { |
| 576 | for (int i = 0; i < MAX_SOUND_FILEScxx . . $ `sndlib/ssl_lib.h:579:9`!; i++) { |
| 577 | SoundLoadFreecxx . . $ SoundLoadFree(d4f767463ce0a6b3).(i); |
| 578 | } |
| 579 | } |
| 580 | } |
| 581 | // Pause and Resume the library |
| 582 | // Pauses all sounds |
| 583 | void hlsSystemcxx . . $ hlsSystem#::PauseSoundscxx . . $ hlsSystem#PauseSounds(b45ddcbc8423892c).(bool f_all_pause) { |
| 584 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 585 | return; |
| 586 | m_pause_newcxx . . $ hlsSystem#m_pause_new. = f_all_pause; |
| 587 | AudioStreamcxx . . $ AudioStream#::PauseAllcxx . . $ AudioStream#PauseAll(49f6e7a06ebc5aa8).(); |
| 588 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->PauseSoundscxx . . $ llsSystem#PauseSounds(49f6e7a06ebc5aa8).(); |
| 589 | } |
| 590 | // Resumes all sounds |
| 591 | void hlsSystemcxx . . $ hlsSystem#::ResumeSoundscxx . . $ hlsSystem#ResumeSounds(49f6e7a06ebc5aa8).() { |
| 592 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 593 | return; |
| 594 | m_pause_newcxx . . $ hlsSystem#m_pause_new. = false; |
| 595 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->ResumeSoundscxx . . $ llsSystem#ResumeSounds(49f6e7a06ebc5aa8).(); |
| 596 | AudioStreamcxx . . $ AudioStream#::ResumeAllcxx . . $ AudioStream#ResumeAll(49f6e7a06ebc5aa8).(); |
| 597 | } |
| 598 | // int hlsSystem::SetSoundPos(int sound_uid, int pos) |
| 599 | //{ |
| 600 | // if(!m_f_hls_system_init) return -1; |
| 601 | // |
| 602 | // return m_ll_sound_ptr->SetSoundPos(sound_uid, pos); |
| 603 | // return -1; |
| 604 | //} |
| 605 | // int hlsSystem::GetSoundPos(int sound_uid) |
| 606 | //{ |
| 607 | // if(!m_f_hls_system_init) return -1; |
| 608 | // |
| 609 | // return m_ll_sound_ptr->GetSoundPos(sound_uid); |
| 610 | // return -1; |
| 611 | //} |
| 612 | // Stops all sound from playing |
| 613 | void hlsSystemcxx . . $ hlsSystem#::StopAllSoundscxx . . $ hlsSystem#StopAllSounds(49f6e7a06ebc5aa8).() { |
| 614 | int i; |
| 615 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 616 | return; |
| 617 | for (i = 0; i < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; i++) { |
| 618 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. = SIF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:377:9`!; |
| 619 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid. = -1; |
| 620 | } |
| 621 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->StopAllSoundscxx . . $ llsSystem#StopAllSounds(49f6e7a06ebc5aa8).(); |
| 622 | BeginSoundFramecxx . . $ hlsSystem#BeginSoundFrame(b45ddcbc8423892c).(false); |
| 623 | EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).(); |
| 624 | |
| 625 | SoundRenderResetcxx . . $ SoundRenderReset(49f6e7a06ebc5aa8).(); |
| 626 | |
| 627 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Stopped all sounds\n"); |
| 628 | } |
| 629 | // Code for the beginning and ending of a frame of action |
| 630 | // Begin_sound_frame(listener pos/orient/velocity) |
| 631 | // SyncSounds |
| 632 | // Do sound pos updates -- IF VOLUME IS LOW AND NOT FOREVER (or looping), THEN STOP SOUND |
| 633 | // compute echo / reverb |
| 634 | // indirect/direct path sounds |
| 635 | |
| 636 | #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/ |
| 637 | |
| 638 | void hlsSystemcxx . . $ hlsSystem#::BeginSoundFramecxx . . $ hlsSystem#BeginSoundFrame(b45ddcbc8423892c).(bool f_in_game) { |
| 639 | bool hwsound_support; // if this is true, sound_render_system is being used |
| 640 | int16_t *sound_room_list; // these values are only meant for sound render system |
| 641 | int i, n, counter = 0; |
| 642 | pos_statecxx . . $ pos_state# listener_pos; |
| 643 | const int num_samples_this_frame = (int)(Frametimecxx . . $ Frametime. * 22050); |
| 644 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 645 | return; |
| 646 | // determine if we're using hardware for sound support. |
| 647 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SoundStartFramecxx . . $ llsSystem#SoundStartFrame(49f6e7a06ebc5aa8).(); |
| 648 | // non game sound frame, this, just updates currently playing sounds. |
| 649 | // placed here to leave early and ensure any further processing involves game only. |
| 650 | if (!f_in_game) { |
| 651 | sound_room_list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 652 | for (i = 0, counter = 0; i < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; i++) { |
| 653 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. && m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid. != -1) { |
| 654 | counter++; |
| 655 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(m_sound_objects[i].m_sound_uid > -1); |
| 656 | if (!m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->IsSoundInstancePlayingcxx . . $ llsSystem#IsSoundInstancePlaying(83c267b20bac841a).(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid.)) { |
| 657 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(i); // stop any sounds playing. |
| 658 | } |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | goto end_beginsoundframe; // this will handle any remaining processing |
| 663 | } |
| 664 | // FROM HERE ON, WE ASSUME WE'RE IN GAME. |
| 665 | hwsound_support = (sound_render_start_framecxx . . $ sound_render_start_frame(c9857a73d68e59ba).()); |
| 666 | // define current environment of the listener. |
| 667 | listener_pos.velocitycxx . . $ pos_state#velocity. = &Viewer_objectcxx . . $ Viewer_object.->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 668 | listener_pos.positioncxx . . $ pos_state#position. = &Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.; |
| 669 | listener_pos.orientcxx . . $ pos_state#orient. = &Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient.; |
| 670 | listener_pos.roomnumcxx . . $ pos_state#roomnum. = Viewer_objectcxx . . $ Viewer_object.->roomnumcxx . . $ object#roomnum.; |
| 671 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SetListenercxx . . $ llsSystem#SetListener(c7791b6699e1fa9e).(&listener_pos); |
| 672 | // do environmental audio int current room. |
| 673 | if (!OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(Viewer_object)) { |
| 674 | n = Roomscxx . . $ Rooms.[Viewer_objectcxx . . $ Viewer_object.->roomnumcxx . . $ object#roomnum.].env_reverbcxx . . $ room#env_reverb.; |
| 675 | if (n >= 0) { |
| 676 | if (m_cur_environmentcxx . . $ hlsSystem#m_cur_environment. != n) { |
| 677 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(n < N_ENVAUDIO_PRESETScxx . . $ `sndlib/hlsoundlib.h:373:9`!); |
| 678 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SetGlobalReverbPropertiescxx . . $ llsSystem#SetGlobalReverbProperties(5f279dd7f821a414).(EnvAudio_Presetscxx . . $ EnvAudio_Presets.[n].volumecxx . . $ tEnvAudioPresets#volume., EnvAudio_Presetscxx . . $ EnvAudio_Presets.[n].dampingcxx . . $ tEnvAudioPresets#damping., |
| 679 | EnvAudio_Presetscxx . . $ EnvAudio_Presets.[n].decaycxx . . $ tEnvAudioPresets#decay.); |
| 680 | m_cur_environmentcxx . . $ hlsSystem#m_cur_environment. = n; |
| 681 | } |
| 682 | } |
| 683 | } else { |
| 684 | if (m_cur_environmentcxx . . $ hlsSystem#m_cur_environment. != ENVAUD_PRESET_MOUNTAINScxx . . $ `sndlib/hlsoundlib.h:392:9`!) { |
| 685 | n = ENVAUD_PRESET_MOUNTAINScxx . . $ `sndlib/hlsoundlib.h:392:9`!; |
| 686 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SetGlobalReverbPropertiescxx . . $ llsSystem#SetGlobalReverbProperties(5f279dd7f821a414).(EnvAudio_Presetscxx . . $ EnvAudio_Presets.[n].volumecxx . . $ tEnvAudioPresets#volume., EnvAudio_Presetscxx . . $ EnvAudio_Presets.[n].dampingcxx . . $ tEnvAudioPresets#damping., |
| 687 | EnvAudio_Presetscxx . . $ EnvAudio_Presets.[n].decaycxx . . $ tEnvAudioPresets#decay.); |
| 688 | m_cur_environmentcxx . . $ hlsSystem#m_cur_environment. = n; |
| 689 | } |
| 690 | } |
| 691 | // render all rooms within a certain range from player (traverse rooms through portals) |
| 692 | sound_room_list = hwsound_support ? sound_render_audible_roomscxx . . $ sound_render_audible_rooms(62024859d2e566e1).(&listener_pos) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 693 | // SoundQ_process(); |
| 694 | // if sound object is outside listener's cone of audibility, emulate the sound. |
| 695 | // if sound is audible, then determine its playback properties. |
| 696 | // |
| 697 | for (i = 0, counter = 0; i < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; i++) { |
| 698 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags.) { |
| 699 | counter++; |
| 700 | // oldvolume = m_sound_objects[i].volume; |
| 701 | // oldpan = m_sound_objects[i].pan; |
| 702 | // mprintf(0, "SO %d playing: uid %d\n", i, m_sound_objects[i].m_sound_uid); |
| 703 | // Handle high-level only sounds |
| 704 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_TOO_FARcxx . . $ `sndlib/ssl_lib.h:381:9`!) { |
| 705 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_LOOPINGcxx . . $ `sndlib/ssl_lib.h:383:9`!) { |
| 706 | // while(m_sound_objects[i].play_info.m_samples_played >= |
| 707 | // Sounds[m_sound_objects[i].m_sound_index].loop_end) |
| 708 | // { |
| 709 | // m_sound_objects[i].play_info.m_samples_played -= |
| 710 | //(Sounds[m_sound_objects[i].m_sound_index].loop_end - Sounds[m_sound_objects[i].m_sound_index].loop_start); |
| 711 | // } |
| 712 | } else { |
| 713 | // Advance sound pointer and see if sound is done |
| 714 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..m_samples_playedcxx . . $ play_information#m_samples_played. += num_samples_this_frame; |
| 715 | |
| 716 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..m_samples_playedcxx . . $ play_information#m_samples_played. >= |
| 717 | SoundFilescxx . . $ SoundFiles.[Soundscxx . . $ Sounds.[m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_indexcxx . . $ sound_object#m_sound_index.].sample_indexcxx . . $ sound_info#sample_index.].sample_lengthcxx . . $ sound_file_info#sample_length.) { |
| 718 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(i); |
| 719 | continue; |
| 720 | } |
| 721 | } |
| 722 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:380:9`!) { |
| 723 | // If object not alive, kill its sound |
| 724 | objectcxx . . $ object# *obj_sound = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_link_infocxx . . $ sound_object#m_link_info..object_handlecxx . . $ sound_object#$anonymous_type_0#object_handle.); |
| 725 | if (!obj_sound || obj_sound->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!) { |
| 726 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(i); |
| 727 | continue; // Go on to next sound... |
| 728 | } |
| 729 | } |
| 730 | // determine new properties of sound if it's still playing, its volume, other properties. |
| 731 | if (Emulate3dSoundcxx . . $ hlsSystem#Emulate3dSound(83c267b20bac841a).(i)) { |
| 732 | // sound is audible now. |
| 733 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid. != -1) { |
| 734 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. &= (~SIF_TOO_FARcxx . . $ `sndlib/ssl_lib.h:381:9`!); |
| 735 | } else { |
| 736 | // mprintf(0, "LLSound full 3\n"); |
| 737 | } |
| 738 | } |
| 739 | continue; |
| 740 | } |
| 741 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(m_sound_objects[i].m_sound_uid > -1); |
| 742 | if (!m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->IsSoundInstancePlayingcxx . . $ llsSystem#IsSoundInstancePlaying(83c267b20bac841a).(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid.)) { |
| 743 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(i); |
| 744 | continue; // Go on to next sound... |
| 745 | } |
| 746 | if ((Soundscxx . . $ Sounds.[m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_indexcxx . . $ sound_object#m_sound_index.].flagscxx . . $ sound_info#flags. & SPF_LISTENER_UPDATEcxx . . $ `sndlib/ssl_lib.h:373:9`!) && |
| 747 | !(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_NO_3D_EFFECTScxx . . $ `sndlib/ssl_lib.h:382:9`!)) { |
| 748 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:380:9`!) { |
| 749 | objectcxx . . $ object# *obj_sound = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_link_infocxx . . $ sound_object#m_link_info..object_handlecxx . . $ sound_object#$anonymous_type_0#object_handle.); |
| 750 | if (!obj_sound || obj_sound->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!) { |
| 751 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(i); |
| 752 | continue; // Go on to next sound... |
| 753 | } |
| 754 | } |
| 755 | if ((m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & (SIF_PLAYING_3Dcxx . . $ `sndlib/ssl_lib.h:379:9`! | SIF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:380:9`!))) { |
| 756 | bool f_audible; |
| 757 | vectorcxx . . $ vector# virtual_pos; |
| 758 | vectorcxx . . $ vector# virtual_vel; |
| 759 | float adjusted_volume; |
| 760 | f_audible = ComputePlayInfocxx . . $ hlsSystem#ComputePlayInfo(371168a55a5b4ad5).(i, &virtual_pos, &virtual_vel, &adjusted_volume); |
| 761 | if (!f_audible) { |
| 762 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->StopSoundcxx . . $ llsSystem#StopSound(9633529ce3c4ff50).(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid., SKT_STOP_IMMEDIATELYcxx . . $ `sndlib/ssl_lib.h:406:9`!); |
| 763 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid. = 0; |
| 764 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. |= SIF_TOO_FARcxx . . $ `sndlib/ssl_lib.h:381:9`!; |
| 765 | } else { |
| 766 | matrixcxx . . $ matrix# orient = Identity_matrixcxx . . $ Identity_matrix.; |
| 767 | pos_statecxx . . $ pos_state# cur_pos; |
| 768 | cur_pos.velocitycxx . . $ pos_state#velocity. = &virtual_vel; |
| 769 | cur_pos.positioncxx . . $ pos_state#position. = &virtual_pos; |
| 770 | cur_pos.orientcxx . . $ pos_state#orient. = &orient; |
| 771 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->AdjustSoundcxx . . $ llsSystem#AdjustSound(f041466fe69f6310).(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid., &cur_pos, adjusted_volume); |
| 772 | |
| 773 | // handle additional 3d sound support |
| 774 | sound_objectcxx . . $ sound_object# *so = &m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i]; |
| 775 | if (m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SoundPropertySupportcxx . . $ llsSystem#SoundPropertySupport(50ce9a9e25b4a850).() && (so->m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:380:9`!)) { |
| 776 | float obstruction = 0.0f; |
| 777 | objectcxx . . $ object# *game_obj; |
| 778 | |
| 779 | // sound must be in same room as listener |
| 780 | // if so, then use FVI to determine obstruction properties. |
| 781 | // and then set the obstruction properties. |
| 782 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(Viewer_object)) |
| 783 | continue; |
| 784 | game_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(so->m_link_infocxx . . $ sound_object#m_link_info..object_handlecxx . . $ sound_object#$anonymous_type_0#object_handle.); |
| 785 | |
| 786 | if (game_obj && game_obj->roomnumcxx . . $ object#roomnum. == Viewer_objectcxx . . $ Viewer_object.->roomnumcxx . . $ object#roomnum.) { |
| 787 | // inside and same room? go for it. |
| 788 | fvi_infocxx . . $ fvi_info# hit_data; |
| 789 | fvi_querycxx . . $ fvi_query# fq; |
| 790 | |
| 791 | // mprintf(0, "Obstruction test.\n"); |
| 792 | |
| 793 | hit_data.hit_typecxx . . $ fvi_info#hit_type.[0] = HIT_WALLcxx . . $ `lib/findintersection_external.h:46:9`!; |
| 794 | fq.p1cxx . . $ fvi_query#p1. = &Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.; |
| 795 | fq.p0cxx . . $ fvi_query#p0. = &game_obj->poscxx . . $ object#pos.; |
| 796 | fq.startroomcxx . . $ fvi_query#startroom. = game_obj->roomnumcxx . . $ object#roomnum.; |
| 797 | fq.radcxx . . $ fvi_query#rad. = .5; |
| 798 | fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = so->m_link_infocxx . . $ sound_object#m_link_info..object_handlecxx . . $ sound_object#$anonymous_type_0#object_handle. & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!; |
| 799 | fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 800 | fq.flagscxx . . $ fvi_query#flags. = 0; |
| 801 | fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_data); |
| 802 | |
| 803 | if (hit_data.hit_typecxx . . $ fvi_info#hit_type.[0] == HIT_WALLcxx . . $ `lib/findintersection_external.h:46:9`!) { |
| 804 | obstruction = 1.0f; |
| 805 | } |
| 806 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SetSoundPropertiescxx . . $ llsSystem#SetSoundProperties(43c79ee2f1b9aefe).(so->m_sound_uidcxx . . $ sound_object#m_sound_uid., obstruction); |
| 807 | } else { |
| 808 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SetSoundPropertiescxx . . $ llsSystem#SetSoundProperties(43c79ee2f1b9aefe).(so->m_sound_uidcxx . . $ sound_object#m_sound_uid., 0.0f); |
| 809 | } |
| 810 | } |
| 811 | } |
| 812 | } |
| 813 | } |
| 814 | } |
| 815 | } |
| 816 | // mprintf(0, "BeginSoundFrame: used sound_objects %d\n", counter); |
| 817 | end_beginsoundframe: |
| 818 | AudioStreamcxx . . $ AudioStream#::Framecxx . . $ AudioStream#Frame(49f6e7a06ebc5aa8).(); |
| 819 | mprintf_atcxx . . $ `ddebug/mono.h:83:9`!(3, 1, 0, "HNS: %04d", counter); |
| 820 | } |
| 821 | |
| 822 | // Plays the deffered 3d stuff |
| 823 | void hlsSystemcxx . . $ hlsSystem#::EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).() { |
| 824 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 825 | return; |
| 826 | sound_render_end_framecxx . . $ sound_render_end_frame(49f6e7a06ebc5aa8).(); |
| 827 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SoundEndFramecxx . . $ llsSystem#SoundEndFrame(49f6e7a06ebc5aa8).(); |
| 828 | } |
| 829 | // Allows for changes in a currently playing sound |
| 830 | int hlsSystemcxx . . $ hlsSystem#::Update2dSoundcxx . . $ hlsSystem#Update2dSound(29af73b9646cef78).(int hlsound_uid, float volume, float pan) { |
| 831 | int sound_obj_index; |
| 832 | |
| 833 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 834 | return -1; |
| 835 | if (volume < 0.0f) |
| 836 | volume = 0.0f; |
| 837 | else if (volume > 1.0f) |
| 838 | volume = 1.0f; |
| 839 | if (pan < -1.0f) |
| 840 | pan = -1.0f; |
| 841 | else if (pan > 1.0f) |
| 842 | pan = 1.0f; |
| 843 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 844 | return -1; |
| 845 | sound_obj_index = ValidateUniqueIdcxx . . $ hlsSystem#ValidateUniqueId(7864480464b09eea).(hlsound_uid); |
| 846 | if (sound_obj_index == -1) |
| 847 | return -1; |
| 848 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->AdjustSoundcxx . . $ llsSystem#AdjustSound(96ebaef3518743f8).(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_uidcxx . . $ sound_object#m_sound_uid., volume, pan, 22050); |
| 849 | return hlsound_uid; |
| 850 | } |
| 851 | bool hlsSystemcxx . . $ hlsSystem#::ComputePlayInfocxx . . $ hlsSystem#ComputePlayInfo(371168a55a5b4ad5).(int sound_obj_index, vectorcxx . . $ vector# *virtual_pos, vectorcxx . . $ vector# *virtual_vel, float *adjusted_volume) { |
| 852 | int sound_index; |
| 853 | |
| 854 | int sound_seg; |
| 855 | int ear_seg; |
| 856 | vectorcxx . . $ vector# sound_pos; |
| 857 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].play_infocxx . . $ sound_object#play_info..sample_skip_intervalcxx . . $ play_information#sample_skip_interval. = 0; |
| 858 | vectorcxx . . $ vector# dir_to_sound; |
| 859 | float dist = 0; |
| 860 | if (m_master_volumecxx . . $ hlsSystem#m_master_volume. <= 0.0) |
| 861 | return false; |
| 862 | |
| 863 | *adjusted_volume = (m_master_volumecxx . . $ hlsSystem#m_master_volume. * m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].volume_3dcxx . . $ sound_object#volume_3d.); |
| 864 | if (*adjusted_volume <= 0.0) { |
| 865 | *adjusted_volume = 0.0; |
| 866 | return false; |
| 867 | } |
| 868 | |
| 869 | sound_index = m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_indexcxx . . $ sound_object#m_sound_index.; |
| 870 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(sound_index >= 0 && sound_index < MAX_SOUNDScxx . . $ `sndlib/ssl_lib.h:578:9`!); |
| 871 | |
| 872 | if ((Soundscxx . . $ Sounds.[m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_indexcxx . . $ sound_object#m_sound_index.].flagscxx . . $ sound_info#flags. & SPF_LISTENER_UPDATEcxx . . $ `sndlib/ssl_lib.h:373:9`!) && |
| 873 | !(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_NO_3D_EFFECTScxx . . $ `sndlib/ssl_lib.h:382:9`!) && |
| 874 | (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:380:9`!)) { // this is an updating object sound |
| 875 | objectcxx . . $ object# *objp = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_link_infocxx . . $ sound_object#m_link_info..object_handlecxx . . $ sound_object#$anonymous_type_0#object_handle.); |
| 876 | if (!objp || objp->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!) { // Couldn't find object for given handle |
| 877 | // Int3(); // get Chris//removed for outside testers |
| 878 | return false; |
| 879 | } |
| 880 | if (objp->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! || objp->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) |
| 881 | *virtual_vel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 882 | else |
| 883 | *virtual_vel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 884 | |
| 885 | sound_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). objp->poscxx . . $ object#pos.; |
| 886 | sound_seg = objp->roomnumcxx . . $ object#roomnum.; |
| 887 | } else { |
| 888 | *virtual_vel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 889 | sound_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_link_infocxx . . $ sound_object#m_link_info..pos_infocxx . . $ sound_object#$anonymous_type_0#pos_info..poscxx . . $ sound_object#$anonymous_type_0#$anonymous_type_1#pos.; |
| 890 | sound_seg = m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_link_infocxx . . $ sound_object#m_link_info..pos_infocxx . . $ sound_object#$anonymous_type_0#pos_info..segnumcxx . . $ sound_object#$anonymous_type_0#$anonymous_type_1#segnum.; |
| 891 | } |
| 892 | |
| 893 | // sound_seg == -1 (which just means that the roomnum/segnum hasn't been |
| 894 | // initialized to a proper value yet )causes crashes when BOA_INDEX() |
| 895 | // calls TERRAIN_REGION() with that value. (By pure luck on 32bit platforms |
| 896 | // the overflow and truncation will likely use an address that doesn't crash, |
| 897 | // but it's still invalid). At least one case that could cause this was fixed, |
| 898 | // if there are others, the ASSERT should tell us about it |
| 899 | // (and if assertions are disabled, return false to handle this gracefully) |
| 900 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(sound_seg != -1 && "invalid (unset) roomnum/segnum!"); |
| 901 | if (sound_seg == -1) |
| 902 | return false; |
| 903 | |
| 904 | sound_seg = BOA_INDEXcxx . . $ `Descent3/BOA.h:197:9`!(sound_seg); |
| 905 | ear_seg = BOA_INDEXcxx . . $ `Descent3/BOA.h:197:9`!(Viewer_object->roomnum); |
| 906 | if (!BOA_IsSoundAudiblecxx . . $ BOA_IsSoundAudible(cf9ef193275fa6d8).(sound_seg, ear_seg)) |
| 907 | return false; |
| 908 | |
| 909 | if (sound_seg != ear_seg && !(sound_seg == Highest_room_indexcxx . . $ Highest_room_index. + 1 && ear_seg > Highest_room_indexcxx . . $ Highest_room_index.) && |
| 910 | !(ear_seg == Highest_room_indexcxx . . $ Highest_room_index. + 1 && sound_seg > Highest_room_indexcxx . . $ Highest_room_index.)) { |
| 911 | int cur_room = sound_seg; |
| 912 | int last_room; |
| 913 | |
| 914 | do { |
| 915 | last_room = cur_room; |
| 916 | |
| 917 | if (cur_room <= Highest_room_indexcxx . . $ Highest_room_index. && (Roomscxx . . $ Rooms.[cur_room].flagscxx . . $ room#flags. & RF_DOORcxx . . $ `Descent3/room_external.h:176:9`!) && (cur_room != sound_seg)) { |
| 918 | float door_position = DoorwayGetPositioncxx . . $ `Descent3/doorway.h:215:9`!(&Roomscxx . . $ Rooms.[cur_room]); |
| 919 | // Closed doors antenuate a lot |
| 920 | if (door_position == 0.0) { |
| 921 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].play_infocxx . . $ sound_object#play_info..sample_skip_intervalcxx . . $ play_information#sample_skip_interval. = 4; |
| 922 | *adjusted_volume *= 0.2f; |
| 923 | } else { |
| 924 | *adjusted_volume *= (0.6f + (0.4 * door_position)); |
| 925 | } |
| 926 | } |
| 927 | cur_room = BOA_NEXT_ROOMcxx . . $ `Descent3/BOA.h:200:9`!(cur_room, ear_seg); |
| 928 | int last_portal; |
| 929 | if (BOA_INDEXcxx . . $ `Descent3/BOA.h:197:9`!(last_room) == BOA_INDEXcxx . . $ `Descent3/BOA.h:197:9`!(cur_room) || cur_room == BOA_NO_PATHcxx . . $ `Descent3/BOA.h:198:9`!) |
| 930 | return false; |
| 931 | if (BOA_INDEXcxx . . $ `Descent3/BOA.h:197:9`!(last_room) != BOA_INDEXcxx . . $ `Descent3/BOA.h:197:9`!(cur_room)) { |
| 932 | last_portal = BOA_DetermineStartRoomPortalcxx . . $ BOA_DetermineStartRoomPortal(836cef11f1e7b2ee).(last_room, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, cur_room, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 933 | if (last_portal == -1) { |
| 934 | return false; |
| 935 | } |
| 936 | } |
| 937 | if (last_room == sound_seg) { |
| 938 | if (cur_room == ear_seg) { |
| 939 | dir_to_sound =cxx . . $ vector#`operator=`(c0842353a20857d). sound_pos -cxx . . $ operator-(b77b703cd1e43e33). Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.; |
| 940 | dist = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dir_to_sound); |
| 941 | } else if ((cur_room != last_room) && (cur_room != BOA_NO_PATHcxx . . $ `Descent3/BOA.h:198:9`!)) { |
| 942 | int this_portal = BOA_DetermineStartRoomPortalcxx . . $ BOA_DetermineStartRoomPortal(836cef11f1e7b2ee).(cur_room, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, last_room, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 943 | dist = BOA_cost_arraycxx . . $ BOA_cost_array.[cur_room][this_portal]; |
| 944 | |
| 945 | if (last_room > Highest_room_indexcxx . . $ Highest_room_index.) { |
| 946 | vectorcxx . . $ vector# pnt = Roomscxx . . $ Rooms.[cur_room].portalscxx . . $ room#portals.[this_portal].path_pntcxx . . $ portal#path_pnt.; |
| 947 | dist += vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&sound_pos, &pnt); |
| 948 | } else { |
| 949 | dist += vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&sound_pos, &Roomscxx . . $ Rooms.[last_room].portalscxx . . $ room#portals.[last_portal].path_pntcxx . . $ portal#path_pnt.); |
| 950 | } |
| 951 | } |
| 952 | } else if (cur_room == ear_seg) { |
| 953 | dist += BOA_cost_arraycxx . . $ BOA_cost_array.[last_room][last_portal]; |
| 954 | |
| 955 | if (last_room > Highest_room_indexcxx . . $ Highest_room_index.) { |
| 956 | int this_portal = BOA_DetermineStartRoomPortalcxx . . $ BOA_DetermineStartRoomPortal(836cef11f1e7b2ee).(cur_room, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, last_room, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 957 | vectorcxx . . $ vector# pnt = Roomscxx . . $ Rooms.[cur_room].portalscxx . . $ room#portals.[this_portal].path_pntcxx . . $ portal#path_pnt.; |
| 958 | dist += vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos., &pnt); |
| 959 | } else { |
| 960 | dist += vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos., &Roomscxx . . $ Rooms.[last_room].portalscxx . . $ room#portals.[last_portal].path_pntcxx . . $ portal#path_pnt.); |
| 961 | } |
| 962 | } else if ((cur_room != last_room) && (cur_room != BOA_NO_PATHcxx . . $ `Descent3/BOA.h:198:9`!)) { |
| 963 | int this_portal = BOA_DetermineStartRoomPortalcxx . . $ BOA_DetermineStartRoomPortal(836cef11f1e7b2ee).(cur_room, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, last_room, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 964 | dist += BOA_cost_arraycxx . . $ BOA_cost_array.[last_room][last_portal] + BOA_cost_arraycxx . . $ BOA_cost_array.[cur_room][this_portal]; |
| 965 | } |
| 966 | } while ((cur_room != ear_seg) && (cur_room != last_room) && (cur_room != BOA_NO_PATHcxx . . $ `Descent3/BOA.h:198:9`!)); |
| 967 | if (cur_room == BOA_NO_PATHcxx . . $ `Descent3/BOA.h:198:9`!) { |
| 968 | *adjusted_volume = 0.0; |
| 969 | } else if ((last_room != ear_seg) && (last_room != sound_seg)) { |
| 970 | dir_to_sound =cxx . . $ vector#`operator=`(c0842353a20857d). Roomscxx . . $ Rooms.[last_room].path_pntcxx . . $ room#path_pnt. -cxx . . $ operator-(b77b703cd1e43e33). Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.; |
| 971 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dir_to_sound); |
| 972 | } |
| 973 | } else |
| 974 | { |
| 975 | dir_to_sound =cxx . . $ vector#`operator=`(c0842353a20857d). sound_pos -cxx . . $ operator-(b77b703cd1e43e33). Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.; |
| 976 | dist = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dir_to_sound); |
| 977 | } |
| 978 | if (dist >= Soundscxx . . $ Sounds.[sound_index].max_distancecxx . . $ sound_info#max_distance.) |
| 979 | return false; |
| 980 | |
| 981 | if (*adjusted_volume <= 0.0) { |
| 982 | *adjusted_volume = 0.0; |
| 983 | return false; |
| 984 | } |
| 985 | if (dist == 0.0f) { |
| 986 | dir_to_sound =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 987 | } |
| 988 | if ((m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].play_infocxx . . $ sound_object#play_info..sample_skip_intervalcxx . . $ play_information#sample_skip_interval. == 0) && (*adjusted_volume > 0.0f) && |
| 989 | (dir_to_sound *cxx . . $ `operator*`(4a721543d64e126a). Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. < -.5)) |
| 990 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].play_infocxx . . $ sound_object#play_info..sample_skip_intervalcxx . . $ play_information#sample_skip_interval. = 1; |
| 991 | *virtual_pos =cxx . . $ vector#`operator=`(c0842353a20857d). Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (dir_to_sound *cxx . . $ `operator*`(252247219a31502c). dist); |
| 992 | return true; |
| 993 | } |
| 994 | bool hlsSystemcxx . . $ hlsSystem#::Emulate3dSoundcxx . . $ hlsSystem#Emulate3dSound(83c267b20bac841a).(int sound_obj_index) { |
| 995 | bool f_audible; |
| 996 | vectorcxx . . $ vector# virtual_pos; |
| 997 | vectorcxx . . $ vector# virtual_vel; |
| 998 | float adjusted_volume; |
| 999 | f_audible = ComputePlayInfocxx . . $ hlsSystem#ComputePlayInfo(371168a55a5b4ad5).(sound_obj_index, &virtual_pos, &virtual_vel, &adjusted_volume); |
| 1000 | |
| 1001 | if (f_audible) { |
| 1002 | pos_statecxx . . $ pos_state# cur_pos; |
| 1003 | matrixcxx . . $ matrix# orient = Identity_matrixcxx . . $ Identity_matrix.; |
| 1004 | cur_pos.velocitycxx . . $ pos_state#velocity. = &virtual_vel; |
| 1005 | cur_pos.positioncxx . . $ pos_state#position. = &virtual_pos; |
| 1006 | cur_pos.orientcxx . . $ pos_state#orient. = &orient; |
| 1007 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_uidcxx . . $ sound_object#m_sound_uid. = m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->PlaySound3dcxx . . $ llsSystem#PlaySound3d(112e06fe9f197cc1).( |
| 1008 | &m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].play_infocxx . . $ sound_object#play_info., m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_indexcxx . . $ sound_object#m_sound_index., &cur_pos, |
| 1009 | adjusted_volume, (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_LOOPINGcxx . . $ `sndlib/ssl_lib.h:383:9`!) != 0); |
| 1010 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_uidcxx . . $ sound_object#m_sound_uid. == -1) |
| 1011 | f_audible = false; |
| 1012 | } else { |
| 1013 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_uidcxx . . $ sound_object#m_sound_uid. = |
| 1014 | 0; // This is a dummy value -- it just cannot be -1 (that would mean that the low level sound system is full) |
| 1015 | } |
| 1016 | return f_audible; |
| 1017 | } |
| 1018 | // Functions that play a 3d sound -- includes the 2d emulation of 3d sound |
| 1019 | int hlsSystemcxx . . $ hlsSystem#::Play3dSoundcxx . . $ hlsSystem#Play3dSound(f0f15c88243d8820).(int sound_index, pos_statecxx . . $ pos_state# *cur_pos, float volume, int flags, float offset) { |
| 1020 | return Play3dSoundcxx . . $ hlsSystem#Play3dSound(cbd2c6aa1db9fc8a).(sound_index, SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, cur_pos, volume, flags, offset); |
| 1021 | } |
| 1022 | // Functions that play a 3d sound -- includes the 2d emulation of 3d sound |
| 1023 | int hlsSystemcxx . . $ hlsSystem#::Play3dSoundcxx . . $ hlsSystem#Play3dSound(7fd84bfdbf757f76).(int sound_index, objectcxx . . $ object# *cur_obj, float volume, int flags, float offset) { |
| 1024 | return Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(sound_index, SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, cur_obj, volume, flags, offset); |
| 1025 | } |
| 1026 | int hlsSystemcxx . . $ hlsSystem#::Play3dSoundcxx . . $ hlsSystem#Play3dSound(cbd2c6aa1db9fc8a).(int sound_index, int priority, pos_statecxx . . $ pos_state# *cur_pos, float volume, int flags, float offset) { |
| 1027 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1028 | return -1; |
| 1029 | return Play3dSoundcxx . . $ hlsSystem#Play3dSound(cef146652f000f45).(sound_index, cur_pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, priority, volume, flags, offset); |
| 1030 | } |
| 1031 | // Functions that play a 3d sound -- includes the 2d emulation of 3d sound |
| 1032 | int hlsSystemcxx . . $ hlsSystem#::Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(int sound_index, int priority, objectcxx . . $ object# *cur_obj, float volume, int flags, float offset) { |
| 1033 | pos_statecxx . . $ pos_state# cur_pos; |
| 1034 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1035 | return -1; |
| 1036 | cur_pos.positioncxx . . $ pos_state#position. = &cur_obj->poscxx . . $ object#pos.; |
| 1037 | cur_pos.orientcxx . . $ pos_state#orient. = &cur_obj->orientcxx . . $ object#orient.; |
| 1038 | cur_pos.velocitycxx . . $ pos_state#velocity. = &cur_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 1039 | cur_pos.roomnumcxx . . $ pos_state#roomnum. = cur_obj->roomnumcxx . . $ object#roomnum.; |
| 1040 | return Play3dSoundcxx . . $ hlsSystem#Play3dSound(cef146652f000f45).(sound_index, &cur_pos, cur_obj, priority, volume, flags, offset); |
| 1041 | } |
| 1042 | // Functions that play a 3d sound -- includes the 2d emulation of 3d sound |
| 1043 | int hlsSystemcxx . . $ hlsSystem#::Play3dSoundcxx . . $ hlsSystem#Play3dSound(cef146652f000f45).(int sound_index, pos_statecxx . . $ pos_state# *cur_pos, objectcxx . . $ object# *cur_obj, int priority, float volume, int flags, |
| 1044 | float offset) { |
| 1045 | int i; |
| 1046 | int sound_uid; |
| 1047 | int sound_obj_index; |
| 1048 | bool f_audible; |
| 1049 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1050 | return -1; |
| 1051 | if (sound_index == SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) |
| 1052 | return -1; |
| 1053 | if (sound_index < 0) |
| 1054 | return -1; |
| 1055 | if (sound_index >= MAX_SOUNDScxx . . $ `sndlib/ssl_lib.h:578:9`! || Soundscxx . . $ Sounds.[sound_index].usedcxx . . $ sound_info#used. == 0) |
| 1056 | return -1; |
| 1057 | // if the position doesn't belong to any valid room or cell, |
| 1058 | // all this would fail anyway (in Emulate3dSound() -> ComputePlayInfo()), |
| 1059 | // so might as well give up now; furthermore, this prevents m_sound_objects[i] |
| 1060 | // from remaining in an half-initialized state below (esp. for looping sounds |
| 1061 | // where StopSound() wouldn't be called after Emulate3dSound() returns false) |
| 1062 | if (cur_pos->roomnumcxx . . $ pos_state#roomnum. == -1) |
| 1063 | return -1; |
| 1064 | // initialize sound. |
| 1065 | Sound_systemcxx . . $ Sound_system..CheckAndForceSoundDataAlloccxx . . $ hlsSystem#CheckAndForceSoundDataAlloc(83c267b20bac841a).(sound_index); |
| 1066 | int sample_offset = offset * 22050.0f; |
| 1067 | if (sample_offset >= SoundFilescxx . . $ SoundFiles.[Soundscxx . . $ Sounds.[sound_index].sample_indexcxx . . $ sound_info#sample_index.].np_sample_lengthcxx . . $ sound_file_info#np_sample_length.) |
| 1068 | return -1; |
| 1069 | // Handles exclusive sounds |
| 1070 | if (Soundscxx . . $ Sounds.[sound_index].flagscxx . . $ sound_info#flags. & SPF_PLAYS_EXCLUSIVELYcxx . . $ `sndlib/ssl_lib.h:370:9`!) { |
| 1071 | sound_uid = m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->IsSoundPlayingcxx . . $ llsSystem#IsSoundPlaying(7864480464b09eea).(sound_index); |
| 1072 | if (sound_uid != -1) |
| 1073 | return -1; |
| 1074 | } |
| 1075 | // Handles play once sounds |
| 1076 | if (Soundscxx . . $ Sounds.[sound_index].flagscxx . . $ sound_info#flags. & SPF_PLAYS_ONCEcxx . . $ `sndlib/ssl_lib.h:371:9`!) { |
| 1077 | for (sound_obj_index = 0; sound_obj_index < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; sound_obj_index++) { |
| 1078 | if ((m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_indexcxx . . $ sound_object#m_sound_index. == sound_index) && |
| 1079 | ((sound_uid = m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_uidcxx . . $ sound_object#m_sound_uid.) != -1)) { |
| 1080 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(sound_obj_index); |
| 1081 | } |
| 1082 | } |
| 1083 | } |
| 1084 | // Handles play once per object |
| 1085 | if ((Soundscxx . . $ Sounds.[sound_index].flagscxx . . $ sound_info#flags. & SPF_ONCE_PER_OBJcxx . . $ `sndlib/ssl_lib.h:374:9`!) && cur_obj) { |
| 1086 | for (sound_obj_index = 0; sound_obj_index < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; sound_obj_index++) { |
| 1087 | if ((m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_indexcxx . . $ sound_object#m_sound_index. == sound_index) && |
| 1088 | ((sound_uid = m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_uidcxx . . $ sound_object#m_sound_uid.) != -1)) { |
| 1089 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:380:9`!) { |
| 1090 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_link_infocxx . . $ sound_object#m_link_info..object_handlecxx . . $ sound_object#$anonymous_type_0#object_handle. == cur_obj->handlecxx . . $ object#handle.) { |
| 1091 | return -1; |
| 1092 | } |
| 1093 | } |
| 1094 | } |
| 1095 | } |
| 1096 | } |
| 1097 | // find free sound slot. |
| 1098 | for (i = 0; i < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; i++) { |
| 1099 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. == SIF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:377:9`!) |
| 1100 | break; // |
| 1101 | } |
| 1102 | // no free slots? hmmm.... |
| 1103 | if (i >= MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!) { |
| 1104 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(2, "HLSOUNDLIB HOLY COW: Over %d sounds trying to play(beyond max) - %s\n", MAX_SOUND_OBJECTS, |
| 1105 | Sounds[sound_index].name); |
| 1106 | // Int3(); |
| 1107 | return -1; |
| 1108 | } |
| 1109 | // Set the current sound |
| 1110 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_indexcxx . . $ sound_object#m_sound_index. = sound_index; |
| 1111 | // Insert the passed flags |
| 1112 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. = flags; |
| 1113 | // Determine if the sound is linked to the object |
| 1114 | if ((cur_obj != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) && (Soundscxx . . $ Sounds.[sound_index].flagscxx . . $ sound_info#flags. & SPF_LISTENER_UPDATEcxx . . $ `sndlib/ssl_lib.h:373:9`!) && |
| 1115 | (Soundscxx . . $ Sounds.[sound_index].flagscxx . . $ sound_info#flags. & SPF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:368:9`!)) { |
| 1116 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. |= SIF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:380:9`!; |
| 1117 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_link_infocxx . . $ sound_object#m_link_info..object_handlecxx . . $ sound_object#$anonymous_type_0#object_handle. = cur_obj->handlecxx . . $ object#handle.; |
| 1118 | } else { |
| 1119 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_link_infocxx . . $ sound_object#m_link_info..pos_infocxx . . $ sound_object#$anonymous_type_0#pos_info..poscxx . . $ sound_object#$anonymous_type_0#$anonymous_type_1#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *cur_pos->positioncxx . . $ pos_state#position.; |
| 1120 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_link_infocxx . . $ sound_object#m_link_info..pos_infocxx . . $ sound_object#$anonymous_type_0#pos_info..orientcxx . . $ sound_object#$anonymous_type_0#$anonymous_type_1#orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). *cur_pos->orientcxx . . $ pos_state#orient.; |
| 1121 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_link_infocxx . . $ sound_object#m_link_info..pos_infocxx . . $ sound_object#$anonymous_type_0#pos_info..segnumcxx . . $ sound_object#$anonymous_type_0#$anonymous_type_1#segnum. = cur_pos->roomnumcxx . . $ pos_state#roomnum.; |
| 1122 | // NOTE: Velocity is zero for all non object-linked sounds |
| 1123 | } |
| 1124 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].volume_3dcxx . . $ sound_object#volume_3d. = volume; |
| 1125 | // m_sound_objects[i].m_sound_uid = m_ll_sound_ptr->PlaySound3d(sound_index, cur_pos, 22050); |
| 1126 | // Increment the total number of sounds played |
| 1127 | m_sounds_playedcxx . . $ hlsSystem#m_sounds_played.++; |
| 1128 | // Initialize the play information to nice values |
| 1129 | memset(&m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info., 0, sizeof(play_informationcxx . . $ play_information#)); |
| 1130 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..samples_per_22khz_samplecxx . . $ play_information#samples_per_22khz_sample. = 1.0; |
| 1131 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..sample_skip_intervalcxx . . $ play_information#sample_skip_interval. = 0; |
| 1132 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..prioritycxx . . $ play_information#priority. = priority; // Set sound's priority rating |
| 1133 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid. = MakeUniqueIdcxx . . $ hlsSystem#MakeUniqueId(7864480464b09eea).(i); |
| 1134 | if (Soundscxx . . $ Sounds.[sound_index].flagscxx . . $ sound_info#flags. & SPF_LOOPEDcxx . . $ `sndlib/ssl_lib.h:366:9`!) |
| 1135 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. |= SIF_LOOPINGcxx . . $ `sndlib/ssl_lib.h:383:9`!; |
| 1136 | if (!m_pause_newcxx . . $ hlsSystem#m_pause_new.) { |
| 1137 | f_audible = Emulate3dSoundcxx . . $ hlsSystem#Emulate3dSound(83c267b20bac841a).(i); |
| 1138 | if ((!f_audible) && (!(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_LOOPINGcxx . . $ `sndlib/ssl_lib.h:383:9`!))) { |
| 1139 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(i, SKT_STOP_IMMEDIATELYcxx . . $ `sndlib/ssl_lib.h:406:9`!); |
| 1140 | return -1; |
| 1141 | } |
| 1142 | } else { |
| 1143 | f_audible = false; |
| 1144 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid. = -1; |
| 1145 | } |
| 1146 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid. == -1) { |
| 1147 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. |= SIF_TOO_FARcxx . . $ `sndlib/ssl_lib.h:381:9`!; |
| 1148 | // mprintf(0, "LLSound full 2\n"); |
| 1149 | } else if (!f_audible) { |
| 1150 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. |= SIF_TOO_FARcxx . . $ `sndlib/ssl_lib.h:381:9`!; |
| 1151 | } |
| 1152 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. |= SIF_PLAYING_3Dcxx . . $ `sndlib/ssl_lib.h:379:9`!; |
| 1153 | if (m_pause_newcxx . . $ hlsSystem#m_pause_new.) { |
| 1154 | PauseSoundscxx . . $ hlsSystem#PauseSounds(b45ddcbc8423892c).(true); |
| 1155 | } |
| 1156 | |
| 1157 | return m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid.; |
| 1158 | } |
| 1159 | // General purpose 2d sound play function |
| 1160 | int hlsSystemcxx . . $ hlsSystem#::Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(int sound_index, float volume, float pan, uint16_tcxx . . $ uint16_t# frequency) { |
| 1161 | return hlsSystemcxx . . $ hlsSystem#::Play2dSoundcxx . . $ hlsSystem#Play2dSound(7bec394c8d81705d).(sound_index, SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, volume, pan, frequency); |
| 1162 | } |
| 1163 | int hlsSystemcxx . . $ hlsSystem#::Play2dSoundcxx . . $ hlsSystem#Play2dSound(7bec394c8d81705d).(int sound_index, int priority, float volume, float pan, uint16_tcxx . . $ uint16_t# frequency) { |
| 1164 | int i = 0; |
| 1165 | int sound_uid; |
| 1166 | int sound_obj_index; |
| 1167 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1168 | return -1; |
| 1169 | if (sound_index == SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) |
| 1170 | return -1; |
| 1171 | if (m_pause_newcxx . . $ hlsSystem#m_pause_new.) |
| 1172 | return -1; |
| 1173 | if (sound_index < 0) { |
| 1174 | return -1; |
| 1175 | } |
| 1176 | Sound_systemcxx . . $ Sound_system..CheckAndForceSoundDataAlloccxx . . $ hlsSystem#CheckAndForceSoundDataAlloc(83c267b20bac841a).(sound_index); |
| 1177 | // Handles exclusive sounds |
| 1178 | if (Soundscxx . . $ Sounds.[sound_index].flagscxx . . $ sound_info#flags. & SPF_PLAYS_EXCLUSIVELYcxx . . $ `sndlib/ssl_lib.h:370:9`!) { |
| 1179 | sound_uid = m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->IsSoundPlayingcxx . . $ llsSystem#IsSoundPlaying(7864480464b09eea).(sound_index); |
| 1180 | if (sound_uid != -1) |
| 1181 | return -1; |
| 1182 | } |
| 1183 | // Handles play once sounds |
| 1184 | if (Soundscxx . . $ Sounds.[sound_index].flagscxx . . $ sound_info#flags. & SPF_PLAYS_ONCEcxx . . $ `sndlib/ssl_lib.h:371:9`!) { |
| 1185 | for (sound_obj_index = 0; sound_obj_index < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; sound_obj_index++) { |
| 1186 | if ((m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_indexcxx . . $ sound_object#m_sound_index. == sound_index) && |
| 1187 | ((sound_uid = m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_uidcxx . . $ sound_object#m_sound_uid.) != -1)) { |
| 1188 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(sound_obj_index); |
| 1189 | } |
| 1190 | } |
| 1191 | } |
| 1192 | for (i = 0; i < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; i++) { |
| 1193 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. == SIF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:377:9`!) |
| 1194 | break; |
| 1195 | } |
| 1196 | // mprintf(0, "HL %d\n", i); |
| 1197 | // ASSERT(i < MAX_SOUND_OBJECTS); |
| 1198 | if (i >= MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!) { |
| 1199 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(3, "Play2DSound: Max Sounds Objects used\n"); |
| 1200 | // Int3(); |
| 1201 | return -1; |
| 1202 | } |
| 1203 | // Increment the total number of sounds played |
| 1204 | m_sounds_playedcxx . . $ hlsSystem#m_sounds_played.++; |
| 1205 | // Initialize the play information to nice values |
| 1206 | memset(&m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info., 0, sizeof(play_informationcxx . . $ play_information#)); |
| 1207 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..samples_per_22khz_samplecxx . . $ play_information#samples_per_22khz_sample. = 1.0; |
| 1208 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid. = MakeUniqueIdcxx . . $ hlsSystem#MakeUniqueId(7864480464b09eea).(i); |
| 1209 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..prioritycxx . . $ play_information#priority. = SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!; |
| 1210 | // static_skip++; |
| 1211 | // if (static_skip > 2) |
| 1212 | // static_skip = 0; |
| 1213 | // |
| 1214 | // m_sound_objects[i].play_info.sample_skip_interval = static_skip; |
| 1215 | // |
| 1216 | // if(m_sound_objects[i].play_info.sample_skip_interval == 0) |
| 1217 | // mprintf(0, "22.5k\n"); |
| 1218 | // else if (m_sound_objects[i].play_info.sample_skip_interval == 1) |
| 1219 | // mprintf(0, "11.25k\n"); |
| 1220 | // else |
| 1221 | // mprintf(0, "5.75k\n"); |
| 1222 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_indexcxx . . $ sound_object#m_sound_index. = sound_index; |
| 1223 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid. = |
| 1224 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->PlaySound2dcxx . . $ llsSystem#PlaySound2d(8751acdd249a09c0).(&m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info., sound_index, volume * m_master_volumecxx . . $ hlsSystem#m_master_volume., pan, |
| 1225 | (Soundscxx . . $ Sounds.[sound_index].flagscxx . . $ sound_info#flags. & SPF_LOOPEDcxx . . $ `sndlib/ssl_lib.h:366:9`!)); |
| 1226 | // ASSERT(m_sound_objects[i].m_sound_uid != -1); |
| 1227 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid. == -1) { |
| 1228 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. = SIF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:377:9`!; |
| 1229 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid. = -1; |
| 1230 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "Play2DSound: $%d Unplayed\n", i); |
| 1231 | return -1; |
| 1232 | } |
| 1233 | |
| 1234 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. |= SIF_PLAYING_2Dcxx . . $ `sndlib/ssl_lib.h:378:9`!; |
| 1235 | |
| 1236 | if (Soundscxx . . $ Sounds.[m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_indexcxx . . $ sound_object#m_sound_index.].flagscxx . . $ sound_info#flags. & SPF_LOOPEDcxx . . $ `sndlib/ssl_lib.h:366:9`!) |
| 1237 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. |= SIF_LOOPINGcxx . . $ `sndlib/ssl_lib.h:383:9`!; |
| 1238 | return m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid.; |
| 1239 | } |
| 1240 | int hlsSystemcxx . . $ hlsSystem#::PlayStreamcxx . . $ hlsSystem#PlayStream(bf4d5b0c3a7930a0).(int unique_handle, void *data, int size, int stream_format, float volume, |
| 1241 | void *stream_callback(void *user_data, int handle, int *size)) { |
| 1242 | int i = 0; |
| 1243 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(stream_format == SIF_STREAMING_8_Mcxx . . $ `sndlib/ssl_lib.h:384:9`! || stream_format == SIF_STREAMING_16_Mcxx . . $ `sndlib/ssl_lib.h:385:9`! || |
| 1244 | stream_format == SIF_STREAMING_8_Scxx . . $ `sndlib/ssl_lib.h:386:9`! || stream_format == SIF_STREAMING_16_Scxx . . $ `sndlib/ssl_lib.h:387:9`!); |
| 1245 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1246 | return -1; |
| 1247 | if (data == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || size <= 0) |
| 1248 | return -1; |
| 1249 | for (i = 0; i < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; i++) { |
| 1250 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. == SIF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:377:9`!) |
| 1251 | break; |
| 1252 | } |
| 1253 | if (i >= MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!) { |
| 1254 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(2, "PlayStream:Max Sounds Objects\n"); |
| 1255 | // Int3(); |
| 1256 | return -1; |
| 1257 | } |
| 1258 | // Increment the total number of sounds played |
| 1259 | m_sounds_playedcxx . . $ hlsSystem#m_sounds_played.++; |
| 1260 | // Initialize the play information to nice values |
| 1261 | memset(&m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info., 0, sizeof(play_informationcxx . . $ play_information#)); |
| 1262 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..samples_per_22khz_samplecxx . . $ play_information#samples_per_22khz_sample. = 1.0; |
| 1263 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..left_volumecxx . . $ play_information#left_volume. = m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..right_volumecxx . . $ play_information#right_volume. = volume * m_master_volumecxx . . $ hlsSystem#m_master_volume.; |
| 1264 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..m_stream_cbackcxx . . $ play_information#m_stream_cback. = stream_callback; |
| 1265 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..m_stream_datacxx . . $ play_information#m_stream_data. = data; |
| 1266 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..m_stream_formatcxx . . $ play_information#m_stream_format. = stream_format; |
| 1267 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..m_stream_sizecxx . . $ play_information#m_stream_size. = size; |
| 1268 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..m_stream_handlecxx . . $ play_information#m_stream_handle. = unique_handle; |
| 1269 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info..m_stream_bufsizecxx . . $ play_information#m_stream_bufsize. = size; |
| 1270 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid. = MakeUniqueIdcxx . . $ hlsSystem#MakeUniqueId(7864480464b09eea).(i); |
| 1271 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_indexcxx . . $ sound_object#m_sound_index. = -1; |
| 1272 | |
| 1273 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid. = m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->PlayStreamcxx . . $ llsSystem#PlayStream(c3f562479373c168).(&m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].play_infocxx . . $ sound_object#play_info.); |
| 1274 | // ASSERT(m_sound_objects[i].m_sound_uid != -1); |
| 1275 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_sound_uidcxx . . $ sound_object#m_sound_uid. == -1) { |
| 1276 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. = SIF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:377:9`!; |
| 1277 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid. = -1; |
| 1278 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(2, "LLSound full 1\n"); |
| 1279 | return -1; |
| 1280 | } |
| 1281 | |
| 1282 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. |= SIF_PLAYING_2Dcxx . . $ `sndlib/ssl_lib.h:378:9`! | stream_format; |
| 1283 | if (m_pause_newcxx . . $ hlsSystem#m_pause_new.) { |
| 1284 | PauseSoundscxx . . $ hlsSystem#PauseSounds(b45ddcbc8423892c).(true); |
| 1285 | } |
| 1286 | return m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid.; |
| 1287 | } |
| 1288 | // Stop a looping sound and plays end snipit |
| 1289 | void hlsSystemcxx . . $ hlsSystem#::StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).(int hlsound_uid) { |
| 1290 | int sound_object_index; |
| 1291 | if (m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init. < 1) |
| 1292 | return; // DAJ -1FIX |
| 1293 | sound_object_index = ValidateUniqueIdcxx . . $ hlsSystem#ValidateUniqueId(7864480464b09eea).(hlsound_uid); |
| 1294 | if (sound_object_index == -1) |
| 1295 | return; |
| 1296 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(sound_object_index, SKT_STOP_AFTER_LOOPcxx . . $ `sndlib/ssl_lib.h:405:9`!); |
| 1297 | } |
| 1298 | void hlsSystemcxx . . $ hlsSystem#::StopSoundImmediatecxx . . $ hlsSystem#StopSoundImmediate(d4f767463ce0a6b3).(int hlsound_uid) { |
| 1299 | int sound_object_index; |
| 1300 | if (m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init. < 1) |
| 1301 | return; // DAJ -1FIX |
| 1302 | sound_object_index = ValidateUniqueIdcxx . . $ hlsSystem#ValidateUniqueId(7864480464b09eea).(hlsound_uid); |
| 1303 | if (sound_object_index == -1) |
| 1304 | return; |
| 1305 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(sound_object_index, SKT_STOP_IMMEDIATELYcxx . . $ `sndlib/ssl_lib.h:406:9`!); |
| 1306 | } |
| 1307 | // Forcefully ends a sound |
| 1308 | void hlsSystemcxx . . $ hlsSystem#::StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(int sound_obj_index, uint8_tcxx . . $ uint8_t# f_stop_priority) { |
| 1309 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1310 | return; |
| 1311 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. &= (~SIF_LOOPINGcxx . . $ `sndlib/ssl_lib.h:383:9`!); |
| 1312 | |
| 1313 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_uidcxx . . $ sound_object#m_sound_uid. != -1) { |
| 1314 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "stopSound %d \n", m_sound_objects[sound_obj_index].m_sound_uid); |
| 1315 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->StopSoundcxx . . $ llsSystem#StopSound(9633529ce3c4ff50).(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_uidcxx . . $ sound_object#m_sound_uid., f_stop_priority); |
| 1316 | } |
| 1317 | if (f_stop_priority == SKT_STOP_IMMEDIATELYcxx . . $ `sndlib/ssl_lib.h:406:9`! || m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_sound_uidcxx . . $ sound_object#m_sound_uid. == -1) { |
| 1318 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. = SIF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:377:9`!; |
| 1319 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[sound_obj_index].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid. = -1; |
| 1320 | } |
| 1321 | } |
| 1322 | // Stops all sounds attached to an object |
| 1323 | void hlsSystemcxx . . $ hlsSystem#::StopObjectSoundcxx . . $ hlsSystem#StopObjectSound(d4f767463ce0a6b3).(int objhandle) { |
| 1324 | int i; |
| 1325 | for (i = 0; i < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; i++) |
| 1326 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:380:9`!) |
| 1327 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_link_infocxx . . $ sound_object#m_link_info..object_handlecxx . . $ sound_object#$anonymous_type_0#object_handle. == objhandle) |
| 1328 | StopSoundcxx . . $ hlsSystem#StopSound(9633529ce3c4ff50).(i, SKT_STOP_IMMEDIATELYcxx . . $ `sndlib/ssl_lib.h:406:9`!); |
| 1329 | } |
| 1330 | // Set the volume for all the sounds attached to an object |
| 1331 | void hlsSystemcxx . . $ hlsSystem#::SetVolumeObjectcxx . . $ hlsSystem#SetVolumeObject(43c79ee2f1b9aefe).(int objhandle, float volume) { |
| 1332 | for (int i = 0; i < MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!; i++) |
| 1333 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_obj_type_flagscxx . . $ sound_object#m_obj_type_flags. & SIF_OBJ_UPDATEcxx . . $ `sndlib/ssl_lib.h:380:9`!) |
| 1334 | if (m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].m_link_infocxx . . $ sound_object#m_link_info..object_handlecxx . . $ sound_object#$anonymous_type_0#object_handle. == objhandle) |
| 1335 | m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[i].volume_3dcxx . . $ sound_object#volume_3d. = volume; |
| 1336 | } |
| 1337 | // Queued sound functions |
| 1338 | // Adds a sound to a queue |
| 1339 | void hlsSystemcxx . . $ hlsSystem#::Add2dSoundQueuedcxx . . $ hlsSystem#Add2dSoundQueued(504dd6028cca1fb1).(int q_num, int sound_index, float volume, float pan, uint16_tcxx . . $ uint16_t# frequency) { |
| 1340 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1341 | return; |
| 1342 | } |
| 1343 | // Cleans a queue (if sound is playing it will finish normally) |
| 1344 | void hlsSystemcxx . . $ hlsSystem#::KillQueuecxx . . $ hlsSystem#KillQueue(d4f767463ce0a6b3).(int q_num) { |
| 1345 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1346 | return; |
| 1347 | } |
| 1348 | // Kills all sound queues |
| 1349 | void hlsSystemcxx . . $ hlsSystem#::KillAllQueuescxx . . $ hlsSystem#KillAllQueues(49f6e7a06ebc5aa8).() { |
| 1350 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1351 | return; |
| 1352 | } |
| 1353 | // Midi play stuff |
| 1354 | void hlsSystemcxx . . $ hlsSystem#::PlayMidicxx . . $ hlsSystem#PlayMidi(49f6e7a06ebc5aa8).() { |
| 1355 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1356 | return; |
| 1357 | } |
| 1358 | void hlsSystemcxx . . $ hlsSystem#::StopMidicxx . . $ hlsSystem#StopMidi(49f6e7a06ebc5aa8).() { |
| 1359 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1360 | return; |
| 1361 | } |
| 1362 | void hlsSystemcxx . . $ hlsSystem#::PauseMidicxx . . $ hlsSystem#PauseMidi(49f6e7a06ebc5aa8).() { |
| 1363 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1364 | return; |
| 1365 | } |
| 1366 | void hlsSystemcxx . . $ hlsSystem#::ResumeMidicxx . . $ hlsSystem#ResumeMidi(49f6e7a06ebc5aa8).() { |
| 1367 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1368 | return; |
| 1369 | } |
| 1370 | void hlsSystemcxx . . $ hlsSystem#::SetMidiVolumecxx . . $ hlsSystem#SetMidiVolume(49f6e7a06ebc5aa8).() { |
| 1371 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1372 | return; |
| 1373 | } |
| 1374 | void hlsSystemcxx . . $ hlsSystem#::GetMidiVolumecxx . . $ hlsSystem#GetMidiVolume(49f6e7a06ebc5aa8).() { |
| 1375 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1376 | return; |
| 1377 | } |
| 1378 | // Sets the master volume |
| 1379 | void hlsSystemcxx . . $ hlsSystem#::SetMasterVolumecxx . . $ hlsSystem#SetMasterVolume(9364e6e7bff7660).(float volume) { |
| 1380 | extern void StreamVolumecxx . . $ StreamVolume(9364e6e7bff7660).(float master_volume); |
| 1381 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(volume >= 0.0 && volume <= 1.0); |
| 1382 | |
| 1383 | if (volume == 0) { |
| 1384 | StopAllSoundscxx . . $ hlsSystem#StopAllSounds(49f6e7a06ebc5aa8).(); |
| 1385 | CloseVoicescxx . . $ CloseVoices(49f6e7a06ebc5aa8).(); |
| 1386 | KillSoundLibcxx . . $ hlsSystem#KillSoundLib(b45ddcbc8423892c).(true); |
| 1387 | m_master_volumecxx . . $ hlsSystem#m_master_volume. = 0; |
| 1388 | } else { |
| 1389 | if (m_master_volumecxx . . $ hlsSystem#m_master_volume. == 0) { |
| 1390 | InitSoundLibcxx . . $ hlsSystem#InitSoundLib(bc2f84f4176dee7e).(Descentcxx . . $ Descent., Sound_mixercxx . . $ Sound_mixer., Sound_qualitycxx . . $ Sound_quality., false); |
| 1391 | InitVoicescxx . . $ InitVoices(c9857a73d68e59ba).(); |
| 1392 | } |
| 1393 | } |
| 1394 | m_master_volumecxx . . $ hlsSystem#m_master_volume. = volume; |
| 1395 | StreamVolumecxx . . $ StreamVolume(9364e6e7bff7660).(m_master_volumecxx . . $ hlsSystem#m_master_volume.); |
| 1396 | } |
| 1397 | |
| 1398 | // Gets the master volume |
| 1399 | float hlsSystemcxx . . $ hlsSystem#::GetMasterVolumecxx . . $ hlsSystem#GetMasterVolume(9b8c9e39889c762c).(void) { return m_master_volumecxx . . $ hlsSystem#m_master_volume.; } |
| 1400 | inline int hlsSystemcxx . . $ hlsSystem#::MakeUniqueIdcxx . . $ hlsSystem#MakeUniqueId(7864480464b09eea).(int sound_obj_index) { return ((((int)m_sounds_playedcxx . . $ hlsSystem#m_sounds_played.) << 12) + sound_obj_index); } |
| 1401 | inline int hlsSystemcxx . . $ hlsSystem#::ValidateUniqueIdcxx . . $ hlsSystem#ValidateUniqueId(7864480464b09eea).(int hl_sound_uid) { |
| 1402 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`! <= 0x0FFF); |
| 1403 | int index = hl_sound_uid & 0x0FFF; |
| 1404 | if (index < 0 || index >= MAX_SOUND_OBJECTScxx . . $ `sndlib/hlsoundlib.h:217:9`!) |
| 1405 | return -1; |
| 1406 | |
| 1407 | if (hl_sound_uid == m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[index].m_hlsound_uidcxx . . $ sound_object#m_hlsound_uid.) { |
| 1408 | return index; |
| 1409 | } else { |
| 1410 | return -1; |
| 1411 | } |
| 1412 | } |
| 1413 | bool hlsSystemcxx . . $ hlsSystem#::CheckAndForceSoundDataAlloccxx . . $ hlsSystem#CheckAndForceSoundDataAlloc(83c267b20bac841a).(int sound_index) { |
| 1414 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1415 | return false; |
| 1416 | return m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->CheckAndForceSoundDataAlloccxx . . $ llsSystem#CheckAndForceSoundDataAlloc(83c267b20bac841a).(sound_index); |
| 1417 | } |
| 1418 | bool hlsSystemcxx . . $ hlsSystem#::IsSoundPlayingcxx . . $ hlsSystem#IsSoundPlaying(83c267b20bac841a).(int hlsound_uid) { |
| 1419 | int hl_index; |
| 1420 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1421 | return false; |
| 1422 | hl_index = ValidateUniqueIdcxx . . $ hlsSystem#ValidateUniqueId(7864480464b09eea).(hlsound_uid); |
| 1423 | if (hl_index != -1) { |
| 1424 | return m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->IsSoundInstancePlayingcxx . . $ llsSystem#IsSoundInstancePlaying(83c267b20bac841a).(m_sound_objectscxx . . $ hlsSystem#m_sound_objects.[hl_index].m_sound_uidcxx . . $ sound_object#m_sound_uid.); |
| 1425 | } |
| 1426 | return false; |
| 1427 | } |
| 1428 | bool hlsSystemcxx . . $ hlsSystem#::SetSoundQualitycxx . . $ hlsSystem#SetSoundQuality(b5fd09639b7a0261).(char quality) { |
| 1429 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1430 | return false; |
| 1431 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SetSoundQualitycxx . . $ llsSystem#SetSoundQuality(b5fd09639b7a0261).(quality); |
| 1432 | Sound_qualitycxx . . $ Sound_quality. = m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->GetSoundQualitycxx . . $ llsSystem#GetSoundQuality(6e9c618e4dd2eafc).(); |
| 1433 | return true; |
| 1434 | } |
| 1435 | char hlsSystemcxx . . $ hlsSystem#::GetSoundQualitycxx . . $ hlsSystem#GetSoundQuality(6e9c618e4dd2eafc).(void) { |
| 1436 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1437 | return -1; |
| 1438 | return (Sound_qualitycxx . . $ Sound_quality. = m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->GetSoundQualitycxx . . $ llsSystem#GetSoundQuality(6e9c618e4dd2eafc).()); |
| 1439 | } |
| 1440 | bool hlsSystemcxx . . $ hlsSystem#::SetSoundMixercxx . . $ hlsSystem#SetSoundMixer(b5fd09639b7a0261).(char mixer) { |
| 1441 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1442 | return false; |
| 1443 | m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->SetSoundMixercxx . . $ llsSystem#SetSoundMixer(b5fd09639b7a0261).(mixer); |
| 1444 | Sound_mixercxx . . $ Sound_mixer. = m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->GetSoundMixercxx . . $ llsSystem#GetSoundMixer(6e9c618e4dd2eafc).(); |
| 1445 | return true; |
| 1446 | } |
| 1447 | char hlsSystemcxx . . $ hlsSystem#::GetSoundMixercxx . . $ hlsSystem#GetSoundMixer(6e9c618e4dd2eafc).(void) { |
| 1448 | if (!m_f_hls_system_initcxx . . $ hlsSystem#m_f_hls_system_init.) |
| 1449 | return SOUND_MIXER_NONEcxx . . $ `sndlib/ssl_lib.h:348:9`!; |
| 1450 | return (Sound_mixercxx . . $ Sound_mixer. = m_ll_sound_ptrcxx . . $ hlsSystem#m_ll_sound_ptr.->GetSoundMixercxx . . $ llsSystem#GetSoundMixer(6e9c618e4dd2eafc).()); |
| 1451 | } |