X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=snd_mix.c;h=ec3de1b7b6961351e2d6c039d1ac32cd356fc294;hb=b691ec2d4059c35f2e1e8702703045d8d5a916b7;hp=1e013f4eb1b7e10fe7b3f45d636a3719cbbeffff;hpb=4afc8578d1934fafc515c720cacb37cccd5e01d8;p=xonotic%2Fdarkplaces.git diff --git a/snd_mix.c b/snd_mix.c index 1e013f4e..ec3de1b7 100644 --- a/snd_mix.c +++ b/snd_mix.c @@ -23,15 +23,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static portable_sampleframe_t paintbuffer[PAINTBUFFER_SIZE]; +static portable_sampleframe_t paintbuffer_unswapped[PAINTBUFFER_SIZE]; +extern speakerlayout_t snd_speakerlayout; // for querying the listeners extern void SCR_CaptureVideo_SoundFrame(const portable_sampleframe_t *paintbuffer, size_t length); static void S_CaptureAVISound(size_t length) { + size_t i; + unsigned int j; + if (!cls.capturevideo.active) return; - SCR_CaptureVideo_SoundFrame(paintbuffer, length); + // undo whatever swapping the channel layout (swapstereo, ALSA) did + for(j = 0; j < snd_speakerlayout.channels; ++j) + { + unsigned int j0 = snd_speakerlayout.listeners[j].channel_unswapped; + for(i = 0; i < length; ++i) + paintbuffer_unswapped[i].sample[j0] = paintbuffer[i].sample[j]; + } + + SCR_CaptureVideo_SoundFrame(paintbuffer_unswapped, length); } static void S_ConvertPaintBuffer(const portable_sampleframe_t *painted_ptr, void *rb_ptr, int nbframes, int width, int channels) @@ -92,6 +105,10 @@ static void S_ConvertPaintBuffer(const portable_sampleframe_t *painted_ptr, void *snd_out++ = bound(-32768, val, 32767); } } + + // noise is really really annoying + if (cls.timedemo) + memset(rb_ptr, 0, nbframes * channels * width); } else // 8bit { @@ -148,6 +165,10 @@ static void S_ConvertPaintBuffer(const portable_sampleframe_t *painted_ptr, void *snd_out++ = bound(0, val, 255); } } + + // noise is really really annoying + if (cls.timedemo) + memset(rb_ptr, 128, nbframes * channels); } }