vkQuake2 doxygen  1.0 dev
snd_loc.h File Reference

Go to the source code of this file.

Classes

struct  portable_samplepair_t
 
struct  sfxcache_t
 
struct  sfx_s
 
struct  playsound_s
 
struct  dma_t
 
struct  channel_t
 
struct  wavinfo_t
 

Macros

#define MAX_CHANNELS   32
 
#define MAX_RAW_SAMPLES   8192
 

Typedefs

typedef struct sfx_s sfx_t
 
typedef struct playsound_s playsound_t
 

Functions

int SNDDMA_Init (void)
 
int SNDDMA_GetDMAPos (void)
 
void SNDDMA_Shutdown (void)
 
void SNDDMA_BeginPainting (void)
 
void SNDDMA_Submit (void)
 
wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength)
 
void S_InitScaletable (void)
 
sfxcache_tS_LoadSound (sfx_t *s)
 
void S_IssuePlaysound (playsound_t *ps)
 
void S_PaintChannels (int endtime)
 
channel_tS_PickChannel (int entnum, int entchannel)
 
void S_Spatialize (channel_t *ch)
 

Variables

channel_t channels [MAX_CHANNELS]
 
int paintedtime
 
int s_rawend
 
vec3_t listener_origin
 
vec3_t listener_forward
 
vec3_t listener_right
 
vec3_t listener_up
 
dma_t dma
 
playsound_t s_pendingplays
 
portable_samplepair_t s_rawsamples [MAX_RAW_SAMPLES]
 
cvar_ts_volume
 
cvar_ts_nosound
 
cvar_ts_loadas8bit
 
cvar_ts_khz
 
cvar_ts_show
 
cvar_ts_mixahead
 
cvar_ts_testsound
 
cvar_ts_primary
 

Macro Definition Documentation

◆ MAX_CHANNELS

#define MAX_CHANNELS   32

Definition at line 126 of file snd_loc.h.

◆ MAX_RAW_SAMPLES

#define MAX_RAW_SAMPLES   8192

Definition at line 138 of file snd_loc.h.

Typedef Documentation

◆ playsound_t

typedef struct playsound_s playsound_t

◆ sfx_t

typedef struct sfx_s sfx_t

Function Documentation

◆ GetWavinfo()

wavinfo_t GetWavinfo ( char *  name,
byte wav,
int  wavlength 
)

Definition at line 267 of file snd_mem.c.

268 {
269  wavinfo_t info;
270  int i;
271  int format;
272  int samples;
273 
274  memset (&info, 0, sizeof(info));
275 
276  if (!wav)
277  return info;
278 
279  iff_data = wav;
280  iff_end = wav + wavlength;
281 
282 // find "RIFF" chunk
283  FindChunk("RIFF");
284  if (!(data_p && !strncmp(data_p+8, "WAVE", 4)))
285  {
286  Com_Printf("Missing RIFF/WAVE chunks\n");
287  return info;
288  }
289 
290 // get "fmt " chunk
291  iff_data = data_p + 12;
292 // DumpChunks ();
293 
294  FindChunk("fmt ");
295  if (!data_p)
296  {
297  Com_Printf("Missing fmt chunk\n");
298  return info;
299  }
300  data_p += 8;
302  if (format != 1)
303  {
304  Com_Printf("Microsoft PCM format only\n");
305  return info;
306  }
307 
308  info.channels = GetLittleShort();
309  info.rate = GetLittleLong();
310  data_p += 4+2;
311  info.width = GetLittleShort() / 8;
312 
313 // get cue chunk
314  FindChunk("cue ");
315  if (data_p)
316  {
317  data_p += 32;
318  info.loopstart = GetLittleLong();
319 // Com_Printf("loopstart=%d\n", sfx->loopstart);
320 
321  // if the next chunk is a LIST chunk, look for a cue length marker
322  FindNextChunk ("LIST");
323  if (data_p)
324  {
325  if (!strncmp (data_p + 28, "mark", 4))
326  { // this is not a proper parse, but it works with cooledit...
327  data_p += 24;
328  i = GetLittleLong (); // samples in loop
329  info.samples = info.loopstart + i;
330 // Com_Printf("looped length: %i\n", i);
331  }
332  }
333  }
334  else
335  info.loopstart = -1;
336 
337 // find data chunk
338  FindChunk("data");
339  if (!data_p)
340  {
341  Com_Printf("Missing data chunk\n");
342  return info;
343  }
344 
345  data_p += 4;
346  samples = GetLittleLong () / info.width;
347 
348  if (info.samples)
349  {
350  if (samples < info.samples)
351  Com_Error (ERR_DROP, "Sound %s has a bad loop length", name);
352  }
353  else
354  info.samples = samples;
355 
356  info.dataofs = data_p - wav;
357 
358  return info;
359 }

