Fix per-channel osc

This commit is contained in:
cam900 2022-06-07 23:59:50 +09:00
parent dd93f6d18e
commit 7bbfe3af7c
2 changed files with 15 additions and 11 deletions

View file

@ -101,7 +101,20 @@ void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t
sn->write(w.val); sn->write(w.val);
writes.pop(); writes.pop();
} }
sn->sound_stream_update(snBuf,len); for (size_t h=0; h<len; h++) {
short* outs[2]={
&snBuf[0][h],
&snBuf[1][h],
};
sn->sound_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) { if (stereo) {
for (size_t i=0; i<len; i++) { for (size_t i=0; i<len; i++) {
bufL[i+start]=snBuf[0][i]; bufL[i+start]=snBuf[0][i];
@ -113,15 +126,6 @@ void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t
bufR[i+start]=bufL[i+start]; bufR[i+start]=bufL[i+start];
} }
} }
for (size_t h=start; h<start+len; h++) {
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);
}
}
}
} }
void DivPlatformSMS::acquire(short* bufL, short* bufR, size_t start, size_t len) { void DivPlatformSMS::acquire(short* bufL, short* bufR, size_t start, size_t len) {

View file

@ -411,7 +411,7 @@ void sn76496_base_device::sound_stream_update(short** outputs, int outLen)
if (m_negate) { out = -out; out2 = -out2; } if (m_negate) { out = -out; out2 = -out2; }
outputs[0][sampindex]=out; outputs[0][sampindex]=out;
if (m_stereo) if (m_stereo && (outputs[1] != nullptr))
outputs[1][sampindex]=out; outputs[1][sampindex]=out;
} }
} }