#define AUDIO_NUM_CHANNELS_MONO 1
#define AUDIO_NUM_CHANNELS_STEREO 2
+#define AUDIO_FORMAT_UNKNOWN (0)
#define AUDIO_FORMAT_U8 (1 << 0)
#define AUDIO_FORMAT_S16 (1 << 1)
#define AUDIO_FORMAT_LE (1 << 2)
#define SOUND_FADING_VOLUME_THRESHOLD (SOUND_FADING_VOLUME_STEP * 2)
#endif
+#if defined(AUDIO_STREAMING_DSP)
#define DEFAULT_AUDIO_SAMPLE_RATE AUDIO_SAMPLE_RATE_22050
+#else
+#define DEFAULT_AUDIO_SAMPLE_RATE AUDIO_SAMPLE_RATE_8000
+#endif
+
#define DEFAULT_AUDIO_FRAGMENT_SIZE_UNIX AUDIO_FRAGMENT_SIZE_512
#define DEFAULT_AUDIO_FRAGMENT_SIZE_WIN32 AUDIO_FRAGMENT_SIZE_2048
#endif
#if defined(TARGET_SDL)
-#define NUM_MIXER_CHANNELS MIX_CHANNELS
+#define NUM_MIXER_CHANNELS MIX_CHANNELS
#else
-#define NUM_MIXER_CHANNELS 8
+#define NUM_MIXER_CHANNELS 8
#endif
+#define MUSIC_CHANNEL 0
+#define FIRST_SOUND_CHANNEL 1
+
#if !defined(PLATFORM_HPUX)
-#define SND_BLOCKSIZE 4096
+#define SND_BLOCKSIZE 4096
#else
-#define SND_BLOCKSIZE 32768
+#define SND_BLOCKSIZE 32768
#endif
/* some values for PlaySound(), StopSound() and friends */
#endif
+#if 0
#define PSND_NO_LOOP 0
#define PSND_LOOP 1
#define PSND_MUSIC 2
#define SND_RELOAD_SOUNDS 1
#define SND_RELOAD_MUSIC 2
+#endif
#define SND_TYPE_NONE 0
#define SND_TYPE_WAV 1
typedef struct SampleInfo SoundInfo;
typedef struct SampleInfo MusicInfo;
+#define SND_CTRL_NONE (0)
+#define SND_CTRL_MUSIC (1 << 0)
+#define SND_CTRL_LOOP (1 << 1)
+#define SND_CTRL_FADE (1 << 2)
+#define SND_CTRL_STOP (1 << 3)
+#define SND_CTRL_ALL_SOUNDS (1 << 4)
+#define SND_CTRL_RELOAD_SOUNDS (1 << 5)
+#define SND_CTRL_RELOAD_MUSIC (1 << 6)
+
+#define SND_CTRL_PLAY_SOUND (SND_CTRL_NONE)
+#define SND_CTRL_PLAY_LOOP (SND_CTRL_LOOP)
+#define SND_CTRL_PLAY_MUSIC (SND_CTRL_LOOP | SND_CTRL_MUSIC)
+
+#define SND_CTRL_FADE_SOUND (SND_CTRL_FADE)
+#define SND_CTRL_FADE_MUSIC (SND_CTRL_FADE | SND_CTRL_MUSIC)
+#define SND_CTRL_FADE_ALL (SND_CTRL_FADE | SND_CTRL_ALL_SOUNDS)
+
+#define SND_CTRL_STOP_SOUND (SND_CTRL_STOP)
+#define SND_CTRL_STOP_MUSIC (SND_CTRL_STOP | SND_CTRL_MUSIC)
+#define SND_CTRL_STOP_ALL (SND_CTRL_STOP | SND_CTRL_ALL_SOUNDS)
+
+#define IS_MUSIC(x) ((x).state & SND_CTRL_MUSIC)
+#define IS_LOOP(x) ((x).state & SND_CTRL_LOOP)
+#define IS_FADING(x) ((x).state & SND_CTRL_FADE)
+#define IS_STOPPING(x) ((x).state & SND_CTRL_STOP)
+#define IS_RELOADING(x) ((x).state & (SND_CTRL_RELOAD_SOUNDS | \
+ SND_CTRL_RELOAD_MUSIC))
+#define ALL_SOUNDS(x) ((x).state & SND_CTRL_ALL_SOUNDS)
+
struct SoundControl
{
+ boolean active;
+
int nr;
int volume;
int stereo;
- boolean active;
+#if 1
+ int state;
+#else
boolean loop;
boolean music;
boolean fade_sound;
boolean stop_all_sounds;
boolean reload_sounds;
boolean reload_music;
+#endif
int playingtime;
long playingpos;
void UnixOpenAudio(void);
void UnixCloseAudio(void);
-/* sound server functions */
-void InitPlaylist(void);
-void StartSoundserver(void);
-void SoundServer(void);
+/* mixer functions */
+void Mixer_InitChannels(void);
+void StartMixer(void);
/* sound client functions */
void PlayMusic(int);
void PlaySoundStereo(int, int);
void PlaySoundLoop(int);
void PlaySoundMusic(int);
-void PlaySoundExt(int, int, int, boolean);
+void PlaySoundExt(int, int, int, int);
void FadeMusic(void);
void FadeSound(int);
void FadeSounds(void);