Referenced by S_LoadSound().

◆ S_InitScaletable()

void S_InitScaletable ( void  )

Definition at line 350 of file snd_mix.c.

351 {
352  int i, j;
353  int scale;
354 
355  s_volume->modified = false;
356  for (i=0 ; i<32 ; i++)
357  {
358  scale = i * 8 * 256 * s_volume->value;
359  for (j=0 ; j<256 ; j++)
360  snd_scaletable[i][j] = ((signed char)j) * scale;
361  }
362 }

Referenced by S_Init(), and S_Update().

◆ S_IssuePlaysound()

void S_IssuePlaysound ( playsound_t ps)

Definition at line 550 of file snd_dma.c.

551 {
552  channel_t *ch;
553  sfxcache_t *sc;
554 
555  if (s_show->value)
556  Com_Printf ("Issue %i\n", ps->begin);
557  // pick a channel to play on
558  ch = S_PickChannel(ps->entnum, ps->entchannel);
559  if (!ch)
560  {
561  S_FreePlaysound (ps);
562  return;
563  }
564 
565  // spatialize
566  if (ps->attenuation == ATTN_STATIC)
567  ch->dist_mult = ps->attenuation * 0.001;
568  else
569  ch->dist_mult = ps->attenuation * 0.0005;
570  ch->master_vol = ps->volume;
571  ch->entnum = ps->entnum;
572  ch->entchannel = ps->entchannel;
573  ch->sfx = ps->sfx;
574  VectorCopy (ps->origin, ch->origin);
575  ch->fixed_origin = ps->fixed_origin;
576 
577  S_Spatialize(ch);
578 
579  ch->pos = 0;
580  sc = S_LoadSound (ch->sfx);
581  ch->end = paintedtime + sc->length;
582 
583  // free the playsound
584  S_FreePlaysound (ps);
585 }

Referenced by S_PaintChannels().

◆ S_LoadSound()

sfxcache_t* S_LoadSound ( sfx_t s)

Definition at line 99 of file snd_mem.c.

100 {
101  char namebuffer[MAX_QPATH];
102  byte *data;
103  wavinfo_t info;
104  int len;
105  float stepscale;
106  sfxcache_t *sc;
107  int size;
108  char *name;
109 
110  if (s->name[0] == '*')
111  return NULL;
112 
113 // see if still in memory
114  sc = s->cache;
115  if (sc)
116  return sc;
117 
118 //Com_Printf ("S_LoadSound: %x\n", (int)stackbuf);
119 // load it in
120  if (s->truename)
121  name = s->truename;
122  else
123  name = s->name;
124 
125  if (name[0] == '#')
126  strcpy(namebuffer, &name[1]);
127  else
128  Com_sprintf (namebuffer, sizeof(namebuffer), "sound/%s", name);
129 
130 // Com_Printf ("loading %s\n",namebuffer);
131 
132  size = FS_LoadFile (namebuffer, (void **)&data);
133 
134  if (!data)
135  {
136  Com_DPrintf ("Couldn't load %s\n", namebuffer);
137  return NULL;
138  }
139 
140  info = GetWavinfo (s->name, data, size);
141  if (info.channels != 1)
142  {
143  Com_Printf ("%s is a stereo sample\n",s->name);
144  FS_FreeFile (data);
145  return NULL;
146  }
147 
148  stepscale = (float)info.rate / dma.speed;
149  len = info.samples / stepscale;
150 
151  len = len * info.width * info.channels;
152 
153  sc = s->cache = Z_Malloc (len + sizeof(sfxcache_t));
154  if (!sc)
155  {
156  FS_FreeFile (data);
157  return NULL;
158  }
159 
160  sc->length = info.samples;
161  sc->loopstart = info.loopstart;
162  sc->speed = info.rate;
163  sc->width = info.width;
164  sc->stereo = info.channels;
165 
166  ResampleSfx (s, sc->speed, sc->width, data + info.dataofs);
167 
168  FS_FreeFile (data);
169 
170  return sc;
171 }

