2014-03-15 16:59:03 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2016-05-18 00:42:11 +00:00
|
|
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
// This program is free software distributed under the
|
|
|
|
// terms of the GNU General Public License, version 2.
|
|
|
|
// See the 'LICENSE' file for more details.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// \file s_sound.h
|
|
|
|
/// \brief The not so system specific sound interface
|
|
|
|
|
|
|
|
#ifndef __S_SOUND__
|
|
|
|
#define __S_SOUND__
|
|
|
|
|
2018-08-23 16:51:45 +00:00
|
|
|
#include "i_sound.h" // musictype_t
|
2014-03-15 16:59:03 +00:00
|
|
|
#include "sounds.h"
|
|
|
|
#include "m_fixed.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "tables.h" // angle_t
|
|
|
|
|
|
|
|
// mask used to indicate sound origin is player item pickup
|
|
|
|
#define PICKUP_SOUND 0x8000
|
|
|
|
|
|
|
|
extern consvar_t stereoreverse;
|
|
|
|
extern consvar_t cv_soundvolume, cv_digmusicvolume, cv_midimusicvolume;
|
|
|
|
extern consvar_t cv_numChannels;
|
2018-10-11 20:29:43 +00:00
|
|
|
extern consvar_t cv_resetmusic;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#ifdef SNDSERV
|
|
|
|
extern consvar_t sndserver_cmd, sndserver_arg;
|
|
|
|
#endif
|
|
|
|
#ifdef MUSSERV
|
|
|
|
extern consvar_t musserver_cmd, musserver_arg;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern CV_PossibleValue_t soundvolume_cons_t[];
|
|
|
|
//part of i_cdmus.c
|
|
|
|
extern consvar_t cd_volume, cdUpdate;
|
|
|
|
|
2014-07-25 23:10:24 +00:00
|
|
|
#if defined (macintosh) && !defined (HAVE_SDL)
|
2014-03-15 16:59:03 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
music_normal,
|
|
|
|
playlist_random,
|
|
|
|
playlist_normal
|
|
|
|
} playmode_t;
|
|
|
|
|
|
|
|
extern consvar_t play_mode;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
SF_TOTALLYSINGLE = 1, // Only play one of these sounds at a time...GLOBALLY
|
|
|
|
SF_NOMULTIPLESOUND = 2, // Like SF_NOINTERRUPT, but doesnt care what the origin is
|
|
|
|
SF_OUTSIDESOUND = 4, // Volume is adjusted depending on how far away you are from 'outside'
|
|
|
|
SF_X4AWAYSOUND = 8, // Hear it from 4x the distance away
|
|
|
|
SF_X8AWAYSOUND = 16, // Hear it from 8x the distance away
|
|
|
|
SF_NOINTERRUPT = 32, // Only play this sound if it isn't already playing on the origin
|
|
|
|
SF_X2AWAYSOUND = 64, // Hear it from 2x the distance away
|
|
|
|
} soundflags_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
fixed_t x, y, z;
|
|
|
|
angle_t angle;
|
|
|
|
} listener_t;
|
|
|
|
|
|
|
|
// register sound vars and commands at game startup
|
|
|
|
void S_RegisterSoundStuff(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Initializes sound stuff, including volume
|
2018-08-23 16:30:47 +00:00
|
|
|
// Sets channels, SFX, allocates channel buffer, sets S_sfx lookup.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
2018-08-23 16:30:47 +00:00
|
|
|
void S_InitSfxChannels(INT32 sfxVolume);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Per level startup code.
|
|
|
|
// Kills playing sounds at start of level, determines music if any, changes music.
|
|
|
|
//
|
|
|
|
void S_StopSounds(void);
|
|
|
|
void S_ClearSfx(void);
|
|
|
|
void S_Start(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Basically a W_GetNumForName that adds "ds" at the beginning of the string. Returns a lumpnum.
|
|
|
|
//
|
|
|
|
lumpnum_t S_GetSfxLumpNum(sfxinfo_t *sfx);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Start sound for thing at <origin> using <sound_id> from sounds.h
|
|
|
|
//
|
|
|
|
void S_StartSound(const void *origin, sfxenum_t sound_id);
|
|
|
|
|
|
|
|
// Will start a sound at a given volume.
|
|
|
|
void S_StartSoundAtVolume(const void *origin, sfxenum_t sound_id, INT32 volume);
|
|
|
|
|
|
|
|
// Stop sound for thing at <origin>
|
|
|
|
void S_StopSound(void *origin);
|
|
|
|
|
2018-08-23 15:51:23 +00:00
|
|
|
//
|
|
|
|
// Music Status
|
|
|
|
//
|
|
|
|
|
2018-08-23 16:30:47 +00:00
|
|
|
boolean S_DigMusicDisabled(void);
|
|
|
|
boolean S_MIDIMusicDisabled(void);
|
|
|
|
boolean S_MusicDisabled(void);
|
|
|
|
boolean S_MusicPlaying(void);
|
|
|
|
boolean S_MusicPaused(void);
|
2018-08-23 16:51:45 +00:00
|
|
|
musictype_t S_MusicType(void);
|
2018-08-23 20:46:40 +00:00
|
|
|
boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping);
|
2018-08-23 16:30:47 +00:00
|
|
|
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi);
|
|
|
|
#define S_DigExists(a) S_MusicExists(a, false, true)
|
|
|
|
#define S_MIDIExists(a) S_MusicExists(a, true, false)
|
|
|
|
|
2018-08-23 15:51:23 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Music Properties
|
|
|
|
//
|
|
|
|
|
|
|
|
// Set Speed of Music
|
|
|
|
boolean S_SpeedMusic(float speed);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Music Routines
|
|
|
|
//
|
|
|
|
|
2016-01-08 03:48:20 +00:00
|
|
|
// Start music track, arbitrary, given its name, and set whether looping
|
|
|
|
// note: music flags 12 bits for tracknum (gme, other formats with more than one track)
|
|
|
|
// 13-15 aren't used yet
|
2014-03-15 16:59:03 +00:00
|
|
|
// and the last bit we ignore (internal game flag for resetting music on reload)
|
2016-01-08 03:48:20 +00:00
|
|
|
#define S_ChangeMusicInternal(a,b) S_ChangeMusic(a,0,b)
|
|
|
|
void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Stops the music.
|
|
|
|
void S_StopMusic(void);
|
|
|
|
|
|
|
|
// Stop and resume music, during game PAUSE.
|
2016-01-08 03:48:20 +00:00
|
|
|
void S_PauseAudio(void);
|
|
|
|
void S_ResumeAudio(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Updates music & sounds
|
|
|
|
//
|
|
|
|
void S_UpdateSounds(void);
|
|
|
|
|
2016-06-12 19:58:03 +00:00
|
|
|
FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
void S_SetSfxVolume(INT32 volume);
|
2018-08-23 15:51:23 +00:00
|
|
|
void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume);
|
|
|
|
#define S_SetDigMusicVolume(a) S_SetMusicVolume(a,-1)
|
|
|
|
#define S_SetMIDIMusicVolume(a) S_SetMusicVolume(-1,a)
|
|
|
|
#define S_InitMusicVolume() S_SetMusicVolume(-1,-1)
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
INT32 S_OriginPlaying(void *origin);
|
|
|
|
INT32 S_IdPlaying(sfxenum_t id);
|
|
|
|
INT32 S_SoundPlaying(void *origin, sfxenum_t id);
|
|
|
|
|
|
|
|
void S_StartSoundName(void *mo, const char *soundname);
|
|
|
|
|
|
|
|
void S_StopSoundByID(void *origin, sfxenum_t sfx_id);
|
|
|
|
void S_StopSoundByNum(sfxenum_t sfxnum);
|
|
|
|
|
|
|
|
#ifndef HW3SOUND
|
|
|
|
#define S_StartAttackSound S_StartSound
|
|
|
|
#define S_StartScreamSound S_StartSound
|
|
|
|
#endif
|
|
|
|
|
2016-03-03 10:54:07 +00:00
|
|
|
#ifdef MUSICSLOT_COMPATIBILITY
|
|
|
|
// For compatibility with code/scripts relying on older versions
|
|
|
|
// This is a list of all the "special" slot names and their associated numbers
|
|
|
|
const char *compat_special_music_slots[16];
|
|
|
|
#endif
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
#endif
|