| 1 | = Audio Objects = |
| 2 | |
| 3 | == Sound == |
| 4 | * '''Overview:''' |
| 5 | * Create a new sound, and assign it to a given handle. |
| 6 | * '''Syntax:''' |
| 7 | * handle = new Sound (!FileName) |
| 8 | * Example: Menu_Sound = new Sound ("audio/music/menu_track.ogg") |
| 9 | * '''Parameters:''' |
| 10 | * !FileName: path and filename of source audio file (WAV or OGG). |
| 11 | * '''Returns:''' |
| 12 | * Handle to sound file. |
| 13 | * '''Notes:''' |
| 14 | * |
| 15 | |
| 16 | = Audio Methods = |
| 17 | |
| 18 | == free == |
| 19 | * '''Overview:''' |
| 20 | * Use this command to free a created sound handle from memory, when it is no longer needed. |
| 21 | * '''Syntax:''' |
| 22 | * handle.free() |
| 23 | * '''Parameters:''' |
| 24 | * None |
| 25 | * '''Returns:''' |
| 26 | * None |
| 27 | * '''Notes:''' |
| 28 | * Sound handles are automatically freed on exit(). |
| 29 | |
| 30 | == loop == |
| 31 | * '''Overview:''' |
| 32 | * Use this command to set a certain handle to loop (repeat when it reaches the end of the track). |
| 33 | * '''Syntax:''' |
| 34 | * handle.loop() |
| 35 | * '''Parameters:''' |
| 36 | * None |
| 37 | * '''Returns:''' |
| 38 | * None |
| 39 | * '''Notes:''' |
| 40 | * |
| 41 | |
| 42 | == play == |
| 43 | * '''Overview:''' |
| 44 | * Use this command to play the sound attached to the given handle. |
| 45 | * '''Syntax:''' |
| 46 | * handle.play() |
| 47 | * '''Parameters:''' |
| 48 | * None |
| 49 | * '''Returns:''' |
| 50 | * None |
| 51 | * '''Notes:''' |
| 52 | * |
| 53 | |
| 54 | == setGain == |
| 55 | * '''Overview:''' |
| 56 | * Use this command to adjust the volume (gain) of a sound. |
| 57 | * '''Syntax:''' |
| 58 | * handle.!SetGain(Gain) |
| 59 | * '''Parameters:''' |
| 60 | * Gain: Floating between value between 0 (silent) and 1 (max volume). |
| 61 | * '''Returns:''' |
| 62 | * None |
| 63 | * '''Notes:''' |
| 64 | * |
| 65 | |
| 66 | = Audio Globals = |
| 67 | |
| 68 | == snd_disabled == |
| 69 | * '''Overview:''' |
| 70 | * Variable that stores the value of snd_disabled in the .cfg file. If it's true, no sound will play. If false, sound will play. |
| 71 | * '''Syntax:''' |
| 72 | * !ReturnString = snd_disabled |
| 73 | * Example: if (snd_disabled == true) |
| 74 | * '''Parameters:''' |
| 75 | * None |
| 76 | * '''Returns:''' |
| 77 | * boolean (true|false). |
| 78 | * '''Notes:''' |
| 79 | * |
| 80 | |
| 81 | == snd_disable == |
| 82 | * '''Overview:''' |
| 83 | * Enables/disables the playing of sounds by setting the value of snd_disabled. |
| 84 | * '''Syntax:''' |
| 85 | * snd_disable (boolean) |
| 86 | * Example: snd_disable (true) // Set snd_disabled to true. |
| 87 | * '''Parameters:''' |
| 88 | * True to disable sound, false to enable sound. |
| 89 | * '''Returns:''' |
| 90 | * None. |
| 91 | * '''Notes:''' |
| 92 | * Documentation from the C++ implementation(snd.cpp!snd_disable): (temporarily) disable all sound output. because it causes future snd_open calls to immediately abort before they demand-initialize OpenAL, startup is sped up considerably (500..1000ms). therefore, this must be called before the first snd_open to have any effect; otherwise, the cat will already be out of the bag and we debug_warn of it. rationale: this is a quick'n dirty way of speeding up startup during development without having to change the game's sound code. can later be called to reactivate sound; all settings ever changed will be applied and subsequent sound load / play requests will work. |