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 $
17 * $Date: 2001-10-12 10:03:32 $
19 * Include file for sound hardware.
21 * $Log: not supported by cvs2svn $
22 * Revision 1.1.1.2 2001/01/19 03:33:43 bradleyb
23 * Import of d2x-0.0.9-pre1
25 * Revision 1.2 1999/11/15 10:43:15 sekmu
26 * added freq/br to digi_sound struct for alt sounds
28 * Revision 1.1.1.1 1999/06/14 22:12:14 donut
29 * Import of d1x 1.37 source.
31 * Revision 2.0 1995/02/27 11:28:40 john
32 * New version 2.0, which has no anonymous unions, builds with
33 * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
35 * Revision 1.29 1995/02/11 12:42:00 john
36 * Added new song method, with FM bank switching..
38 * Revision 1.28 1995/02/03 17:08:26 john
39 * Changed sound stuff to allow low memory usage.
40 * Also, changed so that Sounds isn't an array of digi_sounds, it
41 * is a ubyte pointing into GameSounds, this way the digi.c code that
42 * locks sounds won't accidentally unlock a sound that is already playing, but
43 * since it's Sounds[soundno] is different, it would erroneously be unlocked.
45 * Revision 1.27 1995/02/01 22:20:31 john
46 * Added digi_is_sound_playing.
48 * Revision 1.26 1994/12/20 18:03:51 john
49 * Added loop midi flag.
51 * Revision 1.25 1994/12/13 00:46:14 john
52 * Split digi and midi volume into 2 seperate functions.
54 * Revision 1.24 1994/12/10 20:34:53 john
55 * Added digi_kill_sound_linked_to_object.
57 * Revision 1.23 1994/12/10 15:59:39 mike
60 * Revision 1.22 1994/12/10 15:44:35 john
61 * Added max_distance passing for sound objects.
63 * Revision 1.21 1994/12/05 12:17:40 john
64 * Added code that locks/unlocks digital sounds on demand.
66 * Revision 1.20 1994/11/28 18:34:57 john
67 * Made the digi_max_channels cut of an old sound instead of
68 * not playing a new sound.
70 * Revision 1.19 1994/11/14 17:53:56 allender
71 * made some digi variables extern
73 * Revision 1.18 1994/10/28 14:42:58 john
74 * Added sound volumes to all sound calls.
76 * Revision 1.17 1994/10/11 15:25:37 john
77 * Added new function to play a sound once...
79 * Revision 1.16 1994/10/03 20:51:44 john
80 * Started added pause sound function; for the network I changed to
81 * packet structure a bit; never tested, though.
84 * Revision 1.15 1994/10/03 13:09:43 john
85 * Added Pause function, but never tested it yet.
87 * Revision 1.14 1994/09/30 10:09:24 john
88 * Changed sound stuff... made it so the reseting card doesn't hang,
89 * made volume change only if sound is installed.
91 * Revision 1.13 1994/09/29 21:13:43 john
92 * Added Master volumes for digi and midi. Also took out panning,
93 * because it doesn't work with MasterVolume stuff.
95 * Revision 1.12 1994/09/29 12:42:34 john
96 * Added sidenum to keep track of sound pos. Made sound functions
97 * not do anything if nosound. Made sounds_init delete currently
100 * Revision 1.11 1994/09/29 12:23:42 john
101 * Added digi_kill_sound_linked_to_segment function.
103 * Revision 1.10 1994/09/29 11:59:04 john
104 * Added digi_kill_sound
106 * Revision 1.9 1994/09/29 10:37:38 john
107 * Added sound objects that dynamicaly change volume,pan.
109 * Revision 1.8 1994/09/28 16:18:37 john
110 * Added capability to play midi song.
112 * Revision 1.7 1994/06/17 18:01:41 john
113 * A bunch of new stuff by John
115 * Revision 1.6 1994/06/15 19:00:58 john
116 * Added the capability to make 3d sounds play just once for the
117 * laser hit wall effects.
119 * Revision 1.5 1994/06/07 10:54:30 john
120 * Made key S reinit the sound system.
122 * Revision 1.4 1994/05/09 21:11:39 john
123 * Sound changes; pass index instead of pointer to digi routines.
124 * Made laser sound cut off the last laser sound.
126 * Revision 1.3 1994/04/27 11:44:25 john
127 * First version of sound! Yay!
129 * Revision 1.2 1994/04/20 21:58:50 john
130 * First version of sound stuff... hopefully everything
131 * is commented out because it hangs..
133 * Revision 1.1 1994/04/15 14:25:02 john
154 #include "allg_snd.h"
155 typedef SAMPLE digi_sound;
157 typedef struct digi_sound {
165 #define SAMPLE_RATE_11K 11025
166 #define SAMPLE_RATE_22K 22050
171 extern int digi_driver_board;
172 extern int digi_driver_port;
173 extern int digi_driver_irq;
174 extern int digi_driver_dma;
175 extern int digi_midi_type;
176 extern int digi_midi_port;
179 extern int digi_sample_rate;
181 extern int digi_get_settings();
182 extern int digi_init();
183 extern void digi_reset();
184 extern void digi_close();
186 int digi_xlat_sound(int sound);
187 // Volume is max at F1_0.
188 extern void digi_play_sample( int sndnum, fix max_volume );
189 extern void digi_play_sample_once( int sndnum, fix max_volume );
190 extern int digi_link_sound_to_object( int soundnum, short objnum, int forever, fix max_volume );
191 extern int digi_link_sound_to_pos( int soundnum, short segnum, short sidenum, vms_vector * pos, int forever, fix max_volume );
192 // Same as above, but you pass the max distance sound can be heard. The old way uses f1_0*256 for max_distance.
193 extern int digi_link_sound_to_object2( int soundnum, short objnum, int forever, fix max_volume, fix max_distance );
194 extern int digi_link_sound_to_pos2( int soundnum, short segnum, short sidenum, vms_vector * pos, int forever, fix max_volume, fix max_distance );
196 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 );
198 extern void digi_play_midi_song( char * filename, char * melodic_bank, char * drum_bank, int loop );
200 extern void digi_play_sample_3d( int soundno, int angle, int volume, int no_dups ); // Volume from 0-0x7fff
202 extern void digi_init_sounds();
203 extern void digi_sync_sounds();
204 extern void digi_kill_sound_linked_to_segment( int segnum, int sidenum, int soundnum );
205 extern void digi_kill_sound_linked_to_object( int objnum );
207 extern void digi_set_midi_volume( int mvolume );
208 extern void digi_set_digi_volume( int dvolume );
209 extern void digi_set_volume( int dvolume, int mvolume );
211 extern int digi_is_sound_playing(int soundno);
213 extern void digi_pause_all();
214 extern void digi_resume_all();
215 extern void digi_stop_all();
217 extern void digi_set_max_channels(int n);
218 extern int digi_get_max_channels();
220 extern int digi_lomem;
222 extern void digi_pause_digi_sounds();
223 extern void digi_resume_digi_sounds();
225 int digi_start_sound(int soundnum, fix volume, fix pan, int unknown1, int unknown2, int unknown3, int unknown4);
226 void digi_stop_sound(int channel);
227 void digi_start_sound_queued( short soundnum, fix volume );
228 void digi_play_sample_looping( int soundno, fix max_volume,int loop_start, int loop_end );
229 void digi_stop_looping_sound(void);
230 void digi_change_looping_volume(fix volume);