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.
14 * $Source: /cvs/cvsroot/d2x/main/digi.h,v $
15 * $Revision: 1.1.1.2 $
17 * $Date: 2001-01-19 03:33:43 $
19 * Include file for sound hardware.
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
25 * Revision 1.1.1.1 1999/06/14 22:12:14 donut
26 * Import of d1x 1.37 source.
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.
32 * Revision 1.29 1995/02/11 12:42:00 john
33 * Added new song method, with FM bank switching..
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.
42 * Revision 1.27 1995/02/01 22:20:31 john
43 * Added digi_is_sound_playing.
45 * Revision 1.26 1994/12/20 18:03:51 john
46 * Added loop midi flag.
48 * Revision 1.25 1994/12/13 00:46:14 john
49 * Split digi and midi volume into 2 seperate functions.
51 * Revision 1.24 1994/12/10 20:34:53 john
52 * Added digi_kill_sound_linked_to_object.
54 * Revision 1.23 1994/12/10 15:59:39 mike
57 * Revision 1.22 1994/12/10 15:44:35 john
58 * Added max_distance passing for sound objects.
60 * Revision 1.21 1994/12/05 12:17:40 john
61 * Added code that locks/unlocks digital sounds on demand.
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.
67 * Revision 1.19 1994/11/14 17:53:56 allender
68 * made some digi variables extern
70 * Revision 1.18 1994/10/28 14:42:58 john
71 * Added sound volumes to all sound calls.
73 * Revision 1.17 1994/10/11 15:25:37 john
74 * Added new function to play a sound once...
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.
81 * Revision 1.15 1994/10/03 13:09:43 john
82 * Added Pause function, but never tested it yet.
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.
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.
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
97 * Revision 1.11 1994/09/29 12:23:42 john
98 * Added digi_kill_sound_linked_to_segment function.
100 * Revision 1.10 1994/09/29 11:59:04 john
101 * Added digi_kill_sound
103 * Revision 1.9 1994/09/29 10:37:38 john
104 * Added sound objects that dynamicaly change volume,pan.
106 * Revision 1.8 1994/09/28 16:18:37 john
107 * Added capability to play midi song.
109 * Revision 1.7 1994/06/17 18:01:41 john
110 * A bunch of new stuff by John
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.
116 * Revision 1.5 1994/06/07 10:54:30 john
117 * Made key S reinit the sound system.
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.
123 * Revision 1.3 1994/04/27 11:44:25 john
124 * First version of sound! Yay!
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..
130 * Revision 1.1 1994/04/15 14:25:02 john
151 #include "allg_snd.h"
152 typedef SAMPLE digi_sound;
154 typedef struct digi_sound {
162 #define SAMPLE_RATE_11K 11025
163 #define SAMPLE_RATE_22K 22050
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;
176 extern int digi_sample_rate;
178 extern int digi_get_settings();
179 extern int digi_init();
180 extern void digi_reset();
181 extern void digi_close();
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 );
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 );
195 extern void digi_play_midi_song( char * filename, char * melodic_bank, char * drum_bank, int loop );
197 extern void digi_play_sample_3d( int soundno, int angle, int volume, int no_dups ); // Volume from 0-0x7fff
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 );
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 );
208 extern int digi_is_sound_playing(int soundno);
210 extern void digi_pause_all();
211 extern void digi_resume_all();
212 extern void digi_stop_all();
214 extern void digi_set_max_channels(int n);
215 extern int digi_get_max_channels();
217 extern int digi_lomem;
219 extern void digi_pause_digi_sounds();
220 extern void digi_resume_digi_sounds();
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);