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 f2aee57b4bbc3714532464010eccef54fee4faca
parent ed514ea9dcdc212d02047507c61821f1cf835ab7
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sun, 28 Jul 2024 21:15:59 +0200

support to set custom data at startup

Diffstat:
Msource/hardwareLib/i2cFlash.cpp | 9+++++++++
Msource/hardwareLib/i2cFlash.h | 6+++++-
2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/source/hardwareLib/i2cFlash.cpp b/source/hardwareLib/i2cFlash.cpp @@ -13,6 +13,15 @@ namespace hwLib synthLib::writeFile(_filename, m_data); } + bool I2cFlash::setData(std::vector<uint8_t>& _data) + { + if(_data.size() != Size) + return false; + + std::copy(_data.begin(), _data.end(), m_data.begin()); + return true; + } + void I2cFlash::onStartCondition() { m_state = State::ReadDeviceSelect; diff --git a/source/hardwareLib/i2cFlash.h b/source/hardwareLib/i2cFlash.h @@ -3,6 +3,7 @@ #include <array> #include <optional> #include <string> +#include <vector> #include "i2c.h" @@ -12,7 +13,8 @@ namespace hwLib class I2cFlash : public I2c { public: - using Data = std::array<uint8_t, 0x10000>; + static constexpr uint32_t Size = 0x10000; + using Data = std::array<uint8_t, Size>; I2cFlash() { @@ -25,6 +27,8 @@ namespace hwLib void saveAs(const std::string& _filename) const; + bool setData(std::vector<uint8_t>& _data); + private: enum class State {