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 ***********************************************************/
17 #include <sys/ioctl.h>
20 #define SND_BLOCKSIZE 4096
22 #if defined(PLATFORM_LINUX)
23 #include <linux/soundcard.h>
24 #elif defined(PLATFORM_FREEBSD)
25 #include <machine/soundcard.h>
26 #elif defined(PLATFORM_HPUX)
27 #include <sys/audio.h>
29 #define SND_BLOCKSIZE 32768
34 #if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) || defined(VOXWARE)
35 #define AUDIO_STREAMING_DSP
38 #if !defined(PLATFORM_MSDOS)
39 #define MAX_SOUNDS_PLAYING 16
41 #define MAX_SOUNDS_PLAYING 8
44 /* some values for PlaySound(), StopSound() and friends */
45 #if !defined(PLATFORM_MSDOS)
46 #define PSND_SILENCE 0
47 #define PSND_MAX_VOLUME_BITS 7
48 #define PSND_MIN_VOLUME 0
49 #define PSND_MAX_VOLUME (1 << PSND_MAX_VOLUME_BITS)
50 #define PSND_NO_LOOP 0
53 #define PSND_MAX_STEREO_BITS 7
54 #define PSND_MAX_STEREO (1 << PSND_MAX_STEREO_BITS)
55 #define PSND_MAX_LEFT (-PSND_MAX_STEREO)
56 #define PSND_MAX_RIGHT (+PSND_MAX_STEREO)
57 #define PSND_MAX_LEFT2RIGHT_BITS (PSND_MAX_STEREO_BITS+1)
58 #define PSND_MAX_LEFT2RIGHT (1 << PSND_MAX_LEFT2RIGHT_BITS)
60 #define PSND_SILENCE 0
61 #define PSND_MIN_VOLUME 0
62 #define PSND_MAX_VOLUME 255
63 #define PSND_NO_LOOP 0
65 #define PSND_MAX_LEFT 0
66 #define PSND_MAX_RIGHT 255
67 #define PSND_MIDDLE 128
70 #define SSND_FADE_SOUND (1<<0)
71 #define SSND_FADE_ALL_SOUNDS (1<<1)
72 #define SSND_FADING(x) (x & (SSND_FADE_SOUND | SSND_FADE_ALL_SOUNDS))
73 #define SSND_STOP_SOUND (1<<2)
74 #define SSND_STOP_ALL_SOUNDS (1<<3)
75 #define SSND_STOPPING(x) (x & (SSND_STOP_SOUND | SSND_STOP_ALL_SOUNDS))
76 #define SSND_ALL(x) (x&(SSND_FADE_ALL_SOUNDS|SSND_STOP_ALL_SOUNDS))
78 /* settings for sound path, sound device, etc. */
80 #define SND_PATH "./sounds"
83 #define DEVICENAME_DSP "/dev/dsp"
84 #define DEVICENAME_AUDIO "/dev/audio"
85 #define DEVICENAME_AUDIOCTL "/dev/audioCtl"
88 #if defined(AUDIO_STREAMING_DSP)
89 #define AUDIO_DEVICE DEVICENAME_DSP
91 #define AUDIO_DEVICE DEVICENAME_AUDIO
95 struct SoundHeader_SUN
98 unsigned long hdr_size;
99 unsigned long data_size;
100 unsigned long encoding;
101 unsigned long sample_rate;
102 unsigned long channels;
105 struct SoundHeader_8SVX
108 unsigned long chunk_size;
118 #if defined(PLATFORM_MSDOS)
122 #if defined(TARGET_SDL)
123 Mix_Chunk *mix_chunk;
136 boolean stop_all_sounds;
142 #if defined(PLATFORM_MSDOS)
147 /* general sound functions */
148 void UnixOpenAudio(struct AudioSystemInfo *);
149 void UnixCloseAudio(struct AudioSystemInfo *);
151 /* sound server functions */
152 void SoundServer(void);
154 /* sound client functions */
155 boolean LoadSound(struct SampleInfo *);
157 void PlaySoundStereo(int, int);
158 void PlaySoundLoop(int);
159 void PlaySoundExt(int, int, int, boolean);
161 void FadeSounds(void);
163 void StopSounds(void);
164 void StopSoundExt(int, int);
165 void FreeSounds(int);