Debian Codegraph @

prboom2/src/i_sound.h

raw
1 /* Emacs style mode select -*- C -*-
2 *-----------------------------------------------------------------------------
3 *
4 *
5 * PrBoom: a Doom port merged with LxDoom and LSDLDoom
6 * based on BOOM, a modified and improved DOOM engine
7 * Copyright (C) 1999 by
8 * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
9 * Copyright (C) 1999-2000 by
10 * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
11 * Copyright 2005, 2006 by
12 * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 * 02111-1307, USA.
28 *
29 * DESCRIPTION:
30 * System interface, sound.
31 *
32 *-----------------------------------------------------------------------------*/
33
34 #ifndef __I_SOUND__
35 #define __I_SOUND__
36
37 #include <stddef.h>
38
39 #include "sounds.h"
40 #include "doomtype.h"
41
42 #define SNDSERV
43 #undef SNDINTR
44
45 #ifndef SNDSERV
46 #include "l_soundgen.h"
47 #endif
48
49 // Init at program start...
50 void I_InitSound(void);
51
52 // ... shut down and relase at program termination.
53 void I_ShutdownSound(void);
54
55 //
56 // SFX I/O
57 //
58
59 void I_CacheSounds(void);
60
61 // Initialize channels?
62 void I_SetChannels(void);
63
64 // Get raw data lump index for sound descriptor.
65 int I_GetSfxLumpNum (sfxinfo_t *sfxinfo);
66
67 // Starts a sound in a particular sound channel.
68 int I_StartSound(int id, int channel, sfx_params_t *params);
69
70 // Stops a sound channel.
71 void I_StopSound(int handle);
72
73 // Called by S_*() functions
74 // to see if a channel is still playing.
75 // Returns 0 if no longer playing, 1 if playing.
76 dboolean I_SoundIsPlaying(int handle);
77
78 // Called by m_menu.c to let the quit sound play and quit right after it stops
79 dboolean I_AnySoundStillPlaying(void);
80
81 // Updates the volume, separation,
82 // and pitch of a sound channel.
83 void I_UpdateSoundParams(int handle, sfx_params_t *params);
84
85 // NSM sound capture routines
86 // silences sound output, and instead allows sound capture to work
87 // call this before sound startup
88 void I_SetSoundCap (void);
89 // grabs len samples of audio (16 bit interleaved)
90 unsigned char *I_GrabSound (int len);
91
92 // NSM helper routine for some of the streaming audio
93 void I_ResampleStream (void *dest, unsigned nsamp, void (*proc) (void *dest, unsigned nsamp), unsigned sratein, unsigned srateout);
94
95 //
96 // MUSIC I/O
97 //
98 extern char music_player_order[][200];
99
100 void I_InitMusic(void);
101 void I_ShutdownMusic(void);
102
103 // PAUSE game handling.
104 void I_PauseSong(int handle);
105 void I_ResumeSong(int handle);
106
107 // Registers a song handle to song data.
108 int I_RegisterSong(const void *data, size_t len);
109
110 // Called by anything that wishes to start music.
111 // plays a song, and when the song is done,
112 // starts playing it again in an endless loop.
113 // Horrible thing to do, considering.
114 void I_PlaySong(int handle, int looping);
115
116 // Stops a song over 3 seconds.
117 void I_StopSong(int handle);
118
119 // See above (register), then think backwards
120 void I_UnRegisterSong(int handle);
121
122 // CPhipps - put these in config file
123 extern int snd_samplerate;
124
125 // prefered MIDI player
126 typedef enum
127 {
128 midi_player_fluidsynth,
129 midi_player_opl,
130 midi_player_portmidi,
131
132 midi_player_last
133 } midi_player_name_t;
134
135 extern const char *midiplayers[];
136
137 void M_ChangeMIDIPlayer(void);
138
139 #endif