Referenced by S_EndRegistration(), S_IssuePlaysound(), S_PaintChannels(), S_RegisterSound(), and S_StartSound().

◆ S_PaintChannels()

void S_PaintChannels ( int  endtime)

Definition at line 224 of file snd_mix.c.

225 {
226  int i;
227  int end;
228  channel_t *ch;
229  sfxcache_t *sc;
230  int ltime, count;
231  playsound_t *ps;
232 
233  snd_vol = s_volume->value*256;
234 
235 //Com_Printf ("%i to %i\n", paintedtime, endtime);
236  while (paintedtime < endtime)
237  {
238  // if paintbuffer is smaller than DMA buffer
239  end = endtime;
240  if (endtime - paintedtime > PAINTBUFFER_SIZE)
242 
243  // start any playsounds
244  while (1)
245  {
246  ps = s_pendingplays.next;
247  if (ps == &s_pendingplays)
248  break; // no more pending sounds
249  if (ps->begin <= paintedtime)
250  {
251  S_IssuePlaysound (ps);
252  continue;
253  }
254 
255  if (ps->begin < end)
256  end = ps->begin; // stop here
257  break;
258  }
259 
260  // clear the paint buffer
261  if (s_rawend < paintedtime)
262  {
263 // Com_Printf ("clear\n");
264  memset(paintbuffer, 0, (end - paintedtime) * sizeof(portable_samplepair_t));
265  }
266  else
267  { // copy from the streaming sound source
268  int s;
269  int stop;
270 
271  stop = (end < s_rawend) ? end : s_rawend;
272 
273  for (i=paintedtime ; i<stop ; i++)
274  {
275  s = i&(MAX_RAW_SAMPLES-1);
277  }
278 // if (i != end)
279 // Com_Printf ("partial stream\n");
280 // else
281 // Com_Printf ("full stream\n");
282  for ( ; i<end ; i++)
283  {
286  }
287  }
288 
289 
290  // paint in the channels.
291  ch = channels;
292  for (i=0; i<MAX_CHANNELS ; i++, ch++)
293  {
294  ltime = paintedtime;
295 
296  while (ltime < end)
297  {
298  if (!ch->sfx || (!ch->leftvol && !ch->rightvol) )
299  break;
300 
301  // max painting is to the end of the buffer
302  count = end - ltime;
303 
304  // might be stopped by running out of data
305  if (ch->end - ltime < count)
306  count = ch->end - ltime;
307 
308  sc = S_LoadSound (ch->sfx);
309  if (!sc)
310  break;
311 
312  if (count > 0 && ch->sfx)
313  {
314  if (sc->width == 1)// FIXME; 8 bit asm is wrong now
315  S_PaintChannelFrom8(ch, sc, count, ltime - paintedtime);
316  else
317  S_PaintChannelFrom16(ch, sc, count, ltime - paintedtime);
318 
319  ltime += count;
320  }
321 
322  // if at end of loop, restart
323  if (ltime >= ch->end)
324  {
325  if (ch->autosound)
326  { // autolooping sounds always go back to start
327  ch->pos = 0;
328  ch->end = ltime + sc->length;
329  }
330  else if (sc->loopstart >= 0)
331  {
332  ch->pos = sc->loopstart;
333  ch->end = ltime + sc->length - ch->pos;
334  }
335  else
336  { // channel just stopped
337  ch->sfx = NULL;
338  }
339  }
340  }
341 
342  }
343 
344  // transfer out according to DMA format
346  paintedtime = end;
347  }
348 }

Referenced by S_Update_().

◆ S_PickChannel()

channel_t* S_PickChannel ( int  entnum,
int  entchannel 
)

Definition at line 375 of file snd_dma.c.

