From 8500b1b43554cfd12cfa6e5cf5606ced92600c76 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 24 Nov 2023 15:16:00 -0500 Subject: [PATCH] OPL: YM3812-LLE, part 3 per-chan osc --- src/engine/platform/opl.cpp | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index 06113095b..42d44863f 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -505,10 +505,20 @@ void DivPlatformOPL::acquire_ymfm3(short** buf, size_t len) { } } +static const int cycleMap[18]={ + 6, 7, 8, 6, 7, 8, 0, 1, 2, + 0, 1, 2, 3, 4, 5, 3, 4, 5, +}; + +static const int cycleMapDrums[18]={ + 6, 10, 8, 6, 7, 9, 0, 1, 2, + 0, 1, 2, 3, 4, 5, 3, 4, 5, +}; + void DivPlatformOPL::acquire_nukedLLE2(short** buf, size_t len) { int chOut[11]; for (size_t h=0; h=0 && curCycle<9) { - // TODO: this + if (!(++subCycle&3)) { + if (properDrums) { + chOut[cycleMapDrums[curCycle]]+=fm_lle2.op_value_debug; + } else { + chOut[cycleMap[curCycle]]+=fm_lle2.op_value_debug; + } + curCycle++; } - if (!(++subCycle&3)) curCycle++; if (fm_lle2.o_sy && !lastSY) { dacVal>>=1; @@ -576,17 +590,20 @@ void DivPlatformOPL::acquire_nukedLLE2(short** buf, size_t len) { int m=(dacVal>>5)&1023; m-=512; dacOut=(m<>1; - //logV("dacVal: %.8X",dacVal); - //dacVal=0; - //dacVal&=(1U<<18); break; } } buf[0][h]=dacOut; - //buf[0][h]=((fm_lle2.op_value+0x1000)&0x1fff)-0x1000; for (int i=0; i<11; i++) { + if (i>=6 && properDrums) { + chOut[i]<<=1; + } else { + chOut[i]<<=2; + } + if (chOut[i]<-32768) chOut[i]=-32768; + if (chOut[i]>32767) chOut[i]=32767; oscBuf[i]->data[oscBuf[i]->needle++]=chOut[i]; } }