mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
bah, forgot these
This commit is contained in:
parent
3499f5257f
commit
1c985bc925
6 changed files with 27 additions and 14 deletions
|
@ -121,9 +121,6 @@ struct sfxbuffer_s {
|
|||
*/
|
||||
void (*setpos) (sfxbuffer_t *buffer, unsigned int pos);
|
||||
sfx_t *sfx; //!< owning sfx_t instance
|
||||
/** resampler state information
|
||||
*/
|
||||
void *state;
|
||||
/** Sample data. The block at the beginning of the buffer (size depends on
|
||||
sample size)
|
||||
*/
|
||||
|
@ -137,13 +134,15 @@ struct sfxstream_s {
|
|||
void *file; //!< handle for "file" representing the stream
|
||||
wavinfo_t wavinfo; //!< description of sound data
|
||||
unsigned pos; //!< position of next frame full stream
|
||||
/** resampler state information */
|
||||
void *state;
|
||||
/** Resample raw data into internal format.
|
||||
\param sc buffer to write resampled sound (sfxstream_s::buffer)
|
||||
\param data raw sample data
|
||||
\param length number of frames to resample
|
||||
\param prev pointer to end of last resample for smoothing
|
||||
*/
|
||||
void (*resample)(sfxbuffer_t *, float *, int);
|
||||
int (*resample)(sfxbuffer_t *, float *, int);
|
||||
/** Read data from the stream.
|
||||
\param file handle for "file" representing the stream
|
||||
(sfxstream_s::file)
|
||||
|
|
|
@ -10,6 +10,12 @@ plugin_ldflags= @plugin_ldflags@ -module
|
|||
plugin_libadd= @plugin_libadd@
|
||||
EXEEXT=
|
||||
|
||||
noinst_PROGRAMS= testsound
|
||||
|
||||
testsound_SOURCES= testsound.c
|
||||
testsound_LDADD= $(top_builddir)/libs/audio/libQFsound.la
|
||||
testsound_DEPENDENCIES= $(top_builddir)/libs/audio/libQFsound.la
|
||||
|
||||
plugin_LTLIBRARIES= @CD_PLUGIN_TARGETS@
|
||||
noinst_LTLIBRARIES= @CD_PLUGIN_STATIC@
|
||||
lib_LTLIBRARIES= @CD_TARGETS@ @SND_TARGETS@
|
||||
|
|
|
@ -386,7 +386,7 @@ s_updateAmbientSounds (void)
|
|||
if (!snd_ambient)
|
||||
return;
|
||||
// calc ambient sound levels
|
||||
if (!*snd_render_data.worldmodel)
|
||||
if (!snd_render_data.worldmodel || !*snd_render_data.worldmodel)
|
||||
return;
|
||||
|
||||
l = Mod_PointInLeaf (listener_origin, *snd_render_data.worldmodel);
|
||||
|
@ -462,7 +462,8 @@ s_spatialize (channel_t *ch)
|
|||
ch->oldphase = ch->phase;
|
||||
|
||||
// anything coming from the view entity will always be full volume
|
||||
if (ch->entnum == *snd_render_data.viewentity) {
|
||||
if (!snd_render_data.viewentity
|
||||
|| ch->entnum == *snd_render_data.viewentity) {
|
||||
ch->leftvol = ch->master_vol;
|
||||
ch->rightvol = ch->master_vol;
|
||||
ch->phase = 0;
|
||||
|
|
|
@ -178,9 +178,18 @@ read_samples (sfxbuffer_t *buffer, int count)
|
|||
|
||||
if (stream->resample) {
|
||||
float *data = alloca (size);
|
||||
int c;
|
||||
|
||||
if (stream->read (stream->file, data, frames, info) != frames)
|
||||
Sys_Printf ("%s r\n", sfx->name);
|
||||
stream->resample (buffer, data, frames);
|
||||
c = stream->resample (buffer, data, frames);
|
||||
if (c < count) {
|
||||
data = buffer->data + (buffer->head + c - 1) * info->channels;
|
||||
while (c++ < count) {
|
||||
memcpy (data + info->channels, data,
|
||||
info->channels * sizeof (float));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
float *data = buffer->data + buffer->head * info->channels;
|
||||
if (stream->read (stream->file, data, frames, info) != frames)
|
||||
|
|
|
@ -84,11 +84,11 @@ SND_Resample (sfxbuffer_t *sc, float *data, int length)
|
|||
check_buffer_integrity (sc, outwidth, __FUNCTION__);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
SND_ResampleStream (sfxbuffer_t *sc, float *data, int length)
|
||||
{
|
||||
SRC_DATA src_data;
|
||||
SRC_STATE *state = (SRC_STATE *) sc->state;
|
||||
SRC_STATE *state = (SRC_STATE *) sc->sfx->data.stream->state;
|
||||
|
||||
int outcount;
|
||||
double stepscale;
|
||||
|
@ -106,6 +106,7 @@ SND_ResampleStream (sfxbuffer_t *sc, float *data, int length)
|
|||
src_data.end_of_input = 0; //XXX
|
||||
|
||||
src_process (state, &src_data);
|
||||
return src_data.output_frames_gen;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -130,14 +131,12 @@ SND_SetupResampler (sfxbuffer_t *sc, int streamed)
|
|||
sfxstream_t *stream = sc->sfx->data.stream;
|
||||
|
||||
if (snd_shm->speed == inrate) {
|
||||
sc->state = 0;
|
||||
stream->state = 0;
|
||||
stream->resample = 0;
|
||||
} else {
|
||||
sc->state = src_new (SRC_LINEAR, info->channels, &err);
|
||||
stream->state = src_new (SRC_LINEAR, info->channels, &err);
|
||||
stream->resample = SND_ResampleStream;
|
||||
}
|
||||
} else {
|
||||
sc->state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,6 @@ SND_SFX_StreamOpen (sfx_t *sfx, void *file,
|
|||
memcpy ((byte *) stream->buffer.data + size, "\xde\xad\xbe\xef", 4);
|
||||
stream->file = file;
|
||||
stream->sfx = new_sfx;
|
||||
stream->resample = SND_Resample;
|
||||
stream->read = read;
|
||||
stream->seek = seek;
|
||||
|
||||
|
|
Loading…
Reference in a new issue