26#include "../qcommon/q_shared.h"
27#include "../qcommon/qcommon.h"
28#include "snd_public.h"
30#if defined(NO_MODERN_DMA) && NO_MODERN_DMA
32#define PAINTBUFFER_SIZE 4096
34#define SND_CHUNK_SIZE 1024
35#define SND_CHUNK_SIZE_FLOAT (SND_CHUNK_SIZE/2)
36#define SND_CHUNK_SIZE_BYTE (SND_CHUNK_SIZE*2)
46} portable_samplepair_t;
48typedef struct adpcm_state {
53typedef struct sndBuffer_s {
54 short sndChunk[SND_CHUNK_SIZE];
55 struct sndBuffer_s *next;
62 qboolean defaultSound;
64 qboolean soundCompressed;
65 int soundCompressionMethod;
68 char soundName[MAX_QPATH];
84#define START_SAMPLE_IMMEDIATE 0x7fffffff
86#define MAX_DOPPLER_SCALE 50.0f
88#define THIRD_PERSON_THRESHOLD_SQ (48.0f*48.0f)
90typedef struct loopSound_s {
99 float oldDopplerScale;
113 float oldDopplerScale;
115 qboolean fixed_origin;
122#define WAV_FORMAT_PCM 1
137 void (*Shutdown)(void);
138 void (*StartSound)( vec3_t origin,
int entnum,
int entchannel, sfxHandle_t sfx );
139 void (*StartLocalSound)( sfxHandle_t sfx,
int channelNum );
140 void (*StartBackgroundTrack)(
const char *intro,
const char *loop );
141 void (*StopBackgroundTrack)( void );
142 void (*RawSamples)(
int stream,
int samples,
int rate,
int width,
int channels,
const byte *data,
float volume,
int entityNum);
143 void (*StopAllSounds)( void );
144 void (*ClearLoopingSounds)( qboolean killall );
145 void (*AddLoopingSound)(
int entityNum,
const vec3_t origin,
const vec3_t velocity, sfxHandle_t sfx );
146 void (*AddRealLoopingSound)(
int entityNum,
const vec3_t origin,
const vec3_t velocity, sfxHandle_t sfx );
147 void (*StopLoopingSound)(
int entityNum );
148 void (*Respatialize)(
int entityNum,
const vec3_t origin, vec3_t axis[3],
int inwater );
149 void (*UpdateEntityPosition)(
int entityNum,
const vec3_t origin );
150 void (*Update)( void );
151 void (*DisableSounds)( void );
152 void (*BeginRegistration)( void );
153 sfxHandle_t (*RegisterSound)(
const char *sample, qboolean compressed );
154 void (*ClearSoundBuffer)( void );
155 void (*SoundInfo)( void );
156 void (*SoundList)( void );
158 void (*StartCapture)( void );
159 int (*AvailableCaptureSamples)( void );
160 void (*Capture)(
int samples,
byte *data );
161 void (*StopCapture)( void );
162 void (*MasterGain)(
float gain );
176qboolean SNDDMA_Init(
void);
179int SNDDMA_GetDMAPos(
void);
182void SNDDMA_Shutdown(
void);
184void SNDDMA_BeginPainting (
void);
186void SNDDMA_Submit(
void);
189void SNDDMA_StartCapture(
void);
190int SNDDMA_AvailableCaptureSamples(
void);
191void SNDDMA_Capture(
int samples,
byte *data);
192void SNDDMA_StopCapture(
void);
193void SNDDMA_MasterGain(
float val);
199#define MAX_CHANNELS 96
201extern channel_t s_channels[MAX_CHANNELS];
202extern channel_t loop_channels[MAX_CHANNELS];
203extern int numLoopChannels;
205extern int s_paintedtime;
206extern vec3_t listener_forward;
207extern vec3_t listener_right;
208extern vec3_t listener_up;
211#define MAX_RAW_SAMPLES 16384
212#define MAX_RAW_STREAMS (MAX_CLIENTS * 2 + 1)
213extern portable_samplepair_t s_rawsamples[MAX_RAW_STREAMS][MAX_RAW_SAMPLES];
214extern int s_rawend[MAX_RAW_STREAMS];
216extern cvar_t *s_volume;
217extern cvar_t *s_musicVolume;
218extern cvar_t *s_muted;
219extern cvar_t *s_doppler;
221extern cvar_t *s_testsound;
223qboolean S_LoadSound( sfx_t *sfx );
225void SND_free(sndBuffer *v);
226sndBuffer* SND_malloc(
void );
227void SND_setup(
void );
228void SND_shutdown(
void);
230void S_PaintChannels(
int endtime);
232void S_memoryLoad(sfx_t *sfx);
235void S_Spatialize(channel_t *ch);
238int S_AdpcmMemoryNeeded(
const wavinfo_t *info );
239void S_AdpcmEncodeSound( sfx_t *sfx,
short *samples );
240void S_AdpcmGetSamples(sndBuffer *chunk,
short *to);
244#define SENTINEL_MULAW_ZERO_RUN 127
245#define SENTINEL_MULAW_FOUR_BIT_RUN 126
247qboolean S_FreeOldestSound(
void );
251void encodeWavelet(sfx_t *sfx,
short *packets);
252void decodeWavelet( sndBuffer *stream,
short *packets);
254void encodeMuLaw( sfx_t *sfx,
short *packets);
255extern short mulawToShort[256];
257extern short *sfxScratchBuffer;
258extern sfx_t *sfxScratchPointer;
259extern int sfxScratchIndex;
261qboolean S_Base_Init( soundInterface_t *si );
273typedef int srcHandle_t;
275qboolean S_AL_Init( soundInterface_t *si );
278void S_PaintChannelFrom16_altivec( portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE],
int snd_vol, channel_t *ch,
const sfx_t *sc,
int count,
int sampleOffset,
int bufferOffset );
281#include "new/snd_local_new.h"
288# include "snd_local_new.h"
Definition snd_dma_new.cpp:28
Definition snd_local_new.h:68
Definition snd_local_new.h:55