From: havoc Date: Fri, 19 Nov 2010 12:23:03 +0000 (+0000) Subject: optimize prologic inversion, it was really showing up in profiles X-Git-Tag: xonotic-v0.1.0preview~56^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=96c898c4a8f6d5033b1e2e9990817dcba4ee48f1;p=xonotic%2Fdarkplaces.git optimize prologic inversion, it was really showing up in profiles git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10610 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/snd_mix.c b/snd_mix.c index 74a13671..9094ce6c 100644 --- a/snd_mix.c +++ b/snd_mix.c @@ -257,12 +257,21 @@ static qboolean SND_PaintChannel (channel_t *ch, portable_sampleframe_t *paint, samples += 2; } } + else if (vol[0] + vol[1] > 0 && ch->prologic_invert == -1) + { + for (i = 0;i < count;i++) + { + paint[i].sample[0] += (samples[0] * vol[0]) >> 8; + paint[i].sample[1] -= (samples[1] * vol[1]) >> 8; + samples += 2; + } + } else if (vol[0] + vol[1] > 0) { for (i = 0;i < count;i++) { paint[i].sample[0] += (samples[0] * vol[0]) >> 8; - paint[i].sample[1] += (samples[1] * vol[1] * ch->prologic_invert) >> 8; + paint[i].sample[1] += (samples[1] * vol[1]) >> 8; samples += 2; } } @@ -308,12 +317,21 @@ static qboolean SND_PaintChannel (channel_t *ch, portable_sampleframe_t *paint, samples += 1; } } + else if (vol[0] + vol[1] > 0 && ch->prologic_invert == -1) + { + for (i = 0;i < count;i++) + { + paint[i].sample[0] += (samples[0] * vol[0]) >> 8; + paint[i].sample[1] -= (samples[0] * vol[1]) >> 8; + samples += 1; + } + } else if (vol[0] + vol[1] > 0) { for (i = 0;i < count;i++) { paint[i].sample[0] += (samples[0] * vol[0]) >> 8; - paint[i].sample[1] += (samples[0] * vol[1] * ch->prologic_invert) >> 8; + paint[i].sample[1] += (samples[0] * vol[1]) >> 8; samples += 1; } } @@ -367,12 +385,21 @@ static qboolean SND_PaintChannel (channel_t *ch, portable_sampleframe_t *paint, samples += 2; } } + else if (vol[0] + vol[1] > 0 && ch->prologic_invert == -1) + { + for (i = 0;i < count;i++) + { + paint[i].sample[0] += (samples[0] * vol[0]) >> 16; + paint[i].sample[1] -= (samples[1] * vol[1]) >> 16; + samples += 2; + } + } else if (vol[0] + vol[1] > 0) { for (i = 0;i < count;i++) { paint[i].sample[0] += (samples[0] * vol[0]) >> 16; - paint[i].sample[1] += (samples[1] * vol[1] * ch->prologic_invert) >> 16; + paint[i].sample[1] += (samples[1] * vol[1]) >> 16; samples += 2; } } @@ -418,12 +445,21 @@ static qboolean SND_PaintChannel (channel_t *ch, portable_sampleframe_t *paint, samples += 1; } } + else if (vol[0] + vol[1] > 0 && ch->prologic_invert == -1) + { + for (i = 0;i < count;i++) + { + paint[i].sample[0] += (samples[0] * vol[0]) >> 16; + paint[i].sample[1] -= (samples[0] * vol[1]) >> 16; + samples += 1; + } + } else if (vol[0] + vol[1] > 0) { for (i = 0;i < count;i++) { paint[i].sample[0] += (samples[0] * vol[0]) >> 16; - paint[i].sample[1] += (samples[0] * vol[1] * ch->prologic_invert) >> 16; + paint[i].sample[1] += (samples[0] * vol[1]) >> 16; samples += 1; } }