mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-01 06:50:59 +00:00
cleanup some cruft
This commit is contained in:
parent
1a601ee0f8
commit
d93670df3b
3 changed files with 1 additions and 76 deletions
|
@ -406,15 +406,6 @@ void SND_ResampleMono (sfxbuffer_t *sc, byte *data, int length, void *prev);
|
||||||
\param prev pointer to end of last resample for smoothing
|
\param prev pointer to end of last resample for smoothing
|
||||||
*/
|
*/
|
||||||
void SND_ResampleStereo (sfxbuffer_t *sc, byte *data, int length, void *prev);
|
void SND_ResampleStereo (sfxbuffer_t *sc, byte *data, int length, void *prev);
|
||||||
|
|
||||||
/** Copy stereo data into sample buffer. No resampling is done. Useful for
|
|
||||||
generated effects/music.
|
|
||||||
\param sc buffer to write resampled sound
|
|
||||||
\param data raw sample data
|
|
||||||
\param length number of raw samples to resample
|
|
||||||
\param prev pointer to end of last resample for smoothing
|
|
||||||
*/
|
|
||||||
void SND_NoResampleStereo (sfxbuffer_t *sc, byte *data, int length, void *prev);
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,6 @@ read_samples (sfxbuffer_t *buffer, int count, void *prev)
|
||||||
prev = buffer->data + s * buffer->bps;
|
prev = buffer->data + s * buffer->bps;
|
||||||
read_samples (buffer, count, prev);
|
read_samples (buffer, count, prev);
|
||||||
} else {
|
} else {
|
||||||
byte *data;
|
|
||||||
float stepscale;
|
float stepscale;
|
||||||
int samples, size;
|
int samples, size;
|
||||||
sfx_t *sfx = buffer->sfx;
|
sfx_t *sfx = buffer->sfx;
|
||||||
|
@ -179,9 +178,9 @@ read_samples (sfxbuffer_t *buffer, int count, void *prev)
|
||||||
|
|
||||||
samples = count * stepscale;
|
samples = count * stepscale;
|
||||||
size = samples * info->width * info->channels;
|
size = samples * info->width * info->channels;
|
||||||
data = alloca (size);
|
|
||||||
|
|
||||||
if (stream->resample) {
|
if (stream->resample) {
|
||||||
|
byte *data = alloca (size);
|
||||||
if (stream->read (stream->file, data, size, info) != size)
|
if (stream->read (stream->file, data, size, info) != size)
|
||||||
Sys_Printf ("%s r\n", sfx->name);
|
Sys_Printf ("%s r\n", sfx->name);
|
||||||
stream->resample (buffer, data, samples, prev);
|
stream->resample (buffer, data, samples, prev);
|
||||||
|
|
|
@ -365,68 +365,3 @@ general_Stereo:
|
||||||
}
|
}
|
||||||
check_buffer_integrity (sc, outwidth * 2, __FUNCTION__);
|
check_buffer_integrity (sc, outwidth * 2, __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
SND_NoResampleStereo (sfxbuffer_t *sc, byte *data, int length, void *prev)
|
|
||||||
{
|
|
||||||
int outcount, i;
|
|
||||||
stereo8_t *ib, *ob;
|
|
||||||
stereo16_t *is, *os;
|
|
||||||
wavinfo_t *info = sc->sfx->wavinfo (sc->sfx);
|
|
||||||
int inwidth = info->width;
|
|
||||||
int outwidth;
|
|
||||||
|
|
||||||
is = (stereo16_t *) data;
|
|
||||||
os = (stereo16_t *) sc->data;
|
|
||||||
ib = (stereo8_t *) data;
|
|
||||||
ob = (stereo8_t *) sc->data;
|
|
||||||
|
|
||||||
os += sc->head;
|
|
||||||
ob += sc->head;
|
|
||||||
|
|
||||||
outcount = length;
|
|
||||||
|
|
||||||
sc->sfx->length = info->samples;
|
|
||||||
if (info->loopstart != (unsigned int)-1)
|
|
||||||
sc->sfx->loopstart = info->loopstart;
|
|
||||||
else
|
|
||||||
sc->sfx->loopstart = (unsigned int)-1;
|
|
||||||
|
|
||||||
if (snd_loadas8bit->int_val) {
|
|
||||||
outwidth = 1;
|
|
||||||
sc->bps = 2;
|
|
||||||
} else {
|
|
||||||
outwidth = 2;
|
|
||||||
sc->bps = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!length)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (inwidth == 1) {
|
|
||||||
if (outwidth == 1) {
|
|
||||||
for (i = 0; i < outcount; i++, ob++, ib++) {
|
|
||||||
ob->left = ib->left - 128;
|
|
||||||
ob->right = ib->right - 128;
|
|
||||||
}
|
|
||||||
} else if (outwidth == 2) {
|
|
||||||
for (i = 0; i < outcount; i++, os++, ib++) {
|
|
||||||
os->left = (ib->left - 128) << 8;
|
|
||||||
os->right = (ib->right - 128) << 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (inwidth == 2) {
|
|
||||||
if (outwidth == 1) {
|
|
||||||
for (i = 0; i < outcount; i++, ob++, ib++) {
|
|
||||||
ob->left = LittleShort (is->left) >> 8;
|
|
||||||
ob->right = LittleShort (is->right) >> 8;
|
|
||||||
}
|
|
||||||
} else if (outwidth == 2) {
|
|
||||||
for (i = 0; i < outcount; i++, os++, is++) {
|
|
||||||
os->left = LittleShort (is->left);
|
|
||||||
os->right = LittleShort (is->right);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
check_buffer_integrity (sc, outwidth * 2, __FUNCTION__);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue