X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=sound.h;h=0162c37c72923a83a3494774e7fae5d55b6f54b6;hb=7fb8cfb8d7a076851563e7108d1bd1e1158ec3b6;hp=5c60c1e7f7d543966cc866886d8311098c22bdb1;hpb=847e897b6a32cbeeffd1b3d187ca4e437047cf79;p=xonotic%2Fdarkplaces.git diff --git a/sound.h b/sound.h index 5c60c1e7..0162c37c 100644 --- a/sound.h +++ b/sound.h @@ -45,6 +45,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct sfx_s sfx_t; +extern cvar_t mastervolume; extern cvar_t bgmvolume; extern cvar_t volume; extern cvar_t snd_initialized; @@ -66,13 +67,38 @@ void S_UnloadAllSounds_f (void); void S_Update(const matrix4x4_t *listenermatrix); void S_ExtraUpdate (void); -sfx_t *S_PrecacheSound (const char *sample, qboolean complain, qboolean lock); -void S_ServerSounds (char serversound [][MAX_QPATH], unsigned int numsounds); +sfx_t *S_PrecacheSound (const char *sample, qboolean complain, qboolean levelsound); +float S_SoundLength(const char *name); +void S_ClearUsed (void); void S_PurgeUnused (void); qboolean S_IsSoundPrecached (const sfx_t *sfx); +sfx_t *S_FindName(const char *name); + +// for sound() builtins +#define CHANFLAG_RELIABLE 1 + +// these define the "engine" channel namespace +#define CHAN_MIN_AUTO -128 +#define CHAN_MAX_AUTO 0 +#define CHAN_MIN_SINGLE 1 +#define CHAN_MAX_SINGLE 127 +#define IS_CHAN_AUTO(n) ((n) >= CHAN_MIN_AUTO && (n) <= CHAN_MAX_AUTO) +#define IS_CHAN_SINGLE(n) ((n) >= CHAN_MIN_SINGLE && (n) <= CHAN_MAX_SINGLE) +#define IS_CHAN(n) (IS_CHAN_AUTO(n) || IS_CHAN_SINGLE(n)) + +// engine channel == network channel +#define CHAN_ENGINE2NET(c) (c) +#define CHAN_NET2ENGINE(c) (c) + +// engine view of channel encodes the auto flag into the channel number (see CHAN_ constants below) +// user view uses the flags bitmask for it +#define CHAN_USER2ENGINE(c) (c) +#define CHAN_ENGINE2USER(c) (c) +#define CHAN_ENGINE2CVAR(c) (abs(c)) // S_StartSound returns the channel index, or -1 if an error occurred int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation); +int S_StartSound_StartPosition_Flags (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float startposition, int flags, float fspeed); qboolean S_LocalSound (const char *s); void S_StaticSound (sfx_t *sfx, vec3_t origin, float fvol, float attenuation); @@ -80,9 +106,12 @@ void S_StopSound (int entnum, int entchannel); void S_StopAllSounds (void); void S_PauseGameSounds (qboolean toggle); -void S_StopChannel (unsigned int channel_ind, qboolean lockmutex); +void S_StopChannel (unsigned int channel_ind, qboolean lockmutex, qboolean freesfx); qboolean S_SetChannelFlag (unsigned int ch_ind, unsigned int flag, qboolean value); void S_SetChannelVolume (unsigned int ch_ind, float fvol); +void S_SetChannelSpeed (unsigned int ch_ind, float fspeed); +float S_GetChannelPosition (unsigned int ch_ind); +float S_GetEntChannelPosition(int entnum, int entchannel); void S_BlockSound (void); void S_UnblockSound (void);