Supervision: some hopeful fixes

This commit is contained in:
tildearrow 2025-03-23 03:44:06 -05:00
parent f919d1779a
commit 0d1a482cbd
2 changed files with 8 additions and 6 deletions

View file

@ -5,7 +5,7 @@
#include <string.h>
#define SV_SAMPLE_RATE ((svision->UNSCALED_CLOCK)/64)
#define SV_SAMPLE_RATE ((int)((svision->UNSCALED_CLOCK)/64))
#define SV_DEC_TICK ((SV_SAMPLE_RATE)/60)
void supervision_sound_set_clock(struct svision_t *svision, uint32 clock) {
@ -191,10 +191,11 @@ void supervision_sound_wave_write(struct svision_t *svision, int which, int offs
uint16 size;
size = channel->reg[0] | ((channel->reg[1] & 7) << 8);
// if size == 0 then channel->size == 0
if (size)
if (size) {
channel->size = (uint16)(((real)SV_SAMPLE_RATE) * ((real)((size + 1) << 5)) / ((real)svision->UNSCALED_CLOCK));
else
} else {
channel->size = 0;
}
channel->pos = 0;
// Popo Team
if (channel->count != 0 || svision->ch[which].size == 0 || channel->size == 0) {
@ -257,10 +258,11 @@ void supervision_sound_noise_write(struct svision_t *svision, int offset, uint8
switch (offset) {
case 0: {
uint32 divisor = 8 << (data >> 4);
if (divisor)
if (divisor) {
svision->m_noise.step = ((real)svision->UNSCALED_CLOCK) / ((real)SV_SAMPLE_RATE * divisor);
else
} else {
svision->m_noise.step = 0;
}
svision->m_noise.step = ((real)svision->UNSCALED_CLOCK) / ((real)SV_SAMPLE_RATE * divisor);
svision->m_noise.volume = data & 0xf;

View file

@ -81,7 +81,7 @@ void DivPlatformSupervision::acquire(short** buf, size_t len) {
tempR[0]=(((int)s[1])-128)*256;
for (int i=0; i<4; i++) {
oscBuf[i]->putSample(h,CLAMP((((int)s[2+i])-128)*256,-32768,32767));
oscBuf[i]->putSample(h,CLAMP(((int)s[2+i])<<8,-32768,32767));
}
tempL[0]=(tempL[0]>>1)+(tempL[0]>>2);