#if defined(PLATFORM_UNIX)
static int stereo_volume[PSND_MAX_LEFT2RIGHT+1];
static char premix_first_buffer[SND_BLOCKSIZE];
-#ifdef VOXWARE
+#if defined(AUDIO_STREAMING_DSP)
static char premix_left_buffer[SND_BLOCKSIZE];
static char premix_right_buffer[SND_BLOCKSIZE];
static int premix_last_buffer[SND_BLOCKSIZE];
#endif
/* forward declaration of internal functions */
-#ifdef VOXWARE
+#if defined(AUDIO_STREAMING_DSP)
static void SoundServer_InsertNewSound(struct SoundControl);
-#else
-#if defined(PLATFORM_UNIX)
+#elif defined(PLATFORM_UNIX)
static unsigned char linear_to_ulaw(int);
static int ulaw_to_linear(unsigned char);
#endif
-#endif
-#ifdef HPUX_AUDIO
+#if defined(PLATFORM_HPUX)
static void HPUX_Audio_Control();
#endif
{
static char *audio_device_name[] =
{
- DEV_DSP,
- DEV_AUDIO
+ DEVICENAME_DSP,
+ DEVICENAME_AUDIO
};
int audio_fd;
int i;
audio->sound_available = TRUE;
-#ifdef VOXWARE
+#if defined(AUDIO_STREAMING_DSP)
audio->loops_available = TRUE;
#endif
}
stereo_volume[i] =
(int)sqrt((float)(PSND_MAX_LEFT2RIGHT*PSND_MAX_LEFT2RIGHT-i*i));
-#ifdef HPUX_AUDIO
+#if defined(PLATFORM_HPUX)
HPUX_Audio_Control();
#endif
!= sizeof(snd_ctrl))
Error(ERR_EXIT_SOUND_SERVER, "broken pipe - no sounds");
-#ifdef VOXWARE
+#if defined(AUDIO_STREAMING_DSP)
if (snd_ctrl.fade_sound)
{
}
}
-#else /* !VOXWARE */
+#else /* !AUDIO_STREAMING_DSP */
if (snd_ctrl.active && !snd_ctrl.loop)
{
}
}
-#endif /* !VOXWARE */
+#endif /* !AUDIO_STREAMING_DSP */
}
#endif /* PLATFORM_MSDOS */
#endif /* !PLATFORM_WIN32 */
-#ifdef HPUX_AUDIO
+#if defined(PLATFORM_HPUX)
static void HPUX_Audio_Control()
{
struct audio_describe ainfo;
close(audio_ctl);
}
-#endif /* HPUX_AUDIO */
+#endif /* PLATFORM_HPUX */
-#if !defined(VOXWARE) && defined(PLATFORM_UNIX)
+#if defined(PLATFORM_UNIX) && !defined(AUDIO_STREAMING_DSP)
/* these two are stolen from "sox"... :) */
return(sample);
}
-#endif /* !VOXWARE && PLATFORM_UNIX */
+#endif /* PLATFORM_UNIX && !AUDIO_STREAMING_DSP */
/*** THE STUFF ABOVE IS ONLY USED BY THE SOUND SERVER CHILD PROCESS ***/
#ifndef SOUND_H
#define SOUND_H
-#include <math.h>
-#include "main.h"
-
-#ifdef linux
-#include <linux/soundcard.h>
-#ifndef VOXWARE
-#define VOXWARE
-#endif
+#include "platform.h"
-#if 0
-/* where is the right declaration for 'ioctl'? */
-extern void ioctl(long, long, void *);
-#else
#include <sys/ioctl.h>
-#endif
-
-#endif
-
-#ifdef __FreeBSD__
-#include <machine/soundcard.h>
-#endif
+#include <math.h>
#define SND_BLOCKSIZE 4096
-#ifdef _HPUX_SOURCE
+#if defined(PLATFORM_LINUX)
+#include <linux/soundcard.h>
+#elif defined(PLATFORM_FREEBSD)
+#include <machine/soundcard.h>
+#elif defined(PLATFORM_HPUX)
#include <sys/audio.h>
#undef SND_BLOCKSIZE
#define SND_BLOCKSIZE 32768
-#define HPUX_AUDIO
-#endif /* _HPUX_SOURCE */
+#endif
+
+#include "main.h"
+
+#if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) || defined(VOXWARE)
+#define AUDIO_STREAMING_DSP
+#endif
#if !defined(PLATFORM_MSDOS)
#define MAX_SOUNDS_PLAYING 16
#define SND_PATH "./sounds"
#endif
-#define DEV_DSP "/dev/dsp"
-#define DEV_AUDIO "/dev/audio"
-#define DEV_AUDIOCTL "/dev/audioCtl"
+#define DEVICENAME_DSP "/dev/dsp"
+#define DEVICENAME_AUDIO "/dev/audio"
+#define DEVICENAME_AUDIOCTL "/dev/audioCtl"
-#ifdef VOXWARE
-#define SOUND_DEVICE DEV_DSP
+#if defined(AUDIO_STREAMING_DSP)
+#define AUDIO_DEVICE DEVICENAME_DSP
#else
-#define SOUND_DEVICE DEV_AUDIO
+#define AUDIO_DEVICE DEVICENAME_AUDIO
#endif
struct SoundHeader_SUN