This commit is contained in:
Maurice Grönwoldt 2020-07-09 16:31:33 +02:00
parent 3fda15966c
commit 61482e8d4c
36 changed files with 325 additions and 122 deletions

View file

@ -3,7 +3,7 @@
#include "Veno/Core/AudioConfig.h"
VenoAudioProcessor::VenoAudioProcessor ()
/*#ifndef JucePlugin_PreferredChannelConfigurations
#ifndef JucePlugin_PreferredChannelConfigurations
: AudioProcessor (BusesProperties()
#if ! JucePlugin_IsMidiEffect
#if ! JucePlugin_IsSynth
@ -12,17 +12,17 @@ VenoAudioProcessor::VenoAudioProcessor ()
.withOutput ("Output", AudioChannelSet::stereo(), true)
#endif
)
#endif*/
: AudioProcessor(BusesProperties().withInput("Input", AudioChannelSet::stereo(), true).withOutput("Output",
AudioChannelSet::stereo(),
true))
#endif
{
instance = VenoInstance::createInstance(m_id);
AudioConfig::registerInstance(m_id);
}
VenoAudioProcessor::~VenoAudioProcessor ()
{
instance.reset();
VenoInstance::deleteInstance(m_id);
AudioConfig::deleteInstance(m_id);
}
const String VenoAudioProcessor::getName () const
@ -129,7 +129,6 @@ void VenoAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& m
auto c = buffer.getReadPointer(i);
for (int j = 0; j < buffer.getNumSamples(); ++j)
{
instance->fft.pushNextSampleIntoFifo(c[j]);
instance->audioBuffer->addMonoSample(c[j], j);
if (i == 0)
{
@ -141,6 +140,7 @@ void VenoAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& m
}
}
}
instance->audioBuffer->calcPeak ();
}
//==============================================================================
@ -157,10 +157,19 @@ AudioProcessorEditor* VenoAudioProcessor::createEditor ()
//==============================================================================
void VenoAudioProcessor::getStateInformation (MemoryBlock& destData)
{
auto matrixXML = instance->matrix.saveMatrixToXML();
if (matrixXML != nullptr) {
copyXmlToBinary(*matrixXML, destData);
} else {
DBG("Sorry something went wrong! xml is nullptr");
}
}
void VenoAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
std::unique_ptr<XmlElement> xmlState(getXmlFromBinary(data, sizeInBytes));
if (xmlState != nullptr)
instance->matrix.getMatrixFromXML(xmlState);
}
AudioProcessor* JUCE_CALLTYPE createPluginFilter ()

View file

@ -33,5 +33,5 @@ public:
std::string m_id = Uuid().toString().toStdString();
std::shared_ptr<VenoInstance> instance;
private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoAudioProcessor)
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoAudioProcessor);
};

View file

@ -1,8 +1,18 @@
#version 330 core
in vec4 newColor;
in vec4 newGradientColor;
in vec4 sPosition;
out vec4 fragColor;
void main()
{
fragColor = newColor;
if (newColor == newGradientColor) {
fragColor = newColor;
} else {
vec2 st = sPosition.xy;
float mixValue = distance(st, vec2(0, 0));
vec3 color = mix(newGradientColor.xyz, newColor.xyz, mixValue);
fragColor = vec4(color, mixValue);
}
}

View file

@ -1,10 +1,15 @@
#version 330 core
in vec4 position;
uniform vec4 color = vec4(1f, 1f, 1f, 1f);
uniform vec4 gradientColor = vec4(1f, 1f, 1f, 1f);
out vec4 newColor;
out vec4 newGradientColor;
out vec4 sPosition;
void main()
{
gl_Position = position;
newColor = color;
newGradientColor = gradientColor;
sPosition = position;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View file

@ -0,0 +1,136 @@
//
// Created by versustune on 13.06.20.
//
#include "VeNoMatrix.h"
#include "../../Utils/StringUtils.h"
VeNoMatrix::VeNoMatrix (const std::string& processId) : m_processId (processId)
{
}
VeNoMatrix::~VeNoMatrix ()
{
for (auto& m_slot : m_slots)
{
delete m_slot.second;
m_slots.erase (m_slot.first);
}
for (auto& value : m_modulationValues)
{
delete value.second;
m_modulationValues.erase (value.first);
}
for (auto& value : m_modulators)
{
delete value.second;
m_modulators.erase (value.first);
}
}
void VeNoMatrix::removeModulateValue (const std::string& name)
{
m_modulationValues.erase (name);
}
void VeNoMatrix::removeModulator (const std::string& name)
{
m_modulators.erase (name);
}
void VeNoMatrix::addModulateValue (const std::string& name, ModulateValue* modulateValue)
{
m_modulationValues.emplace (std::pair<const std::string&, ModulateValue*> (name, modulateValue));
}
void VeNoMatrix::addModulator (const std::string& name, Modulator* modulator)
{
m_modulators.emplace (std::pair<const std::string&, Modulator*> (name, modulator));
}
//matrix is not in the valueTree-state is some own implementation!
void VeNoMatrix::updateSlots ()
{
for (auto& m_source : m_modulators)
{
m_source.second->update ();
}
for (auto& m_slot : m_slots)
{
auto source = m_modulators[m_slot.second->source];
auto value = m_modulationValues[m_slot.second->name];
auto amount = m_slot.second->amount;
value->addValue (source->getValue () * amount);
}
}
void VeNoMatrix::setMatrixModulation (const std::string& name, const std::string& source, float amount)
{
auto c = std::string (source + name);
if (m_slots.find (c) == m_slots.end ())
{
m_slots[c] = new VeNoMatrixTarget ();
m_slots[c]->source = source;
m_slots[c]->name = name;
}
m_slots[c]->amount = amount;
}
std::unique_ptr<XmlElement> VeNoMatrix::saveMatrixToXML ()
{
auto* tree = new ValueTree ();
for (auto& m_slot : m_slots)
{
std::string name = m_slot.second->source + m_slot.second->name;
tree->setProperty (String (name), String (m_slot.second->toString ()), nullptr);
}
auto xml = tree->createXml ();
delete tree;
return xml;
}
void VeNoMatrix::getMatrixFromXML (std::unique_ptr<XmlElement>& xml)
{
// first we need to delete the state!
for (auto& m_slot : m_slots)
{
delete m_slot.second;
m_slots.erase (m_slot.first);
}
// recreate the matrix from xml...
auto tree = juce::ValueTree::fromXml (*xml);
for (int i = 0; i < tree.getNumChildren (); ++i)
{
auto name = tree.getPropertyName (i);
auto child = tree.getPropertyAsValue (name, nullptr);
auto slot = VeNoMatrixTarget::fromString (child.toString ().toStdString ());
if (slot != nullptr)
{
m_slots[name.toString ().toStdString ()] = slot;
}
}
}
// crate a string to save to ValueTree-State
std::string VeNoMatrixTarget::toString () const
{
return std::string (source + "_#_" + name + "_#_" + std::to_string (amount));
}
// recreate from ValueTree-State... <3 is a very special format
VeNoMatrixTarget* VeNoMatrixTarget::fromString (const std::string& value)
{
auto out = VeNo::StringUtils::split (value, "_#_");
// if size is not 3 this is invalid! return nullptr!
if (out.size () == 3)
{
auto returnValue = new VeNoMatrixTarget ();
returnValue->source = out[0];
returnValue->name = out[1];
returnValue->amount = std::atof (out[2].c_str ());
return new VeNoMatrixTarget ();
}
return nullptr;
}

View file

@ -10,33 +10,39 @@
#include <vector>
#include "Modulator.h"
#include "ModulateValue.h"
#include "JuceHeader.h"
// class that modulate everything :D
struct VenoMatrixTarget
struct VeNoMatrixTarget
{
std::string name;
std::string source;
float amount = 0; // always 0 to 1 <-- apply amount to modulator
std::string toString() const;
static VeNoMatrixTarget* fromString(const std::string& value);
};
struct VenoMatrixSlot
{
std::string sourceName;
VenoMatrixTarget targets[8];
};
class VenoMatrix
//@todo rebuild to new unlimited implementation!
// and make compatible with the value class that is used for saving and sync the ValueTree...
class VeNoMatrix
{
public:
explicit VenoMatrix (const std::string& processId);
~VenoMatrix ();
explicit VeNoMatrix (const std::string& processId);
~VeNoMatrix ();
void updateSlots ();
void addModulator (const std::string& name, Modulator* modulator);
void addModulateValue (const std::string& name, ModulateValue* modulateValue);
void removeModulator (const std::string& name);
void removeModulateValue (const std::string& name);
VenoMatrixSlot* getSlotById (int id);
void setMatrixModulation(const std::string& name, const std::string& source, float amount);
std::unique_ptr<XmlElement> saveMatrixToXML();
void getMatrixFromXML(std::unique_ptr<XmlElement>& xml);
private:
std::unordered_map<std::string, Modulator*> m_modulators; //all sources
std::unordered_map<std::string, ModulateValue*> m_modulationValues;
VenoMatrixSlot* m_slots[8]{}; // 8 source slots
std::unordered_map<std::string, VeNoMatrixTarget*> m_slots;
std::string m_processId;
protected:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VeNoMatrix)
};
#endif //VENO_VENOMATRIX_H

