int vol[SND_LISTENERS];
const snd_buffer_t *sb;
unsigned int i, sb_offset;
+ sfx_t *sfx;
+
+ sfx = ch->sfx; // fetch the volatile variable
+ if (!sfx) // given that this is called by the mixer thread, this never happens, but...
+ return false;
// move to the stack (do we need to?)
for (i = 0;i < SND_LISTENERS;i++)
return false;
sb_offset = ch->pos;
- sb = ch->sfx->fetcher->getsb (ch->sfx->fetcher_data, &ch->fetcher_data, &sb_offset, count);
+ sb = sfx->fetcher->getsb (sfx->fetcher_data, &ch->fetcher_data, &sb_offset, count);
if (sb == NULL)
{
Con_DPrintf("SND_PaintChannel: ERROR: can't get sound buffer from sfx \"%s\"\n",
- ch->sfx->name); // , count); // or add this? FIXME
+ sfx->name); // , count); // or add this? FIXME
return false;
}
else
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;
}
}
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;
}
}
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;
}
}
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;
}
}
continue;
if (ch->flags & CHANNELFLAG_PAUSED)
continue;
+ if (!sfx->total_length)
+ continue;
ltime = 0;
if (ch->pos < 0)