X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsound.h;h=45905aab9ac0a265c0fe4d804b2e8ec8f7c2e501;hb=ee0895b12e544444db37febb1242bcc8a72d6ad8;hp=5d27f20a9f6f6547cedf369903cb8b921941689c;hpb=2f1f47c267eb7b16d95eb25cfb53eb5effedea9a;p=rocksndiamonds.git diff --git a/src/libgame/sound.h b/src/libgame/sound.h index 5d27f20a..45905aab 100644 --- a/src/libgame/sound.h +++ b/src/libgame/sound.h @@ -1,7 +1,7 @@ /*********************************************************** * Artsoft Retro-Game Library * *----------------------------------------------------------* -* (c) 1994-2001 Artsoft Entertainment * +* (c) 1994-2002 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * @@ -14,7 +14,7 @@ #ifndef SOUND_H #define SOUND_H -#include "platform.h" +#include "system.h" #if defined(PLATFORM_UNIX) && !defined(TARGET_SDL) @@ -37,6 +37,7 @@ #define AUDIO_FRAGMENT_SIZE_1024 1024 #define AUDIO_FRAGMENT_SIZE_2048 2048 #define AUDIO_FRAGMENT_SIZE_4096 4096 +#define AUDIO_FRAGMENT_SIZE_32768 32768 #define AUDIO_NUM_CHANNELS_MONO 1 #define AUDIO_NUM_CHANNELS_STEREO 2 @@ -53,7 +54,9 @@ #define DEFAULT_AUDIO_SAMPLE_RATE AUDIO_SAMPLE_RATE_22050 #endif -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_HPUX) +#define DEFAULT_AUDIO_FRAGMENT_SIZE AUDIO_FRAGMENT_SIZE_32768 +#elif defined(PLATFORM_WIN32) #define DEFAULT_AUDIO_FRAGMENT_SIZE AUDIO_FRAGMENT_SIZE_2048 #else #define DEFAULT_AUDIO_FRAGMENT_SIZE AUDIO_FRAGMENT_SIZE_512 @@ -70,71 +73,51 @@ /* values for PlaySound(), StopSound() and friends */ -#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) - - -#if !defined(TARGET_ALLEGRO) - -#define PSND_SILENCE 0 -#define PSND_MAX_VOLUME_BITS 15 -#define PSND_MIN_VOLUME 0 -#define PSND_MAX_VOLUME (1 << PSND_MAX_VOLUME_BITS) -#define PSND_MIDDLE 0 -#define PSND_MAX_STEREO_BITS 7 -#define PSND_MAX_STEREO (1 << PSND_MAX_STEREO_BITS) -#define PSND_MAX_LEFT (-PSND_MAX_STEREO) -#define PSND_MAX_RIGHT (+PSND_MAX_STEREO) -#define PSND_MAX_LEFT2RIGHT_BITS (PSND_MAX_STEREO_BITS+1) -#define PSND_MAX_LEFT2RIGHT (1 << PSND_MAX_LEFT2RIGHT_BITS) - -#else /* TARGET_ALLEGRO */ - -#define PSND_SILENCE 0 -#define PSND_MIN_VOLUME 0 -#define PSND_MAX_VOLUME 255 -#define PSND_MAX_LEFT 0 -#define PSND_MAX_RIGHT 255 -#define PSND_MIDDLE 128 - +#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) + +#define SOUND_MIN_VOLUME 0 +#if defined(TARGET_SDL) +#define SOUND_MAX_VOLUME SDL_MIX_MAXVOLUME +#elif defined(TARGET_ALLEGRO) +#define SOUND_MAX_VOLUME 255 +#else +#define SOUND_MAX_VOLUME 128 #endif -/* value for undefined sound effect filename */ -#define SND_FILE_UNDEFINED "NONE" - +#define SOUND_MAX_LEFT 0 +#define SOUND_MAX_RIGHT 255 +#define SOUND_MAX_LEFT2RIGHT 255 +#define SOUND_MIDDLE (SOUND_MAX_LEFT2RIGHT / 2) -struct SoundEffectInfo -{ - char *text; - char *default_filename; - char *filename; -}; +/* value for undefined sound effect filename */ +#define SND_FILE_UNDEFINED UNDEFINED_FILENAME /* general sound functions */ @@ -159,9 +142,10 @@ void StopMusic(void); void StopSound(int); void StopSounds(void); void StopSoundExt(int, int); -void InitSoundList(struct SoundEffectInfo *, int); -void InitReloadSounds(char *); -void InitReloadMusic(char *); +struct FileInfo *getCurrentSoundList(); +void InitSoundList(struct ConfigInfo *, struct ConfigInfo *, int); +void InitReloadCustomSounds(char *); +void InitReloadCustomMusic(char *); void FreeAllSounds(void); void FreeAllMusic(void);