diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index 93e38e4b9..374b52d82 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -3271,7 +3271,6 @@ void DivPlatformOPL::renderSamples(int sysID) { int length; switch (s->depth) { - default: case DIV_SAMPLE_DEPTH_8BIT: length=MIN(65535,s->getLoopEndPosition(DIV_SAMPLE_DEPTH_8BIT)); break; @@ -3281,6 +3280,9 @@ void DivPlatformOPL::renderSamples(int sysID) { case DIV_SAMPLE_DEPTH_16BIT: length=MIN(131070,s->getLoopEndPosition(DIV_SAMPLE_DEPTH_16BIT)); break; + default: + length=MIN(65535,s->getLoopEndPosition(DIV_SAMPLE_DEPTH_8BIT)); + break; } unsigned char* src=(unsigned char*)s->getCurBuf(); int actualLength=MIN((int)(getSampleMemCapacity(0)-memPos),length); @@ -3313,10 +3315,9 @@ void DivPlatformOPL::renderSamples(int sysID) { DivSample* s=parent->song.sample[i]; unsigned int insAddr=(i*12)+((ramSize<=0x200000)?0x200000:0); unsigned char bitDepth; - int endPos=CLAMP(s->loopEnd,1,0x10000); - int loop=s->isLoopable()?CLAMP(s->loopStart,0,endPos-1):(endPos-1); + int endPos=CLAMP(s->isLoopable()?s->loopEnd:s->samples,1,0x10000); + int loop=s->isLoopable()?CLAMP(s->loopStart,0,endPos-2):(endPos-2); switch (s->depth) { - default: case DIV_SAMPLE_DEPTH_8BIT: bitDepth=0; break; @@ -3326,6 +3327,9 @@ void DivPlatformOPL::renderSamples(int sysID) { case DIV_SAMPLE_DEPTH_16BIT: bitDepth=2; break; + default: + bitDepth=0; + break; } pcmMem[insAddr]=(bitDepth<<6)|((sampleOffPCM[i]>>16)&0x3f); pcmMem[1+insAddr]=(sampleOffPCM[i]>>8)&0xff; @@ -3334,7 +3338,7 @@ void DivPlatformOPL::renderSamples(int sysID) { pcmMem[4+insAddr]=(loop)&0xff; pcmMem[5+insAddr]=((~(endPos-1))>>8)&0xff; pcmMem[6+insAddr]=(~(endPos-1))&0xff; - // TODO: how to fill in rest of instrument table? + // on MultiPCM this consists of instrument params, but on OPL4 this is not used pcmMem[7+insAddr]=0; // LFO, VIB pcmMem[8+insAddr]=(0xf << 4) | (0xf << 0); // AR, D1R pcmMem[9+insAddr]=0; // DL, D2R diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index f7bb0bc44..fbea92ddc 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -2603,30 +2603,37 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl if (ImGui::RadioButton(_("4MB"),ramSize==0)) { ramSize=0; altered=true; + mustRender=true; } if (ImGui::RadioButton(_("2MB"),ramSize==1)) { ramSize=1; altered=true; + mustRender=true; } if (ImGui::RadioButton(_("1MB"),ramSize==2)) { ramSize=2; altered=true; + mustRender=true; } if (ImGui::RadioButton(_("640KB"),ramSize==3)) { ramSize=3; altered=true; + mustRender=true; } if (ImGui::RadioButton(_("512KB"),ramSize==4)) { ramSize=4; altered=true; + mustRender=true; } if (ImGui::RadioButton(_("256KB"),ramSize==5)) { ramSize=5; altered=true; + mustRender=true; } if (ImGui::RadioButton(_("128KB"),ramSize==6)) { ramSize=6; altered=true; + mustRender=true; } ImGui::Unindent();