extern speakerlayout_t snd_speakerlayout; // for querying the listeners
-extern void SCR_CaptureVideo_SoundFrame(const portable_sampleframe_t *paintbuffer, size_t length);
+#ifdef CONFIG_VIDEO_CAPTURE
static void S_CaptureAVISound(const portable_sampleframe_t *paintbuffer, size_t length)
{
size_t i;
SCR_CaptureVideo_SoundFrame(paintbuffer_unswapped, length);
}
+#endif
extern cvar_t snd_softclip;
if((snd_softclip.integer == 1 && width <= 2) || snd_softclip.integer > 1)
{
+ portable_sampleframe_t *p = painted_ptr;
+
#if 0
/* Soft clipping, the sound of a dream, thanks to Jon Wattes
post to Musicdsp.org */
// let's do a simple limiter instead, seems to sound better
static float maxvol = 0;
- maxvol = max(1.0f, maxvol * (1.0f - nbframes / snd_renderbuffer->format.speed));
-#define SOFTCLIP(x) if((x)>maxvol) maxvol=(x); (x) /= maxvol;
+ maxvol = max(1.0f, maxvol * (1.0f - nbframes / (0.4f * snd_renderbuffer->format.speed)));
+#define SOFTCLIP(x) if(fabs(x)>maxvol) maxvol=fabs(x); (x) /= maxvol;
- portable_sampleframe_t *p = painted_ptr;
if (channels == 8) // 7.1 surround
{
for (i = 0;i < nbframes;i++, p++)
// paint in the channels.
// channels with zero volumes still advance in time but don't paint.
- ch = channels;
+ ch = channels; // cppcheck complains here but it is wrong, channels is a channel_t[MAX_CHANNELS] and not an int
for (channelindex = 0;channelindex < (int)total_channels;channelindex++, ch++)
{
sfx = ch->sfx;
// do the actual paint now (may skip work if silent)
paint = paintbuffer;
- wantframes = totalmixframes;
istartframe = 0;
for (wantframes = totalmixframes;wantframes > 0;posd += count * speedd, wantframes -= count)
{
S_SoftClipPaintBuffer(paintbuffer, totalmixframes, snd_renderbuffer->format.width, snd_renderbuffer->format.channels);
+#ifdef CONFIG_VIDEO_CAPTURE
if (!snd_usethreadedmixing)
S_CaptureAVISound(paintbuffer, totalmixframes);
+#endif
S_ConvertPaintBuffer(paintbuffer, outbytes, totalmixframes, snd_renderbuffer->format.width, snd_renderbuffer->format.channels);