2001-04-10 09:40:09 +00:00
|
|
|
/*
|
|
|
|
snd_dma.c
|
|
|
|
|
|
|
|
main control for any streaming sound output device
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
2001-08-23 04:01:46 +00:00
|
|
|
Boston, MA 02111-1307, USA
|
2001-04-10 09:40:09 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2005-08-04 15:27:09 +00:00
|
|
|
static __attribute__ ((used)) const char rcsid[] =
|
2003-01-15 15:31:36 +00:00
|
|
|
"$Id$";
|
|
|
|
|
2001-04-10 09:40:09 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2001-10-16 21:40:45 +00:00
|
|
|
#include "winquake.h"
|
2001-04-10 20:07:11 +00:00
|
|
|
|
2001-04-10 09:40:09 +00:00
|
|
|
#include "QF/cmd.h"
|
2001-05-31 03:41:35 +00:00
|
|
|
#include "QF/cvar.h"
|
2003-05-08 23:24:02 +00:00
|
|
|
#include "QF/dstring.h"
|
2001-04-10 09:40:09 +00:00
|
|
|
#include "QF/model.h"
|
|
|
|
#include "QF/qargs.h"
|
|
|
|
#include "QF/sys.h"
|
2001-04-10 21:45:42 +00:00
|
|
|
#include "QF/sound.h"
|
2001-05-19 00:05:35 +00:00
|
|
|
#include "QF/plugin.h"
|
2004-01-21 02:52:12 +00:00
|
|
|
#include "QF/va.h"
|
2004-02-03 03:01:06 +00:00
|
|
|
#include "QF/quakefs.h"
|
2001-04-10 09:40:09 +00:00
|
|
|
|
2003-01-31 20:51:04 +00:00
|
|
|
#include "snd_render.h"
|
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static qboolean snd_initialized = false;
|
|
|
|
static int snd_blocked = 0;
|
2001-04-10 09:40:09 +00:00
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static unsigned soundtime; // sample PAIRS
|
2001-04-10 09:40:09 +00:00
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static int sound_started = 0;
|
2001-04-10 09:40:09 +00:00
|
|
|
|
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static cvar_t *nosound;
|
|
|
|
static cvar_t *snd_mixahead;
|
|
|
|
static cvar_t *snd_noextraupdate;
|
|
|
|
static cvar_t *snd_show;
|
2001-08-23 04:01:46 +00:00
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static general_data_t plugin_info_general_data;
|
2001-08-04 18:18:33 +00:00
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static snd_output_funcs_t *snd_output_funcs;
|
2003-01-31 20:19:42 +00:00
|
|
|
|
2007-03-17 07:05:24 +00:00
|
|
|
static int *snd_p, snd_linear_count, snd_vol;
|
|
|
|
static short *snd_out;
|
|
|
|
|
|
|
|
static void
|
|
|
|
SND_WriteLinearBlastStereo16 (void)
|
|
|
|
{
|
|
|
|
int val, i;
|
|
|
|
|
|
|
|
for (i = 0; i < snd_linear_count; i += 2) {
|
|
|
|
val = (snd_p[i] * snd_vol) >> 8;
|
|
|
|
if (val > 0x7fff)
|
|
|
|
snd_out[i] = 0x7fff;
|
|
|
|
else if (val < (short) 0x8000)
|
|
|
|
snd_out[i] = (short) 0x8000;
|
|
|
|
else
|
|
|
|
snd_out[i] = val;
|
|
|
|
|
|
|
|
val = (snd_p[i + 1] * snd_vol) >> 8;
|
|
|
|
if (val > 0x7fff)
|
|
|
|
snd_out[i + 1] = 0x7fff;
|
|
|
|
else if (val < (short) 0x8000)
|
|
|
|
snd_out[i + 1] = (short) 0x8000;
|
|
|
|
else
|
|
|
|
snd_out[i + 1] = val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s_xfer_stereo_16 (int endtime)
|
|
|
|
{
|
|
|
|
int lpaintedtime, lpos;
|
|
|
|
unsigned int *pbuf;
|
|
|
|
|
|
|
|
snd_vol = snd_volume->value * 256;
|
|
|
|
|
|
|
|
snd_p = (int *) snd_paintbuffer;
|
|
|
|
lpaintedtime = snd_paintedtime;
|
|
|
|
|
|
|
|
|
|
|
|
pbuf = (unsigned int *) snd_shm->buffer;
|
|
|
|
|
|
|
|
while (lpaintedtime < endtime) {
|
|
|
|
// handle recirculating buffer issues
|
|
|
|
lpos = lpaintedtime & ((snd_shm->samples >> 1) - 1);
|
|
|
|
|
|
|
|
snd_out = (short *) pbuf + (lpos << 1);
|
|
|
|
|
|
|
|
snd_linear_count = (snd_shm->samples >> 1) - lpos;
|
|
|
|
if (lpaintedtime + snd_linear_count > endtime)
|
|
|
|
snd_linear_count = endtime - lpaintedtime;
|
|
|
|
|
|
|
|
snd_linear_count <<= 1;
|
|
|
|
|
|
|
|
// write a linear blast of samples
|
|
|
|
SND_WriteLinearBlastStereo16 ();
|
|
|
|
|
|
|
|
snd_p += snd_linear_count;
|
|
|
|
lpaintedtime += (snd_linear_count >> 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s_xfer_paint_buffer (int endtime)
|
|
|
|
{
|
|
|
|
int count, out_idx, out_mask, snd_vol, step, val;
|
|
|
|
int *p;
|
|
|
|
unsigned int *pbuf;
|
|
|
|
|
|
|
|
if (snd_shm->samplebits == 16 && snd_shm->channels == 2) {
|
|
|
|
s_xfer_stereo_16 (endtime);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
p = (int *) snd_paintbuffer;
|
|
|
|
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 *) snd_shm->buffer;
|
|
|
|
|
|
|
|
if (snd_shm->samplebits == 16) {
|
|
|
|
short *out = (short *) pbuf;
|
|
|
|
|
|
|
|
while (count--) {
|
|
|
|
val = (*p * snd_vol) >> 8;
|
|
|
|
p += step;
|
|
|
|
if (val > 0x7fff)
|
|
|
|
val = 0x7fff;
|
|
|
|
else if (val < (short) 0x8000)
|
|
|
|
val = (short) 0x8000;
|
|
|
|
out[out_idx] = val;
|
|
|
|
out_idx = (out_idx + 1) & out_mask;
|
|
|
|
}
|
|
|
|
} else if (snd_shm->samplebits == 8) {
|
|
|
|
unsigned char *out = (unsigned char *) pbuf;
|
|
|
|
|
|
|
|
while (count--) {
|
|
|
|
val = (*p * snd_vol) >> 8;
|
|
|
|
p += step;
|
|
|
|
if (val > 0x7fff)
|
|
|
|
val = 0x7fff;
|
|
|
|
else if (val < (short) 0x8000)
|
|
|
|
val = (short) 0x8000;
|
|
|
|
out[out_idx] = (val >> 8) + 128;
|
|
|
|
out_idx = (out_idx + 1) & out_mask;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static void
|
2004-01-09 03:48:00 +00:00
|
|
|
s_clear_buffer (void)
|
2004-01-08 01:48:02 +00:00
|
|
|
{
|
2004-03-01 11:51:01 +00:00
|
|
|
int clear, i;
|
2004-01-08 01:48:02 +00:00
|
|
|
|
2007-03-10 04:21:32 +00:00
|
|
|
if (!sound_started || !snd_shm || !snd_shm->buffer)
|
2004-01-08 01:48:02 +00:00
|
|
|
return;
|
|
|
|
|
2007-03-10 04:21:32 +00:00
|
|
|
if (snd_shm->samplebits == 8)
|
2004-01-08 01:48:02 +00:00
|
|
|
clear = 0x80;
|
|
|
|
else
|
|
|
|
clear = 0;
|
|
|
|
|
2007-03-10 04:21:32 +00:00
|
|
|
for (i = 0; i < snd_shm->samples * snd_shm->samplebits / 8; i++)
|
2007-03-17 03:10:45 +00:00
|
|
|
snd_shm->buffer[i] = clear;
|
2001-04-10 09:40:09 +00:00
|
|
|
}
|
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static void
|
2007-03-17 03:10:45 +00:00
|
|
|
s_stop_all_sounds (void)
|
2001-04-10 09:40:09 +00:00
|
|
|
{
|
2007-03-17 03:10:45 +00:00
|
|
|
SND_StopAllSounds ();
|
|
|
|
s_clear_buffer ();
|
2001-04-10 09:40:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2004-01-09 03:48:00 +00:00
|
|
|
s_get_soundtime (void)
|
2002-11-05 19:12:51 +00:00
|
|
|
{
|
|
|
|
int fullsamples, samplepos;
|
|
|
|
static int buffers, oldsamplepos;
|
|
|
|
|
2007-03-10 04:21:32 +00:00
|
|
|
fullsamples = snd_shm->samples / snd_shm->channels;
|
2002-11-05 19:12:51 +00:00
|
|
|
|
|
|
|
// it is possible to miscount buffers if it has wrapped twice between
|
2004-01-09 03:48:00 +00:00
|
|
|
// calls to s_update. Oh well.
|
2003-03-10 21:28:18 +00:00
|
|
|
if ((samplepos = snd_output_funcs->pS_O_GetDMAPos ()) == -1)
|
|
|
|
return;
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
if (samplepos < oldsamplepos) {
|
|
|
|
buffers++; // buffer wrapped
|
|
|
|
|
2007-03-10 04:21:32 +00:00
|
|
|
if (snd_paintedtime > 0x40000000) { // time to chop things off to avoid
|
2002-11-05 19:12:51 +00:00
|
|
|
// 32 bit limits
|
|
|
|
buffers = 0;
|
2007-03-10 04:21:32 +00:00
|
|
|
snd_paintedtime = fullsamples;
|
2007-03-17 03:10:45 +00:00
|
|
|
s_stop_all_sounds ();
|
2002-11-05 19:12:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
oldsamplepos = samplepos;
|
|
|
|
|
2007-03-10 04:21:32 +00:00
|
|
|
soundtime = buffers * fullsamples + samplepos / snd_shm->channels;
|
2002-11-05 19:12:51 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2004-01-09 03:48:00 +00:00
|
|
|
s_update_ (void)
|
2002-11-05 19:12:51 +00:00
|
|
|
{
|
2003-04-17 00:01:48 +00:00
|
|
|
unsigned int endtime, samps;
|
2002-11-05 19:12:51 +00:00
|
|
|
|
|
|
|
if (!sound_started || (snd_blocked > 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Updates DMA time
|
2004-01-09 03:48:00 +00:00
|
|
|
s_get_soundtime ();
|
2002-11-05 19:12:51 +00:00
|
|
|
|
|
|
|
// check to make sure that we haven't overshot
|
2007-03-10 04:21:32 +00:00
|
|
|
if (snd_paintedtime < soundtime) {
|
2002-11-05 19:12:51 +00:00
|
|
|
// Sys_Printf ("S_Update_ : overflow\n");
|
2007-03-10 04:21:32 +00:00
|
|
|
snd_paintedtime = soundtime;
|
2002-11-05 19:12:51 +00:00
|
|
|
}
|
|
|
|
// mix ahead of current position
|
2007-03-10 04:21:32 +00:00
|
|
|
endtime = soundtime + snd_mixahead->value * snd_shm->speed;
|
|
|
|
samps = snd_shm->samples >> (snd_shm->channels - 1);
|
2002-11-05 19:12:51 +00:00
|
|
|
if (endtime - soundtime > samps)
|
|
|
|
endtime = soundtime + samps;
|
|
|
|
|
|
|
|
SND_PaintChannels (endtime);
|
2003-01-31 20:19:42 +00:00
|
|
|
snd_output_funcs->pS_O_Submit ();
|
2002-11-05 19:12:51 +00:00
|
|
|
}
|
|
|
|
|
2001-04-10 09:40:09 +00:00
|
|
|
/*
|
2004-01-09 03:48:00 +00:00
|
|
|
s_update
|
2001-04-10 09:40:09 +00:00
|
|
|
|
|
|
|
Called once each time through the main loop
|
|
|
|
*/
|
2004-01-08 01:48:02 +00:00
|
|
|
static void
|
2004-01-09 03:48:00 +00:00
|
|
|
s_update (const vec3_t origin, const vec3_t forward, const vec3_t right,
|
2002-01-03 05:29:38 +00:00
|
|
|
const vec3_t up)
|
2001-04-10 09:40:09 +00:00
|
|
|
{
|
|
|
|
if (!sound_started || (snd_blocked > 0))
|
|
|
|
return;
|
|
|
|
|
2007-03-17 03:10:45 +00:00
|
|
|
SND_SetListener (origin, forward, right, up);
|
2001-05-22 12:31:43 +00:00
|
|
|
|
|
|
|
// mix some sound
|
2004-01-09 03:48:00 +00:00
|
|
|
s_update_ ();
|
2007-03-18 13:29:58 +00:00
|
|
|
SND_ScanChannels ();
|
2001-04-10 09:40:09 +00:00
|
|
|
}
|
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static void
|
2004-01-09 03:48:00 +00:00
|
|
|
s_extra_update (void)
|
2001-04-10 09:40:09 +00:00
|
|
|
{
|
2001-08-30 22:11:45 +00:00
|
|
|
if (!sound_started || snd_noextraupdate->int_val)
|
2001-04-10 09:40:09 +00:00
|
|
|
return; // don't pollute timings
|
2004-01-09 03:48:00 +00:00
|
|
|
s_update_ ();
|
2001-04-10 09:40:09 +00:00
|
|
|
}
|
|
|
|
|
2007-03-10 14:17:52 +00:00
|
|
|
static void
|
|
|
|
s_block_sound (void)
|
|
|
|
{
|
|
|
|
if (++snd_blocked == 1) {
|
|
|
|
snd_output_funcs->pS_O_BlockSound ();
|
|
|
|
s_clear_buffer ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
s_unblock_sound (void)
|
|
|
|
{
|
|
|
|
if (!snd_blocked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!--snd_blocked) {
|
|
|
|
s_clear_buffer ();
|
|
|
|
snd_output_funcs->pS_O_UnblockSound ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-08-27 01:00:03 +00:00
|
|
|
/* console functions */
|
2001-04-10 09:40:09 +00:00
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2007-03-10 14:17:52 +00:00
|
|
|
s_soundinfo_f (void)
|
|
|
|
{
|
|
|
|
if (!sound_started || !snd_shm) {
|
|
|
|
Sys_Printf ("sound system not started\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static void
|
2007-03-10 14:17:52 +00:00
|
|
|
s_stop_all_sounds_f (void)
|
2001-04-10 09:40:09 +00:00
|
|
|
{
|
2007-03-17 03:10:45 +00:00
|
|
|
s_stop_all_sounds ();
|
2001-04-10 09:40:09 +00:00
|
|
|
}
|
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static void
|
2007-03-10 14:17:52 +00:00
|
|
|
s_startup (void)
|
2001-04-10 09:40:09 +00:00
|
|
|
{
|
2007-03-10 14:17:52 +00:00
|
|
|
if (!snd_initialized)
|
|
|
|
return;
|
2001-07-05 20:18:23 +00:00
|
|
|
|
2007-03-10 14:17:52 +00:00
|
|
|
snd_shm = snd_output_funcs->pS_O_Init ();
|
2001-07-05 20:18:23 +00:00
|
|
|
|
2007-03-10 14:17:52 +00:00
|
|
|
if (!snd_shm) {
|
|
|
|
Sys_Printf ("S_Startup: S_O_Init failed.\n");
|
|
|
|
sound_started = 0;
|
2001-07-05 20:18:23 +00:00
|
|
|
return;
|
2003-01-31 19:55:21 +00:00
|
|
|
}
|
2007-03-17 07:05:24 +00:00
|
|
|
snd_shm->xfer = s_xfer_paint_buffer;
|
2007-03-25 01:02:03 +00:00
|
|
|
if (snd_shm->speed > 44100) {
|
|
|
|
Sys_Printf ("FIXME clamping Sps to 44100 until resampling is fixed\n");
|
|
|
|
snd_shm->speed = 44100;
|
|
|
|
}
|
2001-08-23 04:01:46 +00:00
|
|
|
|
2007-03-10 14:17:52 +00:00
|
|
|
sound_started = 1;
|
2004-02-03 03:01:06 +00:00
|
|
|
}
|
|
|
|
|
2007-03-19 22:20:13 +00:00
|
|
|
static void
|
|
|
|
s_snd_force_unblock (void)
|
|
|
|
{
|
|
|
|
snd_blocked = 1;
|
|
|
|
s_unblock_sound ();
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2004-01-09 03:48:00 +00:00
|
|
|
s_init (void)
|
2002-11-05 19:12:51 +00:00
|
|
|
{
|
2007-03-17 03:10:45 +00:00
|
|
|
snd_output_funcs = snd_render_data.output->functions->snd_output;
|
2007-03-17 06:20:52 +00:00
|
|
|
snd_render_data.soundtime = &soundtime;
|
2004-01-09 03:48:00 +00:00
|
|
|
Sys_Printf ("\nSound Initialization\n");
|
|
|
|
|
|
|
|
Cmd_AddCommand ("stopsound", s_stop_all_sounds_f,
|
|
|
|
"Stops all sounds currently being played");
|
|
|
|
Cmd_AddCommand ("soundinfo", s_soundinfo_f,
|
|
|
|
"Report information on the sound system");
|
2007-03-19 22:20:13 +00:00
|
|
|
Cmd_AddCommand ("snd_force_unblock", s_snd_force_unblock,
|
|
|
|
"fix permanently blocked sound");
|
2004-01-09 03:48:00 +00:00
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
nosound = Cvar_Get ("nosound", "0", CVAR_NONE, NULL,
|
|
|
|
"Set to turn sound off");
|
2007-03-10 04:21:32 +00:00
|
|
|
snd_volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, NULL,
|
|
|
|
"Set the volume for sound playback");
|
2002-11-05 19:12:51 +00:00
|
|
|
snd_interp = Cvar_Get ("snd_interp", "1", CVAR_ARCHIVE, NULL,
|
|
|
|
"control sample interpolation");
|
|
|
|
snd_loadas8bit = Cvar_Get ("snd_loadas8bit", "0", CVAR_NONE, NULL,
|
|
|
|
"Toggles loading sounds as 8-bit samples");
|
|
|
|
snd_mixahead = Cvar_Get ("snd_mixahead", "0.1", CVAR_ARCHIVE, NULL,
|
|
|
|
"Delay time for sounds");
|
|
|
|
snd_noextraupdate = Cvar_Get ("snd_noextraupdate", "0", CVAR_NONE, NULL,
|
|
|
|
"Toggles the correct value display in "
|
|
|
|
"host_speeds. Usually messes up sound "
|
|
|
|
"playback when in effect");
|
|
|
|
snd_show = Cvar_Get ("snd_show", "0", CVAR_NONE, NULL,
|
|
|
|
"Toggles display of sounds currently being played");
|
|
|
|
// FIXME
|
|
|
|
// if (host_parms.memsize < 0x800000) {
|
|
|
|
// Cvar_Set (snd_loadas8bit, "1");
|
|
|
|
// Sys_Printf ("loading all sounds as 8bit\n");
|
|
|
|
// }
|
|
|
|
|
|
|
|
snd_initialized = true;
|
|
|
|
|
2004-01-09 03:48:00 +00:00
|
|
|
s_startup ();
|
2002-11-05 19:12:51 +00:00
|
|
|
|
|
|
|
if (sound_started == 0) // sound startup failed? Bail out.
|
|
|
|
return;
|
|
|
|
|
2007-03-17 03:10:45 +00:00
|
|
|
SND_SFX_Init ();
|
|
|
|
SND_Channels_Init ();
|
2002-11-05 19:12:51 +00:00
|
|
|
|
2007-03-17 03:10:45 +00:00
|
|
|
SND_InitScaletable ();
|
2004-02-03 03:01:06 +00:00
|
|
|
|
2007-03-17 03:10:45 +00:00
|
|
|
s_stop_all_sounds ();
|
2002-11-05 19:12:51 +00:00
|
|
|
}
|
|
|
|
|
2004-01-08 01:48:02 +00:00
|
|
|
static void
|
2004-01-09 03:48:00 +00:00
|
|
|
s_shutdown (void)
|
2002-11-05 19:12:51 +00:00
|
|
|
{
|
|
|
|
if (!sound_started)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sound_started = 0;
|
|
|
|
|
2007-03-10 14:17:52 +00:00
|
|
|
snd_output_funcs->pS_O_Shutdown ();
|
2002-11-05 19:12:51 +00:00
|
|
|
|
2007-03-10 04:21:32 +00:00
|
|
|
snd_shm = 0;
|
2002-11-05 19:12:51 +00:00
|
|
|
}
|
|
|
|
|
2003-04-20 02:05:28 +00:00
|
|
|
static general_funcs_t plugin_info_general_funcs = {
|
2004-01-09 03:48:00 +00:00
|
|
|
s_init,
|
|
|
|
s_shutdown,
|
2003-04-20 02:05:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static snd_render_funcs_t plugin_info_render_funcs = {
|
2007-03-17 03:10:45 +00:00
|
|
|
SND_AmbientOff,
|
|
|
|
SND_AmbientOn,
|
|
|
|
SND_TouchSound,
|
|
|
|
SND_StaticSound,
|
|
|
|
SND_StartSound,
|
|
|
|
SND_StopSound,
|
|
|
|
SND_PrecacheSound,
|
2004-01-09 03:48:00 +00:00
|
|
|
s_update,
|
|
|
|
s_stop_all_sounds,
|
|
|
|
s_extra_update,
|
2007-03-17 03:10:45 +00:00
|
|
|
SND_LocalSound,
|
2004-01-09 03:48:00 +00:00
|
|
|
s_block_sound,
|
|
|
|
s_unblock_sound,
|
2007-03-17 03:10:45 +00:00
|
|
|
SND_LoadSound,
|
|
|
|
SND_AllocChannel,
|
2007-03-18 12:54:59 +00:00
|
|
|
SND_ChannelStop,
|
2003-04-20 02:05:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static plugin_funcs_t plugin_info_funcs = {
|
|
|
|
&plugin_info_general_funcs,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
&plugin_info_render_funcs,
|
|
|
|
};
|
|
|
|
|
|
|
|
static plugin_data_t plugin_info_data = {
|
|
|
|
&plugin_info_general_data,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
2007-03-17 03:10:45 +00:00
|
|
|
&snd_render_data,
|
2003-04-20 02:05:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static plugin_t plugin_info = {
|
|
|
|
qfp_snd_render,
|
|
|
|
0,
|
|
|
|
QFPLUGIN_VERSION,
|
|
|
|
"0.1",
|
|
|
|
"Sound Renderer",
|
|
|
|
"Copyright (C) 1996-1997 id Software, Inc.\n"
|
|
|
|
"Copyright (C) 1999,2000,2001 contributors of the QuakeForge "
|
|
|
|
"project\n"
|
|
|
|
"Please see the file \"AUTHORS\" for a list of contributors",
|
|
|
|
&plugin_info_funcs,
|
|
|
|
&plugin_info_data,
|
|
|
|
};
|
|
|
|
|
2003-08-01 19:53:46 +00:00
|
|
|
PLUGIN_INFO(snd_render, default)
|
2001-09-09 21:41:35 +00:00
|
|
|
{
|
2001-08-23 04:01:46 +00:00
|
|
|
return &plugin_info;
|
2001-07-05 20:18:23 +00:00
|
|
|
}
|