mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-30 08:23:01 +00:00
make use of sample loop flag
issue #1109 this MAY BREAK THINGS if any problems, REVERT THIS ONE
This commit is contained in:
parent
f55dbc7376
commit
0c0efaea50
5 changed files with 14 additions and 9 deletions
|
@ -319,7 +319,7 @@ void DivPlatformQSound::tick(bool sysTick) {
|
||||||
if (length > 65536 - 16) {
|
if (length > 65536 - 16) {
|
||||||
length = 65536 - 16;
|
length = 65536 - 16;
|
||||||
}
|
}
|
||||||
if (loopStart == -1 || loopStart >= length) {
|
if (!s->isLoopable()) {
|
||||||
if (i<16) {
|
if (i<16) {
|
||||||
qsound_end = offPCM[chan[i].sample] + length + 15;
|
qsound_end = offPCM[chan[i].sample] + length + 15;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -138,7 +138,7 @@ void DivPlatformSegaPCM::tick(bool sysTick) {
|
||||||
rWrite(0x84+(i<<3),(sampleOffSegaPCM[chan[i].pcm.sample])&0xff);
|
rWrite(0x84+(i<<3),(sampleOffSegaPCM[chan[i].pcm.sample])&0xff);
|
||||||
rWrite(0x85+(i<<3),(sampleOffSegaPCM[chan[i].pcm.sample]>>8)&0xff);
|
rWrite(0x85+(i<<3),(sampleOffSegaPCM[chan[i].pcm.sample]>>8)&0xff);
|
||||||
rWrite(6+(i<<3),sampleEndSegaPCM[chan[i].pcm.sample]);
|
rWrite(6+(i<<3),sampleEndSegaPCM[chan[i].pcm.sample]);
|
||||||
if (loopStart<0 || loopStart>=actualLength) {
|
if (!s->isLoopable()) {
|
||||||
rWrite(0x86+(i<<3),2+((sampleOffSegaPCM[chan[i].pcm.sample]>>16)<<3));
|
rWrite(0x86+(i<<3),2+((sampleOffSegaPCM[chan[i].pcm.sample]>>16)<<3));
|
||||||
} else {
|
} else {
|
||||||
int loopPos=(sampleOffSegaPCM[chan[i].pcm.sample]&0xffff)+loopStart;
|
int loopPos=(sampleOffSegaPCM[chan[i].pcm.sample]&0xffff)+loopStart;
|
||||||
|
@ -156,7 +156,7 @@ void DivPlatformSegaPCM::tick(bool sysTick) {
|
||||||
rWrite(0x84+(i<<3),(sampleOffSegaPCM[chan[i].pcm.sample])&0xff);
|
rWrite(0x84+(i<<3),(sampleOffSegaPCM[chan[i].pcm.sample])&0xff);
|
||||||
rWrite(0x85+(i<<3),(sampleOffSegaPCM[chan[i].pcm.sample]>>8)&0xff);
|
rWrite(0x85+(i<<3),(sampleOffSegaPCM[chan[i].pcm.sample]>>8)&0xff);
|
||||||
rWrite(6+(i<<3),sampleEndSegaPCM[chan[i].pcm.sample]);
|
rWrite(6+(i<<3),sampleEndSegaPCM[chan[i].pcm.sample]);
|
||||||
if (loopStart<0 || loopStart>=actualLength) {
|
if (!s->isLoopable()) {
|
||||||
rWrite(0x86+(i<<3),2+((sampleOffSegaPCM[chan[i].pcm.sample]>>16)<<3));
|
rWrite(0x86+(i<<3),2+((sampleOffSegaPCM[chan[i].pcm.sample]>>16)<<3));
|
||||||
} else {
|
} else {
|
||||||
int loopPos=(sampleOffSegaPCM[chan[i].pcm.sample]&0xffff)+loopStart;
|
int loopPos=(sampleOffSegaPCM[chan[i].pcm.sample]&0xffff)+loopStart;
|
||||||
|
|
|
@ -222,7 +222,7 @@ void DivPlatformSNES::tick(bool sysTick) {
|
||||||
if (chan[i].audPos>0) {
|
if (chan[i].audPos>0) {
|
||||||
start=start+MIN(chan[i].audPos,s->lengthBRR-1)/16*9;
|
start=start+MIN(chan[i].audPos,s->lengthBRR-1)/16*9;
|
||||||
}
|
}
|
||||||
if (s->loopStart>=0) {
|
if (s->isLoopable()) {
|
||||||
loop=((s->depth!=DIV_SAMPLE_DEPTH_BRR)?9:0)+start+((s->loopStart/16)*9);
|
loop=((s->depth!=DIV_SAMPLE_DEPTH_BRR)?9:0)+start+((s->loopStart/16)*9);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -591,7 +591,7 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
|
||||||
w->writeC(0x95);
|
w->writeC(0x95);
|
||||||
w->writeC(streamID);
|
w->writeC(streamID);
|
||||||
w->writeS(write.val); // sample number
|
w->writeS(write.val); // sample number
|
||||||
w->writeC((sample->getLoopStartPosition(DIV_SAMPLE_DEPTH_8BIT)==0)|(sampleDir[streamID]?0x10:0)); // flags
|
w->writeC((sample->getLoopStartPosition(DIV_SAMPLE_DEPTH_8BIT)==0 && sample->isLoopable())|(sampleDir[streamID]?0x10:0)); // flags
|
||||||
if (sample->isLoopable() && !sampleDir[streamID]) {
|
if (sample->isLoopable() && !sampleDir[streamID]) {
|
||||||
loopTimer[streamID]=sample->length8;
|
loopTimer[streamID]=sample->length8;
|
||||||
loopSample[streamID]=write.val;
|
loopSample[streamID]=write.val;
|
||||||
|
@ -610,7 +610,7 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
|
||||||
w->writeC(0x95);
|
w->writeC(0x95);
|
||||||
w->writeC(streamID);
|
w->writeC(streamID);
|
||||||
w->writeS(pendingFreq[streamID]); // sample number
|
w->writeS(pendingFreq[streamID]); // sample number
|
||||||
w->writeC((sample->getLoopStartPosition(DIV_SAMPLE_DEPTH_8BIT)==0)|(sampleDir[streamID]?0x10:0)); // flags
|
w->writeC((sample->getLoopStartPosition(DIV_SAMPLE_DEPTH_8BIT)==0 && sample->isLoopable())|(sampleDir[streamID]?0x10:0)); // flags
|
||||||
if (sample->isLoopable() && !sampleDir[streamID]) {
|
if (sample->isLoopable() && !sampleDir[streamID]) {
|
||||||
loopTimer[streamID]=sample->length8;
|
loopTimer[streamID]=sample->length8;
|
||||||
loopSample[streamID]=pendingFreq[streamID];
|
loopSample[streamID]=pendingFreq[streamID];
|
||||||
|
|
|
@ -219,12 +219,17 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
if (ImGui::Checkbox("Loop",&doLoop)) { MARK_MODIFIED
|
if (ImGui::Checkbox("Loop",&doLoop)) { MARK_MODIFIED
|
||||||
if (doLoop) {
|
if (doLoop) {
|
||||||
sample->loop=true;
|
sample->loop=true;
|
||||||
sample->loopStart=0;
|
if (sample->loopStart<0) {
|
||||||
sample->loopEnd=sample->samples;
|
sample->loopStart=0;
|
||||||
|
}
|
||||||
|
if (sample->loopEnd<0) {
|
||||||
|
sample->loopEnd=sample->samples;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sample->loop=false;
|
sample->loop=false;
|
||||||
|
/*
|
||||||
sample->loopStart=-1;
|
sample->loopStart=-1;
|
||||||
sample->loopEnd=sample->samples;
|
sample->loopEnd=sample->samples;*/
|
||||||
}
|
}
|
||||||
updateSampleTex=true;
|
updateSampleTex=true;
|
||||||
if (e->getSampleFormatMask()&(1U<<DIV_SAMPLE_DEPTH_BRR)) {
|
if (e->getSampleFormatMask()&(1U<<DIV_SAMPLE_DEPTH_BRR)) {
|
||||||
|
|
Loading…
Reference in a new issue