View file

@ -1,81 +0,0 @@
//
// Created by versustune on 13.06.20.
//
#include "VenoMatrix.h"
VenoMatrix::VenoMatrix (const std::string& processId) : m_processId(processId)
{
for (auto& m_slot : m_slots)
{
m_slot = new VenoMatrixSlot();
}
}
VenoMatrix::~VenoMatrix ()
{
for (auto& m_slot : m_slots)
{
delete m_slot;
}
}
VenoMatrixSlot* VenoMatrix::getSlotById (int id)
{
return m_slots[id];
}
void VenoMatrix::removeModulateValue (const std::string& name)
{
m_modulationValues.erase(name);
}
void VenoMatrix::removeModulator (const std::string& name)
{
m_modulators.erase(name);
}
void VenoMatrix::addModulateValue (const std::string& name, ModulateValue* modulateValue)
{
m_modulationValues.emplace(std::pair<const std::string&, ModulateValue*>(name, modulateValue));
}
void VenoMatrix::addModulator (const std::string& name, Modulator* modulator)
{
m_modulators.emplace(std::pair<const std::string&, Modulator*>(name, modulator));
}
void VenoMatrix::updateSlots ()
{
for (auto& m_slot : m_slots)
{
if (m_slot->sourceName == "none")
{
continue;
}
if (m_modulators.find(m_slot->sourceName) != m_modulators.end())
{
auto modulator = m_modulators[m_slot->sourceName];
if (modulator == nullptr)
{
continue;
}
modulator->update();
for (auto& value : m_slot->targets)
{
if (value.name != "none")
{
if (m_modulationValues.find(value.name) != m_modulationValues.end())
{
auto modValue = m_modulationValues[value.name];
if (modValue == nullptr)
{
continue;
}
modValue->addValue(modulator->getValue() * value.amount);
}
}
}
}
}
}

View file

@ -6,6 +6,7 @@
#define VENO_SYNTHINSTANCE_H
#include <string>
#include "JuceHeader.h"
// class that hold all voices, oscillators and other stuff :)
class SynthInstance
@ -16,5 +17,6 @@ public:
explicit SynthInstance (std::string processId);
~SynthInstance () = default;
protected:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SynthInstance)
};
#endif //VENO_SYNTHINSTANCE_H

View file

@ -33,9 +33,9 @@ void VenoBuffer::reset (int size)
left[i] = 0;
right[i] = 0;
}
leftPeak = 0;
rightPeak = 0;
monoPeak = 0;
leftPeak = -30;
rightPeak = -30;
monoPeak = -30;
}
void VenoBuffer::addMonoSample (float value, int index)
@ -55,10 +55,6 @@ void VenoBuffer::addRightSample (float value, int index)
void VenoBuffer::calcPeak ()
{
if (monoPeak != 0 && rightPeak != 0 && leftPeak != 0)
{
return;
}
float leftRMS = 0;
float rightRMS = 0;
auto size = buffer.size();
@ -70,7 +66,6 @@ void VenoBuffer::calcPeak ()
rightPeak = VeNo::Utils::clamp (Decibels::gainToDecibels (std::sqrt (rightRMS / size), -30.0f), -30.0f, 0.0f);
leftPeak = VeNo::Utils::clamp (Decibels::gainToDecibels (std::sqrt (leftRMS / size), -30.0f), -30.0f, 0.0f);
monoPeak = leftPeak;
//monoPeak = VeNo::Utils::clamp (Decibels::gainToDecibels (monoPeak, -70.0f), -70.0f, 0.0f);
}
const std::vector<float>& VenoBuffer::getBuffer () const

View file

@ -6,6 +6,7 @@
#define VENO_VENOBUFFER_H
#include <vector>
#include "JuceHeader.h"
class VenoBuffer
{
@ -27,5 +28,7 @@ public:
const std::vector<float>& getBuffer () const;
const std::vector<float>& getRight () const;
const std::vector<float>& getLeft () const;
protected:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoBuffer);
};
#endif //VENO_VENOBUFFER_H

View file

@ -48,6 +48,13 @@ void WaveTableGenerator::cleanTables ()
{
for (auto& m_waveTable : m_waveTables)
{
for (int i = 0; i < numWaveTableSlots; ++i)
{
if (m_waveTable != nullptr && m_waveTable->m_WaveTables[i] != nullptr) {
delete[] m_waveTable->m_WaveTables[i]->m_waveTable;
delete m_waveTable->m_WaveTables[i];
}
}
delete m_waveTable;
}
m_isInit = false;

View file

@ -4,6 +4,9 @@
#ifndef VENO_WAVETABLEGENERATOR_H
#define VENO_WAVETABLEGENERATOR_H
#include "JuceHeader.h"
struct WaveTableObject
{
double m_topFreq;
@ -47,5 +50,6 @@ protected:
bool m_isInit = false;
WaveTableGenerator () = default;
~WaveTableGenerator () = default;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WaveTableGenerator)
};
#endif //VENO_WAVETABLEGENERATOR_H

View file

@ -5,6 +5,7 @@
#include "../Audio/WaveTable/WaveTableGenerator.h"
std::shared_ptr<AudioConfig> AudioConfig::m_instance;
std::unordered_map<std::string, std::string> AudioConfig::m_instances;
float AudioConfig::getSampleRate ()
{
@ -43,16 +44,35 @@ void AudioConfig::setNeedToReInit (bool _needToReInit)
std::shared_ptr<AudioConfig> AudioConfig::getInstance ()
{
if (AudioConfig::m_instance == nullptr)
AudioConfig::m_instance = std::make_shared<AudioConfig>();
AudioConfig::m_instance = std::make_shared<AudioConfig> ();
return m_instance;
}
void AudioConfig::initWaveTables ()
{
WaveTableGenerator::getInstance().init();
WaveTableGenerator::getInstance ().init ();
}
AudioConfig::~AudioConfig ()
{
WaveTableGenerator::getInstance().cleanTables();
WaveTableGenerator::getInstance ().cleanTables ();
}
AudioConfig::AudioConfig ()
{
}
void AudioConfig::registerInstance (std::string id)
{
m_instances[id] = id;
}
void AudioConfig::deleteInstance (std::string id)
{
m_instances.erase (id);
if (m_instances.size () == 0)
{
m_instance.reset ();
}
}

View file

@ -17,6 +17,7 @@ private:
float m_sampleRate = 44100;
float m_bufferSize = 512; //maybe we need that... but this will update always!
bool m_needToReInit = false; //this is to reInit the Oscillators, ADSR and other stuff
static std::unordered_map<std::string, std::string> m_instances;
public:
static std::shared_ptr<AudioConfig> getInstance ();
float getSampleRate ();
@ -26,7 +27,11 @@ public:
bool isNeedToReInit () const;
void setNeedToReInit (bool _needToReInit);
static void initWaveTables ();
AudioConfig();
~AudioConfig ();
static void registerInstance (std::string id);
static void deleteInstance (std::string id);
protected:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioConfig);
};
#endif //VENO_AUDIOCONFIG_H

View file

@ -41,5 +41,6 @@ public:
void repaintAll();
protected:
void initConfig ();
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Config);
};
#endif //VENO_CONFIG_H

View file

@ -12,6 +12,7 @@ class VeNoState
{
protected:
std::string m_pid = "";
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VeNoState);
public:
VeNoState(std::string pid);
~VeNoState();

View file

@ -27,7 +27,9 @@ VenoFonts* VenoFonts::getInstance ()
void VenoFonts::destroyAll ()
{
delete instance;
if (instance != nullptr) {
delete instance;
}
instance = nullptr;
}
@ -43,4 +45,6 @@ VenoFonts::~VenoFonts ()
{
delete arvo;
delete lcdFont;
arvo = nullptr;
lcdFont = nullptr;
}

View file

@ -13,6 +13,7 @@ protected:
static VenoFonts* instance;
Font* lcdFont;
Font* arvo;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoFonts)
public:
VenoFonts ();
~VenoFonts ();

View file

@ -29,5 +29,6 @@ public:
protected:
std::string m_processId;
std::shared_ptr<LabelComponent> m_label;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BaseComponent);
};
#endif //VENO_BASECOMPONENT_H

View file

@ -24,5 +24,6 @@ protected:
void drawHeadline (Graphics& g);
void drawFooter (Graphics& g);
std::unique_ptr<Waveforms> waveform;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SidebarLCD);
};
#endif //VENO_SIDEBARLCD_H

View file

@ -63,6 +63,9 @@ void Waveforms::renderOpenGL ()
auto color = theme->getColour (ThemeColour::lcd);
shaderProgram->setUniform ("color", color.getFloatRed (), color.getFloatGreen (), color.getFloatBlue (),
color.getFloatAlpha ());
// same color currently! will set to a diff if peak is detected!
shaderProgram->setUniform ("gradientColor", color.getFloatRed (), color.getFloatGreen (), color.getFloatBlue (),
color.getFloatAlpha ());
if (m_isWelcome || m_isStarting || m_isChangingData)
{
return;
@ -92,6 +95,8 @@ void Waveforms::compileOpenGLShaderProgram ()
&& shaderProgramAttempt->link ())
{
shaderProgram = std::move (shaderProgramAttempt);
} else {
DBG(shaderProgramAttempt->getLastError().toStdString());
}
}
@ -144,10 +149,17 @@ void Waveforms::drawAudioOutput ()
glBegin (GL_LINE_STRIP);
float posX = -1;
float inc = 2.0f / buffer.size ();
for (float i : buffer)
for (int j = 0; j < buffer.size(); ++j)
{
glVertex2f (posX, i);
posX += inc;
try
{
glVertex2f (posX, buffer.at(j));
posX += inc;
} catch (_exception e)
{
//something is wrong skip the draw and end it!
break;
}
}
glEnd ();
}
@ -160,7 +172,6 @@ void Waveforms::drawPeakMeter ()
return;
}
auto instance = VenoInstance::getInstance (BaseComponent::m_processId);
instance->audioBuffer->calcPeak ();
repaint();
// draw peak signal
auto leftChannel = getdBForChannel (instance->audioBuffer->leftPeak);
@ -276,6 +287,8 @@ void Waveforms::selectColourByPeak (float value)
return;
}
auto color = theme->getColour (ThemeColour::lcd);
shaderProgram->setUniform ("color", color.getFloatRed (), color.getFloatGreen (), color.getFloatBlue (),
color.getFloatAlpha ());
if (value > 0.87)
{
color = theme->getColour (ThemeColour::clip);
@ -284,7 +297,7 @@ void Waveforms::selectColourByPeak (float value)
{
color = theme->getColour (ThemeColour::warning);
}
shaderProgram->setUniform ("color", color.getFloatRed (), color.getFloatGreen (), color.getFloatBlue (),
shaderProgram->setUniform ("gradientColor", color.getFloatRed (), color.getFloatGreen (), color.getFloatBlue (),
color.getFloatAlpha ());
}

View file

@ -28,6 +28,7 @@ protected:
int m_time_needed_startup = 0;
int m_time_needed = 0;
bool needToClear = false;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Waveforms);
public:
explicit Waveforms (const std::string& processId);
~Waveforms () override;

View file

@ -38,6 +38,7 @@ ConfigComponent::~ConfigComponent ()
color.reset();
}
m_colors.clear();
m_preColours.reset(nullptr);
}
ThemeColour ConfigComponent::getColorForId (int id)

View file

@ -18,6 +18,8 @@ Sidebar::~Sidebar ()
{
m_lcd.reset(nullptr);
m_configButton.reset(nullptr);
m_mixer.reset(nullptr);
VenoLogo::deleteInstance();
}
void Sidebar::resized ()

View file

@ -23,5 +23,6 @@ protected:
std::unique_ptr<SidebarLCD> m_lcd;
std::unique_ptr<SidebarMixer> m_mixer;
std::unique_ptr<VenoConfigButton> m_configButton;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Sidebar)
};
#endif //VENO_SIDEBAR_H

View file

@ -18,5 +18,7 @@ public:
static void deleteInstance ();
VenoLogo ();
~VenoLogo () = default;
protected:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoLogo)
};
#endif //VENO_VENOLOGO_H

View file

@ -11,6 +11,8 @@ class FlatLook : public LookAndFeel_V4
{
private:
public:
FlatLook() = default;
~FlatLook() override = default;
void drawButtonBackground (Graphics& graphics, Button& button, const Colour& backgroundColour,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
@ -29,5 +31,6 @@ public:
int buttonH, ComboBox &box) override;
protected:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FlatLook);
};
#endif //VENO_FLATLOOK_H

View file

@ -15,6 +15,7 @@ LookHandler::~LookHandler ()
//delete this shit!
delete m_feels[0];
delete m_feels[1];
m_look.reset();
}
void LookHandler::selectLook (int index)

View file

@ -26,5 +26,6 @@ public:
protected:
//currently both available themes are CrazyLook <-- (this is a fun one xD) and FlatLook
LookAndFeel_V4* m_feels[2] = {new FlatLook(), new CrazyLook()};
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LookHandler);
};
#endif //VENO_LOOKHANDLER_H

View file

@ -27,5 +27,6 @@ public:
protected:
std::map<ThemeColour, Colour*> m_colours;
std::shared_ptr<PropertiesFile> m_configFile;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Theme);
};
#endif //VENO_THEME_H

View file

@ -3,11 +3,13 @@
//
#include "Logger.h"
#include "JuceHeader.h"
void VeNo::Logger::debugMessage (const std::string& message)
{
#ifdef DEBUG
std::cout << "\u001b[38;5;172m[DEBUG]\u001b[0m\t" << message << "\n";
DBG("\u001b[38;5;172m[DEBUG]\u001b[0m\t" + message + "\n");
#endif
}

View file

@ -0,0 +1,20 @@
//
// Created by Maurice on 08.07.2020.
//
#include "StringUtils.h"
std::vector<std::string> VeNo::StringUtils::split (std::string input, std::string separator)
{
std::vector<std::string> result;
std::string_view::size_type position, start = 0;
while (std::string_view::npos != (position = input.find (separator, start)))
{
result.push_back (input.substr (start, position - start));
start = position + separator.size ();
}
result.push_back (input.substr (start));
return result;
}

