]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
optimize prologic inversion, it was really showing up in profiles
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 19 Nov 2010 12:23:03 +0000 (12:23 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 19 Nov 2010 12:35:35 +0000 (13:35 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10610 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=96c898c4a8f6d5033b1e2e9990817dcba4ee48f1

snd_mix.c

index 74a13671146855228c92ca6dbcfb9580a1fde464..9094ce6ccd5f959aa1cddfd7f86d2085f87c2d97 100644 (file)
--- 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;
                                        }
                                }