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 "sounds.h"
38 #include "doomtype.h"
39 
40 #define SNDSERV
41 #undef SNDINTR
42 
43 #ifndef SNDSERV
44 #include "l_soundgen.h"
45 #endif
46 
47 extern int snd_pcspeaker;
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 // Initialize channels?
60 void I_SetChannels(void);
61 
62 // Get raw data lump index for sound descriptor.
63 int I_GetSfxLumpNum (sfxinfo_t *sfxinfo);
64 
65 // Starts a sound in a particular sound channel.
66 int I_StartSound(int id, int channel, int vol, int sep, int pitch, int priority);
67 
68 // Stops a sound channel.
69 void I_StopSound(int handle);
70 
71 // Called by S_*() functions
72 //  to see if a channel is still playing.
73 // Returns 0 if no longer playing, 1 if playing.
74 dboolean I_SoundIsPlaying(int handle);
75 
76 // Called by m_menu.c to let the quit sound play and quit right after it stops
77 dboolean I_AnySoundStillPlaying(void);
78 
79 // Updates the volume, separation,
80 //  and pitch of a sound channel.
81 void I_UpdateSoundParams(int handle, int vol, int sep, int pitch);
82 
83 // NSM sound capture routines
84 // silences sound output, and instead allows sound capture to work
85 // call this before sound startup
86 void I_SetSoundCap (void);
87 // grabs len samples of audio (16 bit interleaved)
88 unsigned char *I_GrabSound (int len);
89 
90 // NSM helper routine for some of the streaming audio
91 void I_ResampleStream (void *dest, unsigned nsamp, void (*proc) (void *dest, unsigned nsamp), unsigned sratein, unsigned srateout);
92 
93 //
94 //  MUSIC I/O
95 //
96 extern const char *snd_soundfont;
97 extern const char *snd_mididev;
98 extern char music_player_order[][200];
99 
100 void I_InitMusic(void);
101 void I_ShutdownMusic(void);
102 
103 // Volume.
104 void I_SetMusicVolume(int volume);
105 
106 // PAUSE game handling.
107 void I_PauseSong(int handle);
108 void I_ResumeSong(int handle);
109 
110 // Registers a song handle to song data.
111 int I_RegisterSong(const void *data, size_t len);
112 
113 // cournia - tries to load a music file
114 int I_RegisterMusic( const char* filename, musicinfo_t *music );
115 
116 // Called by anything that wishes to start music.
117 //  plays a song, and when the song is done,
118 //  starts playing it again in an endless loop.
119 // Horrible thing to do, considering.
120 void I_PlaySong(int handle, int looping);
121 
122 // Stops a song over 3 seconds.
123 void I_StopSong(int handle);
124 
125 // See above (register), then think backwards
126 void I_UnRegisterSong(int handle);
127 
128 // Allegro card support jff 1/18/98
129 extern int snd_card;
130 extern int mus_card;
131 // CPhipps - put these in config file
132 extern int snd_samplerate;
133 
134 extern int use_experimental_music;
135 
136 // prefered MIDI player
137 typedef enum
138 {
139   midi_player_sdl,
140   midi_player_fluidsynth,
141   midi_player_opl2,
142   midi_player_portmidi,
143 
144   midi_player_last
145 } midi_player_name_t;
146 
147 extern const char *snd_midiplayer;
148 extern const char *midiplayers[];
149 
150 void M_ChangeMIDIPlayer(void);
151 
152 #endif
153