OPL4: fix PCM chan osc on ymfm

for real
issue #2566
This commit is contained in:
tildearrow 2025-06-21 17:46:27 -05:00
parent 8d8aecca2a
commit d7c5fceac4
2 changed files with 8 additions and 4 deletions

View file

@ -724,6 +724,8 @@ void DivPlatformOPL::acquire_ymfm4(short** buf, size_t len) {
unsigned char oscOffs=i+pcmChanOffs; unsigned char oscOffs=i+pcmChanOffs;
int chOut=pcmChan[i]->debug_output(0); int chOut=pcmChan[i]->debug_output(0);
chOut+=pcmChan[i]->debug_output(1); chOut+=pcmChan[i]->debug_output(1);
chOut+=pcmChan[i]->debug_output(2);
chOut+=pcmChan[i]->debug_output(3);
oscBuf[oscOffs]->putSample(h,CLAMP(chOut<<1,-32768,32767)); oscBuf[oscOffs]->putSample(h,CLAMP(chOut<<1,-32768,32767));
} }
} }

View file

@ -338,11 +338,13 @@ void pcm_channel::output(output_data &output) const
// fetch current sample and add // fetch current sample and add
int16_t sample = fetch_sample(); int16_t sample = fetch_sample();
int32_t outl = (lvol * sample) >> 15;
int32_t outr = (rvol * sample) >> 15;
uint32_t outnum = m_regs.ch_output_channel(m_choffs) * 2; uint32_t outnum = m_regs.ch_output_channel(m_choffs) * 2;
output.data[outnum + 0] += (lvol * sample) >> 15; output.data[outnum + 0] += outl;
output.data[outnum + 1] += (rvol * sample) >> 15; output.data[outnum + 1] += outr;
m_output[outnum + 0] = output.data[outnum + 0]; m_output[outnum + 0] = outl;
m_output[outnum + 1] = output.data[outnum + 1]; m_output[outnum + 1] = outr;
} }