- save
This commit is contained in:
parent
ac22ea5e75
commit
a27c62f062
49 changed files with 1171 additions and 385 deletions
|
@ -3,36 +3,43 @@
|
||||||
#include "Veno/Core/Config.h"
|
#include "Veno/Core/Config.h"
|
||||||
#include "Veno/Utils/Logger.h"
|
#include "Veno/Utils/Logger.h"
|
||||||
#include "Veno/Fonts/Fonts.h"
|
#include "Veno/Fonts/Fonts.h"
|
||||||
|
#include "Veno/Utils.h"
|
||||||
|
|
||||||
|
#define SIDEBAR_WIDTH 300
|
||||||
|
|
||||||
VenoAudioProcessorEditor::VenoAudioProcessorEditor (VenoAudioProcessor& p)
|
VenoAudioProcessorEditor::VenoAudioProcessorEditor (VenoAudioProcessor& p)
|
||||||
: AudioProcessorEditor (&p), processor (p)
|
: AudioProcessorEditor(&p), processor(p)
|
||||||
{
|
{
|
||||||
m_id = p.m_id;
|
m_id = p.m_id;
|
||||||
Config::getInstance ()->registerEditor (this, m_id);
|
Config::getInstance()->registerEditor(this, m_id);
|
||||||
LookAndFeel::setDefaultLookAndFeel (m_look);
|
LookAndFeel::setDefaultLookAndFeel(m_look);
|
||||||
waveform = std::make_unique<SidebarLCD> (m_id);
|
m_sidebar = std::make_unique<Sidebar>(m_id);
|
||||||
setSize (600, 400);
|
setSize(1200 * Config::getInstance()->getScale(), 700 * Config::getInstance()->getScale());
|
||||||
addAndMakeVisible (*waveform);
|
addAndMakeVisible(*m_sidebar);
|
||||||
}
|
}
|
||||||
|
|
||||||
VenoAudioProcessorEditor::~VenoAudioProcessorEditor ()
|
VenoAudioProcessorEditor::~VenoAudioProcessorEditor ()
|
||||||
{
|
{
|
||||||
LookAndFeel::setDefaultLookAndFeel (nullptr);
|
LookAndFeel::setDefaultLookAndFeel(nullptr);
|
||||||
waveform.reset (nullptr);
|
m_sidebar.reset(nullptr);
|
||||||
delete m_look;
|
delete m_look;
|
||||||
Config::getInstance ()->removeEditor (m_id);
|
Config::getInstance()->removeEditor(m_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VenoAudioProcessorEditor::paint (Graphics& g)
|
void VenoAudioProcessorEditor::paint (Graphics& g)
|
||||||
{
|
{
|
||||||
g.setFont (*VenoFonts::getNormal ());
|
auto theme = Config::getInstance()->getCurrentTheme();
|
||||||
g.fillAll (Colour (0, 0, 0));
|
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 ()
|
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 <JuceHeader.h>
|
||||||
#include "PluginProcessor.h"
|
#include "PluginProcessor.h"
|
||||||
#include "Veno/GUI/LookAndFeel/LookHandler.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
|
class VenoAudioProcessorEditor : public AudioProcessorEditor
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ public:
|
||||||
private:
|
private:
|
||||||
VenoAudioProcessor& processor;
|
VenoAudioProcessor& processor;
|
||||||
std::string m_id = "";
|
std::string m_id = "";
|
||||||
LookAndFeel_V4* m_look = new LookHandler ();
|
LookAndFeel_V4* m_look = new LookHandler();
|
||||||
std::unique_ptr<SidebarLCD> waveform;
|
std::unique_ptr<Sidebar> m_sidebar;
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoAudioProcessorEditor)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoAudioProcessorEditor)
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,16 +13,16 @@ VenoAudioProcessor::VenoAudioProcessor ()
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
#endif*/
|
#endif*/
|
||||||
: AudioProcessor (BusesProperties ().withInput ("Input", AudioChannelSet::stereo (), true).withOutput ("Output",
|
: AudioProcessor(BusesProperties().withInput("Input", AudioChannelSet::stereo(), true).withOutput("Output",
|
||||||
AudioChannelSet::stereo (),
|
AudioChannelSet::stereo(),
|
||||||
true))
|
true))
|
||||||
{
|
{
|
||||||
instance = VenoInstance::createInstance (m_id);
|
instance = VenoInstance::createInstance(m_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
VenoAudioProcessor::~VenoAudioProcessor ()
|
VenoAudioProcessor::~VenoAudioProcessor ()
|
||||||
{
|
{
|
||||||
VenoInstance::deleteInstance (m_id);
|
VenoInstance::deleteInstance(m_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
const String VenoAudioProcessor::getName () const
|
const String VenoAudioProcessor::getName () const
|
||||||
|
@ -88,9 +88,9 @@ void VenoAudioProcessor::changeProgramName (int index, const String& newName)
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void VenoAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
|
void VenoAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
|
||||||
{
|
{
|
||||||
auto audioConfig = AudioConfig::getInstance ();
|
auto audioConfig = AudioConfig::getInstance();
|
||||||
audioConfig->setSampleRate (sampleRate);
|
audioConfig->setSampleRate(sampleRate);
|
||||||
audioConfig->initWaveTables ();
|
audioConfig->initWaveTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VenoAudioProcessor::releaseResources ()
|
void VenoAudioProcessor::releaseResources ()
|
||||||
|
@ -105,8 +105,8 @@ bool VenoAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) con
|
||||||
ignoreUnused (layouts);
|
ignoreUnused (layouts);
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
if (layouts.getMainOutputChannelSet () != AudioChannelSet::mono ()
|
if (layouts.getMainOutputChannelSet() != AudioChannelSet::mono()
|
||||||
&& layouts.getMainOutputChannelSet () != AudioChannelSet::stereo ())
|
&& layouts.getMainOutputChannelSet() != AudioChannelSet::stereo())
|
||||||
return false;
|
return false;
|
||||||
#if !JucePlugin_IsSynth
|
#if !JucePlugin_IsSynth
|
||||||
if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet())
|
if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet())
|
||||||
|
@ -121,23 +121,23 @@ bool VenoAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) con
|
||||||
void VenoAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
|
void VenoAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
|
||||||
{
|
{
|
||||||
ScopedNoDenormals noDenormals;
|
ScopedNoDenormals noDenormals;
|
||||||
instance->matrix.updateSlots ();
|
instance->matrix.updateSlots();
|
||||||
instance->audioBuffer->reset (buffer.getNumSamples ());
|
instance->audioBuffer->reset(buffer.getNumSamples());
|
||||||
int numChannels = buffer.getNumChannels ();
|
int numChannels = buffer.getNumChannels();
|
||||||
for (int i = 0; i < numChannels; ++i)
|
for (int i = 0; i < numChannels; ++i)
|
||||||
{
|
{
|
||||||
auto c = buffer.getReadPointer (i);
|
auto c = buffer.getReadPointer(i);
|
||||||
for (int j = 0; j < buffer.getNumSamples (); ++j)
|
for (int j = 0; j < buffer.getNumSamples(); ++j)
|
||||||
{
|
{
|
||||||
instance->fft.pushNextSampleIntoFifo (c[j]);
|
instance->fft.pushNextSampleIntoFifo(c[j]);
|
||||||
instance->audioBuffer->addMonoSample (c[j], j);
|
instance->audioBuffer->addMonoSample(c[j], j);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
instance->audioBuffer->addLeftSample (c[j], j);
|
instance->audioBuffer->addLeftSample(c[j], j);
|
||||||
}
|
}
|
||||||
if (i == 1 || numChannels == 1)
|
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 ()
|
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 ()
|
AudioProcessor* JUCE_CALLTYPE createPluginFilter ()
|
||||||
{
|
{
|
||||||
return new VenoAudioProcessor ();
|
return new VenoAudioProcessor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,57 +3,35 @@
|
||||||
#include <JuceHeader.h>
|
#include <JuceHeader.h>
|
||||||
#include "Veno/VenoInstance.h"
|
#include "Veno/VenoInstance.h"
|
||||||
|
|
||||||
class VenoAudioProcessor : public AudioProcessor {
|
class VenoAudioProcessor : public AudioProcessor
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
VenoAudioProcessor();
|
VenoAudioProcessor ();
|
||||||
|
~VenoAudioProcessor ();
|
||||||
~VenoAudioProcessor();
|
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
|
||||||
|
void releaseResources () override;
|
||||||
void prepareToPlay(double sampleRate, int samplesPerBlock) override;
|
|
||||||
|
|
||||||
void releaseResources() override;
|
|
||||||
|
|
||||||
#ifndef JucePlugin_PreferredChannelConfigurations
|
#ifndef JucePlugin_PreferredChannelConfigurations
|
||||||
|
bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
|
||||||
bool isBusesLayoutSupported(const BusesLayout &layouts) const override;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
void processBlock (AudioBuffer<float>&, MidiBuffer&) override;
|
||||||
void processBlock(AudioBuffer<float> &, MidiBuffer &) override;
|
AudioProcessorEditor* createEditor () override;
|
||||||
|
bool hasEditor () const override;
|
||||||
AudioProcessorEditor *createEditor() override;
|
const String getName () const override;
|
||||||
|
bool acceptsMidi () const override;
|
||||||
bool hasEditor() const override;
|
bool producesMidi () const override;
|
||||||
|
bool isMidiEffect () const override;
|
||||||
const String getName() const override;
|
double getTailLengthSeconds () const override;
|
||||||
|
int getNumPrograms () override;
|
||||||
bool acceptsMidi() const override;
|
int getCurrentProgram () override;
|
||||||
|
void setCurrentProgram (int index) override;
|
||||||
bool producesMidi() const override;
|
const String getProgramName (int index) override;
|
||||||
|
void changeProgramName (int index, const String& newName) override;
|
||||||
bool isMidiEffect() const override;
|
void getStateInformation (MemoryBlock& destData) override;
|
||||||
|
void setStateInformation (const void* data, int sizeInBytes) 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
|
// Variable to communicate with the GUI and the Processor
|
||||||
std::string m_id = Uuid().toString().toStdString();
|
std::string m_id = Uuid().toString().toStdString();
|
||||||
std::shared_ptr<VenoInstance> instance;
|
std::shared_ptr<VenoInstance> instance;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoAudioProcessor)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoAudioProcessor)
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
|
|
||||||
#include "VenoMatrix.h"
|
#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)
|
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)
|
void VenoMatrix::removeModulateValue (const std::string& name)
|
||||||
{
|
{
|
||||||
m_modulationValues.erase (name);
|
m_modulationValues.erase(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VenoMatrix::removeModulator (const std::string& 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)
|
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)
|
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 ()
|
void VenoMatrix::updateSlots ()
|
||||||
|
@ -53,26 +53,26 @@ void VenoMatrix::updateSlots ()
|
||||||
{
|
{
|
||||||
continue;
|
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];
|
auto modulator = m_modulators[m_slot->sourceName];
|
||||||
if (modulator == nullptr)
|
if (modulator == nullptr)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
modulator->update ();
|
modulator->update();
|
||||||
for (auto& value : m_slot->targets)
|
for (auto& value : m_slot->targets)
|
||||||
{
|
{
|
||||||
if (value.name != "none")
|
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];
|
auto modValue = m_modulationValues[value.name];
|
||||||
if (modValue == nullptr)
|
if (modValue == nullptr)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
modValue->addValue (modulator->getValue () * value.amount);
|
modValue->addValue(modulator->getValue() * value.amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
SynthInstance::SynthInstance (std::string processId)
|
SynthInstance::SynthInstance (std::string processId)
|
||||||
: m_processId (std::move (processId))
|
: m_processId(std::move(processId))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,18 +12,18 @@ VenoBuffer::VenoBuffer ()
|
||||||
|
|
||||||
VenoBuffer::~VenoBuffer ()
|
VenoBuffer::~VenoBuffer ()
|
||||||
{
|
{
|
||||||
buffer.clear ();
|
buffer.clear();
|
||||||
right.clear ();
|
right.clear();
|
||||||
left.clear ();
|
left.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VenoBuffer::reset (int size)
|
void VenoBuffer::reset (int size)
|
||||||
{
|
{
|
||||||
if (size != buffer.size ())
|
if (size != buffer.size())
|
||||||
{
|
{
|
||||||
buffer.resize (size);
|
buffer.resize(size);
|
||||||
right.resize (size);
|
right.resize(size);
|
||||||
left.resize (size);
|
left.resize(size);
|
||||||
}
|
}
|
||||||
// reset to 0 dc :D
|
// reset to 0 dc :D
|
||||||
for (int i = 0; i < size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
|
@ -54,11 +54,11 @@ void VenoBuffer::addRightSample (float value, int index)
|
||||||
|
|
||||||
void VenoBuffer::calcPeak ()
|
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 l = std::abs(left[i]);
|
||||||
auto r = std::abs (right[i]);
|
auto r = std::abs(right[i]);
|
||||||
auto m = std::abs (buffer[i]);
|
auto m = std::abs(buffer[i]);
|
||||||
if (m > monoPeak)
|
if (m > monoPeak)
|
||||||
{
|
{
|
||||||
monoPeak = m;
|
monoPeak = m;
|
||||||
|
|
|
@ -12,7 +12,7 @@ void generateSaw (WaveTableGroup* group)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int tableLen = findTableLen ();
|
int tableLen = findTableLen();
|
||||||
int idx;
|
int idx;
|
||||||
auto* freqWaveRe = new double[tableLen];
|
auto* freqWaveRe = new double[tableLen];
|
||||||
auto* freqWaveIm = new double[tableLen];
|
auto* freqWaveIm = new double[tableLen];
|
||||||
|
@ -26,6 +26,6 @@ void generateSaw (WaveTableGroup* group)
|
||||||
freqWaveRe[idx] = 1.0 / idx; // sawtooth spectrum
|
freqWaveRe[idx] = 1.0 / idx; // sawtooth spectrum
|
||||||
freqWaveRe[tableLen - idx] = -freqWaveRe[idx]; // mirror
|
freqWaveRe[tableLen - idx] = -freqWaveRe[idx]; // mirror
|
||||||
}
|
}
|
||||||
fillTables (group, freqWaveRe, freqWaveIm, tableLen);
|
fillTables(group, freqWaveRe, freqWaveIm, tableLen);
|
||||||
VeNo::Logger::infoDebugMessage ("Generated clean Saw Wave");
|
VeNo::Logger::infoDebugMessage("Generated clean Saw Wave");
|
||||||
}
|
}
|
|
@ -51,8 +51,8 @@ void fft (int N, double* ar, double* ai)
|
||||||
LE *= 2; // (LE = 2^L)
|
LE *= 2; // (LE = 2^L)
|
||||||
Ur = 1.0;
|
Ur = 1.0;
|
||||||
Ui = 0.;
|
Ui = 0.;
|
||||||
Wr = std::cos (M_PI / (float) LE1);
|
Wr = std::cos(M_PI / (float) LE1);
|
||||||
Wi = -std::sin (M_PI / (float) LE1); // Cooley, Lewis, and Welch have "+" here
|
Wi = -std::sin(M_PI / (float) LE1); // Cooley, Lewis, and Welch have "+" here
|
||||||
for (j = 1; j <= LE1; j++)
|
for (j = 1; j <= LE1; j++)
|
||||||
{
|
{
|
||||||
for (i = j; i <= N; i += LE)
|
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)
|
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)
|
if (scale == 0.0)
|
||||||
{
|
{
|
||||||
// calc normal
|
// calc normal
|
||||||
double max = 0;
|
double max = 0;
|
||||||
for (int idx = 0; idx < len; idx++)
|
for (int idx = 0; idx < len; idx++)
|
||||||
{
|
{
|
||||||
double temp = fabs (ai[idx]);
|
double temp = fabs(ai[idx]);
|
||||||
if (max < temp)
|
if (max < temp)
|
||||||
max = temp;
|
max = temp;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ float makeWaveTable (WaveTableGroup* group, int len, double* ar, double* ai, dou
|
||||||
wave[idx] = ai[idx] * scale;
|
wave[idx] = ai[idx] * scale;
|
||||||
if (group->m_numWaveTables < WaveTableGroup::numWaveTableSlots)
|
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];
|
float* waveTable = group->m_WaveTables[group->m_numWaveTables]->m_waveTable = new float[len + 1];
|
||||||
table->m_waveTableLen = len;
|
table->m_waveTableLen = len;
|
||||||
table->m_topFreq = topFreq;
|
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;
|
freqWaveRe[numSamples >> 1] = freqWaveIm[numSamples >> 1] = 0.0;
|
||||||
int maxHarmonic = numSamples >> 1;
|
int maxHarmonic = numSamples >> 1;
|
||||||
const double minVal = 0.000001; // -120 dB
|
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 topFreq = 2.0 / 3.0 / maxHarmonic;
|
||||||
double* ar = new double[numSamples];
|
double* ar = new double[numSamples];
|
||||||
double* ai = new double[numSamples];
|
double* ai = new double[numSamples];
|
||||||
|
@ -141,7 +141,7 @@ int fillTables (WaveTableGroup* group, double* freqWaveRe, double* freqWaveIm, i
|
||||||
}
|
}
|
||||||
|
|
||||||
// make the wavetable
|
// make the wavetable
|
||||||
scale = makeWaveTable (group, numSamples, ar, ai, scale, topFreq);
|
scale = makeWaveTable(group, numSamples, ar, ai, scale, topFreq);
|
||||||
numTables++;
|
numTables++;
|
||||||
|
|
||||||
// prepare for next table
|
// prepare for next table
|
||||||
|
@ -153,11 +153,11 @@ int fillTables (WaveTableGroup* group, double* freqWaveRe, double* freqWaveIm, i
|
||||||
|
|
||||||
float getNextRand ()
|
float getNextRand ()
|
||||||
{
|
{
|
||||||
return std::rand () / double (RAND_MAX);
|
return std::rand() / double(RAND_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
int findTableLen ()
|
int findTableLen ()
|
||||||
{
|
{
|
||||||
int maxHarms = AudioConfig::getInstance ()->getSampleRate () / (5.0 * 20) + 0.5;
|
int maxHarms = AudioConfig::getInstance()->getSampleRate() / (5.0 * 20) + 0.5;
|
||||||
return VeNo::Utils::nextPowerOfTwo (maxHarms) * 2;
|
return VeNo::Utils::nextPowerOfTwo(maxHarms) * 2;
|
||||||
}
|
}
|
|
@ -9,25 +9,25 @@
|
||||||
void WaveTableGenerator::init ()
|
void WaveTableGenerator::init ()
|
||||||
{
|
{
|
||||||
//if the sampleRate changed... the WaveTables are not harmonic Save anymore and are needed to rebuild... pls stay save later!
|
//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 ();
|
cleanTables();
|
||||||
AudioConfig::getInstance ()->setNeedToReInit (false);
|
AudioConfig::getInstance()->setNeedToReInit(false);
|
||||||
}
|
}
|
||||||
if (m_isInit)
|
if (m_isInit)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_waveTables[WaveForms::SAW] = new WaveTableGroup ();
|
m_waveTables[WaveForms::SAW] = new WaveTableGroup();
|
||||||
m_waveTables[WaveForms::SINE] = new WaveTableGroup ();
|
m_waveTables[WaveForms::SINE] = new WaveTableGroup();
|
||||||
m_waveTables[WaveForms::SQUARE] = new WaveTableGroup ();
|
m_waveTables[WaveForms::SQUARE] = new WaveTableGroup();
|
||||||
m_waveTables[WaveForms::TRIANGLE] = new WaveTableGroup ();
|
m_waveTables[WaveForms::TRIANGLE] = new WaveTableGroup();
|
||||||
m_waveTables[WaveForms::wSaw] = new WaveTableGroup ();
|
m_waveTables[WaveForms::wSaw] = new WaveTableGroup();
|
||||||
m_waveTables[WaveForms::wSQUARE] = new WaveTableGroup ();
|
m_waveTables[WaveForms::wSQUARE] = new WaveTableGroup();
|
||||||
m_waveTables[WaveForms::SYNTHONE] = new WaveTableGroup ();
|
m_waveTables[WaveForms::SYNTHONE] = new WaveTableGroup();
|
||||||
m_waveTables[WaveForms::SYNTHTWO] = new WaveTableGroup ();
|
m_waveTables[WaveForms::SYNTHTWO] = new WaveTableGroup();
|
||||||
m_waveTables[WaveForms::VENOX] = new WaveTableGroup ();
|
m_waveTables[WaveForms::VENOX] = new WaveTableGroup();
|
||||||
generateSaw (m_waveTables[WaveForms::SAW]);
|
generateSaw(m_waveTables[WaveForms::SAW]);
|
||||||
m_isInit = true;
|
m_isInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ WaveTableGroup* WaveTableGenerator::getGroup (int id)
|
||||||
{
|
{
|
||||||
if (!m_isInit)
|
if (!m_isInit)
|
||||||
{
|
{
|
||||||
init ();
|
init();
|
||||||
}
|
}
|
||||||
if (id < 40)
|
if (id < 40)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,16 +43,16 @@ void AudioConfig::setNeedToReInit (bool _needToReInit)
|
||||||
std::shared_ptr<AudioConfig> AudioConfig::getInstance ()
|
std::shared_ptr<AudioConfig> AudioConfig::getInstance ()
|
||||||
{
|
{
|
||||||
if (AudioConfig::m_instance == nullptr)
|
if (AudioConfig::m_instance == nullptr)
|
||||||
AudioConfig::m_instance = std::make_shared<AudioConfig> ();
|
AudioConfig::m_instance = std::make_shared<AudioConfig>();
|
||||||
return m_instance;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioConfig::initWaveTables ()
|
void AudioConfig::initWaveTables ()
|
||||||
{
|
{
|
||||||
WaveTableGenerator::getInstance ().init ();
|
WaveTableGenerator::getInstance().init();
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioConfig::~AudioConfig ()
|
AudioConfig::~AudioConfig ()
|
||||||
{
|
{
|
||||||
WaveTableGenerator::getInstance ().cleanTables ();
|
WaveTableGenerator::getInstance().cleanTables();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,23 +4,26 @@
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "../Fonts/Fonts.h"
|
#include "../Fonts/Fonts.h"
|
||||||
|
#include "../GUI/GUIParts/Sidebar/VenoLogo.h"
|
||||||
|
#include "../Utils.h"
|
||||||
|
|
||||||
std::shared_ptr<Config> Config::m_instance = nullptr;
|
std::shared_ptr<Config> Config::m_instance = nullptr;
|
||||||
|
|
||||||
Config::Config ()
|
Config::Config ()
|
||||||
{
|
{
|
||||||
// i want to load the m_config file here...
|
// i want to load the m_config file here...
|
||||||
initConfig ();
|
initConfig();
|
||||||
m_theme = std::make_shared<Theme> (m_config);
|
m_theme = std::make_shared<Theme>(m_config);
|
||||||
m_theme->init ();
|
m_theme->init();
|
||||||
m_fps = m_config->getIntValue ("waveform_fps", 60);
|
m_fps = m_config->getIntValue("waveform_fps", 60);
|
||||||
|
startTimer(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::saveAll ()
|
void Config::saveAll ()
|
||||||
{
|
{
|
||||||
if (m_config != nullptr)
|
if (m_config != nullptr)
|
||||||
{
|
{
|
||||||
m_config->saveIfNeeded ();
|
m_config->saveIfNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +42,8 @@ void Config::initConfig ()
|
||||||
options.applicationName = "config";
|
options.applicationName = "config";
|
||||||
options.folderName = "veno";
|
options.folderName = "veno";
|
||||||
options.filenameSuffix = "xml";
|
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 ()
|
std::shared_ptr<Theme> Config::getCurrentTheme ()
|
||||||
|
@ -47,24 +51,29 @@ std::shared_ptr<Theme> Config::getCurrentTheme ()
|
||||||
return m_theme;
|
return m_theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Config::getScale ()
|
double Config::getScale () const
|
||||||
{
|
{
|
||||||
return 1;
|
return m_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::setColourForIndex (Colour* colour, ThemeColour index)
|
void Config::setColourForIndex (Colour* colour, ThemeColour index)
|
||||||
{
|
{
|
||||||
if (m_theme)
|
if (m_theme)
|
||||||
{
|
{
|
||||||
m_theme->setColour (index, colour);
|
m_theme->setColour(index, colour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::~Config ()
|
Config::~Config ()
|
||||||
{
|
{
|
||||||
m_config->save ();
|
m_config->save();
|
||||||
m_theme.reset ();
|
m_config->setNeedsToBeSaved(false);
|
||||||
m_config.reset ();
|
m_theme.reset();
|
||||||
|
m_config.reset();
|
||||||
|
m_lookHandler.reset();
|
||||||
|
stopTimer();
|
||||||
|
VenoFonts::destroyAll();
|
||||||
|
VenoLogo::deleteInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
//LEAK DETECTOR FIX!
|
//LEAK DETECTOR FIX!
|
||||||
|
@ -75,10 +84,9 @@ void Config::registerEditor (AudioProcessorEditor* editor, const std::string& na
|
||||||
|
|
||||||
void Config::removeEditor (const std::string& name)
|
void Config::removeEditor (const std::string& name)
|
||||||
{
|
{
|
||||||
m_editors.erase (name);
|
m_editors.erase(name);
|
||||||
if (m_editors.empty ())
|
if (m_editors.empty())
|
||||||
{
|
{
|
||||||
VenoFonts::destroyAll ();
|
|
||||||
m_instance = nullptr;
|
m_instance = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,13 +94,13 @@ void Config::removeEditor (const std::string& name)
|
||||||
//for LCD :P let's be a bit funny xD
|
//for LCD :P let's be a bit funny xD
|
||||||
int Config::getEditorCount ()
|
int Config::getEditorCount ()
|
||||||
{
|
{
|
||||||
return m_editors.size ();
|
return m_editors.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Config> Config::getInstance ()
|
std::shared_ptr<Config> Config::getInstance ()
|
||||||
{
|
{
|
||||||
if (m_instance == nullptr)
|
if (m_instance == nullptr)
|
||||||
m_instance = std::make_shared<Config> ();
|
m_instance = std::make_shared<Config>();
|
||||||
return m_instance;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,3 +108,38 @@ int Config::getFps () const
|
||||||
{
|
{
|
||||||
return m_fps;
|
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 "../GUI/Theme/Theme.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class Config
|
class Config : public Timer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<PropertiesFile> m_config = nullptr;
|
std::shared_ptr<PropertiesFile> m_config = nullptr;
|
||||||
|
@ -18,14 +18,16 @@ private:
|
||||||
static std::shared_ptr<Config> m_instance;
|
static std::shared_ptr<Config> m_instance;
|
||||||
int m_currentLook = 0; //nah move the bitch logic from current to next
|
int m_currentLook = 0; //nah move the bitch logic from current to next
|
||||||
std::unordered_map<std::string, AudioProcessorEditor*> m_editors;
|
std::unordered_map<std::string, AudioProcessorEditor*> m_editors;
|
||||||
int m_fps = 60;
|
std::shared_ptr<LookHandler> m_lookHandler;
|
||||||
public:
|
public:
|
||||||
|
int m_fps = 60;
|
||||||
|
float m_scale = 1.0f;
|
||||||
static std::shared_ptr<Config> getInstance ();
|
static std::shared_ptr<Config> getInstance ();
|
||||||
void saveAll ();
|
void saveAll ();
|
||||||
int getCurrentLook ();
|
int getCurrentLook ();
|
||||||
void setColourForIndex (Colour* colour, ThemeColour index);
|
void setColourForIndex (Colour* colour, ThemeColour index);
|
||||||
std::shared_ptr<Theme> getCurrentTheme ();
|
std::shared_ptr<Theme> getCurrentTheme ();
|
||||||
double getScale ();
|
double getScale () const;
|
||||||
// can be public but doesnt need!
|
// can be public but doesnt need!
|
||||||
Config ();
|
Config ();
|
||||||
~Config ();
|
~Config ();
|
||||||
|
@ -33,6 +35,10 @@ public:
|
||||||
void removeEditor (const std::string& name);
|
void removeEditor (const std::string& name);
|
||||||
int getEditorCount ();
|
int getEditorCount ();
|
||||||
int getFps () const;
|
int getFps () const;
|
||||||
|
void setScale(float value);
|
||||||
|
void setFps(float value);
|
||||||
|
void timerCallback () override;
|
||||||
|
void repaintAll();
|
||||||
protected:
|
protected:
|
||||||
void initConfig ();
|
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"
|
#include "Fonts.h"
|
||||||
|
|
||||||
VenoFonts* VenoFonts::instance = new VenoFonts ();
|
VenoFonts* VenoFonts::instance = new VenoFonts();
|
||||||
|
|
||||||
Font* VenoFonts::getNormal ()
|
Font* VenoFonts::getNormal ()
|
||||||
{
|
{
|
||||||
return getInstance ()->arvo;
|
return getInstance()->arvo;
|
||||||
}
|
}
|
||||||
|
|
||||||
Font* VenoFonts::getLCD ()
|
Font* VenoFonts::getLCD ()
|
||||||
{
|
{
|
||||||
return getInstance ()->lcdFont;
|
return getInstance()->lcdFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
VenoFonts* VenoFonts::getInstance ()
|
VenoFonts* VenoFonts::getInstance ()
|
||||||
{
|
{
|
||||||
if (instance == nullptr)
|
if (instance == nullptr)
|
||||||
{
|
{
|
||||||
instance = new VenoFonts ();
|
instance = new VenoFonts();
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,10 @@ void VenoFonts::destroyAll ()
|
||||||
|
|
||||||
VenoFonts::VenoFonts ()
|
VenoFonts::VenoFonts ()
|
||||||
{
|
{
|
||||||
arvo = new Font (Typeface::createSystemTypefaceFor (BinaryData::arvo_ttf,
|
arvo = new Font(Typeface::createSystemTypefaceFor(BinaryData::arvo_ttf,
|
||||||
BinaryData::arvo_ttfSize));
|
BinaryData::arvo_ttfSize));
|
||||||
lcdFont = new Font (Typeface::createSystemTypefaceFor (BinaryData::lcd_ttf,
|
lcdFont = new Font(Typeface::createSystemTypefaceFor(BinaryData::lcd_ttf,
|
||||||
BinaryData::lcd_ttfSize));
|
BinaryData::lcd_ttfSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
VenoFonts::~VenoFonts ()
|
VenoFonts::~VenoFonts ()
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "BaseComponent.h"
|
#include "BaseComponent.h"
|
||||||
|
#include "../../Utils.h"
|
||||||
#include "../../Fonts/Fonts.h"
|
#include "../../Fonts/Fonts.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
@ -13,40 +14,42 @@ BaseComponent::BaseComponent (const std::string& processId)
|
||||||
|
|
||||||
BaseComponent::~BaseComponent ()
|
BaseComponent::~BaseComponent ()
|
||||||
{
|
{
|
||||||
m_label.reset ();
|
m_label.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseComponent::addLabel (const std::string& label_text, LabelPosition labelPosition)
|
void BaseComponent::addLabel (const std::string& label_text, LabelPosition labelPosition)
|
||||||
{
|
{
|
||||||
m_enableLabel = true;
|
m_enableLabel = true;
|
||||||
m_label = std::make_shared<LabelComponent> (this, label_text);
|
m_label = std::make_shared<LabelComponent>(this, label_text);
|
||||||
m_label->setPosition (labelPosition);
|
m_label->setPosition(labelPosition);
|
||||||
|
addAndMakeVisible(*m_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseComponent::resized ()
|
void BaseComponent::resized ()
|
||||||
{
|
{
|
||||||
if (m_enableLabel && m_label != nullptr)
|
if (m_enableLabel && m_label != nullptr)
|
||||||
{
|
{
|
||||||
LabelPosition position = m_label->getLabelPosition ();
|
LabelPosition position = m_label->getLabelPosition();
|
||||||
if (position == LabelPosition::TOP)
|
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)
|
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)
|
void BaseComponent::paint (Graphics& g)
|
||||||
{
|
{
|
||||||
g.setFont (*VenoFonts::getNormal ());
|
g.setFont(*VenoFonts::getNormal());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseComponent::setParameter (std::string name, std::string group)
|
void BaseComponent::setParameter (std::string name, std::string group)
|
||||||
{
|
{
|
||||||
m_name = std::move (name);
|
m_name = std::move(name);
|
||||||
m_group = std::move (group);
|
m_group = std::move(group);
|
||||||
setName (m_name);
|
setName(m_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ private:
|
||||||
std::string m_group;
|
std::string m_group;
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
bool m_enableLabel = false;
|
bool m_enableLabel = false;
|
||||||
std::shared_ptr<LabelComponent> m_label;
|
|
||||||
public:
|
public:
|
||||||
explicit BaseComponent (const std::string& processId);
|
explicit BaseComponent (const std::string& processId);
|
||||||
~BaseComponent () override;
|
~BaseComponent () override;
|
||||||
|
@ -29,5 +28,6 @@ public:
|
||||||
void paint (Graphics& g) override;
|
void paint (Graphics& g) override;
|
||||||
protected:
|
protected:
|
||||||
std::string m_processId;
|
std::string m_processId;
|
||||||
|
std::shared_ptr<LabelComponent> m_label;
|
||||||
};
|
};
|
||||||
#endif //VENO_BASECOMPONENT_H
|
#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
|
34
Source/Veno/GUI/Components/Config/VenoConfigButton.cpp
Normal file
34
Source/Veno/GUI/Components/Config/VenoConfigButton.cpp
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
//
|
||||||
|
// Created by versustune on 14.06.20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "VenoConfigButton.h"
|
||||||
|
#include "../../../Core/Config.h"
|
||||||
|
#include "../../../Utils.h"
|
||||||
|
#include "../../../VenoInstance.h"
|
||||||
|
#include "../../../Utils/Logger.h"
|
||||||
|
|
||||||
|
VenoConfigButton::VenoConfigButton (const std::string& processId) : BaseComponent(processId)
|
||||||
|
{
|
||||||
|
setMouseCursor(MouseCursor::PointingHandCursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoConfigButton::paint (Graphics& g)
|
||||||
|
{
|
||||||
|
auto theme = Config::getInstance()->getCurrentTheme();
|
||||||
|
VeNo::Utils::setFontSize(16.0f, g);
|
||||||
|
g.setColour(theme->getColour(ThemeColour::accent));
|
||||||
|
g.drawRect(0, 0, getWidth(), getHeight());
|
||||||
|
g.drawFittedText("Config", 0, 0, getWidth(), getHeight(), Justification::centred, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoConfigButton::mouseDown (const MouseEvent& event)
|
||||||
|
{
|
||||||
|
// open Window on click :)
|
||||||
|
auto state = VenoInstance::getInstance(m_processId)->state;
|
||||||
|
if (state->configScreen != nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state->configScreen = new VenoConfigScreen(m_processId);
|
||||||
|
}
|
21
Source/Veno/GUI/Components/Config/VenoConfigButton.h
Normal file
21
Source/Veno/GUI/Components/Config/VenoConfigButton.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// Created by versustune on 14.06.20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef VENO_VENOCONFIGBUTTON_H
|
||||||
|
#define VENO_VENOCONFIGBUTTON_H
|
||||||
|
|
||||||
|
#include "JuceHeader.h"
|
||||||
|
#include "../BaseComponent.h"
|
||||||
|
|
||||||
|
class VenoConfigButton : public BaseComponent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VenoConfigButton (const std::string& processId);
|
||||||
|
~VenoConfigButton() = default;
|
||||||
|
void paint (Graphics& g) override;
|
||||||
|
void mouseDown (const MouseEvent& event) override;
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif //VENO_VENOCONFIGBUTTON_H
|
84
Source/Veno/GUI/Components/Config/VenoPreColours.cpp
Normal file
84
Source/Veno/GUI/Components/Config/VenoPreColours.cpp
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
//
|
||||||
|
// Created by versustune on 14.06.20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "VenoPreColours.h"
|
||||||
|
#include "../../../Core/Config.h"
|
||||||
|
|
||||||
|
VenoPreColours::VenoPreColours (const std::string& processId) : BaseComponent(processId)
|
||||||
|
{
|
||||||
|
initSliders();
|
||||||
|
initButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
VenoPreColours::~VenoPreColours ()
|
||||||
|
{
|
||||||
|
m_scaleSlider.reset();
|
||||||
|
m_fpsSlider.reset();
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
m_pre[i].reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoPreColours::initSliders ()
|
||||||
|
{
|
||||||
|
m_fpsSlider = std::make_shared<Slider>();
|
||||||
|
m_fpsSlider->setRange(15, 90, 1);
|
||||||
|
m_fpsSlider->setValue(Config::getInstance()->getFps());
|
||||||
|
m_fpsSlider->setSliderStyle(Slider::SliderStyle::LinearHorizontal);
|
||||||
|
m_fpsSlider->setTooltip("FPS");
|
||||||
|
m_scaleSlider = std::make_shared<Slider>();
|
||||||
|
m_scaleSlider->setRange(0.5f, 2.5f, 0.1);
|
||||||
|
m_scaleSlider->setValue(Config::getInstance()->getScale());
|
||||||
|
m_scaleSlider->setSliderStyle(Slider::SliderStyle::LinearHorizontal);
|
||||||
|
m_scaleSlider->setTooltip("Scale");
|
||||||
|
m_scaleSlider->addListener(this);
|
||||||
|
m_fpsSlider->addListener(this);
|
||||||
|
addAndMakeVisible(*m_fpsSlider);
|
||||||
|
addAndMakeVisible(*m_scaleSlider);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoPreColours::sliderValueChanged (Slider* slider)
|
||||||
|
{
|
||||||
|
if (slider == m_fpsSlider.get())
|
||||||
|
{
|
||||||
|
Config::getInstance()->setFps(slider->getValue());
|
||||||
|
}
|
||||||
|
if (slider == m_scaleSlider.get())
|
||||||
|
{
|
||||||
|
Config::getInstance()->setScale(slider->getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoPreColours::initButtons ()
|
||||||
|
{
|
||||||
|
//4
|
||||||
|
m_pre.resize(4);
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
m_pre[i] = std::make_unique<TextButton>(m_names[i]);
|
||||||
|
m_pre[i]->addListener(this);
|
||||||
|
addAndMakeVisible(m_pre[i].get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoPreColours::buttonClicked (Button* button)
|
||||||
|
{
|
||||||
|
auto text = button->getButtonText().toStdString();
|
||||||
|
Config::getInstance()->getCurrentTheme()->setDefault(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoPreColours::resized ()
|
||||||
|
{
|
||||||
|
auto bounds = Rectangle<int>();
|
||||||
|
bounds.setBounds(0,0,getWidth(), getHeight()-100);
|
||||||
|
auto bWidth = (getWidth()-80) / 4;
|
||||||
|
for (int i = 0; i < 4 ; ++i)
|
||||||
|
{
|
||||||
|
m_pre[i]->setBounds((bWidth * i) + 40, 110, bWidth, 50);
|
||||||
|
}
|
||||||
|
// set slider and button position
|
||||||
|
m_fpsSlider->setBounds(20, 0, getWidth()-40, 50);
|
||||||
|
m_scaleSlider->setBounds(20, 50, getWidth()-40, 50);
|
||||||
|
}
|
30
Source/Veno/GUI/Components/Config/VenoPreColours.h
Normal file
30
Source/Veno/GUI/Components/Config/VenoPreColours.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
//
|
||||||
|
// Created by versustune on 14.06.20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef VENO_VENOPRECOLOURS_H
|
||||||
|
#define VENO_VENOPRECOLOURS_H
|
||||||
|
|
||||||
|
#include "JuceHeader.h"
|
||||||
|
#include "../../Components/BaseComponent.h"
|
||||||
|
|
||||||
|
class VenoPreColours : public BaseComponent, public Slider::Listener, Button::Listener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VenoPreColours (const std::string& processId);
|
||||||
|
~VenoPreColours();
|
||||||
|
void initSliders();
|
||||||
|
void initButtons();
|
||||||
|
void sliderValueChanged (Slider* slider) override;
|
||||||
|
void resized () override;
|
||||||
|
private:
|
||||||
|
void buttonClicked (Button* button) override;
|
||||||
|
protected:
|
||||||
|
std::shared_ptr<Slider> m_fpsSlider;
|
||||||
|
std::shared_ptr<Slider> m_scaleSlider;
|
||||||
|
std::vector<std::unique_ptr<TextButton>> m_pre;
|
||||||
|
std::string m_names[4]{
|
||||||
|
"LED", "Blood", "Orange Dream", "Ocean"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#endif //VENO_VENOPRECOLOURS_H
|
|
@ -7,56 +7,56 @@
|
||||||
#include "../../../Core/Config.h"
|
#include "../../../Core/Config.h"
|
||||||
#include "../../../Fonts/Fonts.h"
|
#include "../../../Fonts/Fonts.h"
|
||||||
|
|
||||||
SidebarLCD::SidebarLCD (const std::string& process_id) : BaseComponent (process_id)
|
SidebarLCD::SidebarLCD (const std::string& process_id) : BaseComponent(process_id)
|
||||||
{
|
{
|
||||||
waveform = std::make_unique<Waveforms> (process_id);
|
waveform = std::make_unique<Waveforms>(process_id);
|
||||||
addAndMakeVisible (*waveform);
|
addAndMakeVisible(*waveform);
|
||||||
}
|
}
|
||||||
|
|
||||||
SidebarLCD::~SidebarLCD ()
|
SidebarLCD::~SidebarLCD ()
|
||||||
{
|
{
|
||||||
waveform.reset (nullptr);
|
waveform.reset(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SidebarLCD::drawHeadline (Graphics& g)
|
void SidebarLCD::drawHeadline (Graphics& g)
|
||||||
{
|
{
|
||||||
float fontSize = VeNo::Utils::setFontSize (12.0f, g) + 2;
|
float fontSize = VeNo::Utils::setFontSize(12.0f, g) + 2;
|
||||||
int line = m_innerY + fontSize + 2;
|
int line = m_innerY + fontSize + 2;
|
||||||
g.drawText (">>> VeNo <<<", 0, m_innerY, getWidth () - m_width, fontSize,
|
g.drawText(">>> VeNo <<<", 0, m_innerY, getWidth() - m_width, fontSize,
|
||||||
Justification::centred,
|
Justification::centred,
|
||||||
true);
|
true);
|
||||||
g.drawLine (0, line, getWidth (), line);
|
g.drawLine(0, line, getWidth(), line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SidebarLCD::drawFooter (Graphics& g)
|
void SidebarLCD::drawFooter (Graphics& g)
|
||||||
{
|
{
|
||||||
float fontSize = VeNo::Utils::setFontSize (8.0f, g) + 4;
|
float fontSize = VeNo::Utils::setFontSize(8.0f, g) + 4;
|
||||||
int space = m_innerY + fontSize;
|
int space = m_innerY + fontSize;
|
||||||
int line = getHeight () - space;
|
int line = getHeight() - space;
|
||||||
g.drawText ("by VersusTuneZ", 0, line, getWidth () - m_width, fontSize,
|
g.drawText("by VersusTuneZ", 0, line, getWidth() - m_width, fontSize,
|
||||||
Justification::horizontallyCentred,
|
Justification::horizontallyCentred,
|
||||||
true);
|
true);
|
||||||
g.drawLine (0, line - 4, getWidth (), line - 4);
|
g.drawLine(0, line - 4, getWidth(), line - 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SidebarLCD::resized ()
|
void SidebarLCD::resized ()
|
||||||
{
|
{
|
||||||
float topSpace = (12 * Config::getInstance ()->getScale ()) + 4 + m_innerY;
|
float topSpace = (12 * Config::getInstance()->getScale()) + 4 + m_innerY;
|
||||||
if (waveform != nullptr)
|
if (waveform != nullptr)
|
||||||
{
|
{
|
||||||
waveform->setBounds (0, topSpace * 2, getWidth (), getHeight () - (topSpace * 4));
|
waveform->setBounds(0, topSpace * 2, getWidth(), getHeight() - (topSpace * 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SidebarLCD::paint (Graphics& g)
|
void SidebarLCD::paint (Graphics& g)
|
||||||
{
|
{
|
||||||
std::shared_ptr<Theme> theme = Config::getInstance ()->getCurrentTheme ();
|
std::shared_ptr<Theme> theme = Config::getInstance()->getCurrentTheme();
|
||||||
auto colour = theme->getColour (ThemeColour::lcd_bg);
|
auto colour = theme->getColour(ThemeColour::lcd_bg);
|
||||||
g.fillAll (colour);
|
g.fillAll(colour);
|
||||||
// background
|
// background
|
||||||
auto accent = theme->getColour (ThemeColour::lcd);
|
auto accent = theme->getColour(ThemeColour::lcd);
|
||||||
g.setColour (accent);
|
g.setColour(accent);
|
||||||
g.setFont (*VenoFonts::getLCD ());
|
g.setFont(*VenoFonts::getLCD());
|
||||||
drawHeadline (g);
|
drawHeadline(g);
|
||||||
drawFooter (g);
|
drawFooter(g);
|
||||||
}
|
}
|
|
@ -9,33 +9,30 @@
|
||||||
#include "../../../VenoInstance.h"
|
#include "../../../VenoInstance.h"
|
||||||
#include "../../../Fonts/Fonts.h"
|
#include "../../../Fonts/Fonts.h"
|
||||||
|
|
||||||
Waveforms::Waveforms (const std::string& processId) : BaseComponent (processId)
|
Waveforms::Waveforms (const std::string& processId) : BaseComponent(processId)
|
||||||
{
|
{
|
||||||
m_context.setOpenGLVersionRequired (OpenGLContext::OpenGLVersion::openGL3_2);
|
setMouseCursor(MouseCursor::PointingHandCursor);
|
||||||
m_context.setRenderer (this);
|
m_context.setOpenGLVersionRequired(OpenGLContext::OpenGLVersion::openGL3_2);
|
||||||
m_context.setContinuousRepainting (false);
|
m_context.setRenderer(this);
|
||||||
m_context.setComponentPaintingEnabled (true);
|
m_context.setContinuousRepainting(false);
|
||||||
m_context.attachTo (*this);
|
m_context.setComponentPaintingEnabled(true);
|
||||||
auto fps = Config::getInstance ()->getFps ();
|
m_context.attachTo(*this);
|
||||||
startTimerHz (Config::getInstance ()->getFps ());
|
setFps();
|
||||||
std::srand (unsigned (time (nullptr)));
|
std::srand(unsigned(time(nullptr)));
|
||||||
pickRandomText = (std::rand () % RANDOM_TEXT_COUNT);
|
pickRandomText = (std::rand() % RANDOM_TEXT_COUNT);
|
||||||
m_ticks = 0;
|
m_ticks = 0;
|
||||||
// is something that
|
|
||||||
m_time_needed = roundToInt (4000 / (1000 / fps));
|
|
||||||
m_time_needed_startup = roundToInt (1000 / (1000 / fps));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Waveforms::~Waveforms ()
|
Waveforms::~Waveforms ()
|
||||||
{
|
{
|
||||||
stopTimer ();
|
stopTimer();
|
||||||
shaderProgram.reset ();
|
shaderProgram.reset();
|
||||||
m_context.detach ();
|
m_context.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Waveforms::newOpenGLContextCreated ()
|
void Waveforms::newOpenGLContextCreated ()
|
||||||
{
|
{
|
||||||
compileOpenGLShaderProgram ();
|
compileOpenGLShaderProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Waveforms::openGLContextClosing ()
|
void Waveforms::openGLContextClosing ()
|
||||||
|
@ -45,23 +42,23 @@ void Waveforms::openGLContextClosing ()
|
||||||
|
|
||||||
void Waveforms::renderOpenGL ()
|
void Waveforms::renderOpenGL ()
|
||||||
{
|
{
|
||||||
if (!isShowing () || shaderProgram == nullptr || !shaderProgram->getLastError ().isEmpty ())
|
if (!isShowing() || shaderProgram == nullptr || !shaderProgram->getLastError().isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto theme = Config::getInstance ()->getCurrentTheme ();
|
auto theme = Config::getInstance()->getCurrentTheme();
|
||||||
if (theme == nullptr)
|
if (theme == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
glViewport (0, 0, getWidth (), getHeight ());
|
glViewport(0, 0, getWidth(), getHeight());
|
||||||
OpenGLHelpers::clear (theme->getColour (ThemeColour::lcd_bg));
|
OpenGLHelpers::clear(theme->getColour(ThemeColour::lcd_bg));
|
||||||
glEnable (GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
shaderProgram->use ();
|
shaderProgram->use();
|
||||||
auto color = theme->getColour (ThemeColour::lcd);
|
auto color = theme->getColour(ThemeColour::lcd);
|
||||||
shaderProgram->setUniform ("color", color.getFloatRed (), color.getFloatGreen (), color.getFloatBlue (),
|
shaderProgram->setUniform("color", color.getFloatRed(), color.getFloatGreen(), color.getFloatBlue(),
|
||||||
color.getFloatAlpha ());
|
color.getFloatAlpha());
|
||||||
if (m_isWelcome || m_isStarting || m_isChangingData)
|
if (m_isWelcome || m_isStarting || m_isChangingData)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -69,33 +66,28 @@ void Waveforms::renderOpenGL ()
|
||||||
switch (m_mode)
|
switch (m_mode)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
drawAudioOutput ();
|
drawAudioOutput();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
drawWaveTable ();
|
drawWaveTable();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
drawSpectrum ();
|
drawSpectrum();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
drawPeakMeter ();
|
drawPeakMeter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Waveforms::handleAsyncUpdate ()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Waveforms::compileOpenGLShaderProgram ()
|
void Waveforms::compileOpenGLShaderProgram ()
|
||||||
{
|
{
|
||||||
std::unique_ptr<OpenGLShaderProgram> shaderProgramAttempt
|
std::unique_ptr<OpenGLShaderProgram> shaderProgramAttempt
|
||||||
= std::make_unique<OpenGLShaderProgram> (m_context);
|
= std::make_unique<OpenGLShaderProgram>(m_context);
|
||||||
if (shaderProgramAttempt->addVertexShader ({BinaryData::WaveForm_vertex_glsl})
|
if (shaderProgramAttempt->addVertexShader({BinaryData::WaveForm_vertex_glsl})
|
||||||
&& shaderProgramAttempt->addFragmentShader ({BinaryData::WaveForm_fragment_glsl})
|
&& shaderProgramAttempt->addFragmentShader({BinaryData::WaveForm_fragment_glsl})
|
||||||
&& shaderProgramAttempt->link ())
|
&& shaderProgramAttempt->link())
|
||||||
{
|
{
|
||||||
shaderProgram = std::move (shaderProgramAttempt);
|
shaderProgram = std::move(shaderProgramAttempt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,15 +113,16 @@ void Waveforms::timerCallback ()
|
||||||
{
|
{
|
||||||
if (m_isWelcome || m_isStarting || m_isChangingData || needToClear)
|
if (m_isWelcome || m_isStarting || m_isChangingData || needToClear)
|
||||||
{
|
{
|
||||||
repaint ();
|
repaint();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_context.isAttached ())
|
if (m_context.isAttached())
|
||||||
{
|
{
|
||||||
m_context.triggerRepaint ();
|
m_context.triggerRepaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setFps();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Waveforms::drawWaveTable ()
|
void Waveforms::drawWaveTable ()
|
||||||
|
@ -140,63 +133,61 @@ void Waveforms::drawWaveTable ()
|
||||||
void Waveforms::drawAudioOutput ()
|
void Waveforms::drawAudioOutput ()
|
||||||
{
|
{
|
||||||
// draw audio from the oscillators
|
// draw audio from the oscillators
|
||||||
auto instance = VenoInstance::getInstance (BaseComponent::m_processId);
|
auto instance = VenoInstance::getInstance(BaseComponent::m_processId);
|
||||||
auto buffer = instance->audioBuffer->getBuffer ();
|
auto buffer = instance->audioBuffer->getBuffer();
|
||||||
glBegin (GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
float posX = -1;
|
float posX = -1;
|
||||||
float inc = 2.0f / buffer.size ();
|
float inc = 2.0f / buffer.size();
|
||||||
for (float i : buffer)
|
for (float i : buffer)
|
||||||
{
|
{
|
||||||
glVertex2f (posX, i);
|
glVertex2f(posX, i);
|
||||||
posX += inc;
|
posX += inc;
|
||||||
}
|
}
|
||||||
glEnd ();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Waveforms::drawPeakMeter ()
|
void Waveforms::drawPeakMeter ()
|
||||||
{
|
{
|
||||||
auto theme = Config::getInstance ()->getCurrentTheme ();
|
auto theme = Config::getInstance()->getCurrentTheme();
|
||||||
if (theme == nullptr)
|
if (theme == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto instance = VenoInstance::getInstance (BaseComponent::m_processId);
|
auto instance = VenoInstance::getInstance(BaseComponent::m_processId);
|
||||||
instance->audioBuffer->calcPeak ();
|
instance->audioBuffer->calcPeak();
|
||||||
// draw peak signal
|
// draw peak signal
|
||||||
auto leftChannel = jmap (Decibels::gainToDecibels (instance->audioBuffer->leftPeak, -80.0f), -80.0f, 6.0f, -1.0f,
|
auto leftChannel = getdBForChannel(instance->audioBuffer->leftPeak);
|
||||||
1.0f);
|
selectColourByPeak(leftChannel);
|
||||||
selectColourByPeak (leftChannel);
|
glBegin(GL_TRIANGLES);
|
||||||
glBegin (GL_TRIANGLES);
|
glVertex2f(-0.9f, leftChannel);
|
||||||
glVertex2f (-0.9f, leftChannel);
|
glVertex2f(-0.9f, -1.0f);
|
||||||
glVertex2f (-0.9f, -1.0f);
|
glVertex2f(-0.01f, -1.0f);
|
||||||
glVertex2f (-0.01f, -1.0f);
|
glVertex2f(-0.9f, leftChannel);
|
||||||
glVertex2f (-0.9f, leftChannel);
|
glVertex2f(-0.01f, leftChannel);
|
||||||
glVertex2f (-0.01f, leftChannel);
|
glVertex2f(-0.01f, -1.0f);
|
||||||
glVertex2f (-0.01f, -1.0f);
|
glEnd();
|
||||||
glEnd ();
|
auto rightChannel = getdBForChannel(instance->audioBuffer->rightPeak);
|
||||||
auto rightChannel = jmap (Decibels::gainToDecibels (instance->audioBuffer->rightPeak, -80.0f), -80.0f, 6.0f, -1.0f,
|
selectColourByPeak(rightChannel);
|
||||||
1.0f);
|
glBegin(GL_TRIANGLES);
|
||||||
selectColourByPeak (rightChannel);
|
glVertex2f(0.9f, rightChannel);
|
||||||
glBegin (GL_TRIANGLES);
|
glVertex2f(0.9f, -1.0f);
|
||||||
glVertex2f (0.9f, rightChannel);
|
glVertex2f(0.01f, -1.0f);
|
||||||
glVertex2f (0.9f, -1.0f);
|
glVertex2f(0.9f, rightChannel);
|
||||||
glVertex2f (0.01f, -1.0f);
|
glVertex2f(0.01f, rightChannel);
|
||||||
glVertex2f (0.9f, rightChannel);
|
glVertex2f(0.01f, -1.0f);
|
||||||
glVertex2f (0.01f, rightChannel);
|
glEnd();
|
||||||
glVertex2f (0.01f, -1.0f);
|
|
||||||
glEnd ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Waveforms::paint (Graphics& g)
|
void Waveforms::paint (Graphics& g)
|
||||||
{
|
{
|
||||||
std::shared_ptr<Theme> theme = Config::getInstance ()->getCurrentTheme ();
|
std::shared_ptr<Theme> theme = Config::getInstance()->getCurrentTheme();
|
||||||
auto accent = theme->getColour (ThemeColour::lcd);
|
auto accent = theme->getColour(ThemeColour::lcd);
|
||||||
g.setColour (accent);
|
g.setColour(accent);
|
||||||
g.setFont (*VenoFonts::getLCD ());
|
g.setFont(*VenoFonts::getLCD());
|
||||||
VeNo::Utils::setFontSize (16.0f, g);
|
VeNo::Utils::setFontSize(16.0f, g);
|
||||||
if (m_isWelcome)
|
if (m_isWelcome)
|
||||||
{
|
{
|
||||||
drawWelcome (g, getWidth (), getHeight (), 0, 0);
|
drawWelcome(g, getWidth(), getHeight(), 0, 0);
|
||||||
m_ticks++;
|
m_ticks++;
|
||||||
if (m_ticks > m_time_needed_startup)
|
if (m_ticks > m_time_needed_startup)
|
||||||
{
|
{
|
||||||
|
@ -207,8 +198,8 @@ void Waveforms::paint (Graphics& g)
|
||||||
}
|
}
|
||||||
else if (m_isStarting)
|
else if (m_isStarting)
|
||||||
{
|
{
|
||||||
g.drawText (m_warmUpText[pickRandomText], 0, 0, getWidth (), getHeight (),
|
g.drawText(m_warmUpText[pickRandomText], 0, 0, getWidth(), getHeight(),
|
||||||
Justification::centred, true);
|
Justification::centred, true);
|
||||||
m_ticks++;
|
m_ticks++;
|
||||||
if (m_ticks > m_time_needed_startup)
|
if (m_ticks > m_time_needed_startup)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +210,7 @@ void Waveforms::paint (Graphics& g)
|
||||||
}
|
}
|
||||||
else if (m_isChangingData)
|
else if (m_isChangingData)
|
||||||
{
|
{
|
||||||
drawChangedParameter (g, getWidth (), getHeight (), 0, 0);
|
drawChangedParameter(g, getWidth(), getHeight(), 0, 0);
|
||||||
m_ticks++;
|
m_ticks++;
|
||||||
if (m_ticks > m_time_needed)
|
if (m_ticks > m_time_needed)
|
||||||
{
|
{
|
||||||
|
@ -230,7 +221,7 @@ void Waveforms::paint (Graphics& g)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g.resetToDefaultState ();
|
g.resetToDefaultState();
|
||||||
needToClear = false;
|
needToClear = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,19 +229,19 @@ void Waveforms::paint (Graphics& g)
|
||||||
void Waveforms::drawChangedParameter (Graphics& g, int w, int h, int x, int y) const
|
void Waveforms::drawChangedParameter (Graphics& g, int w, int h, int x, int y) const
|
||||||
{
|
{
|
||||||
int halfHeight = h / 2;
|
int halfHeight = h / 2;
|
||||||
float font = VeNo::Utils::setFontSize (12, g);
|
float font = VeNo::Utils::setFontSize(12, g);
|
||||||
g.drawText (changingParameter, x, y + halfHeight - font, w, font, Justification::centred, true);
|
g.drawText(changingParameter, x, y + halfHeight - font, w, font, Justification::centred, true);
|
||||||
g.drawText (std::to_string (changedValue), x, y + halfHeight + 4, w, font, Justification::centred,
|
g.drawText(std::to_string(changedValue), x, y + halfHeight + 4, w, font, Justification::centred,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Waveforms::drawWelcome (Graphics& g, int w, int h, int x, int y)
|
void Waveforms::drawWelcome (Graphics& g, int w, int h, int x, int y)
|
||||||
{
|
{
|
||||||
float font = VeNo::Utils::setFontSize (12, g);
|
float font = VeNo::Utils::setFontSize(12, g);
|
||||||
int halfHeight = h / 2;
|
int halfHeight = h / 2;
|
||||||
g.drawText (m_readyText, x, y + halfHeight - font, w, font, Justification::centred, true);
|
g.drawText(m_readyText, x, y + halfHeight - font, w, font, Justification::centred, true);
|
||||||
g.drawText (SystemStats::getLogonName (), x, y + halfHeight + 4, w, font, Justification::centred,
|
g.drawText(SystemStats::getLogonName(), x, y + halfHeight + 4, w, font, Justification::centred,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Waveforms::drawSpectrum ()
|
void Waveforms::drawSpectrum ()
|
||||||
|
@ -259,20 +250,39 @@ void Waveforms::drawSpectrum ()
|
||||||
|
|
||||||
void Waveforms::selectColourByPeak (float value)
|
void Waveforms::selectColourByPeak (float value)
|
||||||
{
|
{
|
||||||
auto theme = Config::getInstance ()->getCurrentTheme ();
|
auto theme = Config::getInstance()->getCurrentTheme();
|
||||||
if (theme == nullptr)
|
if (theme == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto color = theme->getColour (ThemeColour::lcd);
|
auto color = theme->getColour(ThemeColour::lcd);
|
||||||
if (value > 0.8 && value < 0.9)
|
|
||||||
{
|
|
||||||
color = theme->getColour (ThemeColour::warning);
|
|
||||||
}
|
|
||||||
if (value > 0.9)
|
if (value > 0.9)
|
||||||
{
|
{
|
||||||
color = theme->getColour (ThemeColour::clip);
|
color = theme->getColour(ThemeColour::clip);
|
||||||
|
}
|
||||||
|
else if (value > 0.8)
|
||||||
|
{
|
||||||
|
color = theme->getColour(ThemeColour::warning);
|
||||||
|
}
|
||||||
|
shaderProgram->setUniform("color", color.getFloatRed(), color.getFloatGreen(), color.getFloatBlue(),
|
||||||
|
color.getFloatAlpha());
|
||||||
|
}
|
||||||
|
|
||||||
|
float Waveforms::getdBForChannel (float value)
|
||||||
|
{
|
||||||
|
float v = VeNo::Utils::clamp(Decibels::gainToDecibels(value, -60.0f), -60.0f, 6.0f);
|
||||||
|
return jmap(v, -60.0f, 6.0f, -1.0f,
|
||||||
|
1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Waveforms::setFps ()
|
||||||
|
{
|
||||||
|
if(m_currentFps != Config::getInstance()->getFps()) {
|
||||||
|
m_currentFps = Config::getInstance()->getFps();
|
||||||
|
// is something that
|
||||||
|
m_time_needed = roundToInt(4000 / (1000 / m_currentFps));
|
||||||
|
m_time_needed_startup = roundToInt(1000 / (1000 / m_currentFps));
|
||||||
|
stopTimer();
|
||||||
|
startTimer(m_currentFps);
|
||||||
}
|
}
|
||||||
shaderProgram->setUniform ("color", color.getFloatRed (), color.getFloatGreen (), color.getFloatBlue (),
|
|
||||||
color.getFloatAlpha ());
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
// opengl context :D
|
// opengl context :D
|
||||||
class Waveforms : public BaseComponent,
|
class Waveforms : public BaseComponent,
|
||||||
private OpenGLRenderer,
|
private OpenGLRenderer,
|
||||||
private AsyncUpdater,
|
|
||||||
private Timer
|
private Timer
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -34,7 +33,6 @@ public:
|
||||||
void newOpenGLContextCreated () override;
|
void newOpenGLContextCreated () override;
|
||||||
void openGLContextClosing () override;
|
void openGLContextClosing () override;
|
||||||
void renderOpenGL () override;
|
void renderOpenGL () override;
|
||||||
void handleAsyncUpdate () override;
|
|
||||||
void mouseDown (const MouseEvent& e) override;
|
void mouseDown (const MouseEvent& e) override;
|
||||||
void mouseDrag (const MouseEvent& e) override;
|
void mouseDrag (const MouseEvent& e) override;
|
||||||
void paint (Graphics& g) override;
|
void paint (Graphics& g) override;
|
||||||
|
@ -51,7 +49,10 @@ private:
|
||||||
void drawWelcome (Graphics& g, int w, int h, int x, int y);
|
void drawWelcome (Graphics& g, int w, int h, int x, int y);
|
||||||
void compileOpenGLShaderProgram ();
|
void compileOpenGLShaderProgram ();
|
||||||
void selectColourByPeak (float value);
|
void selectColourByPeak (float value);
|
||||||
|
float getdBForChannel (float value);
|
||||||
|
void setFps();
|
||||||
OpenGLContext m_context;
|
OpenGLContext m_context;
|
||||||
std::unique_ptr<OpenGLShaderProgram> shaderProgram;
|
std::unique_ptr<OpenGLShaderProgram> shaderProgram;
|
||||||
|
int m_currentFps = 0;
|
||||||
};
|
};
|
||||||
#endif //VENO_WAVEFORMS_H
|
#endif //VENO_WAVEFORMS_H
|
||||||
|
|
|
@ -8,19 +8,20 @@ LabelComponent::LabelComponent (Component* parent, std::string name)
|
||||||
{
|
{
|
||||||
m_text = name;
|
m_text = name;
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_label = std::make_shared<Label> (m_parent->getName (), name);
|
m_label = std::make_shared<Label>(m_parent->getName(), name);
|
||||||
|
addAndMakeVisible(*m_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelComponent::~LabelComponent ()
|
LabelComponent::~LabelComponent ()
|
||||||
{
|
{
|
||||||
m_label.reset ();
|
m_label.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabelComponent::resized ()
|
void LabelComponent::resized ()
|
||||||
{
|
{
|
||||||
if (m_label != nullptr)
|
if (m_label != nullptr)
|
||||||
{
|
{
|
||||||
m_label->setBounds (0, 0, getWidth (), getHeight ());
|
m_label->setBounds(0, 0, getWidth(), getHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
77
Source/Veno/GUI/GUIParts/ConfigScreen/ConfigComponent.cpp
Normal file
77
Source/Veno/GUI/GUIParts/ConfigScreen/ConfigComponent.cpp
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
//
|
||||||
|
// Created by versustune on 14.06.20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "ConfigComponent.h"
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
ConfigComponent::ConfigComponent (std::string pid)
|
||||||
|
{
|
||||||
|
m_pid = std::move(pid);
|
||||||
|
m_colors.resize(8);
|
||||||
|
auto theme = Config::getInstance()->getCurrentTheme();
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
m_colors[i] = std::make_unique<VeNoColour>(pid, getColorForId(i));
|
||||||
|
m_colors[i]->setName(m_names[i]);
|
||||||
|
addAndMakeVisible(m_colors[i].get());
|
||||||
|
}
|
||||||
|
m_preColours = std::make_unique<VenoPreColours>(pid);
|
||||||
|
addAndMakeVisible(*m_preColours);
|
||||||
|
flexBox.flexDirection = FlexBox::Direction::row;
|
||||||
|
flexBox.justifyContent = FlexBox::JustifyContent::flexStart;
|
||||||
|
flexBox.flexWrap = FlexBox::Wrap::wrap;
|
||||||
|
auto w = 200;
|
||||||
|
auto h = 100;
|
||||||
|
for (auto& color : m_colors)
|
||||||
|
{
|
||||||
|
auto item = FlexItem(w, h, *color);
|
||||||
|
item.margin = FlexItem::Margin(5, 5, 5, 5);
|
||||||
|
flexBox.items.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigComponent::~ConfigComponent ()
|
||||||
|
{
|
||||||
|
for (auto& color : m_colors)
|
||||||
|
{
|
||||||
|
color.reset();
|
||||||
|
}
|
||||||
|
m_colors.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
ThemeColour ConfigComponent::getColorForId (int id)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return ThemeColour::bg;
|
||||||
|
case 1:
|
||||||
|
return ThemeColour::bg_two;
|
||||||
|
case 2:
|
||||||
|
return ThemeColour::accent;
|
||||||
|
case 3:
|
||||||
|
return ThemeColour::accent_two;
|
||||||
|
case 4:
|
||||||
|
return ThemeColour::warning;
|
||||||
|
case 5:
|
||||||
|
return ThemeColour::clip;
|
||||||
|
case 6:
|
||||||
|
return ThemeColour::lcd_bg;
|
||||||
|
case 7:
|
||||||
|
return ThemeColour::lcd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigComponent::paint (Graphics& g)
|
||||||
|
{
|
||||||
|
g.fillAll(Colours::black);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigComponent::resized ()
|
||||||
|
{
|
||||||
|
auto bounds = Rectangle<int>();
|
||||||
|
bounds.setBounds(0,0,getWidth(), getHeight()-200);
|
||||||
|
flexBox.performLayout(bounds);
|
||||||
|
m_preColours->setBounds(0, getHeight() - 200, getWidth(), 200);
|
||||||
|
}
|
30
Source/Veno/GUI/GUIParts/ConfigScreen/ConfigComponent.h
Normal file
30
Source/Veno/GUI/GUIParts/ConfigScreen/ConfigComponent.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
//
|
||||||
|
// Created by versustune on 14.06.20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef VENO_CONFIGCOMPONENT_H
|
||||||
|
#define VENO_CONFIGCOMPONENT_H
|
||||||
|
|
||||||
|
#include "JuceHeader.h"
|
||||||
|
#include "../../../Core/Config.h"
|
||||||
|
#include "../../Components/Config/VeNoColour.h"
|
||||||
|
#include "../../Components/Config/VenoPreColours.h"
|
||||||
|
|
||||||
|
class ConfigComponent : public Component
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ConfigComponent(std::string pid);
|
||||||
|
~ConfigComponent() override;
|
||||||
|
void paint (Graphics& g) override;
|
||||||
|
void resized () override;
|
||||||
|
protected:
|
||||||
|
static ThemeColour getColorForId(int id);
|
||||||
|
std::string m_pid;
|
||||||
|
std::string m_names[8]{
|
||||||
|
"Background", "BackgroundTwo", "Accent", "Accent Two", "Warning", "Clip", "LCD Background", "LCD"
|
||||||
|
};
|
||||||
|
std::vector<std::unique_ptr<VeNoColour>> m_colors;
|
||||||
|
std::unique_ptr<VenoPreColours> m_preColours;
|
||||||
|
FlexBox flexBox;
|
||||||
|
};
|
||||||
|
#endif //VENO_CONFIGCOMPONENT_H
|
49
Source/Veno/GUI/GUIParts/ConfigScreen/VenoConfigScreen.cpp
Normal file
49
Source/Veno/GUI/GUIParts/ConfigScreen/VenoConfigScreen.cpp
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
//
|
||||||
|
// Created by versustune on 14.06.20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "VenoConfigScreen.h"
|
||||||
|
#include "../../../VenoInstance.h"
|
||||||
|
|
||||||
|
VenoConfigScreen::VenoConfigScreen (const std::string& pid) : DocumentWindow("VeNo Config", Colours::black,
|
||||||
|
DocumentWindow::closeButton, true)
|
||||||
|
{
|
||||||
|
m_pid = pid;
|
||||||
|
auto w = 840;
|
||||||
|
auto h = 800;
|
||||||
|
component = std::make_shared<ConfigComponent>(pid);
|
||||||
|
component->setSize(w, h);
|
||||||
|
m_lookHandler = std::make_unique<LookHandler>();
|
||||||
|
component->setLookAndFeel(m_lookHandler->getLook());
|
||||||
|
centreWithSize(w, h);
|
||||||
|
setAlwaysOnTop(true);
|
||||||
|
setContentOwned(component.get(), false);
|
||||||
|
setResizable(false, false);
|
||||||
|
setUsingNativeTitleBar(true);
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
VenoConfigScreen::~VenoConfigScreen ()
|
||||||
|
{
|
||||||
|
component->setLookAndFeel(nullptr);
|
||||||
|
m_lookHandler.reset();
|
||||||
|
component.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoConfigScreen::closeButtonPressed ()
|
||||||
|
{
|
||||||
|
auto state = VenoInstance::getInstance(m_pid)->state;
|
||||||
|
if (state != nullptr && state->configScreen != nullptr)
|
||||||
|
{
|
||||||
|
delete state->configScreen;
|
||||||
|
state->configScreen = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoConfigScreen::paint (Graphics& graphics)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoConfigScreen::resized ()
|
||||||
|
{
|
||||||
|
}
|
28
Source/Veno/GUI/GUIParts/ConfigScreen/VenoConfigScreen.h
Normal file
28
Source/Veno/GUI/GUIParts/ConfigScreen/VenoConfigScreen.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// Created by versustune on 14.06.20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef VENO_VENOCONFIGSCREEN_H
|
||||||
|
#define VENO_VENOCONFIGSCREEN_H
|
||||||
|
|
||||||
|
#include "JuceHeader.h"
|
||||||
|
#include "../../../Core/Config.h"
|
||||||
|
#include "../../Components/Config/VeNoColour.h"
|
||||||
|
#include "ConfigComponent.h"
|
||||||
|
|
||||||
|
class VenoConfigScreen : public DocumentWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit VenoConfigScreen (const std::string& pid);
|
||||||
|
~VenoConfigScreen () override;
|
||||||
|
void closeButtonPressed () override;
|
||||||
|
void paint (Graphics& graphics) override;
|
||||||
|
void resized () override;
|
||||||
|
private:
|
||||||
|
std::string m_pid;
|
||||||
|
std::shared_ptr<ConfigComponent> component;
|
||||||
|
std::unique_ptr<LookHandler> m_lookHandler;
|
||||||
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoConfigScreen)
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif //VENO_VENOCONFIGSCREEN_H
|
|
@ -3,3 +3,48 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "Sidebar.h"
|
#include "Sidebar.h"
|
||||||
|
#include "VenoLogo.h"
|
||||||
|
#include "../../../Utils.h"
|
||||||
|
|
||||||
|
Sidebar::Sidebar (const std::string& processId) : BaseComponent(processId)
|
||||||
|
{
|
||||||
|
m_lcd = std::make_unique<SidebarLCD>(processId);
|
||||||
|
m_configButton = std::make_unique<VenoConfigButton>(processId);
|
||||||
|
addAndMakeVisible(*m_lcd);
|
||||||
|
addAndMakeVisible(*m_configButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
Sidebar::~Sidebar ()
|
||||||
|
{
|
||||||
|
m_lcd.reset(nullptr);
|
||||||
|
m_configButton.reset(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sidebar::resized ()
|
||||||
|
{
|
||||||
|
if (m_lcd != nullptr)
|
||||||
|
{
|
||||||
|
m_lcd->setBounds(0, (getWidth() / 5) + 30, getWidth(), VeNo::Utils::getCalculatedHeight(175));
|
||||||
|
}
|
||||||
|
if (m_configButton != nullptr)
|
||||||
|
{
|
||||||
|
auto height = VeNo::Utils::getCalculatedHeight(30);
|
||||||
|
auto margin = VeNo::Utils::getCalculatedWidth(10);
|
||||||
|
m_configButton->setBounds(margin, getHeight()-height-margin, (getWidth()/2)-(margin*2), height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sidebar::paint (Graphics& g)
|
||||||
|
{
|
||||||
|
auto logo = VenoLogo::getInstance()->getLogo();
|
||||||
|
if (logo.isValid())
|
||||||
|
{
|
||||||
|
float height = getWidth() / 5;
|
||||||
|
g.drawImage(logo, 0, 15, getWidth(), height, 0, 0, 500, 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g.setFont(getWidth() / 4);
|
||||||
|
g.drawSingleLineText("VeNo", 0, 25);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,13 +7,21 @@
|
||||||
|
|
||||||
#include "JuceHeader.h"
|
#include "JuceHeader.h"
|
||||||
#include "../../Components/BaseComponent.h"
|
#include "../../Components/BaseComponent.h"
|
||||||
|
#include "../../Components/LCD/SidebarLCD.h"
|
||||||
|
#include "SidebarMixer.h"
|
||||||
|
#include "../../Components/Config/VenoConfigButton.h"
|
||||||
|
|
||||||
class Sidebar : public BaseComponent
|
class Sidebar : public BaseComponent
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
Sidebar ();
|
Sidebar (const std::string& processId);
|
||||||
~Sidebar ();
|
~Sidebar () override;
|
||||||
|
void resized () override;
|
||||||
|
void paint (Graphics& g) override;
|
||||||
protected:
|
protected:
|
||||||
|
std::unique_ptr<SidebarLCD> m_lcd;
|
||||||
|
std::unique_ptr<SidebarMixer> m_mixer;
|
||||||
|
std::unique_ptr<VenoConfigButton> m_configButton;
|
||||||
};
|
};
|
||||||
#endif //VENO_SIDEBAR_H
|
#endif //VENO_SIDEBAR_H
|
||||||
|
|
36
Source/Veno/GUI/GUIParts/Sidebar/VenoLogo.cpp
Normal file
36
Source/Veno/GUI/GUIParts/Sidebar/VenoLogo.cpp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
//
|
||||||
|
// Created by versustune on 14.06.20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "VenoLogo.h"
|
||||||
|
|
||||||
|
VenoLogo* VenoLogo::instance = nullptr;
|
||||||
|
|
||||||
|
VenoLogo* VenoLogo::getInstance ()
|
||||||
|
{
|
||||||
|
if (instance == nullptr)
|
||||||
|
{
|
||||||
|
instance = new VenoLogo();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
VenoLogo::VenoLogo ()
|
||||||
|
{
|
||||||
|
MemoryOutputStream mo;
|
||||||
|
auto result = Base64::convertFromBase64(mo, base64logo);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
realLogo = juce::PNGImageFormat::loadFrom(mo.getData(), mo.getDataSize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Image VenoLogo::getLogo ()
|
||||||
|
{
|
||||||
|
return getInstance()->realLogo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenoLogo::deleteInstance ()
|
||||||
|
{
|
||||||
|
delete instance;
|
||||||
|
}
|
25
Source/Veno/GUI/GUIParts/Sidebar/VenoLogo.h
Normal file
25
Source/Veno/GUI/GUIParts/Sidebar/VenoLogo.h
Normal file
File diff suppressed because one or more lines are too long
|
@ -3,3 +3,20 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "FlatLook.h"
|
#include "FlatLook.h"
|
||||||
|
#include "../../Core/Config.h"
|
||||||
|
|
||||||
|
void FlatLook::drawButtonBackground (Graphics& graphics, Button& button, const Colour& backgroundColour,
|
||||||
|
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
|
||||||
|
{
|
||||||
|
auto theme = Config::getInstance()->getCurrentTheme();
|
||||||
|
auto buttonArea = button.getLocalBounds();
|
||||||
|
if (shouldDrawButtonAsHighlighted)
|
||||||
|
{
|
||||||
|
graphics.setColour(theme->getColour(ThemeColour::accent));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
graphics.setColour(theme->getColour(ThemeColour::accent_two));
|
||||||
|
}
|
||||||
|
graphics.drawRect(buttonArea);
|
||||||
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ class FlatLook : public LookAndFeel_V4
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
|
void drawButtonBackground (Graphics& graphics, Button& button, const Colour& backgroundColour,
|
||||||
|
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
|
||||||
protected:
|
protected:
|
||||||
};
|
};
|
||||||
#endif //VENO_FLATLOOK_H
|
#endif //VENO_FLATLOOK_H
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
LookHandler::LookHandler ()
|
LookHandler::LookHandler ()
|
||||||
{
|
{
|
||||||
selectLook (Config::getInstance ()->getCurrentLook ());
|
selectLook(Config::getInstance()->getCurrentLook());
|
||||||
}
|
}
|
||||||
|
|
||||||
LookHandler::~LookHandler ()
|
LookHandler::~LookHandler ()
|
||||||
|
|
|
@ -25,6 +25,6 @@ public:
|
||||||
LookAndFeel_V4* getLook ();
|
LookAndFeel_V4* getLook ();
|
||||||
protected:
|
protected:
|
||||||
//currently both available themes are CrazyLook <-- (this is a fun one xD) and FlatLook
|
//currently both available themes are CrazyLook <-- (this is a fun one xD) and FlatLook
|
||||||
LookAndFeel_V4* m_feels[2] = {new FlatLook (), new CrazyLook ()};
|
LookAndFeel_V4* m_feels[2] = {new FlatLook(), new CrazyLook()};
|
||||||
};
|
};
|
||||||
#endif //VENO_LOOKHANDLER_H
|
#endif //VENO_LOOKHANDLER_H
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "Theme.h"
|
#include "Theme.h"
|
||||||
#include "ThemePresets.cpp"
|
#include "ThemePresets.cpp"
|
||||||
|
#include "../../Core/Config.h"
|
||||||
|
|
||||||
Theme::Theme (std::shared_ptr<PropertiesFile> file)
|
Theme::Theme (std::shared_ptr<PropertiesFile> file)
|
||||||
{
|
{
|
||||||
|
@ -12,8 +13,8 @@ Theme::Theme (std::shared_ptr<PropertiesFile> file)
|
||||||
|
|
||||||
Theme::~Theme ()
|
Theme::~Theme ()
|
||||||
{
|
{
|
||||||
m_colours.clear ();
|
m_colours.clear();
|
||||||
m_configFile.reset ();
|
m_configFile.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Theme::setColour (ThemeColour index, Colour* colour)
|
void Theme::setColour (ThemeColour index, Colour* colour)
|
||||||
|
@ -28,37 +29,37 @@ void Theme::setColour (ThemeColour index, Colour* colour)
|
||||||
{
|
{
|
||||||
m_colours[index] = colour;
|
m_colours[index] = colour;
|
||||||
}
|
}
|
||||||
m_configFile->setValue (ThemeColourToString (index), colour->toString ());
|
m_configFile->setValue(ThemeColourToString(index), colour->toString());
|
||||||
m_configFile->save ();
|
m_configFile->setNeedsToBeSaved(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Theme::init ()
|
void Theme::init ()
|
||||||
{
|
{
|
||||||
getColourFromConfig (ThemeColour::bg);
|
getColourFromConfig(ThemeColour::bg);
|
||||||
getColourFromConfig (ThemeColour::bg_two);
|
getColourFromConfig(ThemeColour::bg_two);
|
||||||
getColourFromConfig (ThemeColour::accent);
|
getColourFromConfig(ThemeColour::accent);
|
||||||
getColourFromConfig (ThemeColour::accent_two);
|
getColourFromConfig(ThemeColour::accent_two);
|
||||||
getColourFromConfig (ThemeColour::warning);
|
getColourFromConfig(ThemeColour::warning);
|
||||||
getColourFromConfig (ThemeColour::clip);
|
getColourFromConfig(ThemeColour::clip);
|
||||||
getColourFromConfig (ThemeColour::lcd_bg);
|
getColourFromConfig(ThemeColour::lcd_bg);
|
||||||
getColourFromConfig (ThemeColour::lcd);
|
getColourFromConfig(ThemeColour::lcd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Theme::getColourFromConfig (ThemeColour index)
|
void Theme::getColourFromConfig (ThemeColour index)
|
||||||
{
|
{
|
||||||
std::string key = ThemeColourToString (index);
|
std::string key = ThemeColourToString(index);
|
||||||
if (m_configFile->containsKey (key))
|
if (m_configFile->containsKey(key))
|
||||||
{
|
{
|
||||||
auto baseColour = Colour::fromString (m_configFile->getValue (key));
|
auto baseColour = Colour::fromString(m_configFile->getValue(key));
|
||||||
auto* colour = new Colour (baseColour.getRed (), baseColour.getGreen (), baseColour.getBlue ());
|
auto* colour = new Colour(baseColour.getRed(), baseColour.getGreen(), baseColour.getBlue());
|
||||||
delete m_colours[index];
|
delete m_colours[index];
|
||||||
m_colours[index] = colour;
|
m_colours[index] = colour;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// should only trigger if config is broken or empty :)
|
// should only trigger if config is broken or empty :)
|
||||||
setLEDTheme (this);
|
setLEDTheme(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ Colour Theme::getColour (ThemeColour index)
|
||||||
{
|
{
|
||||||
return *m_colours[index];
|
return *m_colours[index];
|
||||||
}
|
}
|
||||||
return Colour (255, 255, 255);
|
return Colour(255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Theme::setColourThemeById (int id)
|
void Theme::setColourThemeById (int id)
|
||||||
|
@ -76,17 +77,38 @@ void Theme::setColourThemeById (int id)
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
setLEDTheme (this);
|
setLEDTheme(this);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
setOrangeDreamTheme (this);
|
setOrangeDreamTheme(this);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
setBloodTheme (this);
|
setBloodTheme(this);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
setOceanTheme (this);
|
setOceanTheme(this);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Theme::setDefault (const std::string& value)
|
||||||
|
{
|
||||||
|
if (value == "LED")
|
||||||
|
{
|
||||||
|
setLEDTheme(this);
|
||||||
|
}
|
||||||
|
if (value == "Blood")
|
||||||
|
{
|
||||||
|
setBloodTheme(this);
|
||||||
|
}
|
||||||
|
if (value == "Orange Dream")
|
||||||
|
{
|
||||||
|
setOrangeDreamTheme(this);
|
||||||
|
}
|
||||||
|
if (value == "Ocean")
|
||||||
|
{
|
||||||
|
setOceanTheme(this);
|
||||||
|
}
|
||||||
|
Config::getInstance()->repaintAll();
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
void setColour (ThemeColour index, Colour* colour);
|
void setColour (ThemeColour index, Colour* colour);
|
||||||
void setColourThemeById (int id);
|
void setColourThemeById (int id);
|
||||||
void init ();
|
void init ();
|
||||||
|
void setDefault(const std::string& value);
|
||||||
void getColourFromConfig (ThemeColour index);
|
void getColourFromConfig (ThemeColour index);
|
||||||
Colour getColour (ThemeColour index);
|
Colour getColour (ThemeColour index);
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "Theme.h"
|
#include "Theme.h"
|
||||||
|
|
||||||
|
#ifndef VENO_THEME_PRESETS
|
||||||
|
#define VENO_THEME_PRESETS
|
||||||
/*
|
/*
|
||||||
* this file holds function that read some presets
|
* this file holds function that read some presets
|
||||||
* in the current Theme class
|
* in the current Theme class
|
||||||
|
@ -11,50 +13,50 @@
|
||||||
|
|
||||||
void setLEDTheme (Theme* theme)
|
void setLEDTheme (Theme* theme)
|
||||||
{
|
{
|
||||||
theme->setColour (ThemeColour::bg, new Colour (41, 47, 54));
|
theme->setColour(ThemeColour::bg, new Colour(41, 47, 54));
|
||||||
theme->setColour (ThemeColour::bg_two, new Colour (217, 217, 217));
|
theme->setColour(ThemeColour::bg_two, new Colour(217, 217, 217));
|
||||||
theme->setColour (ThemeColour::accent, new Colour (169, 208, 142));
|
theme->setColour(ThemeColour::accent, new Colour(169, 208, 142));
|
||||||
theme->setColour (ThemeColour::accent_two, new Colour (139, 171, 117));
|
theme->setColour(ThemeColour::accent_two, new Colour(139, 171, 117));
|
||||||
theme->setColour (ThemeColour::clip, new Colour (255, 23, 68));
|
theme->setColour(ThemeColour::clip, new Colour(255, 23, 68));
|
||||||
theme->setColour (ThemeColour::warning, new Colour (255, 143, 0));
|
theme->setColour(ThemeColour::warning, new Colour(255, 143, 0));
|
||||||
theme->setColour (ThemeColour::lcd_bg, new Colour (21, 21, 21));
|
theme->setColour(ThemeColour::lcd_bg, new Colour(21, 21, 21));
|
||||||
theme->setColour (ThemeColour::lcd, new Colour (169, 208, 142));
|
theme->setColour(ThemeColour::lcd, new Colour(169, 208, 142));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBloodTheme (Theme* theme)
|
void setBloodTheme (Theme* theme)
|
||||||
{
|
{
|
||||||
theme->setColour (ThemeColour::bg, new Colour (41, 47, 54));
|
theme->setColour(ThemeColour::bg, new Colour(41, 47, 54));
|
||||||
theme->setColour (ThemeColour::bg_two, new Colour (64, 67, 78));
|
theme->setColour(ThemeColour::bg_two, new Colour(64, 67, 78));
|
||||||
theme->setColour (ThemeColour::accent, new Colour (180, 38, 50));
|
theme->setColour(ThemeColour::accent, new Colour(180, 38, 50));
|
||||||
theme->setColour (ThemeColour::accent_two, new Colour (115, 47, 64));
|
theme->setColour(ThemeColour::accent_two, new Colour(115, 47, 64));
|
||||||
theme->setColour (ThemeColour::clip, new Colour (255, 23, 68));
|
theme->setColour(ThemeColour::clip, new Colour(255, 23, 68));
|
||||||
theme->setColour (ThemeColour::warning, new Colour (255, 143, 0));
|
theme->setColour(ThemeColour::warning, new Colour(255, 143, 0));
|
||||||
theme->setColour (ThemeColour::lcd_bg, new Colour (0, 0, 0));
|
theme->setColour(ThemeColour::lcd_bg, new Colour(0, 0, 0));
|
||||||
theme->setColour (ThemeColour::lcd, new Colour (180, 38, 78));
|
theme->setColour(ThemeColour::lcd, new Colour(180, 38, 78));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOrangeDreamTheme (Theme* theme)
|
void setOrangeDreamTheme (Theme* theme)
|
||||||
{
|
{
|
||||||
theme->setColour (ThemeColour::bg, new Colour (21, 21, 21));
|
theme->setColour(ThemeColour::bg, new Colour(21, 21, 21));
|
||||||
theme->setColour (ThemeColour::bg_two, new Colour (42, 42, 42));
|
theme->setColour(ThemeColour::bg_two, new Colour(42, 42, 42));
|
||||||
theme->setColour (ThemeColour::accent, new Colour (255, 160, 0));
|
theme->setColour(ThemeColour::accent, new Colour(255, 160, 0));
|
||||||
theme->setColour (ThemeColour::accent_two, new Colour (255, 11, 0));
|
theme->setColour(ThemeColour::accent_two, new Colour(255, 11, 0));
|
||||||
theme->setColour (ThemeColour::clip, new Colour (255, 23, 68));
|
theme->setColour(ThemeColour::clip, new Colour(255, 23, 68));
|
||||||
theme->setColour (ThemeColour::warning, new Colour (255, 143, 0));
|
theme->setColour(ThemeColour::warning, new Colour(255, 143, 0));
|
||||||
theme->setColour (ThemeColour::lcd_bg, new Colour (33, 33, 33));
|
theme->setColour(ThemeColour::lcd_bg, new Colour(33, 33, 33));
|
||||||
theme->setColour (ThemeColour::lcd, new Colour (255, 160, 0));
|
theme->setColour(ThemeColour::lcd, new Colour(255, 160, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOceanTheme (Theme* theme)
|
void setOceanTheme (Theme* theme)
|
||||||
{
|
{
|
||||||
theme->setColour (ThemeColour::bg, new Colour (55, 63, 81));
|
theme->setColour(ThemeColour::bg, new Colour(55, 63, 81));
|
||||||
theme->setColour (ThemeColour::bg_two, new Colour (64, 67, 78));
|
theme->setColour(ThemeColour::bg_two, new Colour(64, 67, 78));
|
||||||
theme->setColour (ThemeColour::accent, new Colour (0, 141, 213));
|
theme->setColour(ThemeColour::accent, new Colour(0, 141, 213));
|
||||||
theme->setColour (ThemeColour::accent_two, new Colour (0, 129, 194));
|
theme->setColour(ThemeColour::accent_two, new Colour(0, 129, 194));
|
||||||
theme->setColour (ThemeColour::clip, new Colour (255, 23, 68));
|
theme->setColour(ThemeColour::clip, new Colour(255, 23, 68));
|
||||||
theme->setColour (ThemeColour::warning, new Colour (255, 143, 0));
|
theme->setColour(ThemeColour::warning, new Colour(255, 143, 0));
|
||||||
theme->setColour (ThemeColour::lcd_bg, new Colour (21, 21, 21));
|
theme->setColour(ThemeColour::lcd_bg, new Colour(21, 21, 21));
|
||||||
theme->setColour (ThemeColour::lcd, new Colour (0, 129, 194));
|
theme->setColour(ThemeColour::lcd, new Colour(0, 129, 194));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ThemeColourToString (ThemeColour index)
|
std::string ThemeColourToString (ThemeColour index)
|
||||||
|
@ -81,3 +83,5 @@ std::string ThemeColourToString (ThemeColour index)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -20,8 +20,58 @@ int VeNo::Utils::nextPowerOfTwo (float value)
|
||||||
|
|
||||||
float VeNo::Utils::setFontSize (float size, Graphics& g)
|
float VeNo::Utils::setFontSize (float size, Graphics& g)
|
||||||
{
|
{
|
||||||
double scale = Config::getInstance ()->getScale ();
|
double scale = Config::getInstance()->getScale();
|
||||||
float s = size * scale;
|
float s = size * scale;
|
||||||
g.setFont (s);
|
g.setFont(s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float VeNo::Utils::clamp (float value, float min, float max)
|
||||||
|
{
|
||||||
|
return value > max ? max : value < min ? min : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VeNo::Utils::setPosition (int width, int height, int x, int y, std::shared_ptr<Component> component, bool useMarginY)
|
||||||
|
{
|
||||||
|
double scale = Config::getInstance()->getScale();
|
||||||
|
double w = width * scale;
|
||||||
|
double h = height * scale;
|
||||||
|
if (useMarginY)
|
||||||
|
{
|
||||||
|
y += 10;
|
||||||
|
}
|
||||||
|
component->setBounds(x + 10, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VeNo::Utils::setPositionSameRow (int width, int height, std::shared_ptr<Component> component,
|
||||||
|
std::shared_ptr<Component> previous)
|
||||||
|
{
|
||||||
|
setPosition(width, height, previous->getX() + previous->getWidth(), previous->getY(), component, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VeNo::Utils::setPositionByPreviousRow (int width, int height, int x, std::shared_ptr<Component> component,
|
||||||
|
std::shared_ptr<Component> previous)
|
||||||
|
{
|
||||||
|
setPosition(width, height, x, previous->getY() + previous->getHeight(), component, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<int> VeNo::Utils::calcPosition (int width, int height, int prevWidth, int prevHeight)
|
||||||
|
{
|
||||||
|
double scale = Config::getInstance()->getScale();
|
||||||
|
int w = (width * scale);
|
||||||
|
int h = (height * scale);
|
||||||
|
int x = prevWidth + 10;
|
||||||
|
int y = prevHeight + 10;
|
||||||
|
return {x, y, w, h};
|
||||||
|
}
|
||||||
|
|
||||||
|
int VeNo::Utils::getCalculatedWidth (int width)
|
||||||
|
{
|
||||||
|
return width * Config::getInstance()->getScale();
|
||||||
|
}
|
||||||
|
|
||||||
|
int VeNo::Utils::getCalculatedHeight (int height)
|
||||||
|
{
|
||||||
|
return height * Config::getInstance()->getScale();
|
||||||
|
}
|
||||||
|
|
|
@ -15,7 +15,17 @@ namespace VeNo
|
||||||
Utils () = default;
|
Utils () = default;
|
||||||
~Utils () = default;
|
~Utils () = default;
|
||||||
static int nextPowerOfTwo (float value);
|
static int nextPowerOfTwo (float value);
|
||||||
|
static float clamp (float value, float min, float max);
|
||||||
static float setFontSize (float size, Graphics& g);
|
static float setFontSize (float size, Graphics& g);
|
||||||
|
static void
|
||||||
|
setPosition (int width, int height, int x, int y, std::shared_ptr<Component> component, bool useMarginY);
|
||||||
|
static void setPositionSameRow (int width, int height, std::shared_ptr<Component> component,
|
||||||
|
std::shared_ptr<Component> previous);
|
||||||
|
static void
|
||||||
|
setPositionByPreviousRow(int width, int height, int x, std::shared_ptr<Component> component, std::shared_ptr<Component> previous);
|
||||||
|
static std::vector<int> calcPosition(int width, int height, int prevWidth, int prevHeight);
|
||||||
|
static int getCalculatedWidth(int width);
|
||||||
|
static int getCalculatedHeight(int height);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif //VENO_UTILS_H
|
#endif //VENO_UTILS_H
|
||||||
|
|
|
@ -11,8 +11,8 @@ void FFT::pushNextSampleIntoFifo (float sample) noexcept
|
||||||
{
|
{
|
||||||
if (!nextFFTBlockReady) // [12]
|
if (!nextFFTBlockReady) // [12]
|
||||||
{
|
{
|
||||||
zeromem (fftData, sizeof (fftData));
|
zeromem(fftData, sizeof(fftData));
|
||||||
memcpy (fftData, fifo, sizeof (fifo));
|
memcpy(fftData, fifo, sizeof(fifo));
|
||||||
nextFFTBlockReady = true;
|
nextFFTBlockReady = true;
|
||||||
}
|
}
|
||||||
fifoIndex = 0;
|
fifoIndex = 0;
|
||||||
|
@ -23,14 +23,14 @@ void FFT::pushNextSampleIntoFifo (float sample) noexcept
|
||||||
|
|
||||||
void FFT::drawNextFrameOfSpectrum ()
|
void FFT::drawNextFrameOfSpectrum ()
|
||||||
{
|
{
|
||||||
window.multiplyWithWindowingTable (fftData, fftSize); // [1]
|
window.multiplyWithWindowingTable(fftData, fftSize); // [1]
|
||||||
fft.performFrequencyOnlyForwardTransform (fftData); // [2]
|
fft.performFrequencyOnlyForwardTransform(fftData); // [2]
|
||||||
|
|
||||||
auto mindB = -80.0f;
|
auto mindB = -80.0f;
|
||||||
auto maxdB = 0.0f;
|
auto maxdB = 0.0f;
|
||||||
for (int i = 0; i < scopeSize; ++i)
|
for (int i = 0; i < scopeSize; ++i)
|
||||||
{
|
{
|
||||||
auto level = jmap (Decibels::gainToDecibels (fftData[i], mindB), mindB, maxdB, -1.0f, 1.0f);
|
auto level = jmap(Decibels::gainToDecibels(fftData[i], mindB), mindB, maxdB, -1.0f, 1.0f);
|
||||||
scopeData[i] = level;
|
scopeData[i] = level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,33 +10,35 @@ std::unordered_map<std::string, std::shared_ptr<VenoInstance>> VenoInstance::ins
|
||||||
|
|
||||||
VenoInstance::VenoInstance (std::string id)
|
VenoInstance::VenoInstance (std::string id)
|
||||||
{
|
{
|
||||||
m_id = std::move (id);
|
m_id = std::move(id);
|
||||||
m_synthInstance = std::make_shared<SynthInstance> (id);
|
m_synthInstance = std::make_shared<SynthInstance>(id);
|
||||||
audioBuffer = std::make_shared<VenoBuffer> ();
|
audioBuffer = std::make_shared<VenoBuffer>();
|
||||||
|
state = new VeNoState(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
VenoInstance::~VenoInstance ()
|
VenoInstance::~VenoInstance ()
|
||||||
{
|
{
|
||||||
m_synthInstance.reset ();
|
m_synthInstance.reset();
|
||||||
audioBuffer.reset ();
|
audioBuffer.reset();
|
||||||
|
delete state;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<VenoInstance> VenoInstance::createInstance (const std::string& id)
|
std::shared_ptr<VenoInstance> VenoInstance::createInstance (const std::string& id)
|
||||||
{
|
{
|
||||||
auto instance = std::make_shared<VenoInstance> (id);
|
auto instance = std::make_shared<VenoInstance>(id);
|
||||||
instances.insert (std::pair<std::string, std::shared_ptr<VenoInstance>> (id, instance));
|
instances.insert(std::pair<std::string, std::shared_ptr<VenoInstance>>(id, instance));
|
||||||
VeNo::Logger::debugMessage ("Created VenoInstance with id: " + id);
|
VeNo::Logger::debugMessage("Created VenoInstance with id: " + id);
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// will return the instance or a empty new on... can find out because the id is fucked!
|
// will return the instance or a empty new on... can find out because the id is fucked!
|
||||||
std::shared_ptr<VenoInstance> VenoInstance::getInstance (const std::string& id)
|
std::shared_ptr<VenoInstance> VenoInstance::getInstance (const std::string& id)
|
||||||
{
|
{
|
||||||
if (instances.find (id) != instances.end ())
|
if (instances.find(id) != instances.end())
|
||||||
{
|
{
|
||||||
return instances[id];
|
return instances[id];
|
||||||
}
|
}
|
||||||
return createInstance (id);
|
return createInstance(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::shared_ptr<SynthInstance>& VenoInstance::getSynthInstance () const
|
const std::shared_ptr<SynthInstance>& VenoInstance::getSynthInstance () const
|
||||||
|
@ -46,10 +48,15 @@ const std::shared_ptr<SynthInstance>& VenoInstance::getSynthInstance () const
|
||||||
|
|
||||||
void VenoInstance::deleteInstance (const std::string& processId)
|
void VenoInstance::deleteInstance (const std::string& processId)
|
||||||
{
|
{
|
||||||
if (instances.find (processId) != instances.end ())
|
if (instances.find(processId) != instances.end())
|
||||||
{
|
{
|
||||||
instances[processId].reset ();
|
instances[processId].reset();
|
||||||
instances.erase (processId);
|
instances.erase(processId);
|
||||||
VeNo::Logger::debugMessage ("Removed VenoInstance with id: " + processId);
|
VeNo::Logger::debugMessage("Removed VenoInstance with id: " + processId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unordered_map<std::string, std::shared_ptr<VenoInstance>> VenoInstance::getAll ()
|
||||||
|
{
|
||||||
|
return instances;
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "Utils/FFT.h"
|
#include "Utils/FFT.h"
|
||||||
#include "Audio/VenoBuffer.h"
|
#include "Audio/VenoBuffer.h"
|
||||||
#include "Audio/Engine/VenoMatrix.h"
|
#include "Audio/Engine/VenoMatrix.h"
|
||||||
|
#include "Core/VeNoState.h"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
class VenoInstance
|
class VenoInstance
|
||||||
|
@ -28,5 +29,7 @@ public:
|
||||||
FFT fft;
|
FFT fft;
|
||||||
std::shared_ptr<VenoBuffer> audioBuffer;
|
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 ();
|
||||||
};
|
};
|
||||||
#endif //VENO_VENOINSTANCE_H
|
#endif //VENO_VENOINSTANCE_H
|
||||||
|
|
26
Veno.jucer
26
Veno.jucer
|
@ -75,15 +75,39 @@
|
||||||
</GROUP>
|
</GROUP>
|
||||||
<GROUP id="{EFD25B6B-987D-435F-F8DE-BD6C2B831E62}" name="GUI">
|
<GROUP id="{EFD25B6B-987D-435F-F8DE-BD6C2B831E62}" name="GUI">
|
||||||
<GROUP id="{9C28E1EA-57BD-A04E-6ED6-3C46B5BC7FC7}" name="GUIParts">
|
<GROUP id="{9C28E1EA-57BD-A04E-6ED6-3C46B5BC7FC7}" name="GUIParts">
|
||||||
|
<GROUP id="{D7ABC90B-205D-31C2-67AD-7A31B96627FF}" name="ConfigScreen">
|
||||||
|
<FILE id="klHmJa" name="ConfigComponent.cpp" compile="1" resource="0"
|
||||||
|
file="Source/Veno/GUI/GUIParts/ConfigScreen/ConfigComponent.cpp"/>
|
||||||
|
<FILE id="pYQYBm" name="ConfigComponent.h" compile="0" resource="0"
|
||||||
|
file="Source/Veno/GUI/GUIParts/ConfigScreen/ConfigComponent.h"/>
|
||||||
|
<FILE id="aeg3dC" name="VenoConfigScreen.cpp" compile="1" resource="0"
|
||||||
|
file="Source/Veno/GUI/GUIParts/ConfigScreen/VenoConfigScreen.cpp"/>
|
||||||
|
<FILE id="CvExms" name="VenoConfigScreen.h" compile="0" resource="0"
|
||||||
|
file="Source/Veno/GUI/GUIParts/ConfigScreen/VenoConfigScreen.h"/>
|
||||||
|
</GROUP>
|
||||||
<GROUP id="{B7626B9F-22D9-713A-B543-1D7B34AF77B7}" name="Sidebar">
|
<GROUP id="{B7626B9F-22D9-713A-B543-1D7B34AF77B7}" name="Sidebar">
|
||||||
<FILE id="aGx0eJ" name="Sidebar.cpp" compile="1" resource="0" file="Source/Veno/GUI/GUIParts/Sidebar/Sidebar.cpp"/>
|
<FILE id="aGx0eJ" name="Sidebar.cpp" compile="1" resource="0" file="Source/Veno/GUI/GUIParts/Sidebar/Sidebar.cpp"/>
|
||||||
<FILE id="uL7MJ3" name="Sidebar.h" compile="0" resource="0" file="Source/Veno/GUI/GUIParts/Sidebar/Sidebar.h"/>
|
<FILE id="uL7MJ3" name="Sidebar.h" compile="0" resource="0" file="Source/Veno/GUI/GUIParts/Sidebar/Sidebar.h"/>
|
||||||
<FILE id="lNXOQs" name="SidebarMixer.cpp" compile="1" resource="0"
|
<FILE id="lNXOQs" name="SidebarMixer.cpp" compile="1" resource="0"
|
||||||
file="Source/Veno/GUI/GUIParts/Sidebar/SidebarMixer.cpp"/>
|
file="Source/Veno/GUI/GUIParts/Sidebar/SidebarMixer.cpp"/>
|
||||||
<FILE id="onzdTZ" name="SidebarMixer.h" compile="0" resource="0" file="Source/Veno/GUI/GUIParts/Sidebar/SidebarMixer.h"/>
|
<FILE id="onzdTZ" name="SidebarMixer.h" compile="0" resource="0" file="Source/Veno/GUI/GUIParts/Sidebar/SidebarMixer.h"/>
|
||||||
|
<FILE id="w3JFHK" name="VenoLogo.h" compile="0" resource="0" file="Source/Veno/GUI/GUIParts/Sidebar/VenoLogo.h"/>
|
||||||
|
<FILE id="AE7YqM" name="VenoLogo.cpp" compile="1" resource="0" file="Source/Veno/GUI/GUIParts/Sidebar/VenoLogo.cpp"/>
|
||||||
</GROUP>
|
</GROUP>
|
||||||
</GROUP>
|
</GROUP>
|
||||||
<GROUP id="{53C33AC6-67D7-762E-FFD5-C82B7F51DA5F}" name="Components">
|
<GROUP id="{53C33AC6-67D7-762E-FFD5-C82B7F51DA5F}" name="Components">
|
||||||
|
<GROUP id="{90BA3743-01F8-1537-6D24-1C38F4063F10}" name="Config">
|
||||||
|
<FILE id="SRKqRQ" name="VeNoColour.cpp" compile="1" resource="0" file="Source/Veno/GUI/Components/Config/VeNoColour.cpp"/>
|
||||||
|
<FILE id="Da4NUN" name="VeNoColour.h" compile="0" resource="0" file="Source/Veno/GUI/Components/Config/VeNoColour.h"/>
|
||||||
|
<FILE id="zC4cQd" name="VenoConfigButton.cpp" compile="1" resource="0"
|
||||||
|
file="Source/Veno/GUI/Components/Config/VenoConfigButton.cpp"/>
|
||||||
|
<FILE id="kCWitN" name="VenoConfigButton.h" compile="0" resource="0"
|
||||||
|
file="Source/Veno/GUI/Components/Config/VenoConfigButton.h"/>
|
||||||
|
<FILE id="Yxj8Nf" name="VenoPreColours.cpp" compile="1" resource="0"
|
||||||
|
file="Source/Veno/GUI/Components/Config/VenoPreColours.cpp"/>
|
||||||
|
<FILE id="DbGZt9" name="VenoPreColours.h" compile="0" resource="0"
|
||||||
|
file="Source/Veno/GUI/Components/Config/VenoPreColours.h"/>
|
||||||
|
</GROUP>
|
||||||
<GROUP id="{7C37E6D2-F2F7-6BF7-5D9B-2DDABFFE993F}" name="LCD">
|
<GROUP id="{7C37E6D2-F2F7-6BF7-5D9B-2DDABFFE993F}" name="LCD">
|
||||||
<FILE id="LpeTfD" name="SidebarLCD.cpp" compile="1" resource="0" file="Source/Veno/GUI/Components/LCD/SidebarLCD.cpp"/>
|
<FILE id="LpeTfD" name="SidebarLCD.cpp" compile="1" resource="0" file="Source/Veno/GUI/Components/LCD/SidebarLCD.cpp"/>
|
||||||
<FILE id="Y5kUlM" name="SidebarLCD.h" compile="0" resource="0" file="Source/Veno/GUI/Components/LCD/SidebarLCD.h"/>
|
<FILE id="Y5kUlM" name="SidebarLCD.h" compile="0" resource="0" file="Source/Veno/GUI/Components/LCD/SidebarLCD.h"/>
|
||||||
|
@ -121,6 +145,8 @@
|
||||||
<FILE id="i3vbdH" name="PresetManager.cpp" compile="1" resource="0"
|
<FILE id="i3vbdH" name="PresetManager.cpp" compile="1" resource="0"
|
||||||
file="Source/Veno/Core/PresetManager.cpp"/>
|
file="Source/Veno/Core/PresetManager.cpp"/>
|
||||||
<FILE id="WV2uuz" name="PresetManager.h" compile="0" resource="0" file="Source/Veno/Core/PresetManager.h"/>
|
<FILE id="WV2uuz" name="PresetManager.h" compile="0" resource="0" file="Source/Veno/Core/PresetManager.h"/>
|
||||||
|
<FILE id="Wvf9em" name="VeNoState.cpp" compile="1" resource="0" file="Source/Veno/Core/VeNoState.cpp"/>
|
||||||
|
<FILE id="skv4zn" name="VeNoState.h" compile="0" resource="0" file="Source/Veno/Core/VeNoState.h"/>
|
||||||
</GROUP>
|
</GROUP>
|
||||||
</GROUP>
|
</GROUP>
|
||||||
<FILE id="zASeb7" name="PluginProcessor.cpp" compile="1" resource="0"
|
<FILE id="zASeb7" name="PluginProcessor.cpp" compile="1" resource="0"
|
||||||
|
|
Loading…
Reference in a new issue