376 {
377  int ch_idx;
378  int first_to_die;
379  int life_left;
380  channel_t *ch;
381 
382  if (entchannel<0)
383  Com_Error (ERR_DROP, "S_PickChannel: entchannel<0");
384 
385 // Check for replacement sound, or find the best one to replace
386  first_to_die = -1;
387  life_left = 0x7fffffff;
388  for (ch_idx=0 ; ch_idx < MAX_CHANNELS ; ch_idx++)
389  {
390  if (entchannel != 0 // channel 0 never overrides
391  && channels[ch_idx].entnum == entnum
392  && channels[ch_idx].entchannel == entchannel)
393  { // always override sound from same entity
394  first_to_die = ch_idx;
395  break;
396  }
397 
398  // don't let monster sounds override player sounds
399  if (channels[ch_idx].entnum == cl.playernum+1 && entnum != cl.playernum+1 && channels[ch_idx].sfx)
400  continue;
401 
402  if (channels[ch_idx].end - paintedtime < life_left)
403  {
404  life_left = channels[ch_idx].end - paintedtime;
405  first_to_die = ch_idx;
406  }
407  }
408 
409  if (first_to_die == -1)
410  return NULL;
411 
412  ch = &channels[first_to_die];
413  memset (ch, 0, sizeof(*ch));
414 
415  return ch;
416 }

Referenced by S_AddLoopSounds(), and S_IssuePlaysound().

◆ S_Spatialize()

void S_Spatialize ( channel_t ch)

Definition at line 477 of file snd_dma.c.

478 {
479  vec3_t origin;
480 
481  // anything coming from the view entity will always be full volume
482  if (ch->entnum == cl.playernum+1)
483  {
484  ch->leftvol = ch->master_vol;
485  ch->rightvol = ch->master_vol;
486  return;
487  }
488 
489  if (ch->fixed_origin)
490  {
491  VectorCopy (ch->origin, origin);
492  }
493  else
494  CL_GetEntitySoundOrigin (ch->entnum, origin);
495 
496  S_SpatializeOrigin (origin, ch->master_vol, ch->dist_mult, &ch->leftvol, &ch->rightvol);
497 }

Referenced by S_IssuePlaysound(), and S_Update().

◆ SNDDMA_BeginPainting()

void SNDDMA_BeginPainting ( void  )

Definition at line 707 of file snd_win.c.

708 {
709  int reps;
710  DWORD dwSize2;
711  DWORD *pbuf, *pbuf2;
712  HRESULT hresult;
713  DWORD dwStatus;
714 
715  if (!pDSBuf)
716  return;
717 
718  // if the buffer was lost or stopped, restore it and/or restart it
719  if (pDSBuf->lpVtbl->GetStatus (pDSBuf, &dwStatus) != DS_OK)
720  Com_Printf ("Couldn't get sound buffer status\n");
721 
722  if (dwStatus & DSBSTATUS_BUFFERLOST)
723  pDSBuf->lpVtbl->Restore (pDSBuf);
724 
725  if (!(dwStatus & DSBSTATUS_PLAYING))
726  pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING);
727 
728  // lock the dsound buffer
729 
730  reps = 0;
731  dma.buffer = NULL;
732 
733  while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pbuf, &locksize,
734  &pbuf2, &dwSize2, 0)) != DS_OK)
735  {
736  if (hresult != DSERR_BUFFERLOST)
737  {
738  Com_Printf( "S_TransferStereo16: Lock failed with error '%s'\n", DSoundError( hresult ) );
739  S_Shutdown ();
740  return;
741  }
742  else
743  {
744  pDSBuf->lpVtbl->Restore( pDSBuf );
745  }
746 
747  if (++reps > 2)
748  return;
749  }
750  dma.buffer = (unsigned char *)pbuf;
751 }

Referenced by S_ClearBuffer(), and S_Update_().

◆ SNDDMA_GetDMAPos()

int SNDDMA_GetDMAPos ( void  )

Definition at line 674 of file snd_win.c.

675 {
676  MMTIME mmtime;
677  int s;
678  DWORD dwWrite;
679 
680  if (dsound_init)
681  {
682  mmtime.wType = TIME_SAMPLES;
683  pDSBuf->lpVtbl->GetCurrentPosition(pDSBuf, &mmtime.u.sample, &dwWrite);
684  s = mmtime.u.sample - mmstarttime.u.sample;
685  }
686  else if (wav_init)
687  {
689  }
690 
691 
692  s >>= sample16;
693 
694  s &= (dma.samples-1);
695 
696  return s;
697 }

