OPLL: fix per-channel osc, part 1

This commit is contained in:
tildearrow 2022-06-29 01:32:52 -05:00
parent 90481cc460
commit 4dfd413ead
3 changed files with 20 additions and 2 deletions

View File

@ -1019,6 +1019,10 @@ static void OPLL_Operator(opll_t *chip) {
}
chip->ch_out = ismod1 ? routput : (output>>3);
if (!ismod1) {
chip->output_ch[(chip->cycles+1)%9] = chip->ch_out;
}
}
static void OPLL_DoRhythm(opll_t *chip) {

View File

@ -191,6 +191,8 @@ typedef struct {
int16_t output_m;
int16_t output_r;
int16_t output_ch[9];
} opll_t;
const opll_patch_t* OPLL_GetPatchROM(uint32_t chip_type);

View File

@ -97,6 +97,10 @@ const unsigned char drumSlot[11]={
0, 0, 0, 0, 0, 0, 6, 7, 8, 8, 7
};
const unsigned char visMapOPLL[9]={
6, 7, 8, 3, 4, 5, 0, 1, 2
};
void DivPlatformOPLL::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
static int o[2];
static int os;
@ -124,10 +128,18 @@ void DivPlatformOPLL::acquire_nuked(short* bufL, short* bufR, size_t start, size
OPLL_Clock(&fm,o);
unsigned char nextOut=cycleMapOPLL[fm.cycles];
if ((nextOut>=6 && properDrums) || !isMuted[nextOut]) {
oscBuf[nextOut]->data[oscBuf[nextOut]->needle++]=(o[0]+o[1])<<6;
os+=(o[0]+o[1]);
if (vrc7) oscBuf[nextOut]->data[oscBuf[nextOut]->needle++]=(o[0]+o[1])<<6;
} else {
oscBuf[nextOut]->data[oscBuf[nextOut]->needle++]=0;
if (vrc7) oscBuf[nextOut]->data[oscBuf[nextOut]->needle++]=0;
}
}
if (!vrc7) for (int i=0; i<9; i++) {
unsigned char ch=visMapOPLL[i];
if ((i>=6 && properDrums) || !isMuted[ch]) {
oscBuf[ch]->data[oscBuf[ch]->needle++]=(fm.output_ch[i])<<6;
} else {
oscBuf[ch]->data[oscBuf[ch]->needle++]=0;
}
}
os*=50;