Fix the ghastly sound quality.

Due to quake's original sound engine using a push model, the actual place
to which the sound data should be written is not necessarily where the
"hardware" dma cursor is, but rather where the last write finished off.
Thus, the correct output location is indicated by snd_paintedtime rather
than snd_shm->framepos.
This commit is contained in:
Bill Currie 2011-12-08 11:02:19 +09:00
parent fceed07d0b
commit 45288a1a7f
2 changed files with 2 additions and 2 deletions

View file

@ -82,7 +82,7 @@ s_xfer_paint_buffer (portable_samplepair_t *paintbuffer, int count,
p = (float *) paintbuffer;
count *= snd_shm->channels;
out_max = (snd_shm->frames * snd_shm->channels) - 1;
out_idx = snd_shm->framepos * snd_shm->channels;
out_idx = snd_paintedtime * snd_shm->channels;
while (out_idx > out_max)
out_idx -= out_max + 1;
step = 3 - snd_shm->channels;

View file

@ -150,7 +150,7 @@ SNDDMA_ni_xfer (portable_samplepair_t *paintbuffer, int count, float volume)
p = (float *) paintbuffer;
out_max = sn.frames - 1;
out_idx = sn.framepos;
out_idx = *plugin_info_snd_output_data.paintedtime;
while (out_idx > out_max)
out_idx -= out_max + 1;