Referenced by GetSoundtime().

◆ SNDDMA_Init()

int SNDDMA_Init ( void  )

Definition at line 593 of file snd_win.c.

594 {
595  sndinitstat stat;
596 
597  memset ((void *)&dma, 0, sizeof (dma));
598 
599  s_wavonly = Cvar_Get ("s_wavonly", "0", 0);
600 
601  dsound_init = wav_init = 0;
602 
603  stat = SIS_FAILURE; // assume DirectSound won't initialize
604 
605  /* Init DirectSound */
606  if (!s_wavonly->value)
607  {
609  {
610  stat = SNDDMA_InitDirect ();
611 
612  if (stat == SIS_SUCCESS)
613  {
614  snd_isdirect = true;
615 
616  if (snd_firsttime)
617  Com_Printf ("dsound init succeeded\n" );
618  }
619  else
620  {
621  snd_isdirect = false;
622  Com_Printf ("*** dsound init failed ***\n");
623  }
624  }
625  }
626 
627 // if DirectSound didn't succeed in initializing, try to initialize
628 // waveOut sound, unless DirectSound failed because the hardware is
629 // already allocated (in which case the user has already chosen not
630 // to have sound)
631  if (!dsound_init && (stat != SIS_NOTAVAIL))
632  {
633  if (snd_firsttime || snd_iswave)
634  {
635 
637 
638  if (snd_iswave)
639  {
640  if (snd_firsttime)
641  Com_Printf ("Wave sound init succeeded\n");
642  }
643  else
644  {
645  Com_Printf ("Wave sound init failed\n");
646  }
647  }
648  }
649 
650  snd_firsttime = false;
651 
652  snd_buffer_count = 1;
653 
654  if (!dsound_init && !wav_init)
655  {
656  if (snd_firsttime)
657  Com_Printf ("*** No sound device initialized ***\n");
658 
659  return 0;
660  }
661 
662  return 1;
663 }

Referenced by S_Init().

◆ SNDDMA_Shutdown()

void SNDDMA_Shutdown ( void  )

Definition at line 829 of file snd_win.c.

830 {
831  FreeSound ();
832 }

Referenced by S_Shutdown().

◆ SNDDMA_Submit()

void SNDDMA_Submit ( void  )

Definition at line 761 of file snd_win.c.

762 {
763  LPWAVEHDR h;
764  int wResult;
765 
766  if (!dma.buffer)
767  return;
768 
769  // unlock the dsound buffer
770  if (pDSBuf)
771  pDSBuf->lpVtbl->Unlock(pDSBuf, dma.buffer, locksize, NULL, 0);
772 
773  if (!wav_init)
774  return;
775 
776  //
777  // find which sound blocks have completed
778  //
779  while (1)
780  {
781  if ( snd_completed == snd_sent )
782  {
783  Com_DPrintf ("Sound overrun\n");
784  break;
785  }
786 
787  if ( ! (lpWaveHdr[ snd_completed & WAV_MASK].dwFlags & WHDR_DONE) )
788  {
789  break;
790  }
791 
792  snd_completed++; // this buffer has been played
793  }
794 
795 //Com_Printf ("completed %i\n", snd_completed);
796  //
797  // submit a few new sound blocks
798  //
799  while (((snd_sent - snd_completed) >> sample16) < 8)
800  {
801  h = lpWaveHdr + ( snd_sent&WAV_MASK );
802  if (paintedtime/256 <= snd_sent)
803  break; // Com_Printf ("submit overrun\n");
804 //Com_Printf ("send %i\n", snd_sent);
805  snd_sent++;
806  /*
807  * Now the data block can be sent to the output device. The
808  * waveOutWrite function returns immediately and waveform
809  * data is sent to the output device in the background.
810  */
811  wResult = waveOutWrite(hWaveOut, h, sizeof(WAVEHDR));
812 
813  if (wResult != MMSYSERR_NOERROR)
814  {
815  Com_Printf ("Failed to write block to device\n");
816  FreeSound ();
817  return;
818  }
819  }
820 }

Referenced by S_ClearBuffer(), and S_Update_().

Variable Documentation

◆ channels

◆ dma

◆ listener_forward

vec3_t listener_forward

Definition at line 50 of file snd_dma.c.

