1 //---------------------------------------------------------------------------- 2 // EDGE Sound FX Handling Code 3 //---------------------------------------------------------------------------- 4 // 5 // Copyright (c) 1999-2009 The EDGE Team. 6 // 7 // This program is free software; you can redistribute it and/or 8 // modify it under the terms of the GNU General Public License 9 // as published by the Free Software Foundation; either version 2 10 // of the License, or (at your option) any later version. 11 // 12 // This program is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 //---------------------------------------------------------------------------- 18 // 19 // Based on the DOOM source code, released by Id Software under the 20 // following copyright: 21 // 22 // Copyright (C) 1993-1996 by id Software, Inc. 23 // 24 //---------------------------------------------------------------------------- 25 26 #ifndef __S_SOUND_H__ 27 #define __S_SOUND_H__ 28 29 // Forward declarations 30 class position_c; 31 struct mobj_s; 32 struct sfx_s; 33 34 // for the sliders 35 #define SND_SLIDER_NUM 20 36 37 extern float slider_to_gain[SND_SLIDER_NUM]; 38 39 // Sound Categories 40 // ---------------- 41 // 42 // Each category has a minimum number of channels (say N). 43 // Sounds of a category are GUARANTEED to play when there 44 // are less than N sounds of that category already playing. 45 // 46 // So while more than N sounds of a category can be active at 47 // a time, the extra ones are "hogging" channels belonging to 48 // other categories, and will be kicked out (trumped) if there 49 // are no other free channels. 50 // 51 // The order here is significant, if the channel limit for a 52 // category is set to zero, then NEXT category is tried. 53 // 54 typedef enum 55 { 56 SNCAT_UI = 0, // for the user interface (menus, tips) 57 SNCAT_Player, // for console player (pain, death, pickup) 58 SNCAT_Weapon, // for console player's weapon 59 SNCAT_Opponent, // for all other players (DM or COOP) 60 SNCAT_Monster, // for all monster sounds 61 SNCAT_Object, // for all objects (esp. projectiles) 62 SNCAT_Level, // for doors, lifts and map scripts 63 64 SNCAT_NUMTYPES 65 } 66 sound_category_e; 67 68 69 /* FX Flags */ 70 typedef enum 71 { 72 FX_NORMAL = 0, 73 74 // monster bosses: sound is not diminished by distance 75 FX_Boss = (1 << 1), 76 77 // only play one instance of this sound at this location. 78 FX_Single = (1 << 2), 79 80 // combine with FX_Single: the already playing sound is 81 // allowed to continue and the new sound it dropped. 82 // Without this flag: the playing sound is cut off. 83 // (has no effect without FX_Single). 84 FX_Precious = (1 << 3), 85 86 } 87 fx_flag_e; 88 89 90 // Vars 91 extern int sfx_volume; // 0 .. SND_SLIDER_NUM-1 92 93 94 // Init/Shutdown 95 void S_Init(void); 96 void S_Shutdown(void); 97 98 void S_StartFX(struct sfx_s *sfx, int category = SNCAT_UI, position_c *pos = NULL, int flags = 0); 99 100 void S_StopFX(position_c *pos); 101 void S_StopLevelFX(void); 102 103 void S_ResumeSound(void); 104 void S_PauseSound(void); 105 106 void S_SoundTicker(void); 107 108 void S_ChangeSoundVolume(void); 109 void S_ChangeChannelNum(void); 110 111 #endif /* __S_SOUND_H__ */ 112 113 //--- editor settings --- 114 // vi:ts=4:sw=4:noexpandtab 115