1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * ©1995 Artsoft Development *
6 * 33659 Bielefeld-Senne *
7 * Telefon: (0521) 493245 *
8 * eMail: aeglos@valinor.owl.de *
9 * aeglos@uni-paderborn.de *
10 * q99492@pbhrzx.uni-paderborn.de *
11 *----------------------------------------------------------*
13 ***********************************************************/
22 #include <linux/soundcard.h>
26 /* where is the right declaration for 'ioctl'? */
27 extern void ioctl(long, long, void *);
31 #include <machine/soundcard.h>
34 #define SND_BLOCKSIZE 4096
37 #include <sys/audio.h>
39 #define SND_BLOCKSIZE 32768
41 #endif /* _HPUX_SOURCE */
44 #define MAX_SOUNDS_PLAYING 16
46 #define MAX_SOUNDS_PLAYING 8
49 /* some values for PlaySound(), StopSound() and friends */
51 #define PSND_SILENCE 0
52 #define PSND_MAX_VOLUME_BITS 7
53 #define PSND_MIN_VOLUME 0
54 #define PSND_MAX_VOLUME (1 << PSND_MAX_VOLUME_BITS)
55 #define PSND_NO_LOOP 0
58 #define PSND_MAX_STEREO_BITS 7
59 #define PSND_MAX_STEREO (1 << PSND_MAX_STEREO_BITS)
60 #define PSND_MAX_LEFT (-PSND_MAX_STEREO)
61 #define PSND_MAX_RIGHT (+PSND_MAX_STEREO)
62 #define PSND_MAX_LEFT2RIGHT_BITS (PSND_MAX_STEREO_BITS+1)
63 #define PSND_MAX_LEFT2RIGHT (1 << PSND_MAX_LEFT2RIGHT_BITS)
65 #define PSND_SILENCE 0
66 #define PSND_MIN_VOLUME 0
67 #define PSND_MAX_VOLUME 255
68 #define PSND_NO_LOOP 0
70 #define PSND_MAX_LEFT 0
71 #define PSND_MAX_RIGHT 255
72 #define PSND_MIDDLE 128
75 #define SSND_FADE_SOUND (1<<0)
76 #define SSND_FADE_ALL_SOUNDS (1<<1)
77 #define SSND_FADING(x) (x & (SSND_FADE_SOUND | SSND_FADE_ALL_SOUNDS))
78 #define SSND_STOP_SOUND (1<<2)
79 #define SSND_STOP_ALL_SOUNDS (1<<3)
80 #define SSND_STOPPING(x) (x & (SSND_STOP_SOUND | SSND_STOP_ALL_SOUNDS))
81 #define SSND_ALL(x) (x&(SSND_FADE_ALL_SOUNDS|SSND_STOP_ALL_SOUNDS))
86 /* settings for sound path, sound device, etc. */
88 #define SND_PATH "./sounds"
91 #define DEV_AUDIO "/dev/audio"
92 #define DEV_DSP "/dev/dsp"
95 #define SOUND_DEVICE DEV_DSP
97 #define SOUND_DEVICE DEV_AUDIO
101 #define SOUND_AVAILABLE 1
104 #define SOUND_STATUS SOUND_OFF
106 #define SOUND_STATUS SOUND_AVAILABLE
109 struct SoundHeader_SUN
112 unsigned long hdr_size;
113 unsigned long data_size;
114 unsigned long encoding;
115 unsigned long sample_rate;
116 unsigned long channels;
119 struct SoundHeader_8SVX
122 unsigned long chunk_size;
129 unsigned char *file_ptr;
131 long file_len, data_len;
146 BOOL stop_all_sounds;
156 /* sound server functions */
157 void SoundServer(void);
158 void SoundServer_InsertNewSound(struct SoundControl);
159 void SoundServer_StopSound(int);
160 void SoundServer_StopAllSounds(void);
161 void HPUX_Audio_Control(void);
162 unsigned char linear_to_ulaw(int);
163 int ulaw_to_linear(unsigned char);
165 /* application functions */
166 BOOL LoadSound(struct SoundInfo *);
168 void PlaySoundStereo(int, int);
169 void PlaySoundLoop(int);
170 void PlaySoundExt(int, int, int, BOOL);
172 void FadeSounds(void);
174 void StopSounds(void);
175 void StopSoundExt(int, int);
176 void FreeSounds(int);