Referenced by S_Update().

◆ listener_origin

vec3_t listener_origin

Definition at line 49 of file snd_dma.c.

Referenced by S_SpatializeOrigin(), and S_Update().

◆ listener_right

vec3_t listener_right

Definition at line 51 of file snd_dma.c.

Referenced by S_SpatializeOrigin(), and S_Update().

◆ listener_up

vec3_t listener_up

Definition at line 52 of file snd_dma.c.

Referenced by S_Update().

◆ paintedtime

◆ s_khz

cvar_t* s_khz

Definition at line 77 of file snd_dma.c.

Referenced by S_Init(), SNDDMA_InitDirect(), and SNDDMA_InitWav().

◆ s_loadas8bit

cvar_t* s_loadas8bit

Definition at line 76 of file snd_dma.c.

Referenced by ResampleSfx(), and S_Init().

◆ s_mixahead

cvar_t* s_mixahead

Definition at line 79 of file snd_dma.c.

Referenced by S_Init(), and S_Update_().

◆ s_nosound

cvar_t* s_nosound

◆ s_pendingplays

playsound_t s_pendingplays

Definition at line 70 of file snd_dma.c.

Referenced by S_PaintChannels(), S_StartSound(), and S_StopAllSounds().

◆ s_primary

cvar_t* s_primary

Definition at line 80 of file snd_dma.c.

Referenced by DS_CreateBuffers(), and S_Init().

◆ s_rawend

int s_rawend

Definition at line 83 of file snd_dma.c.

Referenced by S_ClearBuffer(), S_PaintChannels(), and S_RawSamples().

◆ s_rawsamples

Definition at line 84 of file snd_dma.c.

Referenced by S_PaintChannels(), and S_RawSamples().

◆ s_show

cvar_t* s_show

Definition at line 78 of file snd_dma.c.

Referenced by S_Init(), S_IssuePlaysound(), and S_Update().

◆ s_testsound

cvar_t* s_testsound

Definition at line 75 of file snd_dma.c.

Referenced by S_Init(), and S_TransferPaintBuffer().

◆ s_volume

cvar_t* s_volume

Definition at line 74 of file snd_dma.c.

Referenced by S_Init(), S_InitScaletable(), S_PaintChannels(), and S_Update().

