YM2612: fix DAC output not visible in per-chan osc

issue #515
This commit is contained in:
tildearrow 2022-06-03 01:47:31 -05:00
parent 94dae570e0
commit 0895789539
2 changed files with 22 additions and 2 deletions

View file

@ -249,8 +249,16 @@ void DivPlatformGenesis::acquire_nuked(short* bufL, short* bufR, size_t start, s
OPN2_Clock(&fm,o); os[0]+=o[0]; os[1]+=o[1]; OPN2_Clock(&fm,o); os[0]+=o[0]; os[1]+=o[1];
//OPN2_Write(&fm,0,0); //OPN2_Write(&fm,0,0);
if (i==5) {
if (fm.dacen) {
oscBuf[i]->data[oscBuf[i]->needle++]=fm.dacdata<<7;
} else {
oscBuf[i]->data[oscBuf[i]->needle++]=fm.ch_out[i]<<7; oscBuf[i]->data[oscBuf[i]->needle++]=fm.ch_out[i]<<7;
} }
} else {
oscBuf[i]->data[oscBuf[i]->needle++]=fm.ch_out[i]<<7;
}
}
os[0]=(os[0]<<5); os[0]=(os[0]<<5);
if (os[0]<-32768) os[0]=-32768; if (os[0]<-32768) os[0]=-32768;
@ -293,8 +301,16 @@ void DivPlatformGenesis::acquire_ymfm(short* bufL, short* bufR, size_t start, si
//OPN2_Write(&fm,0,0); //OPN2_Write(&fm,0,0);
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {
if (i==5) {
if (fm_ymfm->debug_dac_enable()) {
oscBuf[i]->data[oscBuf[i]->needle++]=fm_ymfm->debug_dac_data()<<7;
} else {
oscBuf[i]->data[oscBuf[i]->needle++]=(fme->debug_channel(i)->debug_output(0)+fme->debug_channel(i)->debug_output(1))<<6; oscBuf[i]->data[oscBuf[i]->needle++]=(fme->debug_channel(i)->debug_output(0)+fme->debug_channel(i)->debug_output(1))<<6;
} }
} else {
oscBuf[i]->data[oscBuf[i]->needle++]=(fme->debug_channel(i)->debug_output(0)+fme->debug_channel(i)->debug_output(1))<<6;
}
}
if (os[0]<-32768) os[0]=-32768; if (os[0]<-32768) os[0]=-32768;
if (os[0]>32767) os[0]=32767; if (os[0]>32767) os[0]=32767;

View file

@ -778,6 +778,10 @@ public:
// get the engine // get the engine
fm_engine* debug_engine() { return &m_fm; } fm_engine* debug_engine() { return &m_fm; }
// get DAC state
uint16_t debug_dac_data() { return m_dac_data; }
uint8_t debug_dac_enable() { return m_dac_enable; }
protected: protected:
// simulate the DAC discontinuity // simulate the DAC discontinuity
constexpr int32_t dac_discontinuity(int32_t value) const { return (value < 0) ? (value - 2) : (value + 3); } constexpr int32_t dac_discontinuity(int32_t value) const { return (value < 0) ? (value - 2) : (value + 3); }