- save
This commit is contained in:
parent
ac22ea5e75
commit
a27c62f062
48 changed files with 1170 additions and 384 deletions
|
|
@ -3,36 +3,43 @@
|
|||
#include "Veno/Core/Config.h"
|
||||
#include "Veno/Utils/Logger.h"
|
||||
#include "Veno/Fonts/Fonts.h"
|
||||
#include "Veno/Utils.h"
|
||||
|
||||
#define SIDEBAR_WIDTH 300
|
||||
|
||||
VenoAudioProcessorEditor::VenoAudioProcessorEditor (VenoAudioProcessor& p)
|
||||
: AudioProcessorEditor (&p), processor (p)
|
||||
: AudioProcessorEditor(&p), processor(p)
|
||||
{
|
||||
m_id = p.m_id;
|
||||
Config::getInstance ()->registerEditor (this, m_id);
|
||||
LookAndFeel::setDefaultLookAndFeel (m_look);
|
||||
waveform = std::make_unique<SidebarLCD> (m_id);
|
||||
setSize (600, 400);
|
||||
addAndMakeVisible (*waveform);
|
||||
Config::getInstance()->registerEditor(this, m_id);
|
||||
LookAndFeel::setDefaultLookAndFeel(m_look);
|
||||
m_sidebar = std::make_unique<Sidebar>(m_id);
|
||||
setSize(1200 * Config::getInstance()->getScale(), 700 * Config::getInstance()->getScale());
|
||||
addAndMakeVisible(*m_sidebar);
|
||||
}
|
||||
|
||||
VenoAudioProcessorEditor::~VenoAudioProcessorEditor ()
|
||||
{
|
||||
LookAndFeel::setDefaultLookAndFeel (nullptr);
|
||||
waveform.reset (nullptr);
|
||||
LookAndFeel::setDefaultLookAndFeel(nullptr);
|
||||
m_sidebar.reset(nullptr);
|
||||
delete m_look;
|
||||
Config::getInstance ()->removeEditor (m_id);
|
||||
Config::getInstance()->removeEditor(m_id);
|
||||
}
|
||||
|
||||
void VenoAudioProcessorEditor::paint (Graphics& g)
|
||||
{
|
||||
g.setFont (*VenoFonts::getNormal ());
|
||||
g.fillAll (Colour (0, 0, 0));
|
||||
auto theme = Config::getInstance()->getCurrentTheme();
|
||||
g.setFont(*VenoFonts::getNormal());
|
||||
g.fillAll(theme->getColour(ThemeColour::bg_two));
|
||||
g.setColour(theme->getColour(ThemeColour::bg));
|
||||
g.fillRect(0, 0, VeNo::Utils::getCalculatedWidth(SIDEBAR_WIDTH), getHeight());
|
||||
g.setColour(theme->getColour(ThemeColour::accent));
|
||||
}
|
||||
|
||||
void VenoAudioProcessorEditor::resized ()
|
||||
{
|
||||
if (waveform != nullptr)
|
||||
if (m_sidebar != nullptr)
|
||||
{
|
||||
waveform->setBounds (0, 0, getWidth (), getHeight ());
|
||||
m_sidebar->setBounds(0, 0, VeNo::Utils::getCalculatedWidth(SIDEBAR_WIDTH), getHeight());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <JuceHeader.h>
|
||||
#include "PluginProcessor.h"
|
||||
#include "Veno/GUI/LookAndFeel/LookHandler.h"
|
||||
#include "Veno/GUI/Components/LCD/SidebarLCD.h"
|
||||
#include "Veno/GUI/GUIParts/Sidebar/Sidebar.h"
|
||||
|
||||
class VenoAudioProcessorEditor : public AudioProcessorEditor
|
||||
{
|
||||
|
|
@ -15,7 +15,7 @@ public:
|
|||
private:
|
||||
VenoAudioProcessor& processor;
|
||||
std::string m_id = "";
|
||||
LookAndFeel_V4* m_look = new LookHandler ();
|
||||
std::unique_ptr<SidebarLCD> waveform;
|
||||
LookAndFeel_V4* m_look = new LookHandler();
|
||||
std::unique_ptr<Sidebar> m_sidebar;
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoAudioProcessorEditor)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@ VenoAudioProcessor::VenoAudioProcessor ()
|
|||
#endif
|
||||
)
|
||||
#endif*/
|
||||
: AudioProcessor (BusesProperties ().withInput ("Input", AudioChannelSet::stereo (), true).withOutput ("Output",
|
||||
AudioChannelSet::stereo (),
|
||||
true))
|
||||
: AudioProcessor(BusesProperties().withInput("Input", AudioChannelSet::stereo(), true).withOutput("Output",
|
||||
AudioChannelSet::stereo(),
|
||||
true))
|
||||
{
|
||||
instance = VenoInstance::createInstance (m_id);
|
||||
instance = VenoInstance::createInstance(m_id);
|
||||
}
|
||||
|
||||
VenoAudioProcessor::~VenoAudioProcessor ()
|
||||
{
|
||||
VenoInstance::deleteInstance (m_id);
|
||||
VenoInstance::deleteInstance(m_id);
|
||||
}
|
||||
|
||||
const String VenoAudioProcessor::getName () const
|
||||
|
|
@ -88,9 +88,9 @@ void VenoAudioProcessor::changeProgramName (int index, const String& newName)
|
|||
//==============================================================================
|
||||
void VenoAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
|
||||
{
|
||||
auto audioConfig = AudioConfig::getInstance ();
|
||||
audioConfig->setSampleRate (sampleRate);
|
||||
audioConfig->initWaveTables ();
|
||||
auto audioConfig = AudioConfig::getInstance();
|
||||
audioConfig->setSampleRate(sampleRate);
|
||||
audioConfig->initWaveTables();
|
||||
}
|
||||
|
||||
void VenoAudioProcessor::releaseResources ()
|
||||
|
|
@ -105,8 +105,8 @@ bool VenoAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) con
|
|||
ignoreUnused (layouts);
|
||||
return true;
|
||||
#else
|
||||
if (layouts.getMainOutputChannelSet () != AudioChannelSet::mono ()
|
||||
&& layouts.getMainOutputChannelSet () != AudioChannelSet::stereo ())
|
||||
if (layouts.getMainOutputChannelSet() != AudioChannelSet::mono()
|
||||
&& layouts.getMainOutputChannelSet() != AudioChannelSet::stereo())
|
||||
return false;
|
||||
#if !JucePlugin_IsSynth
|
||||
if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet())
|
||||
|
|
@ -121,23 +121,23 @@ bool VenoAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) con
|
|||
void VenoAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
|
||||
{
|
||||
ScopedNoDenormals noDenormals;
|
||||
instance->matrix.updateSlots ();
|
||||
instance->audioBuffer->reset (buffer.getNumSamples ());
|
||||
int numChannels = buffer.getNumChannels ();
|
||||
instance->matrix.updateSlots();
|
||||
instance->audioBuffer->reset(buffer.getNumSamples());
|
||||
int numChannels = buffer.getNumChannels();
|
||||
for (int i = 0; i < numChannels; ++i)
|
||||
{
|
||||
auto c = buffer.getReadPointer (i);
|
||||
for (int j = 0; j < buffer.getNumSamples (); ++j)
|
||||
auto c = buffer.getReadPointer(i);
|
||||
for (int j = 0; j < buffer.getNumSamples(); ++j)
|
||||
{
|
||||
instance->fft.pushNextSampleIntoFifo (c[j]);
|
||||
instance->audioBuffer->addMonoSample (c[j], j);
|
||||
instance->fft.pushNextSampleIntoFifo(c[j]);
|
||||
instance->audioBuffer->addMonoSample(c[j], j);
|
||||
if (i == 0)
|
||||
{
|
||||
instance->audioBuffer->addLeftSample (c[j], j);
|
||||
instance->audioBuffer->addLeftSample(c[j], j);
|
||||
}
|
||||
if (i == 1 || numChannels == 1)
|
||||
{
|
||||
instance->audioBuffer->addRightSample (c[j], j);
|
||||
instance->audioBuffer->addRightSample(c[j], j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ bool VenoAudioProcessor::hasEditor () const
|
|||
|
||||
AudioProcessorEditor* VenoAudioProcessor::createEditor ()
|
||||
{
|
||||
return new VenoAudioProcessorEditor (*this);
|
||||
return new VenoAudioProcessorEditor(*this);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -165,5 +165,5 @@ void VenoAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
|
|||
|
||||
AudioProcessor* JUCE_CALLTYPE createPluginFilter ()
|
||||
{
|
||||
return new VenoAudioProcessor ();
|
||||
return new VenoAudioProcessor();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,57 +3,35 @@
|
|||
#include <JuceHeader.h>
|
||||
#include "Veno/VenoInstance.h"
|
||||
|
||||
class VenoAudioProcessor : public AudioProcessor {
|
||||
class VenoAudioProcessor : public AudioProcessor
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
VenoAudioProcessor();
|
||||
|
||||
~VenoAudioProcessor();
|
||||
|
||||
void prepareToPlay(double sampleRate, int samplesPerBlock) override;
|
||||
|
||||
void releaseResources() override;
|
||||
|
||||
VenoAudioProcessor ();
|
||||
~VenoAudioProcessor ();
|
||||
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
|
||||
void releaseResources () override;
|
||||
#ifndef JucePlugin_PreferredChannelConfigurations
|
||||
|
||||
bool isBusesLayoutSupported(const BusesLayout &layouts) const override;
|
||||
|
||||
bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
|
||||
#endif
|
||||
|
||||
void processBlock(AudioBuffer<float> &, MidiBuffer &) override;
|
||||
|
||||
AudioProcessorEditor *createEditor() override;
|
||||
|
||||
bool hasEditor() const override;
|
||||
|
||||
const String getName() const override;
|
||||
|
||||
bool acceptsMidi() const override;
|
||||
|
||||
bool producesMidi() const override;
|
||||
|
||||
bool isMidiEffect() const override;
|
||||
|
||||
double getTailLengthSeconds() const override;
|
||||
|
||||
int getNumPrograms() override;
|
||||
|
||||
int getCurrentProgram() override;
|
||||
|
||||
void setCurrentProgram(int index) override;
|
||||
|
||||
const String getProgramName(int index) override;
|
||||
|
||||
void changeProgramName(int index, const String &newName) override;
|
||||
|
||||
void getStateInformation(MemoryBlock &destData) override;
|
||||
|
||||
void setStateInformation(const void *data, int sizeInBytes) override;
|
||||
|
||||
void processBlock (AudioBuffer<float>&, MidiBuffer&) override;
|
||||
AudioProcessorEditor* createEditor () override;
|
||||
bool hasEditor () const override;
|
||||
const String getName () const override;
|
||||
bool acceptsMidi () const override;
|
||||
bool producesMidi () const override;
|
||||
bool isMidiEffect () const override;
|
||||
double getTailLengthSeconds () const override;
|
||||
int getNumPrograms () override;
|
||||
int getCurrentProgram () override;
|
||||
void setCurrentProgram (int index) override;
|
||||
const String getProgramName (int index) override;
|
||||
void changeProgramName (int index, const String& newName) override;
|
||||
void getStateInformation (MemoryBlock& destData) override;
|
||||
void setStateInformation (const void* data, int sizeInBytes) override;
|
||||
// Variable to communicate with the GUI and the Processor
|
||||
std::string m_id = Uuid().toString().toStdString();
|
||||
std::shared_ptr<VenoInstance> instance;
|
||||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoAudioProcessor)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
#include "VenoMatrix.h"
|
||||
|
||||
VenoMatrix::VenoMatrix (const std::string& processId) : m_processId (processId)
|
||||
VenoMatrix::VenoMatrix (const std::string& processId) : m_processId(processId)
|
||||
{
|
||||
for (auto& m_slot : m_slots)
|
||||
{
|
||||
m_slot = new VenoMatrixSlot ();
|
||||
m_slot = new VenoMatrixSlot();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,22 +27,22 @@ VenoMatrixSlot* VenoMatrix::getSlotById (int id)
|
|||
|
||||
void VenoMatrix::removeModulateValue (const std::string& name)
|
||||
{
|
||||
m_modulationValues.erase (name);
|
||||
m_modulationValues.erase(name);
|
||||
}
|
||||
|
||||
void VenoMatrix::removeModulator (const std::string& name)
|
||||
{
|
||||
m_modulators.erase (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));
|
||||
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));
|
||||
m_modulators.emplace(std::pair<const std::string&, Modulator*>(name, modulator));
|
||||
}
|
||||
|
||||
void VenoMatrix::updateSlots ()
|
||||
|
|
@ -53,26 +53,26 @@ void VenoMatrix::updateSlots ()
|
|||
{
|
||||
continue;
|
||||
}
|
||||
if (m_modulators.find (m_slot->sourceName) != m_modulators.end ())
|
||||
if (m_modulators.find(m_slot->sourceName) != m_modulators.end())
|
||||
{
|
||||
auto modulator = m_modulators[m_slot->sourceName];
|
||||
if (modulator == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
modulator->update ();
|
||||
modulator->update();
|
||||
for (auto& value : m_slot->targets)
|
||||
{
|
||||
if (value.name != "none")
|
||||
{
|
||||
if (m_modulationValues.find (value.name) != m_modulationValues.end ())
|
||||
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);
|
||||
modValue->addValue(modulator->getValue() * value.amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@
|
|||
#include <utility>
|
||||
|
||||
SynthInstance::SynthInstance (std::string processId)
|
||||
: m_processId (std::move (processId))
|
||||
: m_processId(std::move(processId))
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,18 +12,18 @@ VenoBuffer::VenoBuffer ()
|
|||
|
||||
VenoBuffer::~VenoBuffer ()
|
||||
{
|
||||
buffer.clear ();
|
||||
right.clear ();
|
||||
left.clear ();
|
||||
buffer.clear();
|
||||
right.clear();
|
||||
left.clear();
|
||||
}
|
||||
|
||||
void VenoBuffer::reset (int size)
|
||||
{
|
||||
if (size != buffer.size ())
|
||||
if (size != buffer.size())
|
||||
{
|
||||
buffer.resize (size);
|
||||
right.resize (size);
|
||||
left.resize (size);
|
||||
buffer.resize(size);
|
||||
right.resize(size);
|
||||
left.resize(size);
|
||||
}
|
||||
// reset to 0 dc :D
|
||||
for (int i = 0; i < size; ++i)
|
||||
|
|
@ -54,11 +54,11 @@ void VenoBuffer::addRightSample (float value, int index)
|
|||
|
||||
void VenoBuffer::calcPeak ()
|
||||
{
|
||||
for (int i = 0; i < buffer.size (); ++i)
|
||||
for (int i = 0; i < buffer.size(); ++i)
|
||||
{
|
||||
auto l = std::abs (left[i]);
|
||||
auto r = std::abs (right[i]);
|
||||
auto m = std::abs (buffer[i]);
|
||||
auto l = std::abs(left[i]);
|
||||
auto r = std::abs(right[i]);
|
||||
auto m = std::abs(buffer[i]);
|
||||
if (m > monoPeak)
|
||||
{
|
||||
monoPeak = m;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ void generateSaw (WaveTableGroup* group)
|
|||
{
|
||||
return;
|
||||
}
|
||||
int tableLen = findTableLen ();
|
||||
int tableLen = findTableLen();
|
||||
int idx;
|
||||
auto* freqWaveRe = new double[tableLen];
|
||||
auto* freqWaveIm = new double[tableLen];
|
||||
|
|
@ -26,6 +26,6 @@ void generateSaw (WaveTableGroup* group)
|
|||
freqWaveRe[idx] = 1.0 / idx; // sawtooth spectrum
|
||||
freqWaveRe[tableLen - idx] = -freqWaveRe[idx]; // mirror
|
||||
}
|
||||
fillTables (group, freqWaveRe, freqWaveIm, tableLen);
|
||||
VeNo::Logger::infoDebugMessage ("Generated clean Saw Wave");
|
||||
fillTables(group, freqWaveRe, freqWaveIm, tableLen);
|
||||
VeNo::Logger::infoDebugMessage("Generated clean Saw Wave");
|
||||
}
|
||||
|
|
@ -51,8 +51,8 @@ void fft (int N, double* ar, double* ai)
|
|||
LE *= 2; // (LE = 2^L)
|
||||
Ur = 1.0;
|
||||
Ui = 0.;
|
||||
Wr = std::cos (M_PI / (float) LE1);
|
||||
Wi = -std::sin (M_PI / (float) LE1); // Cooley, Lewis, and Welch have "+" here
|
||||
Wr = std::cos(M_PI / (float) LE1);
|
||||
Wi = -std::sin(M_PI / (float) LE1); // Cooley, Lewis, and Welch have "+" here
|
||||
for (j = 1; j <= LE1; j++)
|
||||
{
|
||||
for (i = j; i <= N; i += LE)
|
||||
|
|
@ -74,14 +74,14 @@ void fft (int N, double* ar, double* ai)
|
|||
|
||||
float makeWaveTable (WaveTableGroup* group, int len, double* ar, double* ai, double scale, double topFreq)
|
||||
{
|
||||
fft (len, ar, ai);
|
||||
fft(len, ar, ai);
|
||||
if (scale == 0.0)
|
||||
{
|
||||
// calc normal
|
||||
double max = 0;
|
||||
for (int idx = 0; idx < len; idx++)
|
||||
{
|
||||
double temp = fabs (ai[idx]);
|
||||
double temp = fabs(ai[idx]);
|
||||
if (max < temp)
|
||||
max = temp;
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ float makeWaveTable (WaveTableGroup* group, int len, double* ar, double* ai, dou
|
|||
wave[idx] = ai[idx] * scale;
|
||||
if (group->m_numWaveTables < WaveTableGroup::numWaveTableSlots)
|
||||
{
|
||||
auto table = group->m_WaveTables[group->m_numWaveTables] = new WaveTableObject ();
|
||||
auto table = group->m_WaveTables[group->m_numWaveTables] = new WaveTableObject();
|
||||
float* waveTable = group->m_WaveTables[group->m_numWaveTables]->m_waveTable = new float[len + 1];
|
||||
table->m_waveTableLen = len;
|
||||
table->m_topFreq = topFreq;
|
||||
|
|
@ -121,7 +121,7 @@ int fillTables (WaveTableGroup* group, double* freqWaveRe, double* freqWaveIm, i
|
|||
freqWaveRe[numSamples >> 1] = freqWaveIm[numSamples >> 1] = 0.0;
|
||||
int maxHarmonic = numSamples >> 1;
|
||||
const double minVal = 0.000001; // -120 dB
|
||||
while ((fabs (freqWaveRe[maxHarmonic]) + fabs (freqWaveIm[maxHarmonic]) < minVal) && maxHarmonic) --maxHarmonic;
|
||||
while ((fabs(freqWaveRe[maxHarmonic]) + fabs(freqWaveIm[maxHarmonic]) < minVal) && maxHarmonic) --maxHarmonic;
|
||||
double topFreq = 2.0 / 3.0 / maxHarmonic;
|
||||
double* ar = new double[numSamples];
|
||||
double* ai = new double[numSamples];
|
||||
|
|
@ -141,7 +141,7 @@ int fillTables (WaveTableGroup* group, double* freqWaveRe, double* freqWaveIm, i
|
|||
}
|
||||
|
||||
// make the wavetable
|
||||
scale = makeWaveTable (group, numSamples, ar, ai, scale, topFreq);
|
||||
scale = makeWaveTable(group, numSamples, ar, ai, scale, topFreq);
|
||||
numTables++;
|
||||
|
||||
// prepare for next table
|
||||
|
|
@ -153,11 +153,11 @@ int fillTables (WaveTableGroup* group, double* freqWaveRe, double* freqWaveIm, i
|
|||
|
||||
float getNextRand ()
|
||||
{
|
||||
return std::rand () / double (RAND_MAX);
|
||||
return std::rand() / double(RAND_MAX);
|
||||
}
|
||||
|
||||
int findTableLen ()
|
||||
{
|
||||
int maxHarms = AudioConfig::getInstance ()->getSampleRate () / (5.0 * 20) + 0.5;
|
||||
return VeNo::Utils::nextPowerOfTwo (maxHarms) * 2;
|
||||
int maxHarms = AudioConfig::getInstance()->getSampleRate() / (5.0 * 20) + 0.5;
|
||||
return VeNo::Utils::nextPowerOfTwo(maxHarms) * 2;
|
||||
}
|
||||
|
|
@ -9,25 +9,25 @@
|
|||
void WaveTableGenerator::init ()
|
||||
{
|
||||
//if the sampleRate changed... the WaveTables are not harmonic Save anymore and are needed to rebuild... pls stay save later!
|
||||
if (AudioConfig::getInstance ()->isNeedToReInit ())
|
||||
if (AudioConfig::getInstance()->isNeedToReInit())
|
||||
{
|
||||
cleanTables ();
|
||||
AudioConfig::getInstance ()->setNeedToReInit (false);
|
||||
cleanTables();
|
||||
AudioConfig::getInstance()->setNeedToReInit(false);
|
||||
}
|
||||
if (m_isInit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_waveTables[WaveForms::SAW] = new WaveTableGroup ();
|
||||
m_waveTables[WaveForms::SINE] = new WaveTableGroup ();
|
||||
m_waveTables[WaveForms::SQUARE] = new WaveTableGroup ();
|
||||
m_waveTables[WaveForms::TRIANGLE] = new WaveTableGroup ();
|
||||
m_waveTables[WaveForms::wSaw] = new WaveTableGroup ();
|
||||
m_waveTables[WaveForms::wSQUARE] = new WaveTableGroup ();
|
||||
m_waveTables[WaveForms::SYNTHONE] = new WaveTableGroup ();
|
||||
m_waveTables[WaveForms::SYNTHTWO] = new WaveTableGroup ();
|
||||
m_waveTables[WaveForms::VENOX] = new WaveTableGroup ();
|
||||
generateSaw (m_waveTables[WaveForms::SAW]);
|
||||
m_waveTables[WaveForms::SAW] = new WaveTableGroup();
|
||||
m_waveTables[WaveForms::SINE] = new WaveTableGroup();
|
||||
m_waveTables[WaveForms::SQUARE] = new WaveTableGroup();
|
||||
m_waveTables[WaveForms::TRIANGLE] = new WaveTableGroup();
|
||||
m_waveTables[WaveForms::wSaw] = new WaveTableGroup();
|
||||
m_waveTables[WaveForms::wSQUARE] = new WaveTableGroup();
|
||||
m_waveTables[WaveForms::SYNTHONE] = new WaveTableGroup();
|
||||
m_waveTables[WaveForms::SYNTHTWO] = new WaveTableGroup();
|
||||
m_waveTables[WaveForms::VENOX] = new WaveTableGroup();
|
||||
generateSaw(m_waveTables[WaveForms::SAW]);
|
||||
m_isInit = true;
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ WaveTableGroup* WaveTableGenerator::getGroup (int id)
|
|||
{
|
||||
if (!m_isInit)
|
||||
{
|
||||
init ();
|
||||
init();
|
||||
}
|
||||
if (id < 40)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,16 +43,16 @@ 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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,23 +4,26 @@
|
|||
|
||||
#include "Config.h"
|
||||
#include "../Fonts/Fonts.h"
|
||||
#include "../GUI/GUIParts/Sidebar/VenoLogo.h"
|
||||
#include "../Utils.h"
|
||||
|
||||
std::shared_ptr<Config> Config::m_instance = nullptr;
|
||||
|
||||
Config::Config ()
|
||||
{
|
||||
// i want to load the m_config file here...
|
||||
initConfig ();
|
||||
m_theme = std::make_shared<Theme> (m_config);
|
||||
m_theme->init ();
|
||||
m_fps = m_config->getIntValue ("waveform_fps", 60);
|
||||
initConfig();
|
||||
m_theme = std::make_shared<Theme>(m_config);
|
||||
m_theme->init();
|
||||
m_fps = m_config->getIntValue("waveform_fps", 60);
|
||||
startTimer(5000);
|
||||
}
|
||||
|
||||
void Config::saveAll ()
|
||||
{
|
||||
if (m_config != nullptr)
|
||||
{
|
||||
m_config->saveIfNeeded ();
|
||||
m_config->saveIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -39,7 +42,8 @@ void Config::initConfig ()
|
|||
options.applicationName = "config";
|
||||
options.folderName = "veno";
|
||||
options.filenameSuffix = "xml";
|
||||
m_config = std::make_unique<PropertiesFile> (options);
|
||||
m_config = std::make_unique<PropertiesFile>(options);
|
||||
m_scale = (float) m_config->getDoubleValue("scale", 1.0);
|
||||
}
|
||||
|
||||
std::shared_ptr<Theme> Config::getCurrentTheme ()
|
||||
|
|
@ -47,24 +51,29 @@ std::shared_ptr<Theme> Config::getCurrentTheme ()
|
|||
return m_theme;
|
||||
}
|
||||
|
||||
double Config::getScale ()
|
||||
double Config::getScale () const
|
||||
{
|
||||
return 1;
|
||||
return m_scale;
|
||||
}
|
||||
|
||||
void Config::setColourForIndex (Colour* colour, ThemeColour index)
|
||||
{
|
||||
if (m_theme)
|
||||
{
|
||||
m_theme->setColour (index, colour);
|
||||
m_theme->setColour(index, colour);
|
||||
}
|
||||
}
|
||||
|
||||
Config::~Config ()
|
||||
{
|
||||
m_config->save ();
|
||||
m_theme.reset ();
|
||||
m_config.reset ();
|
||||
m_config->save();
|
||||
m_config->setNeedsToBeSaved(false);
|
||||
m_theme.reset();
|
||||
m_config.reset();
|
||||
m_lookHandler.reset();
|
||||
stopTimer();
|
||||
VenoFonts::destroyAll();
|
||||
VenoLogo::deleteInstance();
|
||||
}
|
||||
|
||||
//LEAK DETECTOR FIX!
|
||||
|
|
@ -75,10 +84,9 @@ void Config::registerEditor (AudioProcessorEditor* editor, const std::string& na
|
|||
|
||||
void Config::removeEditor (const std::string& name)
|
||||
{
|
||||
m_editors.erase (name);
|
||||
if (m_editors.empty ())
|
||||
m_editors.erase(name);
|
||||
if (m_editors.empty())
|
||||
{
|
||||
VenoFonts::destroyAll ();
|
||||
m_instance = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
@ -86,13 +94,13 @@ void Config::removeEditor (const std::string& name)
|
|||
//for LCD :P let's be a bit funny xD
|
||||
int Config::getEditorCount ()
|
||||
{
|
||||
return m_editors.size ();
|
||||
return m_editors.size();
|
||||
}
|
||||
|
||||
std::shared_ptr<Config> Config::getInstance ()
|
||||
{
|
||||
if (m_instance == nullptr)
|
||||
m_instance = std::make_shared<Config> ();
|
||||
m_instance = std::make_shared<Config>();
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
|
|
@ -100,3 +108,38 @@ int Config::getFps () const
|
|||
{
|
||||
return m_fps;
|
||||
}
|
||||
|
||||
void Config::setScale (float value)
|
||||
{
|
||||
value = VeNo::Utils::clamp(value, 0.5f, 2.5f);
|
||||
m_scale = value;
|
||||
m_config->setValue("scale", m_scale);
|
||||
m_config->setNeedsToBeSaved(true);
|
||||
for (auto& editor : m_editors)
|
||||
{
|
||||
editor.second->setSize(1200 * m_scale, 700 * m_scale);
|
||||
}
|
||||
}
|
||||
|
||||
void Config::timerCallback ()
|
||||
{
|
||||
m_config->saveIfNeeded();
|
||||
}
|
||||
|
||||
void Config::repaintAll ()
|
||||
{
|
||||
for (auto& editor : m_editors)
|
||||
{
|
||||
if (editor.second->isShowing())
|
||||
{
|
||||
editor.second->repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Config::setFps (float value)
|
||||
{
|
||||
m_fps = VeNo::Utils::clamp(value, 15, 90);
|
||||
m_config->setValue("waveform_fps", m_fps);
|
||||
m_config->setNeedsToBeSaved(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include "../GUI/Theme/Theme.h"
|
||||
#include <memory>
|
||||
|
||||
class Config
|
||||
class Config : public Timer
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<PropertiesFile> m_config = nullptr;
|
||||
|
|
@ -18,14 +18,16 @@ private:
|
|||
static std::shared_ptr<Config> m_instance;
|
||||
int m_currentLook = 0; //nah move the bitch logic from current to next
|
||||
std::unordered_map<std::string, AudioProcessorEditor*> m_editors;
|
||||
int m_fps = 60;
|
||||
std::shared_ptr<LookHandler> m_lookHandler;
|
||||
public:
|
||||
int m_fps = 60;
|
||||
float m_scale = 1.0f;
|
||||
static std::shared_ptr<Config> getInstance ();
|
||||
void saveAll ();
|
||||
int getCurrentLook ();
|
||||
void setColourForIndex (Colour* colour, ThemeColour index);
|
||||
std::shared_ptr<Theme> getCurrentTheme ();
|
||||
double getScale ();
|
||||
double getScale () const;
|
||||
// can be public but doesnt need!
|
||||
Config ();
|
||||
~Config ();
|
||||
|
|
@ -33,6 +35,10 @@ public:
|
|||
void removeEditor (const std::string& name);
|
||||
int getEditorCount ();
|
||||
int getFps () const;
|
||||
void setScale(float value);
|
||||
void setFps(float value);
|
||||
void timerCallback () override;
|
||||
void repaintAll();
|
||||
protected:
|
||||
void initConfig ();
|
||||
};
|
||||
|
|
|
|||
16
Source/Veno/Core/VeNoState.cpp
Normal file
16
Source/Veno/Core/VeNoState.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// Created by versustune on 14.06.20.
|
||||
//
|
||||
|
||||
#include "VeNoState.h"
|
||||
|
||||
VeNoState::VeNoState (std::string pid)
|
||||
{
|
||||
m_pid = pid;
|
||||
}
|
||||
|
||||
VeNoState::~VeNoState ()
|
||||
{
|
||||
delete configScreen;
|
||||
configScreen = nullptr;
|
||||
}
|
||||
20
Source/Veno/Core/VeNoState.h
Normal file
20
Source/Veno/Core/VeNoState.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// Created by versustune on 14.06.20.
|
||||
//
|
||||
|
||||
#ifndef VENO_VENOSTATE_H
|
||||
#define VENO_VENOSTATE_H
|
||||
|
||||
#include <string>
|
||||
#include "../GUI/GUIParts/ConfigScreen/VenoConfigScreen.h"
|
||||
|
||||
class VeNoState
|
||||
{
|
||||
protected:
|
||||
std::string m_pid = "";
|
||||
public:
|
||||
VeNoState(std::string pid);
|
||||
~VeNoState();
|
||||
VenoConfigScreen* configScreen = nullptr;
|
||||
};
|
||||
#endif //VENO_VENOSTATE_H
|
||||
|
|
@ -4,23 +4,23 @@
|
|||
|
||||
#include "Fonts.h"
|
||||
|
||||
VenoFonts* VenoFonts::instance = new VenoFonts ();
|
||||
VenoFonts* VenoFonts::instance = new VenoFonts();
|
||||
|
||||
Font* VenoFonts::getNormal ()
|
||||
{
|
||||
return getInstance ()->arvo;
|
||||
return getInstance()->arvo;
|
||||
}
|
||||
|
||||
Font* VenoFonts::getLCD ()
|
||||
{
|
||||
return getInstance ()->lcdFont;
|
||||
return getInstance()->lcdFont;
|
||||
}
|
||||
|
||||
VenoFonts* VenoFonts::getInstance ()
|
||||
{
|
||||
if (instance == nullptr)
|
||||
{
|
||||
instance = new VenoFonts ();
|
||||
instance = new VenoFonts();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
|
@ -33,10 +33,10 @@ void VenoFonts::destroyAll ()
|
|||
|
||||
VenoFonts::VenoFonts ()
|
||||
{
|
||||
arvo = new Font (Typeface::createSystemTypefaceFor (BinaryData::arvo_ttf,
|
||||
BinaryData::arvo_ttfSize));
|
||||
lcdFont = new Font (Typeface::createSystemTypefaceFor (BinaryData::lcd_ttf,
|
||||
BinaryData::lcd_ttfSize));
|
||||
arvo = new Font(Typeface::createSystemTypefaceFor(BinaryData::arvo_ttf,
|
||||
BinaryData::arvo_ttfSize));
|
||||
lcdFont = new Font(Typeface::createSystemTypefaceFor(BinaryData::lcd_ttf,
|
||||
BinaryData::lcd_ttfSize));
|
||||
}
|
||||
|
||||
VenoFonts::~VenoFonts ()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
//
|
||||
|
||||
#include "BaseComponent.h"
|
||||
#include "../../Utils.h"
|
||||
#include "../../Fonts/Fonts.h"
|
||||
#include <utility>
|
||||
|
||||
|
|
@ -13,40 +14,42 @@ BaseComponent::BaseComponent (const std::string& processId)
|
|||
|
||||
BaseComponent::~BaseComponent ()
|
||||
{
|
||||
m_label.reset ();
|
||||
m_label.reset();
|
||||
}
|
||||
|
||||
void BaseComponent::addLabel (const std::string& label_text, LabelPosition labelPosition)
|
||||
{
|
||||
m_enableLabel = true;
|
||||
m_label = std::make_shared<LabelComponent> (this, label_text);
|
||||
m_label->setPosition (labelPosition);
|
||||
m_label = std::make_shared<LabelComponent>(this, label_text);
|
||||
m_label->setPosition(labelPosition);
|
||||
addAndMakeVisible(*m_label);
|
||||
}
|
||||
|
||||
void BaseComponent::resized ()
|
||||
{
|
||||
if (m_enableLabel && m_label != nullptr)
|
||||
{
|
||||
LabelPosition position = m_label->getLabelPosition ();
|
||||
LabelPosition position = m_label->getLabelPosition();
|
||||
if (position == LabelPosition::TOP)
|
||||
{
|
||||
m_label->setBounds (0, 0, getWidth (), 15);
|
||||
m_label->setBounds(0, 0, getWidth(), VeNo::Utils::getCalculatedHeight(15));
|
||||
}
|
||||
else if (position == LabelPosition::BOTTOM)
|
||||
{
|
||||
m_label->setBounds (0, getHeight () - 20, getWidth (), 15);
|
||||
auto height = VeNo::Utils::getCalculatedHeight(15);
|
||||
m_label->setBounds(0, getHeight() - height, getWidth(), height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BaseComponent::paint (Graphics& g)
|
||||
{
|
||||
g.setFont (*VenoFonts::getNormal ());
|
||||
g.setFont(*VenoFonts::getNormal());
|
||||
}
|
||||
|
||||
void BaseComponent::setParameter (std::string name, std::string group)
|
||||
{
|
||||
m_name = std::move (name);
|
||||
m_group = std::move (group);
|
||||
setName (m_name);
|
||||
m_name = std::move(name);
|
||||
m_group = std::move(group);
|
||||
setName(m_name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ private:
|
|||
std::string m_group;
|
||||
std::string m_name;
|
||||
bool m_enableLabel = false;
|
||||
std::shared_ptr<LabelComponent> m_label;
|
||||
public:
|
||||
explicit BaseComponent (const std::string& processId);
|
||||
~BaseComponent () override;
|
||||
|
|
@ -29,5 +28,6 @@ public:
|
|||
void paint (Graphics& g) override;
|
||||
protected:
|
||||
std::string m_processId;
|
||||
std::shared_ptr<LabelComponent> m_label;
|
||||
};
|
||||
#endif //VENO_BASECOMPONENT_H
|
||||
|
|
|
|||
65
Source/Veno/GUI/Components/Config/VeNoColour.cpp
Normal file
65
Source/Veno/GUI/Components/Config/VeNoColour.cpp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
//
|
||||
// Created by versustune on 14.06.20.
|
||||
//
|
||||
|
||||
#include "VeNoColour.h"
|
||||
#include <utility>
|
||||
#include "../../../Core/Config.h"
|
||||
#include "../../../Utils.h"
|
||||
|
||||
using ColourOption = ColourSelector::ColourSelectorOptions;
|
||||
VeNoColour::~VeNoColour ()
|
||||
{
|
||||
BaseComponent::m_label.reset();
|
||||
m_selector.reset();
|
||||
}
|
||||
|
||||
VeNoColour::VeNoColour (const std::string& processId, ThemeColour index)
|
||||
: BaseComponent(processId)
|
||||
{
|
||||
m_index = index;
|
||||
m_selector = std::make_unique<ColourSelector>(
|
||||
ColourOption::showColourAtTop|ColourOption::editableColour|ColourOption::showColourspace);
|
||||
m_selector->setCurrentColour(Config::getInstance()->getCurrentTheme()->getColour(index),
|
||||
NotificationType::dontSendNotification);
|
||||
m_selector->addChangeListener(this);
|
||||
m_selector->setOpaque(false);
|
||||
addAndMakeVisible(*m_selector);
|
||||
}
|
||||
|
||||
void VeNoColour::setName (std::string name)
|
||||
{
|
||||
m_name = std::move(name);
|
||||
if (BaseComponent::m_label == nullptr)
|
||||
{
|
||||
BaseComponent::addLabel(m_name, LabelPosition::TOP);
|
||||
}
|
||||
}
|
||||
|
||||
void VeNoColour::changeListenerCallback (ChangeBroadcaster* source)
|
||||
{
|
||||
auto selector = m_selector->getCurrentColour();
|
||||
auto* colour = new Colour(selector.getRed(), selector.getGreen(), selector.getBlue(),
|
||||
1.0f);
|
||||
Config::getInstance()->getCurrentTheme()->setColour(m_index, colour);
|
||||
Config::getInstance()->repaintAll();
|
||||
}
|
||||
|
||||
void VeNoColour::resized ()
|
||||
{
|
||||
auto h = VeNo::Utils::getCalculatedHeight(30);
|
||||
if (BaseComponent::m_label != nullptr)
|
||||
{
|
||||
BaseComponent::m_label->setBounds(0, 0, getWidth(), h);
|
||||
}
|
||||
if (m_selector != nullptr)
|
||||
{
|
||||
m_selector->setBounds(0, h, getWidth(), getHeight() - h);
|
||||
}
|
||||
}
|
||||
|
||||
void VeNoColour::paint (Graphics& g)
|
||||
{
|
||||
g.setColour(Colours::white);
|
||||
BaseComponent::paint(g);
|
||||
}
|
||||
27
Source/Veno/GUI/Components/Config/VeNoColour.h
Normal file
27
Source/Veno/GUI/Components/Config/VeNoColour.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// Created by versustune on 14.06.20.
|
||||
//
|
||||
|
||||
#ifndef VENO_VENOCOLOUR_H
|
||||
#define VENO_VENOCOLOUR_H
|
||||
|
||||
#include "JuceHeader.h"
|
||||
#include "../BaseComponent.h"
|
||||
#include "../../Theme/Theme.h"
|
||||
|
||||
class VeNoColour : public BaseComponent, ChangeListener
|
||||
{
|
||||
private:
|
||||
ThemeColour m_index;
|
||||
std::unique_ptr<ColourSelector> m_selector;
|
||||
std::string m_name;
|
||||
public:
|
||||
explicit VeNoColour (const std::string& processId, ThemeColour index);
|
||||
~VeNoColour () override;
|
||||
void setName(std::string name);
|
||||
void resized () override;
|
||||
void paint (Graphics& g) override;
|
||||
private:
|
||||
void changeListenerCallback (ChangeBroadcaster* source) override;
|
||||
};
|
||||
#endif //VENO_VENOCOLOUR_H
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue