1 //
2 // Copyright(C) 1993-1996 Id Software, Inc.
3 // Copyright(C) 1993-2008 Raven Software
4 // Copyright(C) 2005-2014 Simon Howard
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 
17 
18 #ifndef __S_SOUND__
19 #define __S_SOUND__
20 
21 /*
22 typedef struct
23 {
24     char name[8];
25     int p1;
26 } musicinfo_t;
27 */
28 
29 /*
30 typedef struct sfxinfo_s
31 {
32     char tagName[32];
33     char lumpname[12];          // Only need 9 bytes, but padded out to be dword aligned
34     //struct sfxinfo_s *link; // Make alias for another sound
35     int priority;               // Higher priority takes precendence
36     int usefulness;             // Determines when a sound should be cached out
37     void *snd_ptr;
38     int lumpnum;
39     int numchannels;            // total number of channels a sound type may occupy
40     boolean changePitch;
41 } sfxinfo_t;
42 */
43 
44 typedef struct
45 {
46     mobj_t *mo;
47     int sound_id;
48     int handle;
49     int volume;
50     int pitch;
51     int priority;
52 } channel_t;
53 
54 typedef struct
55 {
56     int id;
57     unsigned short priority;
58     char *name;
59     mobj_t *mo;
60     int distance;
61 } ChanInfo_t;
62 
63 typedef struct
64 {
65     int channelCount;
66     int musicVolume;
67     int soundVolume;
68     ChanInfo_t chan[8];
69 } SoundInfo_t;
70 
71 extern int snd_MaxVolume;
72 extern int snd_MusicVolume;
73 extern int snd_Channels;
74 extern boolean cdmusic;
75 
76 void S_Start(void);
77 void S_StartSound(mobj_t * origin, int sound_id);
78 int S_GetSoundID(char *name);
79 void S_StartSoundAtVolume(mobj_t * origin, int sound_id, int volume);
80 void S_StopSound(mobj_t * origin);
81 void S_StopAllSound(void);
82 void S_PauseSound(void);
83 void S_ResumeSound(void);
84 void S_UpdateSounds(mobj_t * listener);
85 void S_StartSong(int song, boolean loop);
86 void S_StartSongName(const char *songLump, boolean loop);
87 void S_Init(void);
88 void S_GetChannelInfo(SoundInfo_t * s);
89 void S_SetMusicVolume(void);
90 boolean S_GetSoundPlayingInfo(mobj_t * mobj, int sound_id);
91 boolean S_StartCustomCDTrack(int tracknum);
92 int S_GetCurrentCDTrack(void);
93 
94 #endif
95