View file

@ -0,0 +1,22 @@
//
// Created by Maurice on 08.07.2020.
//
#ifndef VENO_STRINGUTILS_H
#define VENO_STRINGUTILS_H
#include <string>
#include <vector>
namespace VeNo
{
class StringUtils
{
public:
static std::vector<std::string> split (std::string input, std::string separator = " ");
};
}
#endif //VENO_STRINGUTILS_H

View file

@ -9,7 +9,7 @@
#include "Audio/Synth/SynthInstance.h"
#include "Utils/FFT.h"
#include "Audio/VenoBuffer.h"
#include "Audio/Engine/VenoMatrix.h"
#include "Audio/Engine/VeNoMatrix.h"
#include "Core/VeNoState.h"
#include <unordered_map>
@ -26,10 +26,11 @@ public:
static std::shared_ptr<VenoInstance> getInstance (const std::string& id);
static void deleteInstance (const std::string& processId);
const std::shared_ptr<SynthInstance>& getSynthInstance () const;
FFT fft;
std::shared_ptr<VenoBuffer> audioBuffer;
VenoMatrix matrix{m_id}; //matrix need a own xml profile to save and restore!
VeNoMatrix matrix{m_id}; //matrix need a own xml profile to save and restore!
VeNoState* state;
static std::unordered_map<std::string, std::shared_ptr<VenoInstance>> getAll ();
protected:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoInstance);
};
#endif //VENO_VENOINSTANCE_H

View file

@ -29,6 +29,8 @@
<FILE id="McoT9E" name="FFT.h" compile="0" resource="0" file="Source/Veno/Utils/FFT.h"/>
<FILE id="fnGWyM" name="Logger.cpp" compile="1" resource="0" file="Source/Veno/Utils/Logger.cpp"/>
<FILE id="wYGzZw" name="Logger.h" compile="0" resource="0" file="Source/Veno/Utils/Logger.h"/>
<FILE id="xJwmEr" name="StringUtils.cpp" compile="1" resource="0" file="Source/Veno/Utils/StringUtils.cpp"/>
<FILE id="C21Iyn" name="StringUtils.h" compile="0" resource="0" file="Source/Veno/Utils/StringUtils.h"/>
</GROUP>
<FILE id="XtqjAL" name="VenoInstance.h" compile="0" resource="0" file="Source/Veno/VenoInstance.h"/>
<FILE id="LItgbD" name="VenoInstance.cpp" compile="1" resource="0"
@ -42,8 +44,8 @@
<FILE id="Tpzeeh" name="ModulateValue.h" compile="0" resource="0" file="Source/Veno/Audio/Engine/ModulateValue.h"/>
<FILE id="dB1Djv" name="Modulator.cpp" compile="1" resource="0" file="Source/Veno/Audio/Engine/Modulator.cpp"/>
<FILE id="eA6ftc" name="Modulator.h" compile="0" resource="0" file="Source/Veno/Audio/Engine/Modulator.h"/>
<FILE id="rkTKQ1" name="VenoMatrix.cpp" compile="1" resource="0" file="Source/Veno/Audio/Engine/VenoMatrix.cpp"/>
<FILE id="v4AuOK" name="VenoMatrix.h" compile="0" resource="0" file="Source/Veno/Audio/Engine/VenoMatrix.h"/>
<FILE id="rkTKQ1" name="VeNoMatrix.cpp" compile="1" resource="0" file="Source/Veno/Audio/Engine/VeNoMatrix.cpp"/>
<FILE id="v4AuOK" name="VeNoMatrix.h" compile="0" resource="0" file="Source/Veno/Audio/Engine/VeNoMatrix.h"/>
</GROUP>
<FILE id="tHbIrz" name="VenoBuffer.cpp" compile="1" resource="0" file="Source/Veno/Audio/VenoBuffer.cpp"/>
<FILE id="ufeJaH" name="VenoBuffer.h" compile="0" resource="0" file="Source/Veno/Audio/VenoBuffer.h"/>