1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Castle Game Engine: CastleSoundEngine: Class TSoundEngine</title>
<meta name="generator" content="PasDoc 0.13.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<table class="container"><tr><td class="navigation">
<h2>Castle Game Engine</h2><p><a href="introduction.html" class="navigation">Introduction</a></p><p><a href="AllUnits.html" class="navigation">Units</a></p><p><a href="ClassHierarchy.html" class="navigation">Class Hierarchy</a></p><p><a href="AllClasses.html" class="navigation">Classes, Interfaces, Objects and Records</a></p><p><a href="AllTypes.html" class="navigation">Types</a></p><p><a href="AllVariables.html" class="navigation">Variables</a></p><p><a href="AllConstants.html" class="navigation">Constants</a></p><p><a href="AllFunctions.html" class="navigation">Functions and Procedures</a></p><p><a href="AllIdentifiers.html" class="navigation">Identifiers</a></p></td><td class="content">
<a name="TSoundEngine"></a><h1 class="cio">Class TSoundEngine</h1>
<table class="sections wide_list">
<tr>
<td><a class="section" href="#PasDoc-Description">Description</a></td><td><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></td><td><a class="section" href="#PasDoc-Fields">Fields</a></td><td><a class="section" href="#PasDoc-Methods">Methods</a></td><td><a class="section" href="#PasDoc-Properties">Properties</a></td></tr></table>
<a name="PasDoc-Description"></a><h2 class="unit">Unit</h2>
<p class="unitlink">
<a href="CastleSoundEngine.html">CastleSoundEngine</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type TSoundEngine = class(<a class="normal" href="CastleSoundAllocator.TSoundAllocator.html">TSoundAllocator</a>)</code></p>
<h2 class="description">Description</h2>
<p>
OpenAL sound engine. Takes care of all the 3D sound stuff, wrapping OpenAL is a nice and comfortable interface.
<p>There should always be only one instance of this class, in global <a class="normal" href="CastleSoundEngine.html#SoundEngine">SoundEngine</a> variable. See docs at <a class="normal" href="CastleSoundEngine.html#SoundEngine">SoundEngine</a> for more details.
<p>You can explicitly initialize OpenAL context by <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a>, and explicitly close it by <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextClose">ALContextClose</a>. If you did not call <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a> explicitly (that is, <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALInitialized">ALInitialized</a> is <code>False</code>), then the first <a class="normal" href="CastleSoundEngine.TSoundEngine.html#LoadBuffer">LoadBuffer</a> or <a class="normal" href="CastleSoundEngine.TRepoSoundEngine.html#Sound">TRepoSoundEngine.Sound</a> or TRepoSoundEngine.Sound3D will automatically do it for you. If you do not call <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextClose">ALContextClose</a> explicitly, then at destructor we'll do it automatically.</p>
<a name="PasDoc-Hierarchy"></a><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">TObject</li>
<li class="ancestor"><a class="normal" href="CastleSoundAllocator.TSoundAllocator.html">TSoundAllocator</a></li>
<li class="thisitem">TSoundEngine</li></ul><h2 class="overview">Overview</h2>
<a name="PasDoc-Fields"></a><h3 class="summary">Fields</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>internal const <b><a href="CastleSoundEngine.TSoundEngine.html#DefaultVolume">DefaultVolume</a></b> = 1.0;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>internal const <b><a href="CastleSoundEngine.TSoundEngine.html#DefaultDefaultRolloffFactor">DefaultDefaultRolloffFactor</a></b> = 1.0;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>internal const <b><a href="CastleSoundEngine.TSoundEngine.html#DefaultDefaultReferenceDistance">DefaultDefaultReferenceDistance</a></b> = 1.0;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>internal const <b><a href="CastleSoundEngine.TSoundEngine.html#DefaultDefaultMaxDistance">DefaultDefaultMaxDistance</a></b> = <a href="Castle3D.html#MaxSingle">MaxSingle</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>internal const <b><a href="CastleSoundEngine.TSoundEngine.html#DefaultDistanceModel">DefaultDistanceModel</a></b> = dmLinearDistanceClamped;</code></td>
</tr>
</table>
<a name="PasDoc-Methods"></a><h3 class="summary">Methods</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleSoundEngine.TSoundEngine.html#LoadFromConfig">LoadFromConfig</a></b>(const Config: <a href="CastleXMLConfig.TCastleConfig.html">TCastleConfig</a>); override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleSoundEngine.TSoundEngine.html#SaveToConfig">SaveToConfig</a></b>(const Config: <a href="CastleXMLConfig.TCastleConfig.html">TCastleConfig</a>); override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a href="CastleSoundEngine.TSoundEngine.html#Create">Create</a></b>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>destructor <b><a href="CastleSoundEngine.TSoundEngine.html#Destroy">Destroy</a></b>; override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a></b>; override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleSoundEngine.TSoundEngine.html#ALContextClose">ALContextClose</a></b>; override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleSoundEngine.TSoundEngine.html#GetContextString">GetContextString</a></b>(Enum: TALCenum): string;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleSoundEngine.TSoundEngine.html#LoadBuffer">LoadBuffer</a></b>(const URL: string; out Duration: <a href="CastleTimeUtils.html#TFloatTime">TFloatTime</a>): <a href="CastleSoundEngine.html#TSoundBuffer">TSoundBuffer</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleSoundEngine.TSoundEngine.html#LoadBuffer">LoadBuffer</a></b>(const URL: string): <a href="CastleSoundEngine.html#TSoundBuffer">TSoundBuffer</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleSoundEngine.TSoundEngine.html#FreeBuffer">FreeBuffer</a></b>(var Buffer: <a href="CastleSoundEngine.html#TSoundBuffer">TSoundBuffer</a>);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleSoundEngine.TSoundEngine.html#PlaySound">PlaySound</a></b>(const Buffer: <a href="CastleSoundEngine.html#TSoundBuffer">TSoundBuffer</a>; const Spatial, Looping: boolean; const Importance: Cardinal; const Gain, MinGain, MaxGain: Single; const Position: <a href="CastleVectors.html#TVector3Single">TVector3Single</a>; const Pitch: Single = 1): <a href="CastleSoundEngine.html#TSound">TSound</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleSoundEngine.TSoundEngine.html#PlaySound">PlaySound</a></b>(const Buffer: <a href="CastleSoundEngine.html#TSoundBuffer">TSoundBuffer</a>; const Spatial, Looping: boolean; const Importance: Cardinal; const Gain, MinGain, MaxGain: Single; const Position: <a href="CastleVectors.html#TVector3Single">TVector3Single</a>; const Pitch: Single; const ReferenceDistance: Single; const MaxDistance: Single): <a href="CastleSoundEngine.html#TSound">TSound</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleSoundEngine.TSoundEngine.html#ParseParameters">ParseParameters</a></b>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleSoundEngine.TSoundEngine.html#ParseParametersHelp">ParseParametersHelp</a></b>: string;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleSoundEngine.TSoundEngine.html#UpdateListener">UpdateListener</a></b>(const Position, Direction, Up: <a href="CastleVectors.html#TVector3Single">TVector3Single</a>);</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleSoundEngine.TSoundEngine.html#Devices">Devices</a></b>: <a href="CastleSoundEngine.html#TSoundDeviceList">TSoundDeviceList</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleSoundEngine.TSoundEngine.html#DeviceNiceName">DeviceNiceName</a></b>: string;</code></td>
</tr>
</table>
<a name="PasDoc-Properties"></a><h3 class="summary">Properties</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#ALActive">ALActive</a></b>: boolean read FALActive;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#ALInitialized">ALInitialized</a></b>: boolean read FALInitialized;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#EFXSupported">EFXSupported</a></b>: boolean read FEFXSupported;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#SoundInitializationReport">SoundInitializationReport</a></b>: string read FSoundInitializationReport;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#OnOpenClose">OnOpenClose</a></b>: <a href="CastleClassUtils.TNotifyEventList.html">TNotifyEventList</a> read FOnOpenClose;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#EnableSaveToConfig">EnableSaveToConfig</a></b>: boolean
read FEnableSaveToConfig write FEnableSaveToConfig default true;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#Volume">Volume</a></b>: Single read FVolume write SetVolume
default <a href="CastleSoundEngine.TSoundEngine.html#DefaultVolume">DefaultVolume</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#Device">Device</a></b>: string read FDevice write SetDevice;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#Enable">Enable</a></b>: boolean read FEnable write SetEnable default true;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#DefaultRolloffFactor">DefaultRolloffFactor</a></b>: Single
read FDefaultRolloffFactor write FDefaultRolloffFactor default <a href="CastleSoundEngine.TSoundEngine.html#DefaultDefaultRolloffFactor">DefaultDefaultRolloffFactor</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#DefaultReferenceDistance">DefaultReferenceDistance</a></b>: Single
read FDefaultReferenceDistance write FDefaultReferenceDistance default <a href="CastleSoundEngine.TSoundEngine.html#DefaultDefaultReferenceDistance">DefaultDefaultReferenceDistance</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#DefaultMaxDistance">DefaultMaxDistance</a></b>: Single
read FDefaultMaxDistance write FDefaultMaxDistance default <a href="CastleSoundEngine.TSoundEngine.html#DefaultDefaultMaxDistance">DefaultDefaultMaxDistance</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleSoundEngine.TSoundEngine.html#DistanceModel">DistanceModel</a></b>: <a href="CastleSoundEngine.html#TSoundDistanceModel">TSoundDistanceModel</a>
read FDistanceModel write SetDistanceModel default <a href="CastleSoundEngine.TSoundEngine.html#DefaultDistanceModel">DefaultDistanceModel</a>;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Fields</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="DefaultVolume"></a><code>internal const <b>DefaultVolume</b> = 1.0;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="DefaultDefaultRolloffFactor"></a><code>internal const <b>DefaultDefaultRolloffFactor</b> = 1.0;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="DefaultDefaultReferenceDistance"></a><code>internal const <b>DefaultDefaultReferenceDistance</b> = 1.0;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="DefaultDefaultMaxDistance"></a><code>internal const <b>DefaultDefaultMaxDistance</b> = <a href="Castle3D.html#MaxSingle">MaxSingle</a>;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="DefaultDistanceModel"></a><code>internal const <b>DefaultDistanceModel</b> = dmLinearDistanceClamped;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<h3 class="detail">Methods</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><a name="LoadFromConfig"></a><code>procedure <b>LoadFromConfig</b>(const Config: <a href="CastleXMLConfig.TCastleConfig.html">TCastleConfig</a>); override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><a name="SaveToConfig"></a><code>procedure <b>SaveToConfig</b>(const Config: <a href="CastleXMLConfig.TCastleConfig.html">TCastleConfig</a>); override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Create"></a><code>constructor <b>Create</b>;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Destroy"></a><code>destructor <b>Destroy</b>; override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ALContextOpen"></a><code>procedure <b>ALContextOpen</b>; override;</code></td>
</tr>
<tr><td colspan="2">
<p>
Initialize OpenAL library, and output device and context. Sets <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALInitialized">ALInitialized</a>, <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALActive">ALActive</a>, <a class="normal" href="CastleSoundEngine.TSoundEngine.html#SoundInitializationReport">SoundInitializationReport</a>, <a class="normal" href="CastleSoundEngine.TSoundEngine.html#EFXSupported">EFXSupported</a>, ALMajorVersion, ALMinorVersion. You can set <a class="normal" href="CastleSoundEngine.TSoundEngine.html#Device">Device</a> before calling this.
<p>Note that we continue (without any exception) if the initialization failed for any reason (maybe OpenAL library is not available, or no sound output device is available). You can check things like <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALActive">ALActive</a> and <a class="normal" href="CastleSoundEngine.TSoundEngine.html#SoundInitializationReport">SoundInitializationReport</a>, but generally this class will hide from you the fact that sound is not initialized.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ALContextClose"></a><code>procedure <b>ALContextClose</b>; override;</code></td>
</tr>
<tr><td colspan="2">
<p>
Release OpenAL context and resources.
<p><a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALInitialized">ALInitialized</a> and <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALActive">ALActive</a> are set to <code>False</code>. It's allowed and harmless to cal this when one of them is already <code>False</code>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="GetContextString"></a><code>function <b>GetContextString</b>(Enum: TALCenum): string;</code></td>
</tr>
<tr><td colspan="2">
<p>
Wrapper for alcGetString.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="LoadBuffer"></a><code>function <b>LoadBuffer</b>(const URL: string; out Duration: <a href="CastleTimeUtils.html#TFloatTime">TFloatTime</a>): <a href="CastleSoundEngine.html#TSoundBuffer">TSoundBuffer</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Load a sound file into OpenAL buffer.
<p>Result is 0 only if we don't have a valid OpenAL context. Note that this method will automatically call <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a> if it wasn't called yet. So result = zero means that <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a> was called, but for some reason failed.
<p>The buffer should be released by <a class="normal" href="CastleSoundEngine.TSoundEngine.html#FreeBuffer">FreeBuffer</a> later when it's not needed. Although we will take care to always free remaining buffers before closing OpenAL context anyway. (And OpenAL would also free the buffer anyway at closing, although some OpenAL versions could write a warning about this.)
<p>We have a cache of sound files here. An absolute URL will be recorded as being loaded to given buffer. Loading the same URL second time returns the same OpenAL buffer. The buffer is released only once you call <a class="normal" href="CastleSoundEngine.TSoundEngine.html#FreeBuffer">FreeBuffer</a> as many times as you called <a class="normal" href="CastleSoundEngine.TSoundEngine.html#LoadBuffer">LoadBuffer</a> for it. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="LoadBuffer"></a><code>function <b>LoadBuffer</b>(const URL: string): <a href="CastleSoundEngine.html#TSoundBuffer">TSoundBuffer</a>;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="FreeBuffer"></a><code>procedure <b>FreeBuffer</b>(var Buffer: <a href="CastleSoundEngine.html#TSoundBuffer">TSoundBuffer</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Free a sound file buffer. Ignored when buffer is zero. Buffer is always set to zero after this.
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleSoundEngine.ESoundBufferNotLoaded.html">ESoundBufferNotLoaded</a></dt>
<dd>When invalid (not zero, and not returned by <a class="normal" href="CastleSoundEngine.TSoundEngine.html#LoadBuffer">LoadBuffer</a>) buffer identifier is given.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="PlaySound"></a><code>function <b>PlaySound</b>(const Buffer: <a href="CastleSoundEngine.html#TSoundBuffer">TSoundBuffer</a>; const Spatial, Looping: boolean; const Importance: Cardinal; const Gain, MinGain, MaxGain: Single; const Position: <a href="CastleVectors.html#TVector3Single">TVector3Single</a>; const Pitch: Single = 1): <a href="CastleSoundEngine.html#TSound">TSound</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Play a sound from given buffer.
<p>We use a smart OpenAL sound allocator, so the sound will be actually played only if resources allow. Use higher Importance to indicate sounds that are more important to play.
<p>We set the sound properties and start playing it.
<p>Both spatialized (3D) and not sounds are possible. When Spatial = <code>False</code>, then Position is ignored (you can pass anything, like <a class="normal" href="CastleVectors.html#ZeroVector3Single">ZeroVector3Single</a>).
<p></p>
<h6 class="description_section">Returns</h6>
<p class="return">The allocated sound as <a class="normal" href="CastleSoundEngine.html#TSound">TSound</a>.
<p>Returns <code>Nil</code> when there were no resources to play another sound (and it wasn't important enough to override another sound). Always returns <code>Nil</code> when SoundBuffer is zero (indicating that buffer was not loaded).
<p>In simple cases you can just ignore the result of this method. In advanced cases, you can use it to observe and update the sound later.</p></td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="PlaySound"></a><code>function <b>PlaySound</b>(const Buffer: <a href="CastleSoundEngine.html#TSoundBuffer">TSoundBuffer</a>; const Spatial, Looping: boolean; const Importance: Cardinal; const Gain, MinGain, MaxGain: Single; const Position: <a href="CastleVectors.html#TVector3Single">TVector3Single</a>; const Pitch: Single; const ReferenceDistance: Single; const MaxDistance: Single): <a href="CastleSoundEngine.html#TSound">TSound</a>;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ParseParameters"></a><code>procedure <b>ParseParameters</b>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Parse parameters in <a class="normal" href="CastleParameters.html#Parameters">Parameters</a> and interpret and remove recognized options. Internally it uses Parameters.Parse with ParseOnlyKnownLongOptions = <code>True</code>. Recognized options:
<p></p>
<dl class="paragraph_spacing">
<dt>--audio-device DEVICE-NAME</dt>
<dd><p>Set <a class="normal" href="CastleSoundEngine.TSoundEngine.html#Device">Device</a> variable to given argument.</p></dd>
<dt>--no-sound</dt>
<dd><p>Disable any sound (sets <a class="normal" href="CastleSoundEngine.TSoundEngine.html#Enable">Enable</a> to <code>False</code>).</p></dd>
</dl>
<p>
<p>More user-oriented documentation for the above options is here: [<a href="http://castle-engine.sourceforge.net/openal_notes.php#section_options">http://castle-engine.sourceforge.net/openal_notes.php#section_options</a>]</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ParseParametersHelp"></a><code>function <b>ParseParametersHelp</b>: string;</code></td>
</tr>
<tr><td colspan="2">
<p>
Help string for options parsed by <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ParseParameters">ParseParameters</a>.
<p>Note that it also lists the available OpenAL <a class="normal" href="CastleSoundEngine.TSoundEngine.html#Devices">Devices</a>, as they are valid arguments for the --audio-device option.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="UpdateListener"></a><code>procedure <b>UpdateListener</b>(const Position, Direction, Up: <a href="CastleVectors.html#TVector3Single">TVector3Single</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Set OpenAL listener position and orientation.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Devices"></a><code>function <b>Devices</b>: <a href="CastleSoundEngine.html#TSoundDeviceList">TSoundDeviceList</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
List of available OpenAL sound devices. Read-only.
<p>Use <code>Devices[].Name</code> as <a class="normal" href="CastleSoundEngine.TSoundEngine.html#Device">Device</a> values. On some OpenAL implementations, some other <a class="normal" href="CastleSoundEngine.TSoundEngine.html#Device">Device</a> values may be possible, e.g. old Loki implementation allowed some hints to be encoded in Lisp-like language inside the <a class="normal" href="CastleSoundEngine.TSoundEngine.html#Device">Device</a> string.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="DeviceNiceName"></a><code>function <b>DeviceNiceName</b>: string;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<h3 class="detail">Properties</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ALActive"></a><code>property <b>ALActive</b>: boolean read FALActive;</code></td>
</tr>
<tr><td colspan="2">
<p>
Do we have active OpenAL context. This is <code>True</code> when you successfully called <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a> (and you didn't call <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextClose">ALContextClose</a> yet). This also implies that OpenAL library is loaded, that is ALInited = <code>True</code>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ALInitialized"></a><code>property <b>ALInitialized</b>: boolean read FALInitialized;</code></td>
</tr>
<tr><td colspan="2">
<p>
Did we attempt to initialize OpenAL context. This indicates that <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a> was called, and not closed with <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextClose">ALContextClose</a> yet. Contrary to <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALActive">ALActive</a>, this <i>doesn't care if <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a> was a success</i>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="EFXSupported"></a><code>property <b>EFXSupported</b>: boolean read FEFXSupported;</code></td>
</tr>
<tr><td colspan="2">
<p>
Are OpenAL effects (EFX) extensions supported. Meaningful only when <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALActive">ALActive</a>, that is it's initialized by <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="SoundInitializationReport"></a><code>property <b>SoundInitializationReport</b>: string read FSoundInitializationReport;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="OnOpenClose"></a><code>property <b>OnOpenClose</b>: <a href="CastleClassUtils.TNotifyEventList.html">TNotifyEventList</a> read FOnOpenClose;</code></td>
</tr>
<tr><td colspan="2">
<p>
Events fired after OpenAL context and device are being open or closed. More precisely, when <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALInitialized">ALInitialized</a> changes (and so, possibly, <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALActive">ALActive</a> changed).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="EnableSaveToConfig"></a><code>property <b>EnableSaveToConfig</b>: boolean
read FEnableSaveToConfig write FEnableSaveToConfig default true;</code></td>
</tr>
<tr><td colspan="2">
<p>
Should we save <a class="normal" href="CastleSoundEngine.TSoundEngine.html#Enable">Enable</a> to config file in <a class="normal" href="CastleSoundEngine.TSoundEngine.html#SaveToConfig">SaveToConfig</a> call. This is always reset to <code>True</code> after setting <a class="normal" href="CastleSoundEngine.TSoundEngine.html#Enable">Enable</a> value.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="Volume"></a><code>property <b>Volume</b>: Single read FVolume write SetVolume
default <a href="CastleSoundEngine.TSoundEngine.html#DefaultVolume">DefaultVolume</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Sound volume, affects all OpenAL sounds (effects and music). This must always be within 0..1 range. 0.0 means that there are no effects (this case should be optimized).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="Device"></a><code>property <b>Device</b>: string read FDevice write SetDevice;</code></td>
</tr>
<tr><td colspan="2">
<p>
Sound output device, used when initializing OpenAL context.
<p>You can change it even when OpenAL is already initialized. Then we'll close the old device (<a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextClose">ALContextClose</a>), change <a class="normal" href="CastleSoundEngine.TSoundEngine.html#Device">Device</a> value, and initialize context again (<a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a>). Note that you will need to reload your buffers and sources again.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="Enable"></a><code>property <b>Enable</b>: boolean read FEnable write SetEnable default true;</code></td>
</tr>
<tr><td colspan="2">
<p>
Enable sound.
<p>If <code>False</code>, then <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a> will not initialize any OpenAL device. This is useful if you simply want to disable any sound output (or OpenAL usage), even when OpenAL library is available.
<p>If the OpenAL context is already initialized when setting this, we will eventually close it. (More precisely, we will do <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextClose">ALContextClose</a> and then <a class="normal" href="CastleSoundEngine.TSoundEngine.html#ALContextOpen">ALContextOpen</a> again. This behaves correctly.)</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="DefaultRolloffFactor"></a><code>property <b>DefaultRolloffFactor</b>: Single
read FDefaultRolloffFactor write FDefaultRolloffFactor default <a href="CastleSoundEngine.TSoundEngine.html#DefaultDefaultRolloffFactor">DefaultDefaultRolloffFactor</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
How the sound is attenuated with the distance. These are used only for spatialized sounds created with <a class="normal" href="CastleSoundEngine.TSoundEngine.html#PlaySound">PlaySound</a>. The <a class="normal" href="CastleSoundEngine.TSoundEngine.html#DefaultReferenceDistance">DefaultReferenceDistance</a> and <a class="normal" href="CastleSoundEngine.TSoundEngine.html#DefaultMaxDistance">DefaultMaxDistance</a> values are used only if you don't supply explicit values to <a class="normal" href="CastleSoundEngine.TSoundEngine.html#PlaySound">PlaySound</a>.
<p>The exact interpretation of these depends on current <a class="normal" href="CastleSoundEngine.TSoundEngine.html#DistanceModel">DistanceModel</a>. See OpenAL specification for exact equations. In short:
<p></p>
<ul class="paragraph_spacing">
<li><p>Smaller Rolloff Factor makes the attenuation weaker. In particular 0 turns off attenuation by distance. Default is 1.</p></li>
<li><p>Reference Distance is the distance at which exactly sound gain is heard. Default is 1.</p></li>
<li><p>Max Distance interpretation depends on the model. For "inverse clamped model", the gain is no longer scaled down after reaching this distance. For linear models, the gain reaches zero at this distance. Default is maximum float (I don't know the interpretation of this for linear model).</p></li>
</ul>
<p>
<p>Our default values follow OpenAL default values. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="DefaultReferenceDistance"></a><code>property <b>DefaultReferenceDistance</b>: Single
read FDefaultReferenceDistance write FDefaultReferenceDistance default <a href="CastleSoundEngine.TSoundEngine.html#DefaultDefaultReferenceDistance">DefaultDefaultReferenceDistance</a>;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="DefaultMaxDistance"></a><code>property <b>DefaultMaxDistance</b>: Single
read FDefaultMaxDistance write FDefaultMaxDistance default <a href="CastleSoundEngine.TSoundEngine.html#DefaultDefaultMaxDistance">DefaultDefaultMaxDistance</a>;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="DistanceModel"></a><code>property <b>DistanceModel</b>: <a href="CastleSoundEngine.html#TSoundDistanceModel">TSoundDistanceModel</a>
read FDistanceModel write SetDistanceModel default <a href="CastleSoundEngine.TSoundEngine.html#DefaultDistanceModel">DefaultDistanceModel</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
How the sources are spatialized. For precise meaning, see OpenAL specification of alDistanceModel.
<p>Note that some models are actually available only since OpenAL 1.1 version. Older OpenAL versions may (but don't have to) support them through extensions. We will internally do everything possible to request given model, but eventually may fallback on some other model. This probably will not be a problem in practice, as all modern OS versions (Linux distros, Windows OpenAL installers etc.) include OpenAL 1.1.
<p>The default distance model, <a class="normal" href="CastleSoundEngine.TSoundEngine.html#DefaultDistanceModel">DefaultDistanceModel</a>, is the linear model most conforming to VRML/X3D sound requirements. You can change it if you want (for example, OpenAL default is dmInverseDistanceClamped).</p>
</td></tr>
</table>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://michalis.ii.uni.wroc.pl/piwik-castle-engine/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "1"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->
<noscript>
<!-- Piwik Image Tracker -->
<img src="http://michalis.ii.uni.wroc.pl/piwik-castle-engine/piwik.php?idsite=1&rec=1" style="border:0" alt="" />
<!-- End Piwik -->
</noscript>
<hr noshade size="1"><span class="appinfo"><em>Generated by <a href="http://pasdoc.sourceforge.net/">PasDoc 0.13.0</a> on 2015-06-15 04:43:12</em>
</span>
</td></tr></table></body></html>
|