1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
4 // Copyright(C) 1993-1996 Id Software, Inc.
5 // Copyright(C) 2005 Simon Howard
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.
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.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 // The not so system specific sound interface.
25 //-----------------------------------------------------------------------------
37 SNDDEVICE_PCSPEAKER
= 1,
42 SNDDEVICE_WAVEBLASTER
= 6,
43 SNDDEVICE_SOUNDCANVAS
= 7,
44 SNDDEVICE_GENMIDI
= 8,
48 // Interface for sound modules
52 // List of sound devices that this sound module is used for.
54 snddevice_t
*sound_devices
;
55 int num_sound_devices
;
57 // Initialize sound module
58 // Returns true if successfully initialized
60 boolean (*Init
)(void);
62 // Shutdown sound module
64 void (*Shutdown
)(void);
66 // Returns the lump index of the given sound.
68 int (*GetSfxLumpNum
)(sfxinfo_t
*sfxinfo
);
70 // Called periodically to update the subsystem.
74 // Update the sound settings on the given channel.
76 void (*UpdateSoundParams
)(int channel
, int vol
, int sep
);
78 // Start a sound on a given channel. Returns the channel id
81 int (*StartSound
)(int id
, int channel
, int vol
, int sep
);
83 // Stop the sound playing on the given channel.
85 void (*StopSound
)(int channel
);
87 // Query if a sound is playing on the given channel
89 boolean (*SoundIsPlaying
)(int channel
);
93 // Interface for music modules
97 // List of sound devices that this music module is used for.
99 snddevice_t
*sound_devices
;
100 int num_sound_devices
;
102 // Initialize the music subsystem
104 boolean (*Init
)(void);
106 // Shutdown the music subsystem
108 void (*Shutdown
)(void);
110 // Set music volume - range 0-127
112 void (*SetMusicVolume
)(int volume
);
116 void (*PauseMusic
)(void);
120 void (*ResumeMusic
)(void);
122 // Register a song handle from data
123 // Returns a handle that can be used to play the song
125 void *(*RegisterSong
)(void *data
, int len
);
127 // Un-register (free) song data
129 void (*UnRegisterSong
)(void *handle
);
133 void (*PlaySong
)(void *handle
, int looping
);
135 // Stop playing the current song.
137 void (*StopSong
)(void);
139 // Query if music is playing.
141 boolean (*MusicIsPlaying
)(void);
144 extern int snd_sfxdevice
;
145 extern int snd_musicdevice
;
146 extern int snd_samplerate
;
149 // Initializes sound stuff, including volume
150 // Sets channels, SFX and music volume,
151 // allocates channel buffer, sets S_sfx lookup.
154 void S_Init(int sfxVolume
, int musicVolume
);
159 void S_Shutdown(void);
164 // Per level startup code.
165 // Kills playing sounds at start of level,
166 // determines music if any, changes music.
172 // Start sound for thing at <origin>
173 // using <sound_id> from sounds.h
176 void S_StartSound(void *origin
, int sound_id
);
178 // Stop sound for thing at <origin>
179 void S_StopSound(mobj_t
*origin
);
182 // Start music using <music_id> from sounds.h
183 void S_StartMusic(int music_id
);
185 // Start music using <music_id> from sounds.h,
186 // and set whether looping
187 void S_ChangeMusic(int music_id
, int looping
);
189 // query if music is playing
190 boolean
S_MusicPlaying(void);
192 // Stops the music fer sure.
193 void S_StopMusic(void);
195 // Stop and resume music, during game PAUSE.
196 void S_PauseSound(void);
197 void S_ResumeSound(void);
201 // Updates music & sounds
203 void S_UpdateSounds(mobj_t
*listener
);
205 void S_SetMusicVolume(int volume
);
206 void S_SetSfxVolume(int volume
);