MAX_CHANNELS
#define MAX_CHANNELS
Definition: snd_loc.h:126
snd_firsttime
static qboolean snd_firsttime
Definition: snd_win.c:42
MAX_QPATH
#define MAX_QPATH
Definition: q_shared.h:80
channel_t::pos
int pos
Definition: snd_loc.h:81
S_PickChannel
channel_t * S_PickChannel(int entnum, int entchannel)
Definition: snd_dma.c:375
S_PaintChannelFrom8
void S_PaintChannelFrom8(channel_t *ch, sfxcache_t *sc, int endtime, int offset)
Definition: snd_mix.c:368
wavinfo_t::width
int width
Definition: snd_loc.h:95
sfxcache_t::length
int length
Definition: snd_loc.h:31
channel_t::sfx
sfx_t * sfx
Definition: snd_loc.h:77
FindChunk
void FindChunk(char *name)
Definition: snd_mem.c:239
channel_t::entnum
int entnum
Definition: snd_loc.h:83
SNDDMA_InitDirect
sndinitstat SNDDMA_InitDirect(void)
Definition: snd_win.c:352
channel_t::fixed_origin
qboolean fixed_origin
Definition: snd_loc.h:88
SIS_SUCCESS
@ SIS_SUCCESS
Definition: snd_win.c:36
lpWaveHdr
LPWAVEHDR lpWaveHdr
Definition: snd_win.c:60
PAINTBUFFER_SIZE
#define PAINTBUFFER_SIZE
Definition: snd_mix.c:25
playsound_s
Definition: snd_loc.h:50
channel_t::autosound
qboolean autosound
Definition: snd_loc.h:89
s_rawend
int s_rawend
Definition: snd_dma.c:83
wavinfo_t::channels
int channels
Definition: snd_loc.h:96
WAV_MASK
#define WAV_MASK
Definition: snd_win.c:32
cvar_s::modified
qboolean modified
Definition: q_shared.h:330
channel_t::rightvol
int rightvol
Definition: snd_loc.h:79
sample16
static int sample16
Definition: snd_win.c:47
data_p
byte * data_p
Definition: snd_mem.c:184
wavinfo_t::samples
int samples
Definition: snd_loc.h:98
i
int i
Definition: q_shared.c:305
snd_iswave
static qboolean snd_iswave
Definition: snd_win.c:42
sfxcache_t::stereo
int stereo
Definition: snd_loc.h:35
FindNextChunk
void FindNextChunk(char *name)
Definition: snd_mem.c:211
channel_t::leftvol
int leftvol
Definition: snd_loc.h:78
S_Spatialize
void S_Spatialize(channel_t *ch)
Definition: snd_dma.c:477
ATTN_STATIC
#define ATTN_STATIC
Definition: q_shared.h:997
dma_t::samples
int samples
Definition: snd_loc.h:66
GetWavinfo
wavinfo_t GetWavinfo(char *name, byte *wav, int wavlength)
Definition: snd_mem.c:267
Cvar_Get
cvar_t * Cvar_Get(char *var_name, char *var_value, int flags)
Definition: cvar.c:127
playsound_s::attenuation
float attenuation
Definition: snd_loc.h:55
portable_samplepair_t::left
int left
Definition: snd_loc.h:25
sfxcache_t::speed
int speed
Definition: snd_loc.h:33
s_volume
cvar_t * s_volume
Definition: snd_dma.c:74
S_SpatializeOrigin
void S_SpatializeOrigin(vec3_t origin, float master_vol, float dist_mult, int *left_vol, int *right_vol)
Definition: snd_dma.c:425
GetLittleShort
short GetLittleShort(void)
Definition: snd_mem.c:191
j
GLint j
Definition: qgl_win.c:150
playsound_s::begin
unsigned begin
Definition: snd_loc.h:60
playsound_s::sfx
sfx_t * sfx
Definition: snd_loc.h:53
MAX_RAW_SAMPLES
#define MAX_RAW_SAMPLES
Definition: snd_loc.h:138
snd_buffer_count
static int snd_buffer_count
Definition: snd_win.c:46
DSoundError
static const char * DSoundError(int error)
Definition: snd_win.c:80
S_LoadSound
sfxcache_t * S_LoadSound(sfx_t *s)
Definition: snd_mem.c:99
dma_t::buffer
byte * buffer
Definition: snd_loc.h:71
ResampleSfx
void ResampleSfx(sfx_t *sfx, int inrate, int inwidth, byte *data)
Definition: snd_mem.c:35
playsound_s::next
struct playsound_s * next
Definition: snd_loc.h:52
paintedtime
int paintedtime
Definition: snd_dma.c:57
SNDDMA_InitWav
qboolean SNDDMA_InitWav(void)
Definition: snd_win.c:444
snd_scaletable
int snd_scaletable[32][256]
Definition: snd_mix.c:27
S_TransferPaintBuffer
void S_TransferPaintBuffer(int endtime)
Definition: snd_mix.c:143
locksize
DWORD locksize
Definition: snd_win.c:706
playsound_s::volume
float volume
Definition: snd_loc.h:54
pDSBuf
LPDIRECTSOUNDBUFFER pDSBuf
Definition: snd_win.c:71
snd_sent
static int snd_sent
Definition: snd_win.c:48
FS_LoadFile
int FS_LoadFile(char *path, void **buffer)
Definition: files.c:398
snd_isdirect
static qboolean snd_isdirect
Definition: snd_win.c:42
playsound_s::entchannel
int entchannel
Definition: snd_loc.h:57
S_Shutdown
void S_Shutdown(void)
Definition: snd_dma.c:164
cvar_s::value
float value
Definition: q_shared.h:331
dma_t::speed
int speed
Definition: snd_loc.h:70
hWaveOut
HWAVEOUT hWaveOut
Definition: snd_win.c:62
wav_init
static qboolean wav_init
Definition: snd_win.c:41
NULL
#define NULL
Definition: q_shared.h:67
dsound_init
static qboolean dsound_init
Definition: snd_win.c:40
dma
dma_t dma
Definition: snd_dma.c:47
channel_t
Definition: snd_loc.h:75
S_IssuePlaysound
void S_IssuePlaysound(playsound_t *ps)
Definition: snd_dma.c:550
channels
channel_t channels[MAX_CHANNELS]
Definition: snd_dma.c:42
Com_Error
void Com_Error(int code, char *fmt,...)
Definition: common.c:181
client_state_t::playernum
int playernum
Definition: client.h:156
wavinfo_t::rate
int rate
Definition: snd_loc.h:94
Z_Malloc
void * Z_Malloc(int size)
Definition: common.c:1200
snd_completed
static int snd_completed
Definition: snd_win.c:48
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:744
S_FreePlaysound
void S_FreePlaysound(playsound_t *ps)
Definition: snd_dma.c:526
name
cvar_t * name
Definition: cl_main.c:79
CL_GetEntitySoundOrigin
void CL_GetEntitySoundOrigin(int ent, vec3_t org)
Definition: cl_ents.c:1529
s_wavonly
cvar_t * s_wavonly
Definition: snd_win.c:38
channel_t::entchannel
int entchannel
Definition: snd_loc.h:84
s_rawsamples
portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES]
Definition: snd_dma.c:84
s
static fixed16_t s
Definition: r_scan.c:30
SIS_FAILURE
@ SIS_FAILURE
Definition: snd_win.c:36
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:165
iff_data
byte * iff_data
Definition: snd_mem.c:187
iff_end
byte * iff_end
Definition: snd_mem.c:185
snd_vol
int snd_vol
Definition: snd_mix.c:28
playsound_s::origin
vec3_t origin
Definition: snd_loc.h:59
paintbuffer
portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE]
Definition: snd_mix.c:26
channel_t::master_vol
int master_vol
Definition: snd_loc.h:87
SIS_NOTAVAIL
@ SIS_NOTAVAIL
Definition: snd_win.c:36
playsound_s::entnum
int entnum
Definition: snd_loc.h:56
portable_samplepair_t::right
int right
Definition: snd_loc.h:26
portable_samplepair_t
Definition: snd_loc.h:23
s_pendingplays
playsound_t s_pendingplays
Definition: snd_dma.c:70
wavinfo_t::loopstart
int loopstart
Definition: snd_loc.h:97
format
GLsizei GLenum format
Definition: qgl_win.c:131
Com_DPrintf
void Com_DPrintf(char *fmt,...)
Definition: common.c:157
sfxcache_t
Definition: snd_loc.h:29
channel_t::origin
vec3_t origin
Definition: snd_loc.h:85
FS_FreeFile
void FS_FreeFile(void *buffer)
Definition: files.c:437
DWORD
DWORD
Definition: qgl_win.c:49
s_show
cvar_t * s_show
Definition: snd_dma.c:78
playsound_s::fixed_origin
qboolean fixed_origin
Definition: snd_loc.h:58
sfxcache_t::width
int width
Definition: snd_loc.h:34
GetLittleLong
int GetLittleLong(void)
Definition: snd_mem.c:200
mmstarttime
MMTIME mmstarttime
Definition: snd_win.c:68
Com_Printf
void Com_Printf(char *fmt,...)
Definition: common.c:104
channel_t::dist_mult
vec_t dist_mult
Definition: snd_loc.h:86
sndinitstat
sndinitstat
Definition: snd_win.c:36
wavinfo_t::dataofs
int dataofs
Definition: snd_loc.h:99
FreeSound
void FreeSound(void)
Definition: snd_win.c:280
cl
client_state_t cl
Definition: cl_main.c:91
WAV_BUFFER_SIZE
#define WAV_BUFFER_SIZE
Definition: snd_win.c:33
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:134
HRESULT
HRESULT(WINAPI *pDirectSoundCreate)(GUID FAR *lpGUID
Com_sprintf
void Com_sprintf(char *dest, int size, char *fmt,...)
Definition: q_shared.c:1223
gSndBufSize
DWORD gSndBufSize
Definition: snd_win.c:66
channel_t::end
int end
Definition: snd_loc.h:80
sfxcache_t::loopstart
int loopstart
Definition: snd_loc.h:32
wavinfo_t
Definition: snd_loc.h:92
count
GLint GLsizei count
Definition: qgl_win.c:128
S_PaintChannelFrom16
void S_PaintChannelFrom16(channel_t *ch, sfxcache_t *sc, int endtime, int offset)
Definition: snd_mix.c:474