1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * (c) 1995-98 Artsoft Entertainment *
8 * phone: ++49 +521 290471 *
9 * email: aeglos@valinor.owl.de *
10 *----------------------------------------------------------*
12 ***********************************************************/
21 #include <linux/soundcard.h>
27 /* where is the right declaration for 'ioctl'? */
28 extern void ioctl(long, long, void *);
30 #include <sys/ioctl.h>
36 #include <machine/soundcard.h>
39 #define SND_BLOCKSIZE 4096
42 #include <sys/audio.h>
44 #define SND_BLOCKSIZE 32768
46 #endif /* _HPUX_SOURCE */
49 #define MAX_SOUNDS_PLAYING 16
51 #define MAX_SOUNDS_PLAYING 8
54 /* some values for PlaySound(), StopSound() and friends */
56 #define PSND_SILENCE 0
57 #define PSND_MAX_VOLUME_BITS 7
58 #define PSND_MIN_VOLUME 0
59 #define PSND_MAX_VOLUME (1 << PSND_MAX_VOLUME_BITS)
60 #define PSND_NO_LOOP 0
63 #define PSND_MAX_STEREO_BITS 7
64 #define PSND_MAX_STEREO (1 << PSND_MAX_STEREO_BITS)
65 #define PSND_MAX_LEFT (-PSND_MAX_STEREO)
66 #define PSND_MAX_RIGHT (+PSND_MAX_STEREO)
67 #define PSND_MAX_LEFT2RIGHT_BITS (PSND_MAX_STEREO_BITS+1)
68 #define PSND_MAX_LEFT2RIGHT (1 << PSND_MAX_LEFT2RIGHT_BITS)
70 #define PSND_SILENCE 0
71 #define PSND_MIN_VOLUME 0
72 #define PSND_MAX_VOLUME 255
73 #define PSND_NO_LOOP 0
75 #define PSND_MAX_LEFT 0
76 #define PSND_MAX_RIGHT 255
77 #define PSND_MIDDLE 128
80 #define SSND_FADE_SOUND (1<<0)
81 #define SSND_FADE_ALL_SOUNDS (1<<1)
82 #define SSND_FADING(x) (x & (SSND_FADE_SOUND | SSND_FADE_ALL_SOUNDS))
83 #define SSND_STOP_SOUND (1<<2)
84 #define SSND_STOP_ALL_SOUNDS (1<<3)
85 #define SSND_STOPPING(x) (x & (SSND_STOP_SOUND | SSND_STOP_ALL_SOUNDS))
86 #define SSND_ALL(x) (x&(SSND_FADE_ALL_SOUNDS|SSND_STOP_ALL_SOUNDS))
88 /* settings for sound path, sound device, etc. */
90 #define SND_PATH "./sounds"
93 #define DEV_AUDIO "/dev/audio"
94 #define DEV_DSP "/dev/dsp"
97 #define SOUND_DEVICE DEV_DSP
99 #define SOUND_DEVICE DEV_AUDIO
103 #define SOUND_AVAILABLE 1
106 #define SOUND_STATUS SOUND_OFF
108 #define SOUND_STATUS SOUND_AVAILABLE
111 struct SoundHeader_SUN
114 unsigned long hdr_size;
115 unsigned long data_size;
116 unsigned long encoding;
117 unsigned long sample_rate;
118 unsigned long channels;
121 struct SoundHeader_8SVX
124 unsigned long chunk_size;
138 #ifdef USE_SDL_LIBRARY
139 Mix_Chunk *mix_chunk;
152 boolean stop_all_sounds;
162 /* start sound server */
163 void SoundServer(void);
165 /* client functions */
166 boolean LoadSound(struct SoundInfo *);
168 void PlaySoundStereo(int, int);
169 void PlaySoundLoop(int);
170 void PlaySoundExt(int, int, int, boolean);
172 void FadeSounds(void);
174 void StopSounds(void);
175 void StopSoundExt(int, int);
176 void FreeSounds(int);