gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit e7e3f07d2cb90491bce9ddd51d940db87743e2a2
parent 1fd24349a11a8f0ae792bb181f3982b6150f7158
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sun, 21 Jul 2024 19:59:48 +0200

front panel now displaying properly

Diffstat:
Msource/nord/n2x/n2xLib/n2xfrontpanel.cpp | 78+++++++++++++++++++++++++++++++++++-------------------------------------------
Msource/nord/n2x/n2xLib/n2xfrontpanel.h | 5++++-
2 files changed, 39 insertions(+), 44 deletions(-)

diff --git a/source/nord/n2x/n2xLib/n2xfrontpanel.cpp b/source/nord/n2x/n2xLib/n2xfrontpanel.cpp @@ -13,15 +13,20 @@ namespace n2x { } - uint8_t FrontPanelCS4::read8(mc68k::PeriphAddress _addr) + FrontPanelCS4::FrontPanelCS4(FrontPanel& _fp) : FrontPanelCS(_fp) { - return 0xff; - - return FrontPanelCS<2107392>::read8(_addr); } - FrontPanelCS4::FrontPanelCS4(FrontPanel& _fp) : FrontPanelCS(_fp) + uint8_t FrontPanelCS4::read8(mc68k::PeriphAddress _addr) { + switch (m_panel.cs6().getEncoderType()) + { + case EncoderType::PitchBend: + case EncoderType::ModWheel: + return 0; // pretend we're a rack unit + default: + return 0x80; + } } FrontPanelCS6::FrontPanelCS6(FrontPanel& _fp) : FrontPanelCS(_fp) @@ -30,36 +35,12 @@ namespace n2x void FrontPanelCS6::write8(const mc68k::PeriphAddress _addr, const uint8_t _val) { +// LOG("Write CS6 " << HEXN(_addr - base(),2) << " = " << HEXN(_val,2)); + switch (static_cast<uint32_t>(_addr)) { case g_frontPanelAddressCS6 + 0x8: - { - m_ledLatch8 = _val; - - // 10 / 12 first and then 8 didn't lead to any result - - /* - bool gotLCDs = false; - if(m_ledLatch12 & (1<<6)) - { - m_lcds[0] = _val; - gotLCDs = true; - } - if(m_ledLatch12 & (1<<7)) - { - m_lcds[1] = _val; - gotLCDs = true; - } - if(m_ledLatch10 & (1<<7)) - { - m_lcds[2] = _val; - gotLCDs = true; - } - - if(gotLCDs) - printLCD(); - */ - } + m_ledLatch8 = _val; break; case g_frontPanelAddressCS6 + 0xa: m_ledLatch10 = _val; @@ -68,6 +49,11 @@ namespace n2x m_lcds[2] = m_ledLatch8; printLCD(); } + else + { +// LOG("Read pot " << HEXN(_val, 2)); + m_selectedEncoder = static_cast<EncoderType>(_val); + } break; case g_frontPanelAddressCS6 + 0xc: { @@ -77,12 +63,12 @@ namespace n2x if(m_ledLatch12 & (1<<6)) { - m_lcds[0] = _val; + m_lcds[0] = m_ledLatch8; gotLCDs = true; } if(m_ledLatch12 & (1<<7)) { - m_lcds[1] = _val; + m_lcds[1] = m_ledLatch8; gotLCDs = true; } @@ -91,13 +77,14 @@ namespace n2x } break; } - FrontPanelCS<2105344>::write8(_addr, _val); + FrontPanelCS::write8(_addr, _val); } static uint8_t g_counter = 0; uint8_t FrontPanelCS6::read8(mc68k::PeriphAddress _addr) { + return 0; const auto a = static_cast<uint32_t>(_addr); switch (a) { @@ -152,19 +139,24 @@ namespace n2x for(auto i=0; i<3; ++i) { - drawH(1, 0, m_lcds[i] & (1<<1)); - drawH(1, 2, m_lcds[i] & (1<<7)); - drawH(1, 4, m_lcds[i] & (1<<4)); + auto bt = [&](const uint32_t _bit) + { + return !(m_lcds[i] & (1<<_bit)); + }; + + drawH(1, 0, bt(7)); + drawH(1, 2, bt(1)); + drawH(1, 4, bt(4)); - drawV(0, 1, m_lcds[i] & (1<<2)); - drawV(3, 1, m_lcds[i] & (1<<6)); - drawV(0, 3, m_lcds[i] & (1<<3)); - drawV(3, 3, m_lcds[i] & (1<<5)); + drawV(0, 1, bt(2)); + drawV(3, 1, bt(6)); + drawV(0, 3, bt(3)); + drawV(3, 3, bt(5)); off += 6; } - buf[4][4] = (m_lcds[0] & (1<<0)) ? '*' : ' '; + buf[4][4] = (m_lcds[0] & (1<<0)) ? ' ' : '*'; char message[(sizeof(Line) + 1) * buf.size() + 1]; size_t i=0; diff --git a/source/nord/n2x/n2xLib/n2xfrontpanel.h b/source/nord/n2x/n2xLib/n2xfrontpanel.h @@ -13,7 +13,7 @@ namespace n2x public: explicit FrontPanelCS(FrontPanel& _fp); - private: + protected: FrontPanel& m_panel; }; @@ -32,6 +32,8 @@ namespace n2x void write8(mc68k::PeriphAddress _addr, uint8_t _val) override; uint8_t read8(mc68k::PeriphAddress _addr) override; + auto getEncoderType() const { return m_selectedEncoder; } + private: void printLCD(); @@ -40,6 +42,7 @@ namespace n2x uint8_t m_ledLatch12 = 0; std::array<uint8_t,3> m_lcds{0,0,0}; std::array<uint8_t,3> m_lcdsPrev{0,0,0}; + EncoderType m_selectedEncoder = EncoderType::PitchBend; }; class FrontPanel