From 7bbfe3af7c8cab34ca65d9416e5dd0cedebc7d1e Mon Sep 17 00:00:00 2001 From: cam900 Date: Tue, 7 Jun 2022 23:59:50 +0900 Subject: [PATCH] Fix per-channel osc --- src/engine/platform/sms.cpp | 24 ++++++++++++++---------- src/engine/platform/sound/sn76496.cpp | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/engine/platform/sms.cpp b/src/engine/platform/sms.cpp index e5be23045..35bb9c40c 100644 --- a/src/engine/platform/sms.cpp +++ b/src/engine/platform/sms.cpp @@ -101,7 +101,20 @@ void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t sn->write(w.val); writes.pop(); } - sn->sound_stream_update(snBuf,len); + for (size_t h=0; hsound_stream_update(outs,1); + for (int i=0; i<4; i++) { + if (isMuted[i]) { + oscBuf[i]->data[oscBuf[i]->needle++]=0; + } else { + oscBuf[i]->data[oscBuf[i]->needle++]=sn->get_channel_output(i); + } + } + } if (stereo) { for (size_t i=0; idata[oscBuf[i]->needle++]=0; - } else { - oscBuf[i]->data[oscBuf[i]->needle++]=sn->get_channel_output(i); - } - } - } } void DivPlatformSMS::acquire(short* bufL, short* bufR, size_t start, size_t len) { diff --git a/src/engine/platform/sound/sn76496.cpp b/src/engine/platform/sound/sn76496.cpp index afb82ad3a..4bbb5848a 100644 --- a/src/engine/platform/sound/sn76496.cpp +++ b/src/engine/platform/sound/sn76496.cpp @@ -411,7 +411,7 @@ void sn76496_base_device::sound_stream_update(short** outputs, int outLen) if (m_negate) { out = -out; out2 = -out2; } outputs[0][sampindex]=out; - if (m_stereo) + if (m_stereo && (outputs[1] != nullptr)) outputs[1][sampindex]=out; } }