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 560cf678d605817c843e0a6048fefe5853d82469
parent e8e820b04e37fb38d0371fef0809276a6b6b2ecd
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sun, 29 Sep 2024 12:24:26 +0200

always display last 3 entires of control table as tri/square/saw and prevent edits

Diffstat:
Msource/xtJucePlugin/weControlTreeItem.cpp | 14++++++++++----
Msource/xtJucePlugin/weData.cpp | 5+++++
Msource/xtJucePlugin/weData.h | 1+
3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/source/xtJucePlugin/weControlTreeItem.cpp b/source/xtJucePlugin/weControlTreeItem.cpp @@ -26,14 +26,20 @@ namespace xtJucePlugin void ControlTreeItem::paintItem(juce::Graphics& _g, const int _width, const int _height) { - if(const auto wave = m_editor.getData().getWave(m_table, m_index)) + if(const auto wave = m_editor.getData().getWave(m_wave)) WaveTreeItem::paintWave(*wave, _g, _width>>1, 0, _width>>1, _height, juce::Colour(0xffffffff)); TreeItem::paintItem(_g, _width, _height); } - void ControlTreeItem::setWave(const xt::WaveId _wave) + void ControlTreeItem::setWave(xt::WaveId _wave) { + switch (m_index.rawId()) + { + case 61: _wave = xt::WaveId(101); break; + case 62: _wave = xt::WaveId(100); break; + case 63: _wave = xt::WaveId(104); break; + } if(m_wave == _wave) return; m_wave = _wave; @@ -54,7 +60,7 @@ namespace xtJucePlugin juce::var ControlTreeItem::getDragSourceDescription() { - if(m_wave == g_invalidWaveIndex || WaveEditorData::isReadOnly(m_table)) + if(m_wave == g_invalidWaveIndex || WaveEditorData::isReadOnly(m_table) || WaveEditorData::isReadOnly(m_index)) return TreeViewItem::getDragSourceDescription(); auto* desc = new WaveDesc(); @@ -66,7 +72,7 @@ namespace xtJucePlugin bool ControlTreeItem::isInterestedInDragSource(const juce::DragAndDropTarget::SourceDetails& _dragSourceDetails) { - if(WaveEditorData::isReadOnly(m_table)) + if(WaveEditorData::isReadOnly(m_table) || WaveEditorData::isReadOnly(m_index)) return false; return WaveDesc::fromDragSource(_dragSourceDetails) != nullptr; } diff --git a/source/xtJucePlugin/weData.cpp b/source/xtJucePlugin/weData.cpp @@ -276,4 +276,9 @@ namespace xtJucePlugin return true; return _waveId.rawId() < xt::Wave::g_firstRamWaveIndex; } + + bool WaveEditorData::isReadOnly(const xt::TableIndex _index) + { + return _index.rawId() >= 61; // always tri/square/saw + } } diff --git a/source/xtJucePlugin/weData.h b/source/xtJucePlugin/weData.h @@ -50,6 +50,7 @@ namespace xtJucePlugin static bool isAlgorithmicTable(xt::TableId _index); static bool isReadOnly(xt::TableId _table); static bool isReadOnly(xt::WaveId _waveId); + static bool isReadOnly(xt::TableIndex _index); bool setWave(xt::WaveId _id, const xt::WaveData& _data); bool setTable(xt::TableId _index, const xt::TableData& _data);