| 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 | |
| 19 | #ifndef SOUNDLOAD_H_ |
| 20 | #define SOUNDLOAD_H_ |
| 21 | |
| 22 | #include "ssl_lib.h" |
| 23 | |
| 24 | extern int Num_sounds; |
| 25 | extern int Num_sound_files; |
| 26 | |
| 27 | // Allocs a sound file for use, returns -1 if error, else index on success |
| 28 | int AllocSoundFile(); |
| 29 | |
| 30 | // Frees sound index n |
| 31 | void FreeSoundFile(int n); |
| 32 | |
| 33 | // Gets next sound file from n that has actually been alloced |
| 34 | int GetNextSoundFile(int n); |
| 35 | |
| 36 | // Gets previous sound file from n that has actually been alloced |
| 37 | int GetPrevSoundFile(int n); |
| 38 | |
| 39 | // Searches thru all sounds for a specific name, returns -1 if not found |
| 40 | // or index of sound with name |
| 41 | int FindSoundFileName(const char *name); |
| 42 | |
| 43 | // Given a filename, loads the sound file. |
| 44 | int LoadSoundFile(const char *filename, float import_volume, bool f_get_data = false); |
| 45 | |
| 46 | // Sets all sounds to unused |
| 47 | void InitSounds(); |
| 48 | |
| 49 | // Allocs a sound for use, returns -1 if error, else index on success |
| 50 | int AllocSound(); |
| 51 | |
| 52 | // Frees sound index n |
| 53 | void FreeSound(int n); |
| 54 | |
| 55 | // Gets next sound from n that has actually been alloced |
| 56 | int GetNextSound(int n); |
| 57 | |
| 58 | // Gets previous sound from n that has actually been alloced |
| 59 | int GetPrevSound(int n); |
| 60 | |
| 61 | // Searches thru all sounds for a specific name, returns -1 if not found |
| 62 | // or index of sound with name |
| 63 | int FindSoundName(const char *name); |
| 64 | |
| 65 | // Given a filename, loads the sound. |
| 66 | int LoadSound(const char *filename); |
| 67 | |
| 68 | // This is a very confusing function. It takes all the sounds that we have loaded |
| 69 | // and remaps then into their proper places (if they are static). |
| 70 | void RemapSounds(); |
| 71 | |
| 72 | // goes thru every entity that could possible have a sound index (ie objects, robots, etc) |
| 73 | // and changes the old index to the new index |
| 74 | void RemapAllSoundObjects(int old_index, int new_index); |
| 75 | |
| 76 | #endif |