29 #ifndef __SND_LOCAL_H__
30 #define __SND_LOCAL_H__
34 #include "../openal/include/al.h"
35 #include "../openal/include/alc.h"
36 #include "../openal/idal.h"
38 #define ID_ALCHAR (ALubyte *)
39 #elif defined( MACOS_X )
40 #include <OpenAL/al.h>
41 #include <OpenAL/alc.h>
48 #include "../openal/include/efxlib.h"
94 #pragma pack (push, 1)
135 #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
136 ( (dword)(byte)(ch0) | ( (dword)(byte)(ch1) << 8 ) | \
137 ( (dword)(byte)(ch2) << 16 ) | ( (dword)(byte)(ch3) << 24 ) )
140 #define fourcc_riff mmioFOURCC('R', 'I', 'F', 'F')
190 int Read(
byte* pBuffer,
int dwSizeToRead,
int *pdwSizeRead );
221 int ReadOGG(
byte* pBuffer,
int dwSizeToRead,
int *pdwSizeRead );
242 virtual bool Lock(
void **pDSLockedBuffer,
ulong *dwDSLockedBufferSize ) = 0;
243 virtual bool Unlock(
void *pDSLockedBuffer,
dword dwDSLockedBufferSize ) = 0;
248 virtual bool Flush(
void ) = 0;
250 virtual void Write(
bool flushing ) = 0;
269 virtual int Stop(
void ) = 0;
270 virtual int Reset(
void ) = 0;
343 void SetParms(
float p1 = 0,
float p2 = 0,
float p3 = 0 );
446 virtual void Free(
bool immediate );
466 virtual int Index(
void )
const;
570 virtual void FadeSoundClasses(
const int soundClass,
const float to,
const float over );
583 virtual void Pause(
void );
588 virtual void AVIOpen(
const char *
path,
const char *name );
619 int current44kHz,
int numSpeakers,
float *finalMixBuffer );
620 void MixLoop(
int current44kHz,
int numSpeakers,
float *finalMixBuffer );
683 virtual void Init(
void );
691 virtual bool InitHW(
void );
698 virtual int AsyncMix(
int soundTime,
float *mixBuffer );
700 virtual void SetMute(
bool mute );
726 float dB2Scale(
const float val )
const;
730 void DoEnviroSuit(
float* samples,
int numSamples,
int numSpeakers );
862 void Reload(
bool force );
879 static void Init(
void );
887 virtual void Decode(
idSoundSample *sample,
int sampleOffset44k,
int sampleCount44k,
float *dest ) = 0;
idSlowChannel GetSlowChannel(const idSoundChannel *chan)
idSoundWorldLocal * currentSoundWorld
static idCVar s_force22kHz
idSoundChannel channels[SOUND_MAX_CHANNELS]
virtual void SetPlayingSoundWorld(idSoundWorld *soundWorld)
void GetContinuitySamples(float &in1, float &in2, float &out1, float &out2)
virtual int AsyncUpdate(int time)
waveformatextensible_t mpwfx
void SetChannel(int chan)
virtual bool Initialize()=0
static idSampleDecoder * Alloc(void)
virtual bool Flush(void)=0
const idSoundShader * soundShader
EAXGetBufferMode alEAXGetBufferMode
static idCVar s_enviroSuitCutoffFreq
static idCVar s_meterTopTime
virtual idSoundEmitter * EmitterForIndex(int index)
float continuitySamples[4]
virtual void ClearBuffer(void)
virtual bool CurrentlyPlaying(void) const
idSoundFade soundClassFade[SOUND_MAX_CLASSES]
void ForegroundUpdate(int currentTime)
virtual void Free(bool immediate)
idList< idSoundEmitterLocal * > emitters
static idCVar s_reverbTime
waveformat_s waveformat_t
const idSoundChannel * chan
bool FetchFromCache(int offset, const byte **output, int *position, int *size, const bool allowIO)
virtual void ProcessSample(float *in, float *out)
static idCVar s_numberOfSpeakers
const int GetNumObjects(void)
virtual bool Lock(void **pDSLockedBuffer, ulong *dwDSLockedBufferSize)=0
void GatherChannelSamples(int sampleOffset44k, int sampleCount44k, float *dest)
int listenerEnvironmentID
virtual void UpdateEmitter(const idVec3 &origin, int listenerId, const soundShaderParms_t *parms)
const int MIXBUFFER_SAMPLES
float dB2Scale(const float val) const
struct waveformatex_s PACKED
union waveformatextensible_s::@96 Samples
float FindAmplitude(idSoundEmitterLocal *sound, const int localTime, const idVec3 *listenerPosition, const s_channelType channel, bool shakesOnly)
void FreeOpenALSource(ALuint handle)
virtual void WriteToSaveGameSoundChannel(idFile *saveGame, idSoundChannel *ch)
virtual void StopWritingDemo(void)
virtual void ProcessSample(float *in, float *out)
virtual float CurrentShakeAmplitudeForPosition(const int time, const idVec3 &listererPosition)
virtual idSoundSample * GetSample(void) const =0
static int GetNumUsedBlocks(void)
virtual void ReadFromSaveGame(idFile *savefile)
static idCVar s_libOpenAL
virtual ~idSampleDecoder(void)
virtual void FadeSound(const s_channelType channel, float to, float over)
virtual cinData_t ImageForTime(const int milliseconds, const bool waveform)
int MillisecondsToSamples(int ms) const
static idCVar s_skipHelltimeFX
int GetCurrent44kHzTime(void) const
void ReloadSounds(bool force)
void DoEnviroSuit(float *samples, int numSamples, int numSpeakers)
virtual void ClearDecoder(void)=0
virtual void ModifySound(const s_channelType channel, const soundShaderParms_t *parms)
static idCVar s_spatializationDecay
void ResolveOrigin(const int stackDepth, const soundPortalTrace_t *prevStack, const int soundArea, const float dist, const idVec3 &soundOrigin, idSoundEmitterLocal *def)
ALuint lastopenalStreamingBuffer[3]
idAudioHardware * snd_audio_hw
static idCVar s_slowAttenuate
virtual idSoundEmitter * AllocSoundEmitter(void)
static idCVar s_muteEAXReverb
void SetSlowChannel(const idSoundChannel *chan, idSlowChannel slow)
FracTime GetCurrentPosition()
idSoundSample * FindSound(const idStr &fname, bool loadOnDemandOnly)
waveformatex_s waveformatex_t
virtual idSoundWorld * AllocSoundWorld(idRenderWorld *rw)
static idCVar s_decompressionLimit
virtual int GetNumberOfSpeakers(void)=0
idSoundEmitterLocal(void)
static idCVar s_useOcclusion
static idCVar s_quadraticFalloff
int Open(const char *strFileName, waveformatex_t *pwfx=NULL)
virtual int Play(dword dwPriority=0, dword dwFlags=0)=0
static idCVar s_playDefaultSound
idList< idSoundSample * > listCache
virtual bool Unlock(void *pDSLockedBuffer, dword dwDSLockedBufferSize)=0
const int ROOM_SLICES_IN_BUFFER
virtual void Shutdown(void)
unsigned ALuint
OpenAL 32bit unsigned integer type.
virtual void Initialize()
virtual void ProcessDemoCommand(idDemoFile *readDemo)
int LengthIn44kHzSamples() const
void SetParms(float p1=0, float p2=0, float p3=0)
unsigned int ALsizei
OpenAL 32bit type.
virtual void FadeSoundClasses(const int soundClass, const float to, const float over)
virtual void SetSlowmoSpeed(float speed)
void CheckForCompletion(int current44kHzTime)
virtual void SetEnviroSuit(bool active)
static int GetUsedBlockMemory(void)
void ResetSlowChannel(const idSoundChannel *chan)
virtual void Initialize()
virtual void StopAllSounds(void)
void PrintMemInfo(MemInfo_t *mi)
virtual int Reset(void)=0
const struct soundPortalTrace_s * prevStack
void Init(idRenderWorld *rw)
static void Shutdown(void)
virtual int IsEAXAvailable(void)
void MixLoop(int current44kHz, int numSpeakers, float *finalMixBuffer)
virtual void UnPause(void)
idSlowChannel slowChannels[SOUND_MAX_CHANNELS]
int OpenFromMemory(short *pbData, int ulDataSize, waveformatextensible_t *pwfx)
void AddChannelContribution(idSoundEmitterLocal *sound, idSoundChannel *chan, int current44kHz, int numSpeakers, float *finalMixBuffer)
SoundFX_LowpassFast lowpass
idSampleDecoder * decoder
virtual void SetMute(bool mute)
static idCVar s_enviroSuitCutoffQ
int OpenOGG(const char *strFileName, waveformatex_t *pwfx=NULL)
static idCVar s_constantAmplitude
removeStatus_t removeStatus
static idCVar s_useOpenAL
static idCVar s_reverbFeedback
void CalcEars(int numSpeakers, idVec3 realOrigin, idVec3 listenerPos, idMat3 listenerAxis, float ears[6], float spatialize)
ALuint openalStreamingOffset
static void Free(idSampleDecoder *decoder)
virtual bool GetCurrentPosition(ulong *pdwCurrentWriteCursor)=0
virtual bool IsPaused(void)
idList< SoundFX * > fxList
virtual bool InitHW(void)
idSoundEmitterLocal * AllocLocalSoundEmitter()
virtual void WriteToSaveGameSoundShaderParams(idFile *saveGame, soundShaderParms_t *params)
void SetParameter(float val)
virtual void StartWritingDemo(idDemoFile *demo)
virtual bool IsSoundPlaying(void)=0
static idCVar s_drawSounds
static idCVar s_clipVolumes
int Read(byte *pBuffer, int dwSizeToRead, int *pdwSizeRead)
struct soundPortalTrace_s soundPortalTrace_t
virtual void EndLevelLoad(const char *mapString)
waveformatextensible_s waveformatextensible_t
static idCVar s_showLevelMeter
idSoundSample * leadinSample
void AttachSoundChannel(const idSoundChannel *chan)
virtual short * GetMixBuffer(void)=0
virtual ~idSoundWorldLocal(void)
virtual void ProcessSample(float *in, float *out)=0
virtual void StopSound(const s_channelType channel)
virtual int GetLastDecodeTime(void) const =0
pcmwaveformat_s pcmwaveformat_t
idSoundEmitterLocal * localSound
virtual int StartSound(const idSoundShader *shader, const s_channelType channel, float diversity=0, int shaderFlags=0, bool allowSlow=true)
virtual void BeginLevelLoad(void)
static idCVar s_doorDistanceAdd
static idCVar s_useEAXReverb
EAXSetBufferMode alEAXSetBufferMode
static idCVar s_enviroSuitSkipLowpass
idSoundSystemLocal soundSystemLocal
virtual void ClearAllSoundEmitters(void)
static idCVar s_minVolume2
virtual void PlaceListener(const idVec3 &origin, const idMat3 &axis, const int listenerId, const int gameTime, const idStr &areaName)
void GatherChannelSamples(int sampleOffset44k, int sampleCount44k, float *dest) const
void GenerateSlowChannel(FracTime &playPos, int sampleCount44k, float *finalBuffer)
float realAccum[6 *MIXBUFFER_SAMPLES+16]
virtual void ReadFromSaveGameSoundShaderParams(idFile *saveGame, soundShaderParms_t *params)
ID_TIME_T GetNewTimeStamp(void) const
virtual int GetMixBufferSize(void)=0
virtual void Write(bool flushing)=0
static idCVar s_enviroSuitVolumeScale
static idCVar s_maxSoundsPerShader
idSoundCache * soundCache
openalSource_t openalSources[256]
void SetContinuitySamples(float in1, float in2, float out1, float out2)
const idSoundSample * GetObject(const int index) const
virtual idSoundWorld * GetPlayingSoundWorld(void)
ALuint openalStreamingBuffer[3]
virtual void ReadFromSaveGameSoundChannel(idFile *saveGame, idSoundChannel *ch)
virtual void PlayShaderDirectly(const char *name, int channel=-1)
virtual int Index(void) const
virtual void SetSlowmo(bool active)
const int SOUND_DECODER_FREE_DELAY
virtual bool ShutdownHW(void)
static idCVar s_globalFraction
static idCVar s_subFraction
virtual void Decode(idSoundSample *sample, int sampleOffset44k, int sampleCount44k, float *dest)=0
virtual int AsyncMix(int soundTime, float *mixBuffer)
ALsizei openalSourceCount
void CheckForDownSample()
virtual ~idSoundEmitterLocal(void)
int SamplesToMilliseconds(int samples) const
ALuint AllocOpenALSource(idSoundChannel *chan, bool looping, bool stereo)
ALCcontext * openalContext
int GetSoundDecoderInfo(int index, soundDecoderInfo_t &decoderInfo)
static idAudioHardware * Alloc()
waveformatex_t objectInfo
virtual void AVIClose(void)
static idCVar s_showStartSound
void OverrideParms(const soundShaderParms_t *base, const soundShaderParms_t *over, soundShaderParms_t *out)
virtual int AsyncUpdateWrite(int time)
bool mbIsReadingFromMemory
virtual void WriteToSaveGame(idFile *savefile)
const int SOUND_MAX_CLASSES
virtual void SetVolume(float x)=0
idSoundWorldLocal * soundWorld
virtual void ProcessSample(float *in, float *out)
void Spatialize(idVec3 listenerPos, int listenerArea, idRenderWorld *rw)
static idCVar s_realTimeDecoding
int ReadOGG(byte *pBuffer, int dwSizeToRead, int *pdwSizeRead)
virtual void AVIOpen(const char *path, const char *name)
virtual void PrintMemInfo(MemInfo_t *mi)
s_channelType triggerChannel
float FadeDbAt44kHz(int current44kHz)
static idCVar s_enviroSuitSkipReverb
virtual ~idAudioHardware()
static idCVar s_singleEmitter
static idCVar s_minVolume6
const int SOUND_MAX_CHANNELS
virtual float CurrentAmplitude(void)
void OffsetSoundTime(int offset44kHz)
GLenum const GLfloat * params
void Increment(float val)
unsigned int nextWriteBlock