diff --git a/src/devices/sound/huc6230.cpp b/src/devices/sound/huc6230.cpp index 50a28a37cbb..ed297c36cf8 100644 --- a/src/devices/sound/huc6230.cpp +++ b/src/devices/sound/huc6230.cpp @@ -23,6 +23,10 @@ void huc6230_device::sound_stream_update(sound_stream &stream, std::vectorm_playing) continue; - samp0 = std::clamp(samp0 + ((channel->m_output * channel->m_lvol) >> 3), -32768, 32767); - samp1 = std::clamp(samp1 + ((channel->m_output * channel->m_rvol) >> 3), -32768, 32767); + // TODO: wrong volume scales + samp0 = std::clamp(samp0 + ((channel->m_output * channel->m_lvol) >> 4), -32768, 32767); + samp1 = std::clamp(samp1 + ((channel->m_output * channel->m_rvol) >> 4), -32768, 32767); } outputs[0].put_int(i, samp0, 32768); @@ -124,6 +129,8 @@ TIMER_CALLBACK_MEMBER(huc6230_device::adpcm_timer) } int32_t new_output; + // TODO: BIOS doesn't use interpolation + // which actually is linear interpolation off/on ... if (!channel->m_interpolate) new_output = channel->m_curr_sample; else diff --git a/src/devices/video/huc6272.cpp b/src/devices/video/huc6272.cpp index 5fcef2e2a7d..5f4ec6b8c7a 100644 --- a/src/devices/video/huc6272.cpp +++ b/src/devices/video/huc6272.cpp @@ -453,8 +453,9 @@ void huc6272_device::write(offs_t offset, uint32_t data) m_adpcm.playing[i] = BIT(data, i); if (!m_adpcm.playing[i]) { - m_adpcm.input[i] = -1; + m_adpcm.input[i] = 0; m_adpcm.pos[i] = 0; + m_adpcm.nibble[i] = 32; } else { @@ -504,6 +505,8 @@ void huc6272_device::write(offs_t offset, uint32_t data) } } +// TODO: clearly written in blind faith +// (interrupt_update fns are untested by the BIOS main menu) uint8_t huc6272_device::adpcm_update(int chan) { if (!m_adpcm.playing[chan]) @@ -513,7 +516,11 @@ uint8_t huc6272_device::adpcm_update(int chan) m_adpcm.pos[chan]++; if (m_adpcm.pos[chan] >= rate) { - if (m_adpcm.input[chan] == -1) + m_adpcm.nibble[chan] += 4; + if (m_adpcm.nibble[chan] >= 32) + m_adpcm.nibble[chan] = 0; + + if (m_adpcm.nibble[chan] == 0) { m_adpcm.input[chan] = read_dword(((m_page_setting & 0x1000) << 6) | m_adpcm.addr[chan]); m_adpcm.addr[chan] = (m_adpcm.addr[chan] & 0x20000) | ((m_adpcm.addr[chan] + 1) & 0x1ffff); @@ -535,7 +542,7 @@ uint8_t huc6272_device::adpcm_update(int chan) interrupt_update(); } - if (BIT(m_adpcm.control[chan],0)) // Ring Buffer + if (BIT(m_adpcm.control[chan], 0)) // Ring Buffer { m_adpcm.addr[chan] = m_adpcm.start[chan]; } @@ -545,14 +552,9 @@ uint8_t huc6272_device::adpcm_update(int chan) return 0; } } - m_adpcm.nibble[chan] = 0; - } - else - { - m_adpcm.nibble[chan] += 4; - if (m_adpcm.nibble[chan] >= 28) - m_adpcm.input[chan] = -1; + //m_adpcm.nibble[chan] = 0; } + m_adpcm.pos[chan] = 0; }