X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsound.h;h=4e26eba1aaebc8b55e41d847dfea6960fb838495;hb=9a7426789c04bf396df78eb915522f9e57af985e;hp=8481f3684e8ab26dae7fd9adbc6193ecca11b3cd;hpb=7b6d9e43fdb99e1923f4a2a401ae60e7b2975bd8;p=rocksndiamonds.git diff --git a/src/libgame/sound.h b/src/libgame/sound.h index 8481f368..4e26eba1 100644 --- a/src/libgame/sound.h +++ b/src/libgame/sound.h @@ -52,8 +52,8 @@ #define AUDIO_FRAGMENT_SIZE_2048 2048 #define AUDIO_FRAGMENT_SIZE_4096 4096 -#define AUDIO_MONO_CHANNEL 1 -#define AUDIO_STEREO_CHANNELS 2 +#define AUDIO_NUM_CHANNELS_MONO 1 +#define AUDIO_NUM_CHANNELS_STEREO 2 #define AUDIO_FORMAT_U8 (1 << 0) #define AUDIO_FORMAT_S16 (1 << 1) @@ -81,16 +81,19 @@ #define DEFAULT_AUDIO_FRAGMENT_SIZE DEFAULT_AUDIO_FRAGMENT_SIZE_WIN32 #endif -#if !defined(PLATFORM_MSDOS) -#define MAX_SOUNDS_PLAYING 16 +#if defined(TARGET_SDL) +#define NUM_MIXER_CHANNELS MIX_CHANNELS #else -#define MAX_SOUNDS_PLAYING 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 */ @@ -119,6 +122,7 @@ #endif +#if 0 #define PSND_NO_LOOP 0 #define PSND_LOOP 1 #define PSND_MUSIC 2 @@ -140,6 +144,7 @@ #define SND_RELOAD_SOUNDS 1 #define SND_RELOAD_MUSIC 2 +#endif #define SND_TYPE_NONE 0 #define SND_TYPE_WAV 1 @@ -165,6 +170,10 @@ #endif #endif +/* value for undefined sound effect filename */ +#define SND_FILE_UNDEFINED "NONE" + + #if 0 struct SoundHeader_SUN { @@ -213,13 +222,46 @@ struct SampleInfo 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; @@ -227,6 +269,7 @@ struct SoundControl boolean stop_all_sounds; boolean reload_sounds; boolean reload_music; +#endif int playingtime; long playingpos; @@ -255,7 +298,7 @@ void PlaySound(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);