diff --git a/src/engine/platform/amiga.cpp b/src/engine/platform/amiga.cpp index d229998e2..7a49fccfa 100644 --- a/src/engine/platform/amiga.cpp +++ b/src/engine/platform/amiga.cpp @@ -99,9 +99,9 @@ void DivPlatformAmiga::acquire(short* bufL, short* bufR, size_t start, size_t le if (chan[i].audPossamples) { writeAudDat(s->data8[chan[i].audPos++]); } - if (s->isLoopable() && chan[i].audPos>=MIN(131071,(unsigned int)s->getLoopEndPosition())) { - chan[i].audPos=s->getLoopStartPosition(); - } else if (chan[i].audPos>=MIN(131071,(unsigned int)s->getEndPosition())) { + if (s->isLoopable() && chan[i].audPos>=MIN(131071,(unsigned int)s->loopEnd)) { + chan[i].audPos=s->loopStart; + } else if (chan[i].audPos>=MIN(131071,s->samples)) { chan[i].sample=-1; } } else { diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index b7871b680..0b275cb5d 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -104,9 +104,9 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l changed=true; } chan[i].dac.pos++; - if (s->isLoopable() && chan[i].dac.pos>=s->getLoopEndPosition()) { - chan[i].dac.pos=s->getLoopStartPosition(); - } else if (chan[i].dac.pos>=s->getEndPosition()) { + if (s->isLoopable() && chan[i].dac.pos>=s->loopEnd) { + chan[i].dac.pos=s->loopStart; + } else if (chan[i].dac.pos>=(int)s->samples) { chan[i].dac.sample=-1; rWrite(0x08+i,0); end=true; diff --git a/src/engine/platform/ay8930.cpp b/src/engine/platform/ay8930.cpp index 2943ac177..8714f2308 100644 --- a/src/engine/platform/ay8930.cpp +++ b/src/engine/platform/ay8930.cpp @@ -108,9 +108,9 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l changed=true; } chan[i].dac.pos++; - if (s->isLoopable() && chan[i].dac.pos>=s->getLoopEndPosition()) { - chan[i].dac.pos=s->getLoopStartPosition(); - } else if (chan[i].dac.pos>=s->getEndPosition()) { + if (s->isLoopable() && chan[i].dac.pos>=s->loopEnd) { + chan[i].dac.pos=s->loopStart; + } else if (chan[i].dac.pos>=(int)s->samples) { chan[i].dac.sample=-1; rWrite(0x08+i,0); end=true; diff --git a/src/engine/platform/genesis.cpp b/src/engine/platform/genesis.cpp index e9e90c4bd..6ae10d0ce 100644 --- a/src/engine/platform/genesis.cpp +++ b/src/engine/platform/genesis.cpp @@ -52,9 +52,9 @@ void DivPlatformGenesis::processDAC() { if (s->samples>0) { while (chan[i].dacPeriod>=(chipClock/576)) { ++chan[i].dacPos; - if (!chan[i].dacDirection && (s->isLoopable() && chan[i].dacPos>=(unsigned int)s->getLoopEndPosition())) { - chan[i].dacPos=s->getLoopStartPosition(); - } else if (chan[i].dacPos>=(unsigned int)s->getEndPosition()) { + if (!chan[i].dacDirection && (s->isLoopable() && chan[i].dacPos>=(unsigned int)s->loopEnd)) { + chan[i].dacPos=s->loopStart; + } else if (chan[i].dacPos>=s->samples) { chan[i].dacSample=-1; chan[i].dacPeriod=0; break; @@ -98,9 +98,9 @@ void DivPlatformGenesis::processDAC() { } } chan[5].dacPos++; - if (!chan[5].dacDirection && (s->isLoopable() && chan[5].dacPos>=(unsigned int)s->getLoopEndPosition())) { - chan[5].dacPos=s->getLoopStartPosition(); - } else if (chan[5].dacPos>=(unsigned int)s->getEndPosition()) { + if (!chan[5].dacDirection && (s->isLoopable() && chan[5].dacPos>=(unsigned int)s->loopEnd)) { + chan[5].dacPos=s->loopStart; + } else if (chan[5].dacPos>=s->samples) { chan[5].dacSample=-1; if (parent->song.brokenDACMode) { rWrite(0x2b,0); diff --git a/src/engine/platform/lynx.cpp b/src/engine/platform/lynx.cpp index 6e9995bea..c67f35234 100644 --- a/src/engine/platform/lynx.cpp +++ b/src/engine/platform/lynx.cpp @@ -146,9 +146,9 @@ void DivPlatformLynx::acquire(short* bufL, short* bufR, size_t start, size_t len WRITE_OUTPUT(i,CLAMP((s->data8[chan[i].samplePos++]*chan[i].outVol)>>7,-128,127)); } - if (s->isLoopable() && chan[i].samplePos>=s->getLoopEndPosition()) { - chan[i].samplePos=s->getLoopStartPosition(); - } else if (chan[i].samplePos>=s->getEndPosition()) { + if (s->isLoopable() && chan[i].samplePos>=s->loopEnd) { + chan[i].samplePos=s->loopStart; + } else if (chan[i].samplePos>=(int)s->samples) { chan[i].sample=-1; } } diff --git a/src/engine/platform/mmc5.cpp b/src/engine/platform/mmc5.cpp index de997a025..7d271046e 100644 --- a/src/engine/platform/mmc5.cpp +++ b/src/engine/platform/mmc5.cpp @@ -54,9 +54,9 @@ void DivPlatformMMC5::acquire(short* bufL, short* bufR, size_t start, size_t len rWrite(0x5011,((unsigned char)s->data8[dacPos]+0x80)); } dacPos++; - if (s->isLoopable() && dacPos>=(unsigned int)s->getLoopEndPosition()) { - dacPos=s->getLoopStartPosition(); - } else if (dacPos>=(unsigned int)s->getEndPosition()) { + if (s->isLoopable() && dacPos>=(unsigned int)s->loopEnd) { + dacPos=s->loopStart; + } else if (dacPos>=s->samples) { dacSample=-1; } dacPeriod-=rate; diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index fbb7fa3a8..c4376b126 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -88,9 +88,9 @@ void DivPlatformNES::doWrite(unsigned short addr, unsigned char data) { } \ } \ dacPos++; \ - if (s->isLoopable() && dacPos>=(unsigned int)s->getLoopEndPosition()) { \ - dacPos=s->getLoopStartPosition(); \ - } else if (dacPos>=(unsigned int)s->getEndPosition()) { \ + if (s->isLoopable() && dacPos>=(unsigned int)s->loopEnd) { \ + dacPos=s->loopStart; \ + } else if (dacPos>=s->samples) { \ dacSample=-1; \ } \ dacPeriod-=rate; \ diff --git a/src/engine/platform/pce.cpp b/src/engine/platform/pce.cpp index d9d339e4b..ea6f0e56e 100644 --- a/src/engine/platform/pce.cpp +++ b/src/engine/platform/pce.cpp @@ -76,9 +76,9 @@ void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len) chWrite(i,0x06,0x10); } chan[i].dacPos++; - if (s->isLoopable() && chan[i].dacPos>=(unsigned int)s->getLoopEndPosition()) { - chan[i].dacPos=s->getLoopStartPosition(); - } else if (chan[i].dacPos>=(unsigned int)s->getEndPosition()) { + if (s->isLoopable() && chan[i].dacPos>=(unsigned int)s->loopEnd) { + chan[i].dacPos=s->loopStart; + } else if (chan[i].dacPos>=s->samples) { chan[i].dacSample=-1; } chan[i].dacPeriod-=rate; diff --git a/src/engine/platform/pcmdac.cpp b/src/engine/platform/pcmdac.cpp index 8f1440878..f7db0ef4c 100644 --- a/src/engine/platform/pcmdac.cpp +++ b/src/engine/platform/pcmdac.cpp @@ -56,14 +56,14 @@ void DivPlatformPCMDAC::acquire(short* bufL, short* bufR, size_t start, size_t l switch (s->loopMode) { case DIV_SAMPLE_LOOP_FORWARD: case DIV_SAMPLE_LOOP_PINGPONG: - if (chan.audPosgetLoopStartPosition()) { - chan.audPos=s->getLoopStartPosition()+(s->getLoopStartPosition()-chan.audPos); + if (chan.audPosloopStart) { + chan.audPos=s->loopStart+(s->loopStart-chan.audPos); chan.audDir=false; } break; case DIV_SAMPLE_LOOP_BACKWARD: - if (chan.audPosgetLoopStartPosition()) { - chan.audPos=s->getLoopEndPosition()-1-(s->getLoopStartPosition()-chan.audPos); + if (chan.audPosloopStart) { + chan.audPos=s->loopEnd-1-(s->loopStart-chan.audPos); chan.audDir=true; } break; @@ -73,36 +73,36 @@ void DivPlatformPCMDAC::acquire(short* bufL, short* bufR, size_t start, size_t l } break; } - } else if (chan.audPos>=s->getEndPosition()) { + } else if (chan.audPos>=(int)s->samples) { chan.sample=-1; } } else { if (s->isLoopable()) { switch (s->loopMode) { case DIV_SAMPLE_LOOP_FORWARD: - if (chan.audPos>=s->getLoopEndPosition()) { - chan.audPos=(chan.audPos+s->getLoopStartPosition())-s->getLoopEndPosition(); + if (chan.audPos>=s->loopEnd) { + chan.audPos=(chan.audPos+s->loopStart)-s->loopEnd; chan.audDir=false; } break; case DIV_SAMPLE_LOOP_BACKWARD: case DIV_SAMPLE_LOOP_PINGPONG: - if (chan.audPos>=s->getLoopEndPosition()) { - chan.audPos=s->getLoopEndPosition()-1-(s->getLoopEndPosition()-1-chan.audPos); + if (chan.audPos>=s->loopEnd) { + chan.audPos=s->loopEnd-1-(s->loopEnd-1-chan.audPos); chan.audDir=true; } break; default: - if (chan.audPos>=s->getEndPosition()) { + if (chan.audPos>=(int)s->samples) { chan.sample=-1; } break; } - } else if (chan.audPos>=s->getEndPosition()) { + } else if (chan.audPos>=(int)s->samples) { chan.sample=-1; } } - if (chan.audPos>=0 && chan.audPosgetEndPosition()) { + if (chan.audPos>=0 && chan.audPos<(int)s->samples) { output=s->data16[chan.audPos]; } } else { diff --git a/src/engine/platform/qsound.cpp b/src/engine/platform/qsound.cpp index 63985c801..18216f03f 100644 --- a/src/engine/platform/qsound.cpp +++ b/src/engine/platform/qsound.cpp @@ -289,8 +289,8 @@ void DivPlatformQSound::tick(bool sysTick) { qsound_bank = 0x8000 | (s->offQSound >> 16); qsound_addr = s->offQSound & 0xffff; - int loopStart=s->getLoopStartPosition(); - int length = s->getLoopEndPosition(); + int loopStart=s->loopStart; + int length = s->loopEnd; if (length > 65536 - 16) { length = 65536 - 16; } diff --git a/src/engine/platform/rf5c68.cpp b/src/engine/platform/rf5c68.cpp index 9a0510b05..86d373722 100644 --- a/src/engine/platform/rf5c68.cpp +++ b/src/engine/platform/rf5c68.cpp @@ -136,7 +136,7 @@ void DivPlatformRF5C68::tick(bool sysTick) { start=start+MIN(chan[i].audPos,s->length8); } if (s->isLoopable()) { - loop=start+s->getLoopStartPosition(); + loop=start+s->loopStart; } start=MIN(start,getSampleMemCapacity()-31); loop=MIN(loop,getSampleMemCapacity()-31); diff --git a/src/engine/platform/segapcm.cpp b/src/engine/platform/segapcm.cpp index 93481d94f..69e996b8b 100644 --- a/src/engine/platform/segapcm.cpp +++ b/src/engine/platform/segapcm.cpp @@ -47,9 +47,9 @@ void DivPlatformSegaPCM::acquire(short* bufL, short* bufR, size_t start, size_t pcmR+=(s->data8[chan[i].pcm.pos>>8]*chan[i].chVolR); } chan[i].pcm.pos+=chan[i].pcm.freq; - if (s->isLoopable() && chan[i].pcm.pos>=((unsigned int)s->getLoopEndPosition()<<8)) { - chan[i].pcm.pos=s->getLoopStartPosition()<<8; - } else if (chan[i].pcm.pos>=((unsigned int)s->getEndPosition()<<8)) { + if (s->isLoopable() && chan[i].pcm.pos>=((unsigned int)s->loopEnd<<8)) { + chan[i].pcm.pos=s->loopStart<<8; + } else if (chan[i].pcm.pos>=(s->samples<<8)) { chan[i].pcm.sample=-1; } } else { diff --git a/src/engine/platform/su.cpp b/src/engine/platform/su.cpp index b314ecde6..9a2c4f569 100644 --- a/src/engine/platform/su.cpp +++ b/src/engine/platform/su.cpp @@ -552,7 +552,7 @@ void DivPlatformSoundUnit::renderSamples() { for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; if (s->data8==NULL) continue; - int paddedLen=s->getEndPosition(); + int paddedLen=s->length8; if (memPos>=getSampleMemCapacity(0)) { logW("out of PCM memory for sample %d!",i); break; diff --git a/src/engine/platform/swan.cpp b/src/engine/platform/swan.cpp index e6242c795..6d2954530 100644 --- a/src/engine/platform/swan.cpp +++ b/src/engine/platform/swan.cpp @@ -62,9 +62,9 @@ void DivPlatformSwan::acquire(short* bufL, short* bufR, size_t start, size_t len continue; } rWrite(0x09,(unsigned char)s->data8[dacPos++]+0x80); - if (s->isLoopable() && dacPos>=(unsigned int)s->getLoopEndPosition()) { - dacPos=s->getLoopStartPosition(); - } else if (dacPos>=(unsigned int)s->getEndPosition()) { + if (s->isLoopable() && dacPos>=(unsigned int)s->loopEnd) { + dacPos=s->loopStart; + } else if (dacPos>=s->samples) { dacSample=-1; } dacPeriod-=rate; diff --git a/src/engine/platform/vera.cpp b/src/engine/platform/vera.cpp index 22be5e984..c586cc9fc 100644 --- a/src/engine/platform/vera.cpp +++ b/src/engine/platform/vera.cpp @@ -84,9 +84,9 @@ void DivPlatformVERA::acquire(short* bufL, short* bufR, size_t start, size_t len rWritePCMData(tmp_r&0xff); } chan[16].pcm.pos++; - if (s->isLoopable() && chan[16].pcm.pos>=(unsigned int)s->getLoopEndPosition()) { - chan[16].pcm.pos=s->getLoopStartPosition(); - } else if (chan[16].pcm.pos>=(unsigned int)s->getEndPosition()) { + if (s->isLoopable() && chan[16].pcm.pos>=(unsigned int)s->loopEnd) { + chan[16].pcm.pos=s->loopStart; + } else if (chan[16].pcm.pos>=s->samples) { chan[16].pcm.sample=-1; break; } diff --git a/src/engine/platform/vrc6.cpp b/src/engine/platform/vrc6.cpp index 134905479..e8cfb99d0 100644 --- a/src/engine/platform/vrc6.cpp +++ b/src/engine/platform/vrc6.cpp @@ -65,9 +65,9 @@ void DivPlatformVRC6::acquire(short* bufL, short* bufR, size_t start, size_t len chWrite(i,0,0x80|chan[i].dacOut); } chan[i].dacPos++; - if (s->isLoopable() && chan[i].dacPos>=(unsigned int)s->getLoopEndPosition()) { - chan[i].dacPos=s->getLoopStartPosition(); - } else if (chan[i].dacPos>=(unsigned int)s->getEndPosition()) { + if (s->isLoopable() && chan[i].dacPos>=(unsigned int)s->loopEnd) { + chan[i].dacPos=s->loopStart; + } else if (chan[i].dacPos>=s->samples) { chan[i].dacSample=-1; chWrite(i,0,0); } diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 9017c40bb..10f544d78 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1334,19 +1334,19 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi samp_prevSample=samp_temp; if (sPreview.dir) { // backward - if (sPreview.posgetLoopStartPosition() || (sPreview.pBegin>=0 && sPreview.posisLoopable() && sPreview.posgetLoopEndPosition()) { + if (sPreview.posloopStart || (sPreview.pBegin>=0 && sPreview.posisLoopable() && sPreview.posloopEnd) { switch (s->loopMode) { case DivSampleLoopMode::DIV_SAMPLE_LOOP_FORWARD: - sPreview.pos=s->getLoopStartPosition(); + sPreview.pos=s->loopStart; sPreview.dir=false; break; case DivSampleLoopMode::DIV_SAMPLE_LOOP_BACKWARD: - sPreview.pos=s->getLoopEndPosition()-1; + sPreview.pos=s->loopEnd-1; sPreview.dir=true; break; case DivSampleLoopMode::DIV_SAMPLE_LOOP_PINGPONG: - sPreview.pos=s->getLoopStartPosition(); + sPreview.pos=s->loopStart; sPreview.dir=false; break; default: @@ -1355,19 +1355,19 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi } } } else { // forward - if (sPreview.pos>=s->getLoopEndPosition() || (sPreview.pEnd>=0 && sPreview.pos>=sPreview.pEnd)) { - if (s->isLoopable() && sPreview.pos>=s->getLoopStartPosition()) { + if (sPreview.pos>=s->loopEnd || (sPreview.pEnd>=0 && sPreview.pos>=sPreview.pEnd)) { + if (s->isLoopable() && sPreview.pos>=s->loopStart) { switch (s->loopMode) { case DivSampleLoopMode::DIV_SAMPLE_LOOP_FORWARD: - sPreview.pos=s->getLoopStartPosition(); + sPreview.pos=s->loopStart; sPreview.dir=false; break; case DivSampleLoopMode::DIV_SAMPLE_LOOP_BACKWARD: - sPreview.pos=s->getLoopEndPosition()-1; + sPreview.pos=s->loopEnd-1; sPreview.dir=true; break; case DivSampleLoopMode::DIV_SAMPLE_LOOP_PINGPONG: - sPreview.pos=s->getLoopEndPosition()-1; + sPreview.pos=s->loopEnd-1; sPreview.dir=true; break; default: @@ -1378,19 +1378,19 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi } } if (sPreview.dir) { // backward - if (sPreview.pos<=s->getLoopStartPosition() || (sPreview.pBegin>=0 && sPreview.pos<=sPreview.pBegin)) { - if (s->isLoopable() && sPreview.pos>=s->getLoopStartPosition()) { + if (sPreview.pos<=s->loopStart || (sPreview.pBegin>=0 && sPreview.pos<=sPreview.pBegin)) { + if (s->isLoopable() && sPreview.pos>=s->loopStart) { switch (s->loopMode) { case DivSampleLoopMode::DIV_SAMPLE_LOOP_FORWARD: - sPreview.pos=s->getLoopStartPosition(); + sPreview.pos=s->loopStart; sPreview.dir=false; break; case DivSampleLoopMode::DIV_SAMPLE_LOOP_BACKWARD: - sPreview.pos=s->getLoopEndPosition()-1; + sPreview.pos=s->loopEnd-1; sPreview.dir=true; break; case DivSampleLoopMode::DIV_SAMPLE_LOOP_PINGPONG: - sPreview.pos=s->getLoopStartPosition(); + sPreview.pos=s->loopStart; sPreview.dir=false; break; default: @@ -1401,25 +1401,25 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi } } } else { // forward - if (sPreview.pos>=s->getLoopEndPosition() || (sPreview.pEnd>=0 && sPreview.pos>=sPreview.pEnd)) { - if (s->isLoopable() && sPreview.pos>=s->getLoopStartPosition()) { + if (sPreview.pos>=s->loopEnd || (sPreview.pEnd>=0 && sPreview.pos>=sPreview.pEnd)) { + if (s->isLoopable() && sPreview.pos>=s->loopStart) { switch (s->loopMode) { case DivSampleLoopMode::DIV_SAMPLE_LOOP_FORWARD: - sPreview.pos=s->getLoopStartPosition(); + sPreview.pos=s->loopStart; sPreview.dir=false; break; case DivSampleLoopMode::DIV_SAMPLE_LOOP_BACKWARD: - sPreview.pos=s->getLoopEndPosition()-1; + sPreview.pos=s->loopEnd-1; sPreview.dir=true; break; case DivSampleLoopMode::DIV_SAMPLE_LOOP_PINGPONG: - sPreview.pos=s->getLoopEndPosition()-1; + sPreview.pos=s->loopEnd-1; sPreview.dir=true; break; default: break; } - } else if (sPreview.pos>=s->getEndPosition()) { + } else if (sPreview.pos>=(int)s->samples) { sPreview.sample=-1; } }