From 55de7f05beb5b9aa37327545714e94e7e1c84831 Mon Sep 17 00:00:00 2001 From: angelosa Date: Tue, 10 Sep 2024 10:21:39 +0200 Subject: funtech/umc6619_sound.cpp: add live audio view debugging --- src/mame/funtech/umc6619_sound.cpp | 52 ++++++++++++++++++++++++++++++++++++++ src/mame/funtech/umc6619_sound.h | 3 +++ 2 files changed, 55 insertions(+) diff --git a/src/mame/funtech/umc6619_sound.cpp b/src/mame/funtech/umc6619_sound.cpp index bf847eb12c7..40e08237e9c 100644 --- a/src/mame/funtech/umc6619_sound.cpp +++ b/src/mame/funtech/umc6619_sound.cpp @@ -14,6 +14,8 @@ #define VERBOSE (0) #include "logmacro.h" +#define LIVE_AUDIO_VIEW 0 + // device type definition DEFINE_DEVICE_TYPE(UMC6619_SOUND, umc6619_sound_device, "umc6619_sound", "UMC UM6619 Sound Engine") @@ -53,6 +55,7 @@ void umc6619_sound_device::device_start() save_item(STRUCT_MEMBER(m_channels, volume_l)); save_item(STRUCT_MEMBER(m_channels, volume_r)); save_item(STRUCT_MEMBER(m_channels, one_shot)); + save_item(STRUCT_MEMBER(m_channels, unk_upper_05)); save_item(NAME(m_regs)); } @@ -64,7 +67,20 @@ void umc6619_sound_device::device_reset() for (auto &channel : m_channels) { + channel.pitch = 0; + channel.length = 0; + channel.start_addr = 0; + channel.curr_addr = 0; + channel.end_addr = 0; + channel.addr_increment = 0; + channel.frac = 0; channel.register9 = 0; + std::fill(std::begin(channel.envelope), std::end(channel.envelope), 0); + channel.volume = 0; + channel.volume_l = 0; + channel.volume_r = 0; + channel.one_shot = false; + channel.unk_upper_05 = 0; } m_timer->reset(); @@ -84,10 +100,45 @@ TIMER_CALLBACK_MEMBER(umc6619_sound_device::channel_irq) } } +std::string umc6619_sound_device::print_audio_state() +{ + std::ostringstream outbuffer; + + util::stream_format(outbuffer, "channel | address | length | pitch | one? | vol | DMA? | (unk09) |\n"); + + for (int i = 0; i < 16; i++) + { + acan_channel &channel = m_channels[i]; + + util::stream_format(outbuffer, "%02d: %01d | %04x (%04x-%04x) | %04x | %04x | %d (%02x)| %02x | %02x | %02x %02x %02x %02x|\n" + , i + , BIT(m_active_channels, i) + , channel.curr_addr + , (channel.start_addr << 6) & 0xffff + , channel.end_addr + , channel.length + , channel.pitch + , channel.one_shot + , channel.unk_upper_05 + , channel.volume + , channel.register9 + , channel.envelope[0] + , channel.envelope[1] + , channel.envelope[2] + , channel.envelope[3] + ); + } + + return outbuffer.str(); +} + void umc6619_sound_device::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) { std::fill_n(&m_mix[0], outputs[0].samples() * 2, 0); + if (LIVE_AUDIO_VIEW) + popmessage(print_audio_state()); + for (int i = 0; i < 16 && m_active_channels != 0; i++) { if (BIT(m_active_channels, i)) @@ -244,6 +295,7 @@ void umc6619_sound_device::write(offs_t offset, uint8_t data) acan_channel &channel = m_channels[lower]; channel.length = 0x40 << ((data & 0x0e) >> 1); channel.one_shot = BIT(data, 0); + channel.unk_upper_05 = data & 0xf0; LOG("%s: Waveform length and attributes (voice %02x): %02x\n", machine().describe_context(), lower, data); break; } diff --git a/src/mame/funtech/umc6619_sound.h b/src/mame/funtech/umc6619_sound.h index d607735c7c9..17dff54dc46 100644 --- a/src/mame/funtech/umc6619_sound.h +++ b/src/mame/funtech/umc6619_sound.h @@ -49,6 +49,7 @@ private: uint8_t volume_l; uint8_t volume_r; bool one_shot; + uint8_t unk_upper_05; }; void keyon_voice(uint8_t voice); @@ -63,6 +64,8 @@ private: acan_channel m_channels[16]; uint8_t m_regs[256]; std::unique_ptr m_mix; + + std::string print_audio_state(); }; DECLARE_DEVICE_TYPE(UMC6619_SOUND, umc6619_sound_device) -- cgit v1.2.3