most of the hacking needed to break out the common code from snd_dma.c

This commit is contained in:
Bill Currie 2007-03-17 03:10:45 +00:00 committed by Jeff Teunissen
parent 0105754f6f
commit cde6e60848
16 changed files with 176 additions and 679 deletions

View file

@ -38,6 +38,8 @@
*/
//@{
#include "QF/plugin/snd_render.h"
#include "QF/quakeio.h"
#include "QF/sound.h"
#include "QF/zone.h"
@ -176,14 +178,42 @@ struct channel_s {
int oldphase; //!< phase shift between l-r in samples
};
extern struct cvar_s *snd_loadas8bit;
extern struct cvar_s *snd_volume;
extern struct cvar_s *snd_loadas8bit;
extern struct cvar_s *snd_volume;
extern struct cvar_s *snd_interp;
extern struct cvar_s *snd_stereo_phase_separation;
extern struct cvar_s *snd_interp;
extern struct cvar_s *snd_stereo_phase_separation;
extern volatile dma_t *snd_shm;
extern snd_render_data_t snd_render_data;
//@}
/** \defgroup sound_render_sfx Sound sfx
\ingroup sound_render_mix
*/
//@{
/** Pre-load a sound into the cache.
\param sample name of sound to precache
*/
sfx_t *SND_PrecacheSound (const char *sample);
/** Tag a cached sound to prevent it being flushed unnecessarily.
\param sample name of sound touch
\todo check that Cache_TryGet() does the right thing
*/
void SND_TouchSound (const char *sample);
/** Pre-load a sound.
\param name name of sound to load
*/
sfx_t *SND_LoadSound (const char *name);
/** Initialize the sfx sub-subsystem
*/
void SND_SFX_Init (void);
//@}
/** \defgroup sound_render_mix_channels Sound channels
@ -202,6 +232,78 @@ extern volatile dma_t *snd_shm;
#define MAX_DYNAMIC_CHANNELS 8 //!< number of dynamic channels
extern channel_t snd_channels[MAX_CHANNELS]; //!< pool of available channels
extern int snd_total_channels; //!< number of active channels
/** Allocate a sound channel that can be used for playing sounds.
*/
struct channel_s *SND_AllocChannel (void);
/** Stop a channel from playing.
\param chan the channel to stop
*/
void SND_ChannelStop (channel_t *chan);
/** Disable ambient sounds.
\todo not used, remove?
*/
void SND_AmbientOff (void);
/** Enable ambient sounds.
\todo not used, remove?
*/
void SND_AmbientOn (void);
/** Update the sound engine with the client's position and orientation and
render some sound.
\param origin 3d coords of the client
\param v_forward 3d vector of the client's facing direction
\param v_right 3d vector of the client's rightward direction
\param v_up 3d vector of the client's upward direction
*/
void SND_SetListener (const vec3_t origin, const vec3_t v_forward,
const vec3_t v_right, const vec3_t v_up);
/** Stop all sounds from playing.
*/
void SND_StopAllSounds(void);
/** Initialize the channels sub-subsystem
*/
void SND_Channels_Init (void);
/** Start a sound playing.
\param entnum index of entity the sound is associated with.
\param entchannel 0-7
- 0 auto (never willingly overrides)
- 1 weapon
- 2 voice
- 3 item
- 4 body
\param sfx sound to play
\param origin 3d coords of where the sound originates
\param fvol absolute volume of the sound
\param attenuation rate of volume dropoff vs distance
*/
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
float fvol, float attenuation);
/** Create a sound generated by the world.
\param sfx sound to play
\param origin 3d coords of where the sound originates
\param vol absolute volume of the sound
\param attenuation rate of volume dropoff vs distance
*/
void SND_StaticSound (sfx_t *sfx, const vec3_t origin, float vol,
float attenuation);
/** Stop an entity's sound.
\param entnum index of entity the sound is associated with.
\param entchannel channel to silence
*/
void SND_StopSound (int entnum, int entchannel);
/** Start a sound local to the client view.
\param s name of sound to play
*/
void SND_LocalSound (const char *s);
//@}