commit 3c8f80c69777345e21db084fdc966317332e8c4f
parent 379d2d27d49c1b985d62320fa13cf196911230b0
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Thu, 12 Sep 2024 23:39:36 +0200
move wave & wavetable preview preparations
Diffstat:
6 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/source/xtJucePlugin/xtWaveEditor.cpp b/source/xtJucePlugin/xtWaveEditor.cpp
@@ -61,6 +61,22 @@ namespace xtJucePlugin
m_graphFreq->setColour(colourId, colour);
m_graphPhase->setColour(colourId, colour);
m_graphTime->setColour(colourId, colour);
+
+ m_btWavePreview = m_editor.findComponentT<juce::Button>("btWavePreview");
+ m_ledWavePreview = m_editor.findComponentT<juce::Button>("ledWavePreview");
+
+ m_btWavetablePreview = m_editor.findComponentT<juce::Button>("btWavetablePreview");
+ m_ledWavetablePreview = m_editor.findComponentT<juce::Button>("ledWavetablePreview");
+
+ m_btWavePreview->onClick = [this]
+ {
+ toggleWavePreview(m_btWavePreview->getToggleState());
+ };
+
+ m_btWavetablePreview->onClick = [this]
+ {
+ toggleWavetablePreview(m_btWavePreview->getToggleState());
+ };
}
void WaveEditor::destroy()
@@ -87,6 +103,24 @@ namespace xtJucePlugin
m_data.requestData();
}
+ void WaveEditor::toggleWavePreview(const bool _enabled)
+ {
+ if(_enabled)
+ toggleWavetablePreview(false);
+
+ m_btWavePreview->setToggleState(_enabled, juce::dontSendNotification);
+ m_ledWavePreview->setToggleState(_enabled, juce::dontSendNotification);
+ }
+
+ void WaveEditor::toggleWavetablePreview(const bool _enabled)
+ {
+ if(_enabled)
+ toggleWavePreview(false);
+
+ m_btWavetablePreview->setToggleState(_enabled, juce::dontSendNotification);
+ m_ledWavetablePreview->setToggleState(_enabled, juce::dontSendNotification);
+ }
+
void WaveEditor::onReceiveWave(const pluginLib::MidiPacket::Data& _data, const std::vector<uint8_t>& _msg)
{
m_data.onReceiveWave(_data, _msg);
diff --git a/source/xtJucePlugin/xtWaveEditor.h b/source/xtJucePlugin/xtWaveEditor.h
@@ -56,6 +56,9 @@ namespace xtJucePlugin
void checkFirstTimeVisible();
void onFirstTimeVisible();
+ void toggleWavePreview(bool _enabled);
+ void toggleWavetablePreview(bool _enabled);
+
Editor& m_editor;
std::unique_ptr<WaveTree> m_waveTree;
@@ -66,6 +69,12 @@ namespace xtJucePlugin
std::unique_ptr<GraphPhase> m_graphPhase;
std::unique_ptr<GraphTime> m_graphTime;
+ juce::Button* m_btWavePreview = nullptr;
+ juce::Button* m_ledWavePreview = nullptr;
+
+ juce::Button* m_btWavetablePreview = nullptr;
+ juce::Button* m_ledWavetablePreview = nullptr;
+
WaveEditorData m_data;
GraphData m_graphData;
diff --git a/source/xtLib/CMakeLists.txt b/source/xtLib/CMakeLists.txt
@@ -18,6 +18,7 @@ set(SOURCES
xtState.cpp xtState.h
xtSysexRemoteControl.cpp xtSysexRemoteControl.h
xtUc.cpp xtUc.h
+ xtWavePreview.cpp xtWavePreview.h
)
target_sources(xtLib PRIVATE ${SOURCES})
diff --git a/source/xtLib/xtMidiTypes.h b/source/xtLib/xtMidiTypes.h
@@ -26,6 +26,11 @@ namespace xt
ModeRequest = 0x07, ModeDump = 0x17, ModeParameterChange = 0x27, ModeStore = 0x37, ModeRecall = 0x47, ModeCompare = 0x57,
InfoRequest = 0x08, InfoDump = 0x18, InfoParameterChange = 0x28, InfoStore = 0x38, InfoRecall = 0x48, InfoCompare = 0x58,
+ // emu specific, these are to preview waves and wavetables, the dump format is identical to regular wave/wavetable dumps but we modify the DSP memory directly
+ WaveRequestP = 0x09, WaveDumpP = 0x19, WaveParameterChangeP = 0x29, WaveStoreP = 0x39, WaveRecallP = 0x49, WaveCompareP = 0x59,
+ WaveCtlRequestP = 0x0a, WaveCtlDumpP = 0x1a, WaveCtlParameterChangeP = 0x2a, WaveCtlStoreP = 0x3a, WaveCtlRecallP = 0x4a, WaveCtlCompareP = 0x5a,
+
+ // emu remote control support
EmuLCD = 0x60,
EmuLEDs = 0x61,
EmuButtons = 0x62,
diff --git a/source/xtLib/xtWavePreview.cpp b/source/xtLib/xtWavePreview.cpp
@@ -0,0 +1,13 @@
+#include "xtWavePreview.h"
+
+#include "xt.h"
+#include "xtHardware.h"
+
+namespace xt
+{
+ WavePreview::WavePreview(Xt& _xt)
+ : m_xt(_xt)
+ , m_dspMem(m_xt.getHardware()->getDSP(0).dsp().memory())
+ {
+ }
+}
diff --git a/source/xtLib/xtWavePreview.h b/source/xtLib/xtWavePreview.h
@@ -0,0 +1,21 @@
+#pragma once
+
+namespace dsp56k
+{
+ class Memory;
+}
+
+namespace xt
+{
+ class Xt;
+
+ class WavePreview
+ {
+ public:
+ WavePreview(Xt& _xt);
+
+ private:
+ Xt& m_xt;
+ dsp56k::Memory& m_dspMem;
+ };
+}