| 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 | * $Source: $ |
| 21 | * $Revision: 3 $ |
| 22 | * $Author: Samir $ |
| 23 | * $Date: 8/11/99 3:12p $ |
| 24 | * |
| 25 | * Sound renderer system |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/sndlib/sndrender.h $ |
| 28 | * |
| 29 | * 3 8/11/99 3:12p Samir |
| 30 | * fixes for aureal support. |
| 31 | * |
| 32 | * 2 4/01/99 4:28p Samir |
| 33 | * hardware geometry integration if it's available. |
| 34 | * |
| 35 | * 1 3/28/99 3:25p Samir |
| 36 | * |
| 37 | */ |
| 38 | |
| 39 | #ifndef SNDRENDER_H |
| 40 | #define SNDRENDER_H |
| 41 | |
| 42 | #define SOUND_RENDER_RADIUS 120.0f |
| 43 | #define SOUND_RENDER_ROOM_LIMIT 16 |
| 44 | |
| 45 | // resets sound geometry system (called beginning of each level) |
| 46 | void SoundRenderReset(); |
| 47 | |
| 48 | // if this fails, renderer won't work, do emulation. |
| 49 | bool sound_render_start_frame(); |
| 50 | |
| 51 | // ends sound rendering |
| 52 | void sound_render_end_frame(); |
| 53 | |
| 54 | // render all rooms within a certain radius from player |
| 55 | // the radius is actually scaled according to orientation. radius is maximum radius, really, which is forward |
| 56 | // minimum radius will be rear view. |
| 57 | // returns list of rooms rendered (-1 = end of list!) |
| 58 | int16_t *sound_render_audible_rooms(pos_state *listener_pos, float max_radius = SOUND_RENDER_RADIUS); |
| 59 | |
| 60 | // render one room's geometry |
| 61 | void sound_render_room_geometry(int roomnum, int slot); |
| 62 | |
| 63 | // check if a room exists in room list. |
| 64 | inline bool sound_render_room_in_list(int16_t room, int16_t *list) { |
| 65 | int8_t idx = 0; |
| 66 | while (list[idx] != -1) { |
| 67 | if (room == list[idx]) { |
| 68 | return true; |
| 69 | } |
| 70 | idx++; |
| 71 | } |
| 72 | return false; |
| 73 | } |
| 74 | |
| 75 | #endif |