Reverted previous commit and added a correct playptmod fix

CQTexperiment
Chris Moeller 2013-11-18 22:27:01 -08:00
parent 94c1ebf2a7
commit 0921d843d8
1 changed files with 11 additions and 5 deletions

View File

@ -591,11 +591,10 @@ static void outputAudio(player *p, short *target, int numSamples)
step = p->v[i].step;
for (j = 0; j < numSamples;)
{
int sample_valid = p->v[i].data && (p->v[i].data - p->source->sampleData + p->v[i].index < p->source->head.totalSampleSize);
tempSample = (sample_valid ? (step == 2 ? (p->v[i].data[p->v[i].index] + p->v[i].data[p->v[i].index + 1] * 0x100) : p->v[i].data[p->v[i].index] * 0x100) : 0);
tempVolume = (sample_valid && !p->v[i].mute ? p->v[i].vol : 0);
tempSample = (p->v[i].data ? (step == 2 ? (p->v[i].data[p->v[i].index] + p->v[i].data[p->v[i].index + 1] * 0x100) : p->v[i].data[p->v[i].index] * 0x100) : 0);
tempVolume = (p->v[i].data && !p->v[i].mute ? p->v[i].vol : 0);
while (j < numSamples && (!sample_valid || p->v[i].frac >= 1.0f))
while (j < numSamples && (!p->v[i].data || p->v[i].frac >= 1.0f))
{
float t_vol = 0.0f;
float t_smp = 0.0f;
@ -632,7 +631,7 @@ static void outputAudio(player *p, short *target, int numSamples)
ptm_blip_add_delta(&p->blepVol[i], 0, delta);
}
if (sample_valid)
if (p->v[i].data)
{
p->v[i].index += step;
p->v[i].frac += p->v[i].rate;
@ -671,6 +670,13 @@ static void outputAudio(player *p, short *target, int numSamples)
if (p->v[i].swapSampleFlag == true)
{
p->v[i].swapSampleFlag = false;
if (p->v[i].newLoopLength <= 2)
{
p->v[i].data = NULL;
break;
}
p->v[i].data = p->v[i].newData;
p->v[i].length = p->v[i].newLength;
p->v[i].loopEnd = p->v[i].newLoopEnd;