commit c333867956e9f18e3c16ec25b1790cbb2d0fa62a
parent 61aa016b070e0539d497cbc20204c70a2e717e5f
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Tue, 8 Oct 2024 23:47:02 +0200
create tool function to get all wave data for a single, we're gonna need it to store a single together with custom waves + table
Diffstat:
3 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/source/xtJucePlugin/weData.cpp b/source/xtJucePlugin/weData.cpp
@@ -94,9 +94,6 @@ namespace xtJucePlugin
if(i >= m_ramWaves.size())
return {};
- if(!m_ramWaves[i])
- return {};
-
return m_ramWaves[i];
}
@@ -239,6 +236,45 @@ namespace xtJucePlugin
return true;
}
+ void WaveEditorData::getWaveDataForSingle(std::vector<xt::SysEx>& _results, const xt::SysEx& _single) const
+ {
+ constexpr auto wavetableIndex = xt::IdxSingleParamFirst + static_cast<uint32_t>(xt::SingleParameter::Wavetable);
+
+ if(wavetableIndex >= _single.size())
+ return;
+
+ const auto tableId = xt::TableId(_single[wavetableIndex]);
+
+ if(isReadOnly(tableId))
+ return;
+
+ const auto table = getTable(tableId);
+
+ if(!table)
+ return;
+
+ auto& t = *table;
+
+ for (const auto waveId : t)
+ {
+ if(!xt::Wave::isValidWaveIndex(waveId.rawId()))
+ continue;
+
+ if(isReadOnly(waveId))
+ continue;
+
+ const auto wave = getWave(waveId);
+ if(!wave)
+ continue;
+
+ const auto& w = *wave;
+
+ _results.emplace_back(xt::State::createWaveData(w, waveId.rawId(), false));
+ }
+
+ _results.emplace_back(xt::State::createTableData(t, tableId.rawId(), false));
+ }
+
bool WaveEditorData::requestWave(const xt::WaveId _index)
{
if(isWaitingForData())
diff --git a/source/xtJucePlugin/weData.h b/source/xtJucePlugin/weData.h
@@ -7,6 +7,7 @@
#include "weTypes.h"
#include "xtLib/xtMidiTypes.h"
+#include "xtLib/xtState.h"
#include "jucePluginLib/midipacket.h"
#include "jucePluginLib/event.h"
@@ -55,6 +56,8 @@ namespace xtJucePlugin
bool sendTableToDevice(xt::TableId _id) const;
bool sendWaveToDevice(xt::WaveId _id) const;
+ void getWaveDataForSingle(std::vector<xt::SysEx>& _results, const xt::SysEx& _single) const;
+
private:
bool requestWave(xt::WaveId _index);
bool requestTable(xt::TableId _index);
diff --git a/source/xtLib/xtMidiTypes.h b/source/xtLib/xtMidiTypes.h
@@ -125,6 +125,12 @@ namespace xt
Mode = 0 // 0 = Single, 1 = Multi
};
+ enum class SingleParameter
+ {
+ Version = 0,
+ Wavetable = 25
+ };
+
enum class MultiParameter
{
Volume,