OPL: fix YMF262-LLE chan osc, part 1

issue #1728
This commit is contained in:
tildearrow 2024-02-02 16:21:22 -05:00
parent ffcf6587c4
commit 731b7a1bd6
3 changed files with 34 additions and 7 deletions

View file

@ -1442,6 +1442,8 @@ void FMOPL3_Clock(fmopl3_t *chip)
int sign;
chip->op_value_debug = chip->op_value;
int accm_a = chip->fsm_out[6] ? 0 : chip->accm_a[1];
accm_a += (chip->pan_l[1][1] & 1) != 0 ? value : 0;
chip->accm_a[0] = accm_a;

View file

@ -297,6 +297,7 @@ typedef struct
int op_mod[2];
int op_value;
int op_value_debug;
int accm_a[2];
int accm_b[2];

View file

@ -515,6 +515,18 @@ static const int cycleMapDrums[18]={
0, 1, 2, 3, 4, 5, 3, 4, 5,
};
static const int cycleMap3[36]={
14, 12, 13, 14, 0, 2, 4, 0, 2,
4, 1, 3, 5, 1, 3, 5, 15, 16,
17, 15, 16, 17, 6, 8, 10, 6, 8, 10, 7, 9, 11, 7, 9, 11, 12, 13
};
static const int cycleMap3Drums[36]={
14, 12, 13, 14, 0, 2, 4, 0, 2,
4, 1, 3, 5, 1, 3, 5, 15, 19,
17, 15, 16, 18, 6, 8, 10, 6, 8, 10, 7, 9, 11, 7, 9, 11, 12, 13
};
void DivPlatformOPL::acquire_nukedLLE2(short** buf, size_t len) {
int chOut[11];
thread_local ymfm::ymfm_output<2> aOut;
@ -664,8 +676,8 @@ void DivPlatformOPL::acquire_nukedLLE3(short** buf, size_t len) {
int chOut[20];
for (size_t h=0; h<len; h++) {
//int curCycle=0;
//unsigned char subCycle=0;
int curCycle=0;
unsigned char subCycle=0;
for (int i=0; i<20; i++) {
chOut[i]=0;
@ -721,10 +733,22 @@ void DivPlatformOPL::acquire_nukedLLE3(short** buf, size_t len) {
if (--delay<0) waitingBusy=false;
}
/*if (!(++subCycle&3)) {
// TODO: chan osc
if (!(++subCycle&1)) {
if (properDrums) {
if (fm_lle3.op_value_debug&0x1000) {
chOut[cycleMap3Drums[curCycle]]+=(fm_lle3.op_value_debug|0xfffff000)<<1;
} else {
chOut[cycleMap3Drums[curCycle]]+=(fm_lle3.op_value_debug)<<1;
}
} else {
if (fm_lle3.op_value_debug&0x1000) {
chOut[cycleMap3[curCycle]]+=(fm_lle3.op_value_debug|0xfffff000)<<1;
} else {
chOut[cycleMap3[curCycle]]+=(fm_lle3.op_value_debug)<<1;
}
}
curCycle++;
}*/
}
if (fm_lle3.o_sy && !lastSY) {
dacVal>>=1;
@ -746,11 +770,11 @@ void DivPlatformOPL::acquire_nukedLLE3(short** buf, size_t len) {
}
for (int i=0; i<20; i++) {
if (i>=15 && properDrums) {
/*if (i>=15 && 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];