diff options
Diffstat (limited to 'src/devices/sound/huc6230.cpp')
-rw-r--r-- | src/devices/sound/huc6230.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/devices/sound/huc6230.cpp b/src/devices/sound/huc6230.cpp index 50a28a37cbb..ba969479cf2 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::vector<read_ { for (int i = 0; i < outputs[0].samples(); i++) { + // TODO: this implies to read from the PSG inputs + // doesn't seem right at all, eventually causes extreme DC offset on BIOS main menu, + // possibly because adpcm_timer runs from a different thread, + // needs to be rechecked once we have better examples ... s32 samp0 = inputs[0].get(i) * 32768.0; s32 samp1 = inputs[1].get(i) * 32768.0; @@ -33,8 +37,9 @@ void huc6230_device::sound_stream_update(sound_stream &stream, std::vector<read_ if (!channel->m_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 @@ -148,7 +155,7 @@ huc6230_device::huc6230_device(const machine_config &mconfig, const char *tag, d , m_adpcm_freq(0) , m_pcm_lvol(0) , m_pcm_rvol(0) - , m_adpcm_update_cb(*this) + , m_adpcm_update_cb(*this, 0) , m_vca_cb(*this) { } @@ -169,12 +176,8 @@ void huc6230_device::device_add_mconfig(machine_config &config) void huc6230_device::device_start() { - m_adpcm_update_cb.resolve_all_safe(0); - - m_vca_cb.resolve_safe(); - m_stream = stream_alloc(2, 2, clock() / 6); - m_adpcm_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(huc6230_device::adpcm_timer),this)); + m_adpcm_timer = timer_alloc(FUNC(huc6230_device::adpcm_timer), this); for (int i = 0; i < 2; i++) { |