mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
a bunch of docs for snd_render.h and a some cleanup of namepace and old cruft
This commit is contained in:
parent
6f017f18ac
commit
d4719db021
20 changed files with 261 additions and 255 deletions
|
@ -35,15 +35,10 @@
|
|||
|
||||
#include "QF/mathlib.h"
|
||||
|
||||
#define AMBIENT_WATER 0
|
||||
#define AMBIENT_SKY 1
|
||||
#define AMBIENT_SLIME 2
|
||||
#define AMBIENT_LAVA 3
|
||||
#define NUM_AMBIENTS 4 // automatic ambient sounds
|
||||
|
||||
#define DEFAULT_SOUND_PACKET_VOLUME 255
|
||||
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
|
||||
|
||||
/**
|
||||
\ingroup sound
|
||||
*/
|
||||
//@{
|
||||
typedef struct sfx_s sfx_t;
|
||||
struct sfx_s
|
||||
{
|
||||
|
@ -61,19 +56,7 @@ struct sfx_s
|
|||
void (*close) (sfx_t *sfx);
|
||||
void (*release) (sfx_t *sfx);
|
||||
};
|
||||
|
||||
typedef struct dma_s {
|
||||
qboolean gamealive;
|
||||
qboolean soundalive;
|
||||
qboolean splitbuffer;
|
||||
int channels;
|
||||
int samples; // mono samples in buffer
|
||||
int submission_chunk; // don't mix less than this #
|
||||
int samplepos; // in mono samples
|
||||
int samplebits;
|
||||
int speed;
|
||||
unsigned char *buffer;
|
||||
} dma_t;
|
||||
//@}
|
||||
|
||||
struct model_s;
|
||||
|
||||
|
|
|
@ -77,37 +77,4 @@
|
|||
#define nd_numfaces 36
|
||||
#define nd_size 40
|
||||
|
||||
// sfxcache_t structure
|
||||
// !!! if this is changed, it much be changed in sound.h too !!!
|
||||
#define sfxc_length 0
|
||||
#define sfxc_loopstart 4
|
||||
#define sfxc_speed 8
|
||||
#define sfxc_width 12
|
||||
#define sfxc_stereo 16
|
||||
#define sfxc_bytes 20
|
||||
#define sfxc_data 24
|
||||
|
||||
// channel_t structure
|
||||
// !!! if this is changed, it much be changed in sound.h too !!!
|
||||
#define ch_sfx 0
|
||||
#define ch_leftvol 4
|
||||
#define ch_rightvol 8
|
||||
#define ch_end 12
|
||||
#define ch_pos 16
|
||||
#define ch_looping 20
|
||||
#define ch_entnum 24
|
||||
#define ch_entchannel 28
|
||||
#define ch_origin 32
|
||||
#define ch_dist_mult 44
|
||||
#define ch_master_vol 48
|
||||
#define ch_phase 52
|
||||
#define ch_oldphase 56
|
||||
#define ch_size 60
|
||||
|
||||
// portable_samplepair_t structure
|
||||
// !!! if this is changed, it much be changed in sound.h too !!!
|
||||
#define psp_left 0
|
||||
#define psp_right 4
|
||||
#define psp_size 8
|
||||
|
||||
#endif
|
||||
|
|
|
@ -258,6 +258,8 @@
|
|||
// the sound field has bits 0-2: channel, 3-12: entity
|
||||
#define SND_VOLUME (1<<15) // a byte
|
||||
#define SND_ATTENUATION (1<<14) // a byte
|
||||
#define DEFAULT_SOUND_PACKET_VOLUME 255
|
||||
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
|
||||
|
||||
// svc_print messages have an id, so messages can be filtered
|
||||
#define PRINT_LOW 0
|
||||
|
|
|
@ -32,72 +32,148 @@
|
|||
#ifndef __snd_render_h
|
||||
#define __snd_render_h
|
||||
|
||||
|
||||
/** \defgroup sound_render Sound rendering sub-system.
|
||||
\ingroup sound
|
||||
*/
|
||||
//@{
|
||||
|
||||
#include "QF/sound.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
// !!! if this is changed, it must be changed in asm_i386.h too !!!
|
||||
typedef struct portable_samplepair_s {
|
||||
int left;
|
||||
int right;
|
||||
} portable_samplepair_t;
|
||||
|
||||
typedef struct wavinfo_s {
|
||||
unsigned rate;
|
||||
unsigned width;
|
||||
unsigned channels;
|
||||
unsigned loopstart;
|
||||
unsigned samples;
|
||||
unsigned dataofs; // chunk starts this many bytes from file start
|
||||
unsigned datalen; // chunk bytes
|
||||
} wavinfo_t;
|
||||
|
||||
typedef struct portable_samplepair_s portable_samplepair_t;
|
||||
typedef struct dma_s dma_t;
|
||||
typedef struct wavinfo_s wavinfo_t;
|
||||
typedef struct channel_s channel_t;
|
||||
typedef struct sfxbuffer_s sfxbuffer_t;
|
||||
struct sfxbuffer_s {
|
||||
unsigned head; // ring buffer head position in sampels
|
||||
unsigned tail; // ring buffer tail position in sampels
|
||||
unsigned length; // length of buffer in samples
|
||||
unsigned pos; // position of tail within full stream
|
||||
unsigned bps; // bytes per sample: 1 2 4 usually
|
||||
void (*paint) (channel_t *ch, sfxbuffer_t *buffer, int count);
|
||||
void (*advance) (sfxbuffer_t *buffer, unsigned int count);
|
||||
void (*setpos) (sfxbuffer_t *buffer, unsigned int pos);
|
||||
sfx_t *sfx;
|
||||
byte data[4];
|
||||
typedef struct sfxblock_s sfxblock_t;
|
||||
typedef struct sfxstream_s sfxstream_t;
|
||||
|
||||
/** Represent a sound sample in the mixer.
|
||||
*/
|
||||
struct portable_samplepair_s {
|
||||
int left; //!< left sample
|
||||
int right; //!< right sample
|
||||
};
|
||||
|
||||
typedef struct sfxstream_s {
|
||||
sfx_t *sfx;
|
||||
void *file;
|
||||
wavinfo_t wavinfo;
|
||||
int pos;
|
||||
/** communication structure between output drivers and renderer
|
||||
*/
|
||||
struct dma_s {
|
||||
int speed; //!< sample rate
|
||||
int samplebits; //!< bits per sample
|
||||
int channels; //!< number of output channels
|
||||
int samples; //!< mono samples in buffer
|
||||
int submission_chunk; //!< don't mix less than this #
|
||||
int samplepos; //!< in mono samples
|
||||
unsigned char *buffer; //!< destination for mixed sound
|
||||
};
|
||||
|
||||
/** Describes the sound data.
|
||||
For looped data (loopstart >= 0), play starts at sample 0, goes to the end,
|
||||
then loops back to loopstart. This allows an optional lead in section
|
||||
followed by a continuously looped (until the sound is stopped) section.
|
||||
*/
|
||||
struct wavinfo_s {
|
||||
unsigned rate; //!< sample rate
|
||||
unsigned width; //!< bits per sample
|
||||
unsigned channels; //!< number of channels
|
||||
unsigned loopstart; //!< start sample of loop. -1 = no loop
|
||||
unsigned samples; //!< size of sound in samples
|
||||
unsigned dataofs; //!< chunk starts this many bytes from BOF
|
||||
unsigned datalen; //!< chunk bytes
|
||||
};
|
||||
|
||||
/** Buffer for storing sound samples in memory. For cached sounds, acts as
|
||||
an ordinary buffer. For streamed sounds, acts as a ring buffer.
|
||||
*/
|
||||
struct sfxbuffer_s {
|
||||
unsigned head; //!< ring buffer head position in sampels
|
||||
unsigned tail; //!< ring buffer tail position in sampels
|
||||
unsigned length; //!< length of buffer in samples
|
||||
unsigned pos; //!< position of tail within full stream
|
||||
unsigned bps; //!< bytes per sample: 1 2 4 usually
|
||||
/** paint samples into the mix buffer
|
||||
\param ch sound channel
|
||||
\param buffer "this"
|
||||
\param count number of samples to paint
|
||||
*/
|
||||
void (*paint) (channel_t *ch, sfxbuffer_t *buffer, int count);
|
||||
/** Advance the position with the stream, updating the ring buffer as
|
||||
necessary. Null for chached sounds.
|
||||
\param buffer "this"
|
||||
\param count number of samples to advance
|
||||
*/
|
||||
void (*advance) (sfxbuffer_t *buffer, unsigned int count);
|
||||
/** Seek to an absolute position within the stream, resetting the ring
|
||||
buffer.
|
||||
\param buffer "this"
|
||||
\param pos sample position with the stream
|
||||
*/
|
||||
void (*setpos) (sfxbuffer_t *buffer, unsigned int pos);
|
||||
sfx_t *sfx; //!< owning sfx_t instance
|
||||
byte data[4]; //!< sample data
|
||||
};
|
||||
|
||||
/** Representation of sound loaded that is streamed in as needed.
|
||||
*/
|
||||
struct sfxstream_s {
|
||||
sfx_t *sfx; //!< owning sfx_t instance
|
||||
void *file; //!< handle for "file" representing the stream
|
||||
wavinfo_t wavinfo; //!< description of sound data
|
||||
unsigned pos; //!< position of next sample within full stream
|
||||
/** Seek to an absolute position within the stream, resetting the ring
|
||||
buffer.
|
||||
\param sc buffer to write resampled sound (sfxstream_s::buffer)
|
||||
\param data raw sample data
|
||||
\param length number of raw samples to resample
|
||||
\param prev pointer to end of last resample for smoothing
|
||||
*/
|
||||
void (*resample)(sfxbuffer_t *, byte *, int, void *);
|
||||
/** Seek to an absolute position within the stream, resetting the ring
|
||||
buffer.
|
||||
\param file handle for "file" representing the stream
|
||||
(sfxstream_s::file)
|
||||
\param data destination of read data
|
||||
\param bytes number of \i bytes to read from stream
|
||||
\param info description of sound data (sfxstream_s::wavinfo)
|
||||
\return number of bytes read from stream
|
||||
*/
|
||||
int (*read)(void *file, byte *data, int bytes, wavinfo_t *info);
|
||||
/** Seek to an absolute position within the stream.
|
||||
\param file handle for "file" representing the stream
|
||||
(sfxstream_s::file)
|
||||
\param pos sample position with the stream
|
||||
\param info description of sound data (sfxstream_s::wavinfo)
|
||||
*/
|
||||
int (*seek)(void *file, int pos, wavinfo_t *info);
|
||||
sfxbuffer_t buffer;
|
||||
} sfxstream_t;
|
||||
sfxbuffer_t buffer; //<! stream's ring buffer
|
||||
};
|
||||
|
||||
typedef struct sfxblock_s {
|
||||
sfx_t *sfx;
|
||||
void *file;
|
||||
wavinfo_t wavinfo;
|
||||
cache_user_t cache;
|
||||
} sfxblock_t;
|
||||
/** Representation of sound loaded into memory as a full block.
|
||||
*/
|
||||
struct sfxblock_s {
|
||||
sfx_t *sfx; //!< owning sfx_t instance
|
||||
void *file; //!< handle for "file" representing the block
|
||||
wavinfo_t wavinfo; //!< description of sound data
|
||||
cache_user_t cache; //!< cached sound buffer (::sfxbuffer_s)
|
||||
};
|
||||
|
||||
// !!! if this is changed, it must be changed in asm_i386.h too !!!
|
||||
/** Representation of a sound being played
|
||||
*/
|
||||
struct channel_s {
|
||||
sfx_t *sfx; // sfx number
|
||||
int leftvol; // 0-255 volume
|
||||
int rightvol; // 0-255 volume
|
||||
unsigned end; // end time in global paintsamples
|
||||
unsigned pos; // sample position in sfx
|
||||
unsigned looping; // where to loop, -1 = no looping
|
||||
int entnum; // to allow overriding a specific sound
|
||||
sfx_t *sfx; //!< sound played by this channel
|
||||
int leftvol; //!< 0-255 volume
|
||||
int rightvol; //!< 0-255 volume
|
||||
unsigned end; //!< end time in global paintsamples
|
||||
unsigned pos; //!< sample position in sfx
|
||||
unsigned looping; //!< where to loop, -1 = no looping
|
||||
int entnum; //!< to allow overriding a specific sound
|
||||
int entchannel; //
|
||||
vec3_t origin; // origin of sound effect
|
||||
vec_t dist_mult; // distance multiplier (attenuation/clipK)
|
||||
int master_vol; // 0-255 master volume
|
||||
int phase; // phase shift between l-r in samples
|
||||
int oldphase; // phase shift between l-r in samples
|
||||
vec3_t origin; //!< origin of sound effect
|
||||
vec_t dist_mult; //!< distance multiplier (attenuation/clip)
|
||||
int master_vol; //!< 0-255 master volume
|
||||
int phase; //!< phase shift between l-r in samples
|
||||
int oldphase; //!< phase shift between l-r in samples
|
||||
};
|
||||
|
||||
void SND_PaintChannels(unsigned int endtime);
|
||||
|
@ -111,7 +187,6 @@ sfxbuffer_t *SND_GetCache (long samples, int rate, int inwidth, int channels,
|
|||
void SND_InitScaletable (void);
|
||||
|
||||
void SND_Load (sfx_t *sfx);
|
||||
void SND_CallbackLoad (void *object, cache_allocator_t allocator);
|
||||
void SND_LoadOgg (QFile *file, sfx_t *sfx, char *realname);
|
||||
void SND_LoadFLAC (QFile *file, sfx_t *sfx, char *realname);
|
||||
void SND_LoadWav (QFile *file, sfx_t *sfx, char *realname);
|
||||
|
@ -127,38 +202,29 @@ void SND_StreamRelease (sfx_t *sfx);
|
|||
void SND_StreamAdvance (sfxbuffer_t *buffer, unsigned int count);
|
||||
void SND_StreamSetPos (sfxbuffer_t *buffer, unsigned int pos);
|
||||
|
||||
void SND_WriteLinearBlastStereo16 (void);
|
||||
void SND_PaintChannelFrom8 (channel_t *ch, sfxbuffer_t *sc, int count);
|
||||
void SND_PaintChannelFrom16 (channel_t *ch, sfxbuffer_t *sc, int count);
|
||||
void SND_PaintChannelStereo8 (channel_t *ch, sfxbuffer_t *sc, int count);
|
||||
void SND_PaintChannelStereo16 (channel_t *ch, sfxbuffer_t *sc, int count);
|
||||
|
||||
// ====================================================================
|
||||
// User-setable variables
|
||||
// ====================================================================
|
||||
extern unsigned snd_paintedtime;
|
||||
|
||||
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 volatile dma_t *snd_shm;
|
||||
|
||||
#define MAX_CHANNELS 256
|
||||
#define MAX_DYNAMIC_CHANNELS 8
|
||||
|
||||
//
|
||||
// Fake dma is a synchronous faking of the DMA progress used for
|
||||
// isolating performance in the renderer. The fakedma_updates is
|
||||
// number of times S_Update() is called per second.
|
||||
//
|
||||
|
||||
extern unsigned paintedtime;
|
||||
|
||||
extern struct cvar_s *snd_loadas8bit;
|
||||
extern struct cvar_s *volume;
|
||||
|
||||
extern struct cvar_s *snd_interp;
|
||||
extern struct cvar_s *snd_stereo_phase_separation;
|
||||
|
||||
extern volatile dma_t *shm;
|
||||
extern channel_t channels[MAX_CHANNELS];
|
||||
extern channel_t snd_channels[MAX_CHANNELS];
|
||||
// 0 to MAX_DYNAMIC_CHANNELS-1 = normal entity sounds
|
||||
// MAX_DYNAMIC_CHANNELS to MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS -1 = water, etc
|
||||
// MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS to total_channels = static sounds
|
||||
extern int total_channels;
|
||||
extern int snd_total_channels;
|
||||
|
||||
//@}
|
||||
|
||||
#endif//__snd_render_h
|
||||
|
|
|
@ -371,7 +371,7 @@ flac_stream_open (sfx_t *_sfx)
|
|||
return 0;
|
||||
|
||||
sfx = calloc (1, sizeof (sfx_t));
|
||||
samples = shm->speed * 0.3;
|
||||
samples = snd_shm->speed * 0.3;
|
||||
size = samples = (samples + 255) & ~255;
|
||||
if (!snd_loadas8bit->int_val)
|
||||
size *= 2;
|
||||
|
|
|
@ -57,15 +57,15 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
|
||||
// Internal sound data & structures ===========================================
|
||||
|
||||
volatile dma_t *shm = 0;
|
||||
unsigned int paintedtime; // sample PAIRS
|
||||
volatile dma_t *snd_shm = 0;
|
||||
unsigned int snd_paintedtime; // sample PAIRS
|
||||
|
||||
cvar_t *snd_loadas8bit;
|
||||
cvar_t *volume;
|
||||
cvar_t *snd_volume;
|
||||
cvar_t *snd_interp;
|
||||
|
||||
channel_t channels[MAX_CHANNELS];
|
||||
int total_channels;
|
||||
channel_t snd_channels[MAX_CHANNELS];
|
||||
int snd_total_channels;
|
||||
|
||||
static channel_t *ambient_channels[NUM_AMBIENTS];
|
||||
static channel_t *dynamic_channels[MAX_DYNAMIC_CHANNELS];
|
||||
|
@ -109,7 +109,7 @@ static snd_render_data_t render_data = {
|
|||
0,
|
||||
0,
|
||||
&soundtime,
|
||||
&paintedtime,
|
||||
&snd_paintedtime,
|
||||
0,
|
||||
};
|
||||
|
||||
|
@ -141,19 +141,19 @@ s_ambient_on (void)
|
|||
static void
|
||||
s_soundinfo_f (void)
|
||||
{
|
||||
if (!sound_started || !shm) {
|
||||
if (!sound_started || !snd_shm) {
|
||||
Sys_Printf ("sound system not started\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Sys_Printf ("%5d stereo\n", shm->channels - 1);
|
||||
Sys_Printf ("%5d samples\n", shm->samples);
|
||||
Sys_Printf ("%5d samplepos\n", shm->samplepos);
|
||||
Sys_Printf ("%5d samplebits\n", shm->samplebits);
|
||||
Sys_Printf ("%5d submission_chunk\n", shm->submission_chunk);
|
||||
Sys_Printf ("%5d speed\n", shm->speed);
|
||||
Sys_Printf ("0x%lx dma buffer\n", (unsigned long) shm->buffer);
|
||||
Sys_Printf ("%5d total_channels\n", total_channels);
|
||||
Sys_Printf ("%5d stereo\n", snd_shm->channels - 1);
|
||||
Sys_Printf ("%5d samples\n", snd_shm->samples);
|
||||
Sys_Printf ("%5d samplepos\n", snd_shm->samplepos);
|
||||
Sys_Printf ("%5d samplebits\n", snd_shm->samplebits);
|
||||
Sys_Printf ("%5d submission_chunk\n", snd_shm->submission_chunk);
|
||||
Sys_Printf ("%5d speed\n", snd_shm->speed);
|
||||
Sys_Printf ("0x%lx dma buffer\n", (unsigned long) snd_shm->buffer);
|
||||
Sys_Printf ("%5d total_channels\n", snd_total_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -163,9 +163,9 @@ s_startup (void)
|
|||
return;
|
||||
|
||||
if (!fakedma) {
|
||||
shm = snd_output_funcs->pS_O_Init ();
|
||||
snd_shm = snd_output_funcs->pS_O_Init ();
|
||||
|
||||
if (!shm) {
|
||||
if (!snd_shm) {
|
||||
Sys_Printf ("S_Startup: S_O_Init failed.\n");
|
||||
sound_started = 0;
|
||||
return;
|
||||
|
@ -248,8 +248,8 @@ s_precache_sound (const char *name)
|
|||
static channel_t *
|
||||
s_alloc_channel (void)
|
||||
{
|
||||
if (total_channels < MAX_CHANNELS)
|
||||
return &channels[total_channels++];
|
||||
if (snd_total_channels < MAX_CHANNELS)
|
||||
return &snd_channels[snd_total_channels++];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -278,8 +278,8 @@ s_pick_channel (int entnum, int entchannel)
|
|||
&& ch->sfx)
|
||||
continue;
|
||||
|
||||
if (paintedtime + life_left > ch->end) {
|
||||
life_left = ch->end - paintedtime;
|
||||
if (snd_paintedtime + life_left > ch->end) {
|
||||
life_left = ch->end - snd_paintedtime;
|
||||
first_to_die = ch;
|
||||
}
|
||||
}
|
||||
|
@ -317,14 +317,14 @@ s_spatialize (channel_t *ch)
|
|||
|
||||
dot = DotProduct (listener_right, source_vec);
|
||||
|
||||
if (shm->channels == 1) {
|
||||
if (snd_shm->channels == 1) {
|
||||
rscale = 1.0;
|
||||
lscale = 1.0;
|
||||
phase = 0;
|
||||
} else {
|
||||
rscale = 1.0 + dot * snd_volumesep->value;
|
||||
lscale = 1.0 - dot * snd_volumesep->value;
|
||||
phase = snd_phasesep->value * 0.001 * shm->speed * dot;
|
||||
phase = snd_phasesep->value * 0.001 * snd_shm->speed * dot;
|
||||
}
|
||||
|
||||
// add in distance effect
|
||||
|
@ -388,7 +388,7 @@ s_start_sound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
|||
return;
|
||||
}
|
||||
target_chan->pos = 0.0;
|
||||
target_chan->end = paintedtime + target_chan->sfx->length;
|
||||
target_chan->end = snd_paintedtime + target_chan->sfx->length;
|
||||
sfx->release (sfx);
|
||||
|
||||
// if an identical sound has also been started this frame, offset the pos
|
||||
|
@ -398,7 +398,7 @@ s_start_sound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
|||
if (check == target_chan)
|
||||
continue;
|
||||
if (check->sfx == sfx && !check->pos) {
|
||||
skip = rand () % (int) (0.1 * shm->speed);
|
||||
skip = rand () % (int) (0.1 * snd_shm->speed);
|
||||
if (skip >= target_chan->end)
|
||||
skip = target_chan->end - 1;
|
||||
target_chan->pos += skip;
|
||||
|
@ -434,16 +434,16 @@ s_clear_buffer (void)
|
|||
{
|
||||
int clear, i;
|
||||
|
||||
if (!sound_started || !shm || !shm->buffer)
|
||||
if (!sound_started || !snd_shm || !snd_shm->buffer)
|
||||
return;
|
||||
|
||||
if (shm->samplebits == 8)
|
||||
if (snd_shm->samplebits == 8)
|
||||
clear = 0x80;
|
||||
else
|
||||
clear = 0;
|
||||
|
||||
for (i = 0; i < shm->samples * shm->samplebits / 8; i++)
|
||||
shm->buffer[i] = 0;
|
||||
for (i = 0; i < snd_shm->samples * snd_shm->samplebits / 8; i++)
|
||||
snd_shm->buffer[i] = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -457,12 +457,12 @@ s_stop_all_sounds (qboolean clear)
|
|||
num_statics = 0;
|
||||
|
||||
for (i = 0; i < MAX_CHANNELS; i++)
|
||||
if (channels[i].sfx) {
|
||||
channels[i].sfx->close (channels[i].sfx);
|
||||
channels[i].sfx = NULL;
|
||||
if (snd_channels[i].sfx) {
|
||||
snd_channels[i].sfx->close (snd_channels[i].sfx);
|
||||
snd_channels[i].sfx = NULL;
|
||||
}
|
||||
|
||||
memset (channels, 0, MAX_CHANNELS * sizeof (channel_t));
|
||||
memset (snd_channels, 0, MAX_CHANNELS * sizeof (channel_t));
|
||||
|
||||
if (clear)
|
||||
s_clear_buffer ();
|
||||
|
@ -508,7 +508,7 @@ s_static_sound (sfx_t *sfx, const vec3_t origin, float vol,
|
|||
VectorCopy (origin, ss->origin);
|
||||
ss->master_vol = vol;
|
||||
ss->dist_mult = (attenuation / 64) / sound_nominal_clip_dist;
|
||||
ss->end = paintedtime + sfx->length;
|
||||
ss->end = snd_paintedtime + sfx->length;
|
||||
sfx->release (sfx);
|
||||
|
||||
s_spatialize (ss);
|
||||
|
@ -580,7 +580,7 @@ s_get_soundtime (void)
|
|||
int fullsamples, samplepos;
|
||||
static int buffers, oldsamplepos;
|
||||
|
||||
fullsamples = shm->samples / shm->channels;
|
||||
fullsamples = snd_shm->samples / snd_shm->channels;
|
||||
|
||||
// it is possible to miscount buffers if it has wrapped twice between
|
||||
// calls to s_update. Oh well.
|
||||
|
@ -590,16 +590,16 @@ s_get_soundtime (void)
|
|||
if (samplepos < oldsamplepos) {
|
||||
buffers++; // buffer wrapped
|
||||
|
||||
if (paintedtime > 0x40000000) { // time to chop things off to avoid
|
||||
if (snd_paintedtime > 0x40000000) { // time to chop things off to avoid
|
||||
// 32 bit limits
|
||||
buffers = 0;
|
||||
paintedtime = fullsamples;
|
||||
snd_paintedtime = fullsamples;
|
||||
s_stop_all_sounds (true);
|
||||
}
|
||||
}
|
||||
oldsamplepos = samplepos;
|
||||
|
||||
soundtime = buffers * fullsamples + samplepos / shm->channels;
|
||||
soundtime = buffers * fullsamples + samplepos / snd_shm->channels;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -614,13 +614,13 @@ s_update_ (void)
|
|||
s_get_soundtime ();
|
||||
|
||||
// check to make sure that we haven't overshot
|
||||
if (paintedtime < soundtime) {
|
||||
if (snd_paintedtime < soundtime) {
|
||||
// Sys_Printf ("S_Update_ : overflow\n");
|
||||
paintedtime = soundtime;
|
||||
snd_paintedtime = soundtime;
|
||||
}
|
||||
// mix ahead of current position
|
||||
endtime = soundtime + snd_mixahead->value * shm->speed;
|
||||
samps = shm->samples >> (shm->channels - 1);
|
||||
endtime = soundtime + snd_mixahead->value * snd_shm->speed;
|
||||
samps = snd_shm->samples >> (snd_shm->channels - 1);
|
||||
if (endtime - soundtime > samps)
|
||||
endtime = soundtime + samps;
|
||||
|
||||
|
@ -705,8 +705,8 @@ s_update (const vec3_t origin, const vec3_t forward, const vec3_t right,
|
|||
// debugging output
|
||||
if (snd_show->int_val) {
|
||||
total = 0;
|
||||
ch = channels;
|
||||
for (i = 0; i < total_channels; i++, ch++)
|
||||
ch = snd_channels;
|
||||
for (i = 0; i < snd_total_channels; i++, ch++)
|
||||
if (ch->sfx && (ch->leftvol || ch->rightvol)) {
|
||||
// Sys_Printf ("%3i %3i %s\n", ch->leftvol, ch->rightvol,
|
||||
// ch->sfx->name);
|
||||
|
@ -922,8 +922,8 @@ s_init (void)
|
|||
"Set to turn sound off");
|
||||
precache = Cvar_Get ("precache", "1", CVAR_NONE, NULL,
|
||||
"Toggle the use of a precache");
|
||||
volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, NULL,
|
||||
"Set the volume for sound playback");
|
||||
snd_volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, NULL,
|
||||
"Set the volume for sound playback");
|
||||
snd_interp = Cvar_Get ("snd_interp", "1", CVAR_ARCHIVE, NULL,
|
||||
"control sample interpolation");
|
||||
snd_loadas8bit = Cvar_Get ("snd_loadas8bit", "0", CVAR_NONE, NULL,
|
||||
|
@ -969,24 +969,21 @@ s_init (void)
|
|||
|
||||
// create a piece of DMA memory
|
||||
if (fakedma) {
|
||||
shm = (void *) Hunk_AllocName (sizeof (*shm), "shm");
|
||||
shm->splitbuffer = 0;
|
||||
shm->samplebits = 16;
|
||||
shm->speed = 22050;
|
||||
shm->channels = 2;
|
||||
shm->samples = 32768;
|
||||
shm->samplepos = 0;
|
||||
shm->soundalive = true;
|
||||
shm->gamealive = true;
|
||||
shm->submission_chunk = 1;
|
||||
shm->buffer = Hunk_AllocName (1 << 16, "shmbuf");
|
||||
snd_shm = (void *) Hunk_AllocName (sizeof (*snd_shm), "snd_shm");
|
||||
snd_shm->samplebits = 16;
|
||||
snd_shm->speed = 22050;
|
||||
snd_shm->channels = 2;
|
||||
snd_shm->samples = 32768;
|
||||
snd_shm->samplepos = 0;
|
||||
snd_shm->submission_chunk = 1;
|
||||
snd_shm->buffer = Hunk_AllocName (1 << 16, "shmbuf");
|
||||
}
|
||||
// Sys_Printf ("Sound sampling rate: %i\n", shm->speed);
|
||||
// Sys_Printf ("Sound sampling rate: %i\n", snd_shm->speed);
|
||||
|
||||
// provides a tick sound until washed clean
|
||||
|
||||
// if (shm->buffer)
|
||||
// shm->buffer[4] = shm->buffer[5] = 0x7f; // force a pop for debugging
|
||||
// if (snd_shm->buffer)
|
||||
// snd_shm->buffer[4] = snd_shm->buffer[5] = 0x7f; // force a pop for debugging
|
||||
|
||||
ambient_sfx[AMBIENT_WATER] = s_precache_sound ("ambience/water1.wav");
|
||||
ambient_sfx[AMBIENT_SKY] = s_precache_sound ("ambience/wind2.wav");
|
||||
|
@ -1003,16 +1000,13 @@ s_shutdown (void)
|
|||
if (!sound_started)
|
||||
return;
|
||||
|
||||
if (shm)
|
||||
shm->gamealive = 0;
|
||||
|
||||
sound_started = 0;
|
||||
|
||||
if (!fakedma) {
|
||||
snd_output_funcs->pS_O_Shutdown ();
|
||||
}
|
||||
|
||||
shm = 0;
|
||||
snd_shm = 0;
|
||||
}
|
||||
|
||||
static general_funcs_t plugin_info_general_funcs = {
|
||||
|
|
|
@ -137,7 +137,7 @@ read_samples (sfxbuffer_t *buffer, int count, void *prev)
|
|||
sfxstream_t *stream = (sfxstream_t *) sfx->data;
|
||||
wavinfo_t *info = &stream->wavinfo;
|
||||
|
||||
stepscale = (float) info->rate / shm->speed; // usually 0.5, 1, or 2
|
||||
stepscale = (float) info->rate / snd_shm->speed;
|
||||
|
||||
samples = count * stepscale;
|
||||
size = samples * info->width * info->channels;
|
||||
|
@ -211,7 +211,7 @@ SND_StreamSetPos (sfxbuffer_t *buffer, unsigned int pos)
|
|||
sfxstream_t *stream = (sfxstream_t *) sfx->data;
|
||||
wavinfo_t *info = &stream->wavinfo;
|
||||
|
||||
stepscale = (float) info->rate / shm->speed; // usually 0.5, 1, or 2
|
||||
stepscale = (float) info->rate / snd_shm->speed;
|
||||
|
||||
buffer->head = buffer->tail = 0;
|
||||
buffer->pos = pos;
|
||||
|
@ -234,7 +234,7 @@ SND_StreamAdvance (sfxbuffer_t *buffer, unsigned int count)
|
|||
if (!count)
|
||||
return;
|
||||
|
||||
stepscale = (float) info->rate / shm->speed; // usually 0.5, 1, or 2
|
||||
stepscale = (float) info->rate / snd_shm->speed;
|
||||
|
||||
// find out how many samples the buffer currently holds
|
||||
samples = buffer->head - buffer->tail;
|
||||
|
@ -356,7 +356,7 @@ SND_GetCache (long samples, int rate, int inwidth, int channels,
|
|||
sfx_t *sfx = block->sfx;
|
||||
|
||||
width = snd_loadas8bit->int_val ? 1 : 2;
|
||||
stepscale = (float) rate / shm->speed; // usually 0.5, 1, or 2
|
||||
stepscale = (float) rate / snd_shm->speed;
|
||||
len = size = samples / stepscale;
|
||||
// printf ("%ld %d\n", samples, size);
|
||||
size *= width * channels;
|
||||
|
@ -399,7 +399,7 @@ SND_ResampleMono (sfxbuffer_t *sc, byte *data, int length, void *prev)
|
|||
os += sc->head;
|
||||
ob += sc->head;
|
||||
|
||||
stepscale = (float) inrate / shm->speed; // usually 0.5, 1, or 2
|
||||
stepscale = (float) inrate / snd_shm->speed;
|
||||
|
||||
outcount = length / stepscale;
|
||||
// printf ("%d %d\n", length, outcount);
|
||||
|
@ -542,7 +542,7 @@ SND_ResampleStereo (sfxbuffer_t *sc, byte *data, int length, void *prev)
|
|||
os += sc->head;
|
||||
ob += sc->head;
|
||||
|
||||
stepscale = (float) inrate / shm->speed; // usually 0.5, 1, or 2
|
||||
stepscale = (float) inrate / snd_shm->speed;
|
||||
|
||||
outcount = length / stepscale;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ int snd_scaletable[32][256];
|
|||
int *snd_p, snd_linear_count, snd_vol;
|
||||
short *snd_out;
|
||||
|
||||
void
|
||||
static void
|
||||
SND_WriteLinearBlastStereo16 (void)
|
||||
{
|
||||
int val, i;
|
||||
|
@ -85,21 +85,21 @@ s_xfer_stereo_16 (int endtime)
|
|||
int lpaintedtime, lpos;
|
||||
unsigned int *pbuf;
|
||||
|
||||
snd_vol = volume->value * 256;
|
||||
snd_vol = snd_volume->value * 256;
|
||||
|
||||
snd_p = (int *) paintbuffer;
|
||||
lpaintedtime = paintedtime;
|
||||
lpaintedtime = snd_paintedtime;
|
||||
|
||||
|
||||
pbuf = (unsigned int *) shm->buffer;
|
||||
pbuf = (unsigned int *) snd_shm->buffer;
|
||||
|
||||
while (lpaintedtime < endtime) {
|
||||
// handle recirculating buffer issues
|
||||
lpos = lpaintedtime & ((shm->samples >> 1) - 1);
|
||||
lpos = lpaintedtime & ((snd_shm->samples >> 1) - 1);
|
||||
|
||||
snd_out = (short *) pbuf + (lpos << 1);
|
||||
|
||||
snd_linear_count = (shm->samples >> 1) - lpos;
|
||||
snd_linear_count = (snd_shm->samples >> 1) - lpos;
|
||||
if (lpaintedtime + snd_linear_count > endtime)
|
||||
snd_linear_count = endtime - lpaintedtime;
|
||||
|
||||
|
@ -120,21 +120,21 @@ s_xfer_paint_buffer (int endtime)
|
|||
int *p;
|
||||
unsigned int *pbuf;
|
||||
|
||||
if (shm->samplebits == 16 && shm->channels == 2) {
|
||||
if (snd_shm->samplebits == 16 && snd_shm->channels == 2) {
|
||||
s_xfer_stereo_16 (endtime);
|
||||
return;
|
||||
}
|
||||
|
||||
p = (int *) paintbuffer;
|
||||
count = (endtime - paintedtime) * shm->channels;
|
||||
out_mask = shm->samples - 1;
|
||||
out_idx = paintedtime * shm->channels & out_mask;
|
||||
step = 3 - shm->channels;
|
||||
snd_vol = volume->value * 256;
|
||||
count = (endtime - snd_paintedtime) * snd_shm->channels;
|
||||
out_mask = snd_shm->samples - 1;
|
||||
out_idx = snd_paintedtime * snd_shm->channels & out_mask;
|
||||
step = 3 - snd_shm->channels;
|
||||
snd_vol = snd_volume->value * 256;
|
||||
|
||||
pbuf = (unsigned int *) shm->buffer;
|
||||
pbuf = (unsigned int *) snd_shm->buffer;
|
||||
|
||||
if (shm->samplebits == 16) {
|
||||
if (snd_shm->samplebits == 16) {
|
||||
short *out = (short *) pbuf;
|
||||
|
||||
while (count--) {
|
||||
|
@ -147,7 +147,7 @@ s_xfer_paint_buffer (int endtime)
|
|||
out[out_idx] = val;
|
||||
out_idx = (out_idx + 1) & out_mask;
|
||||
}
|
||||
} else if (shm->samplebits == 8) {
|
||||
} else if (snd_shm->samplebits == 8) {
|
||||
unsigned char *out = (unsigned char *) pbuf;
|
||||
|
||||
while (count--) {
|
||||
|
@ -173,20 +173,20 @@ SND_PaintChannels (unsigned int endtime)
|
|||
channel_t *ch;
|
||||
sfxbuffer_t *sc;
|
||||
|
||||
while (paintedtime < endtime) {
|
||||
while (snd_paintedtime < endtime) {
|
||||
// if paintbuffer is smaller than DMA buffer
|
||||
end = endtime;
|
||||
if (endtime - paintedtime > PAINTBUFFER_SIZE)
|
||||
end = paintedtime + PAINTBUFFER_SIZE;
|
||||
if (endtime - snd_paintedtime > PAINTBUFFER_SIZE)
|
||||
end = snd_paintedtime + PAINTBUFFER_SIZE;
|
||||
|
||||
// clear the paint buffer
|
||||
// memset (paintbuffer, 0, (end - paintedtime) *
|
||||
// memset (paintbuffer, 0, (end - snd_paintedtime) *
|
||||
// sizeof (portable_samplepair_t));
|
||||
max_overpaint = 0;
|
||||
|
||||
// paint in the channels.
|
||||
ch = channels;
|
||||
for (i = 0; i < total_channels; i++, ch++) {
|
||||
ch = snd_channels;
|
||||
for (i = 0; i < snd_total_channels; i++, ch++) {
|
||||
if (!ch->sfx)
|
||||
continue;
|
||||
if (!ch->leftvol && !ch->rightvol)
|
||||
|
@ -195,7 +195,7 @@ SND_PaintChannels (unsigned int endtime)
|
|||
if (!sc)
|
||||
continue;
|
||||
|
||||
ltime = paintedtime;
|
||||
ltime = snd_paintedtime;
|
||||
|
||||
while (ltime < end) { // paint up to end
|
||||
if (ch->end < end)
|
||||
|
@ -233,12 +233,12 @@ SND_PaintChannels (unsigned int endtime)
|
|||
// transfer out according to DMA format
|
||||
s_xfer_paint_buffer (end);
|
||||
|
||||
memmove (paintbuffer, paintbuffer + end - paintedtime,
|
||||
memmove (paintbuffer, paintbuffer + end - snd_paintedtime,
|
||||
max_overpaint * sizeof (paintbuffer[0]));
|
||||
memset (paintbuffer + max_overpaint, 0, sizeof (paintbuffer)
|
||||
- max_overpaint * sizeof (paintbuffer[0]));
|
||||
|
||||
paintedtime = end;
|
||||
snd_paintedtime = end;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ vorbis_stream_open (sfx_t *_sfx)
|
|||
return 0;
|
||||
|
||||
sfx = calloc (1, sizeof (sfx_t));
|
||||
samples = shm->speed * 0.3;
|
||||
samples = snd_shm->speed * 0.3;
|
||||
size = samples = (samples + 255) & ~255;
|
||||
if (!snd_loadas8bit->int_val)
|
||||
size *= 2;
|
||||
|
|
|
@ -136,7 +136,7 @@ wav_stream_open (sfx_t *_sfx)
|
|||
return 0;
|
||||
|
||||
sfx = calloc (1, sizeof (sfx_t));
|
||||
samples = shm->speed * 0.3;
|
||||
samples = snd_shm->speed * 0.3;
|
||||
size = samples = (samples + 255) & ~255;
|
||||
if (!snd_loadas8bit->int_val)
|
||||
size *= 2;
|
||||
|
|
|
@ -39,9 +39,10 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/cvar.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
|
||||
static int snd_inited;
|
||||
static int snd_blocked = 0;
|
||||
static volatile dma_t sn;
|
||||
|
@ -316,7 +317,6 @@ SNDDMA_Init (void)
|
|||
}
|
||||
|
||||
memset ((dma_t *) &sn, 0, sizeof (sn));
|
||||
sn.splitbuffer = 0;
|
||||
sn.channels = stereo + 1;
|
||||
|
||||
// don't mix less than this in mono samples:
|
||||
|
@ -344,7 +344,7 @@ SNDDMA_Init (void)
|
|||
Sys_Printf ("to have a power of 2 buffer size\n");
|
||||
}
|
||||
|
||||
sn.samples = buffer_size * sn.channels; // mono samples in buffer
|
||||
sn.samples = buffer_size * sn.channels;
|
||||
sn.speed = rate;
|
||||
SNDDMA_GetDMAPos (); //XXX sets sn.buffer
|
||||
Sys_Printf ("%5d stereo\n", sn.channels - 1);
|
||||
|
|
|
@ -39,9 +39,10 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/cvar.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
|
||||
static int snd_inited;
|
||||
static int snd_blocked = 0;
|
||||
static volatile dma_t sn;
|
||||
|
@ -259,7 +260,6 @@ SNDDMA_Init (void)
|
|||
}
|
||||
|
||||
memset ((dma_t *) &sn, 0, sizeof (sn));
|
||||
sn.splitbuffer = 0;
|
||||
sn.channels = stereo + 1;
|
||||
sn.submission_chunk = qfsnd_pcm_hw_params_get_period_size (hw, 0);
|
||||
// don't mix less than this
|
||||
|
|
|
@ -50,9 +50,10 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/cvar.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
|
||||
static int snd_inited;
|
||||
static QFile *snd_file;
|
||||
static int snd_blocked = 0;
|
||||
|
@ -72,7 +73,6 @@ static volatile dma_t *
|
|||
SNDDMA_Init (void)
|
||||
{
|
||||
memset ((dma_t *) sn, 0, sizeof (sn));
|
||||
sn.splitbuffer = 0;
|
||||
sn.channels = 2;
|
||||
sn.submission_chunk = 1; // don't mix less than this #
|
||||
sn.samplepos = 0; // in mono samples
|
||||
|
|
|
@ -38,9 +38,10 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/cvar.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
|
||||
#define iDirectSoundCreate(a,b,c) pDirectSoundCreate(a,b,c)
|
||||
|
||||
HRESULT (WINAPI * pDirectSoundCreate) (GUID FAR * lpGUID,
|
||||
|
@ -333,8 +334,6 @@ SNDDMA_InitDirect (void)
|
|||
&dwWrite);
|
||||
IDirectSoundBuffer_Play (pDSBuf, 0, 0, DSBPLAY_LOOPING);
|
||||
|
||||
sn.soundalive = true;
|
||||
sn.splitbuffer = false;
|
||||
sn.samples = gSndBufSize / (sn.samplebits / 8);
|
||||
sn.samplepos = 0;
|
||||
sn.submission_chunk = 1;
|
||||
|
|
|
@ -70,9 +70,10 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/cvar.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
|
||||
#ifndef MAP_FAILED
|
||||
# define MAP_FAILED ((void *) -1)
|
||||
#endif
|
||||
|
@ -177,8 +178,6 @@ try_open (int rw)
|
|||
return 0;
|
||||
}
|
||||
|
||||
sn.splitbuffer = 0;
|
||||
|
||||
// set sample bits & speed
|
||||
sn.samplebits = snd_bits->int_val;
|
||||
|
||||
|
|
|
@ -46,9 +46,10 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/cmd.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
|
||||
static dma_t sn;
|
||||
static int snd_inited;
|
||||
static int snd_blocked = 0;
|
||||
|
@ -77,7 +78,6 @@ paint_audio (void *unused, Uint8 * stream, int len)
|
|||
sn.samplepos += streamsamples;
|
||||
while (sn.samplepos >= sn.samples)
|
||||
sn.samplepos -= sn.samples;
|
||||
// SND_PaintChannels (*plugin_info_snd_output_data.soundtime + streamsamples);
|
||||
|
||||
if (sn.samplepos + streamsamples <= sn.samples)
|
||||
memcpy (stream, sn.buffer + sampleposbytes, len);
|
||||
|
@ -162,7 +162,6 @@ SNDDMA_Init (void)
|
|||
SDL_PauseAudio (0);
|
||||
|
||||
/* Fill the audio DMA information block */
|
||||
sn.splitbuffer = 0;
|
||||
sn.samplebits = (obtained.format & 0xFF);
|
||||
sn.speed = obtained.freq;
|
||||
sn.channels = obtained.channels;
|
||||
|
|
|
@ -40,9 +40,10 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/plugin.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
|
||||
static int snd_inited = 0;
|
||||
static ALconfig alc;
|
||||
static ALport alp;
|
||||
|
@ -79,8 +80,6 @@ SNDDMA_Init (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
sn.splitbuffer = 0;
|
||||
|
||||
/* get & probe settings */
|
||||
/* sample format */
|
||||
if (alSetSampFmt (alc, AL_SAMPFMT_TWOSCOMP) < 0) {
|
||||
|
@ -247,7 +246,6 @@ SNDDMA_Init (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
sn.soundalive = true;
|
||||
sn.samples = bufsize / (sn.samplebits / 8);
|
||||
sn.samplepos = 0;
|
||||
sn.submission_chunk = 1;
|
||||
|
|
|
@ -51,9 +51,10 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/plugin.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
|
||||
static int audio_fd;
|
||||
static int snd_inited;
|
||||
static int snd_blocked = 0;
|
||||
|
@ -87,8 +88,6 @@ SNDDMA_Init (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
sn.splitbuffer = 0;
|
||||
|
||||
audio_fd = open ("/dev/audio", O_WRONLY | O_NDELAY);
|
||||
|
||||
if (audio_fd < 0) {
|
||||
|
@ -142,7 +141,6 @@ SNDDMA_Init (void)
|
|||
sn.channels = 2;
|
||||
}
|
||||
|
||||
sn.soundalive = true;
|
||||
sn.samples = sizeof (dma_buffer) / (sn.samplebits / 8);
|
||||
sn.samplepos = 0;
|
||||
sn.submission_chunk = 1;
|
||||
|
|
|
@ -37,9 +37,10 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/cvar.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
|
||||
// 64K is > 1 second at 16-bit, 22050 Hz
|
||||
#define WAV_BUFFERS 64
|
||||
#define WAV_MASK 0x3F
|
||||
|
@ -249,8 +250,6 @@ SNDDMA_InitWav (void)
|
|||
}
|
||||
}
|
||||
|
||||
sn.soundalive = true;
|
||||
sn.splitbuffer = false;
|
||||
sn.samples = gSndBufSize / (sn.samplebits / 8);
|
||||
sn.samplepos = 0;
|
||||
sn.submission_chunk = 1;
|
||||
|
|
|
@ -96,6 +96,8 @@
|
|||
#define SND_VOLUME (1<<0) // a byte
|
||||
#define SND_ATTENUATION (1<<1) // a byte
|
||||
#define SND_LOOPING (1<<2) // a long
|
||||
#define DEFAULT_SOUND_PACKET_VOLUME 255
|
||||
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
|
||||
|
||||
// defaults for clientinfo messages
|
||||
#define DEFAULT_VIEWHEIGHT 22
|
||||
|
|
Loading…
Reference in a new issue