]> icculus.org git repositories - btb/d2x.git/blob - main/digi.h
Fix detection of opengl
[btb/d2x.git] / main / digi.h
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
11 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13 /*
14  * $Source: /cvs/cvsroot/d2x/main/digi.h,v $
15  * $Revision: 1.1.1.2 $
16  * $Author: bradleyb $
17  * $Date: 2001-01-19 03:33:43 $
18  * 
19  * Include file for sound hardware.
20  * 
21  * $Log: not supported by cvs2svn $
22  * Revision 1.2  1999/11/15 10:43:15  sekmu
23  * added freq/br to digi_sound struct for alt sounds
24  *
25  * Revision 1.1.1.1  1999/06/14 22:12:14  donut
26  * Import of d1x 1.37 source.
27  *
28  * Revision 2.0  1995/02/27  11:28:40  john
29  * New version 2.0, which has no anonymous unions, builds with
30  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
31  * 
32  * Revision 1.29  1995/02/11  12:42:00  john
33  * Added new song method, with FM bank switching..
34  * 
35  * Revision 1.28  1995/02/03  17:08:26  john
36  * Changed sound stuff to allow low memory usage.
37  * Also, changed so that Sounds isn't an array of digi_sounds, it
38  * is a ubyte pointing into GameSounds, this way the digi.c code that
39  * locks sounds won't accidentally unlock a sound that is already playing, but
40  * since it's Sounds[soundno] is different, it would erroneously be unlocked.
41  * 
42  * Revision 1.27  1995/02/01  22:20:31  john
43  * Added digi_is_sound_playing.
44  * 
45  * Revision 1.26  1994/12/20  18:03:51  john
46  * Added loop midi flag.
47  * 
48  * Revision 1.25  1994/12/13  00:46:14  john
49  * Split digi and midi volume into 2 seperate functions.
50  * 
51  * Revision 1.24  1994/12/10  20:34:53  john
52  * Added digi_kill_sound_linked_to_object.
53  * 
54  * Revision 1.23  1994/12/10  15:59:39  mike
55  * Fixed bug.
56  * 
57  * Revision 1.22  1994/12/10  15:44:35  john
58  * Added max_distance passing for sound objects.
59  * 
60  * Revision 1.21  1994/12/05  12:17:40  john
61  * Added code that locks/unlocks digital sounds on demand.
62  * 
63  * Revision 1.20  1994/11/28  18:34:57  john
64  * Made the digi_max_channels cut of an old sound instead of
65  * not playing a new sound.
66  * 
67  * Revision 1.19  1994/11/14  17:53:56  allender
68  * made some digi variables extern
69  * 
70  * Revision 1.18  1994/10/28  14:42:58  john
71  * Added sound volumes to all sound calls.
72  * 
73  * Revision 1.17  1994/10/11  15:25:37  john
74  * Added new function to play a sound once...
75  * 
76  * Revision 1.16  1994/10/03  20:51:44  john
77  * Started added pause sound function; for the network I changed to 
78  * packet structure a bit; never tested, though.
79  * 
80  * 
81  * Revision 1.15  1994/10/03  13:09:43  john
82  * Added Pause function, but never tested it yet.
83  * 
84  * Revision 1.14  1994/09/30  10:09:24  john
85  * Changed sound stuff... made it so the reseting card doesn't hang, 
86  * made volume change only if sound is installed.
87  * 
88  * Revision 1.13  1994/09/29  21:13:43  john
89  * Added Master volumes for digi and midi. Also took out panning,
90  * because it doesn't work with MasterVolume stuff. 
91  * 
92  * Revision 1.12  1994/09/29  12:42:34  john
93  * Added sidenum to keep track of sound pos. Made sound functions
94  * not do anything if nosound. Made sounds_init delete currently
95  * playing sounds.
96  * 
97  * Revision 1.11  1994/09/29  12:23:42  john
98  * Added digi_kill_sound_linked_to_segment function.
99  * 
100  * Revision 1.10  1994/09/29  11:59:04  john
101  * Added digi_kill_sound
102  * 
103  * Revision 1.9  1994/09/29  10:37:38  john
104  * Added sound objects that dynamicaly change volume,pan.
105  * 
106  * Revision 1.8  1994/09/28  16:18:37  john
107  * Added capability to play midi song.
108  * 
109  * Revision 1.7  1994/06/17  18:01:41  john
110  * A bunch of new stuff by John
111  * 
112  * Revision 1.6  1994/06/15  19:00:58  john
113  * Added the capability to make 3d sounds play just once for the
114  * laser hit wall effects.
115  * 
116  * Revision 1.5  1994/06/07  10:54:30  john
117  * Made key S reinit the sound system.
118  * 
119  * Revision 1.4  1994/05/09  21:11:39  john
120  * Sound changes; pass index instead of pointer to digi routines.
121  * Made laser sound cut off the last laser sound.
122  * 
123  * Revision 1.3  1994/04/27  11:44:25  john
124  * First version of sound! Yay!
125  * 
126  * Revision 1.2  1994/04/20  21:58:50  john
127  * First version of sound stuff... hopefully everything
128  * is commented out because it hangs..
129  * 
130  * Revision 1.1  1994/04/15  14:25:02  john
131  * Initial revision
132  * 
133  * 
134  */
135
136
137
138 #ifndef _DIGI_H
139 #define _DIGI_H
140
141 #include "pstypes.h"
142 #include "vecmat.h"
143
144 /*
145 #ifdef __DJGPP__
146 #define ALLEGRO
147 #endif
148 */
149
150 #ifdef ALLEGRO
151 #include "allg_snd.h"
152 typedef SAMPLE digi_sound;
153 #else
154 typedef struct digi_sound       {
155         int bits;
156         int freq;
157         int length;
158         ubyte * data;
159 } digi_sound;
160 #endif
161
162 #define SAMPLE_RATE_11K         11025
163 #define SAMPLE_RATE_22K         22050
164
165
166
167 #ifdef __ENV_DJGPP__
168 extern int digi_driver_board;
169 extern int digi_driver_port;
170 extern int digi_driver_irq;
171 extern int digi_driver_dma;
172 extern int digi_midi_type;
173 extern int digi_midi_port;
174 #endif
175
176 extern int digi_sample_rate;
177
178 extern int digi_get_settings();
179 extern int digi_init();
180 extern void digi_reset();
181 extern void digi_close();
182
183 int digi_xlat_sound(int sound);
184 // Volume is max at F1_0.
185 extern void digi_play_sample( int sndnum, fix max_volume );
186 extern void digi_play_sample_once( int sndnum, fix max_volume );
187 extern int digi_link_sound_to_object( int soundnum, short objnum, int forever, fix max_volume );
188 extern int digi_link_sound_to_pos( int soundnum, short segnum, short sidenum, vms_vector * pos, int forever, fix max_volume );
189 // Same as above, but you pass the max distance sound can be heard.  The old way uses f1_0*256 for max_distance.
190 extern int digi_link_sound_to_object2( int soundnum, short objnum, int forever, fix max_volume, fix  max_distance );
191 extern int digi_link_sound_to_pos2( int soundnum, short segnum, short sidenum, vms_vector * pos, int forever, fix max_volume, fix max_distance );
192
193 extern int digi_link_sound_to_object3( int org_soundnum, short objnum, int forever, fix max_volume, fix  max_distance, int loop_start, int loop_end );
194
195 extern void digi_play_midi_song( char * filename, char * melodic_bank, char * drum_bank, int loop );
196
197 extern void digi_play_sample_3d( int soundno, int angle, int volume, int no_dups ); // Volume from 0-0x7fff
198
199 extern void digi_init_sounds();
200 extern void digi_sync_sounds();
201 extern void digi_kill_sound_linked_to_segment( int segnum, int sidenum, int soundnum );
202 extern void digi_kill_sound_linked_to_object( int objnum );
203
204 extern void digi_set_midi_volume( int mvolume );
205 extern void digi_set_digi_volume( int dvolume );
206 extern void digi_set_volume( int dvolume, int mvolume );
207
208 extern int digi_is_sound_playing(int soundno);
209
210 extern void digi_pause_all();
211 extern void digi_resume_all();
212 extern void digi_stop_all();
213
214 extern void digi_set_max_channels(int n);
215 extern int digi_get_max_channels();
216
217 extern int digi_lomem;
218
219 extern void digi_pause_digi_sounds();
220 extern void digi_resume_digi_sounds();
221
222 int digi_start_sound(int soundnum, fix volume, fix pan, int unknown1, int unknown2, int unknown3, int unknown4);
223 void digi_stop_sound(int channel);
224 void digi_start_sound_queued( short soundnum, fix volume );
225 void digi_play_sample_looping( int soundno, fix max_volume,int loop_start, int loop_end );
226 void digi_stop_looping_sound(void);
227 void digi_change_looping_volume(fix volume);
228
229 #endif
230