1 enum 2 { 3 S_GUIPRESS = 0, S_GUIBACK, S_GUIACT, 4 S_GAMESPECIFIC 5 }; 6 7 enum 8 { 9 SND_NONE = 0, 10 SND_NOATTEN = 1<<0, // disable attenuation 11 SND_NODELAY = 1<<1, // disable delay 12 SND_NOCULL = 1<<2, // disable culling 13 SND_NOPAN = 1<<3, // disable panning (distance only attenuation) 14 SND_NODIST = 1<<4, // disable distance (panning only) 15 SND_NOQUIET = 1<<5, // disable water effects (panning only) 16 SND_CLAMPED = 1<<6, // makes volume the minimum volume to clamp to 17 SND_LOOP = 1<<7, // loops when it reaches the end 18 SND_BUFFER = 1<<8, // channel becomes/adds to a buffer for sounds 19 SND_MAP = 1<<9, 20 SND_IMPORT = SND_NODELAY|SND_NOCULL|SND_NOQUIET, 21 SND_FORCED = SND_IMPORT|SND_NOATTEN|SND_NODIST, 22 SND_DIRECT = SND_IMPORT|SND_CLAMPED, 23 SND_MASKF = SND_LOOP|SND_MAP, 24 SND_LAST = 7 25 }; 26 27 #ifndef STANDALONE 28 #define SOUNDMINDIST 16.0f 29 #define SOUNDMAXDIST 10000.f 30 31 struct soundsample; 32 33 struct soundslot 34 { 35 vector<soundsample *> samples; 36 int vol, maxrad, minrad; 37 char *name; 38 39 soundslot(); 40 ~soundslot(); 41 }; 42 43 struct sound 44 { 45 soundslot *slot; 46 vec pos, oldpos; 47 physent *owner; 48 int vol, curvol, curpan; 49 int flags, maxrad, minrad, material; 50 int millis, ends, slotnum, chan, *hook; 51 vector<int> buffer; 52 53 sound(); 54 ~sound(); 55 56 void reset(); 57 bool playing(); validsound58 bool valid() { return chan >= 0 && playing(); } 59 }; 60 61 extern bool nosound; 62 extern int mastervol, soundvol, musicvol; 63 extern vector<soundslot> gamesounds, mapsounds; 64 extern vector<sound> sounds; 65 66 #define issound(c) (sounds.inrange(c) && sounds[c].valid()) 67 68 extern void initsound(); 69 extern void stopsound(); 70 extern bool playmusic(const char *name, const char *cmd = NULL); 71 extern bool playingmusic(bool check = true); 72 extern void smartmusic(bool cond, bool init = false); 73 extern void musicdone(bool docmd); 74 extern void updatesounds(); 75 extern int addsound(const char *name, int vol, int maxrad, int minrad, int value, vector<soundslot> &soundset); 76 extern void removesound(int c); 77 extern void clearsound(); 78 extern int playsound(int n, const vec &pos, physent *d = NULL, int flags = 0, int vol = -1, int maxrad = -1, int minrad = -1, int *hook = NULL, int ends = 0, int *oldhook = NULL); 79 extern void removetrackedsounds(physent *d); 80 81 extern void initmumble(); 82 extern void closemumble(); 83 extern void updatemumble(); 84 #endif 85