- cleanup vars
- added LICENSE.txt - added LabelComponent.cpp - renamed some variables - moved instance id to processor
This commit is contained in:
parent
452c5cabba
commit
d735c1d076
19 changed files with 948 additions and 180 deletions
37
Source/Veno/Core/AudioConfig.cpp
Normal file
37
Source/Veno/Core/AudioConfig.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// Created by versustune on 22.03.20.
|
||||
//
|
||||
#include "AudioConfig.h"
|
||||
|
||||
float AudioConfig::getSampleRate() {
|
||||
return m_sampleRate;
|
||||
}
|
||||
|
||||
void AudioConfig::setSampleRate(float _sampleRate) {
|
||||
if (m_sampleRate != _sampleRate) {
|
||||
m_sampleRate = _sampleRate;
|
||||
m_needToReInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
float AudioConfig::getBufferSize() {
|
||||
return m_bufferSize;
|
||||
}
|
||||
|
||||
void AudioConfig::setBufferSize(float _bufferSize) {
|
||||
m_bufferSize = _bufferSize;
|
||||
}
|
||||
|
||||
bool AudioConfig::isNeedToReInit() {
|
||||
return m_needToReInit;
|
||||
}
|
||||
|
||||
void AudioConfig::setNeedToReInit(bool _needToReInit) {
|
||||
m_needToReInit = _needToReInit;
|
||||
}
|
||||
|
||||
std::shared_ptr<AudioConfig> AudioConfig::getInstance() {
|
||||
if (!m_instance)
|
||||
m_instance = std::make_shared<AudioConfig>();
|
||||
return m_instance;
|
||||
}
|
||||
|
|
@ -12,43 +12,24 @@
|
|||
*/
|
||||
class AudioConfig {
|
||||
private:
|
||||
static std::shared_ptr<AudioConfig> instance;
|
||||
float sampleRate = 44100;
|
||||
float bufferSize = 512; //maybe we need that... but this will update always!
|
||||
bool needToReInit = false; //this is to reInit the Oscillators, ADSR and other stuff
|
||||
static std::shared_ptr<AudioConfig> m_instance;
|
||||
float m_sampleRate = 44100;
|
||||
float m_bufferSize = 512; //maybe we need that... but this will update always!
|
||||
bool m_needToReInit = false; //this is to reInit the Oscillators, ADSR and other stuff
|
||||
public:
|
||||
static std::shared_ptr<AudioConfig> getInstance() {
|
||||
if (!instance)
|
||||
instance = std::make_shared<AudioConfig>();
|
||||
return instance;
|
||||
}
|
||||
static std::shared_ptr<AudioConfig> getInstance();
|
||||
|
||||
float getSampleRate() const {
|
||||
return sampleRate;
|
||||
}
|
||||
float getSampleRate();
|
||||
|
||||
void setSampleRate(float _sampleRate) {
|
||||
if (sampleRate != _sampleRate) {
|
||||
sampleRate = _sampleRate;
|
||||
needToReInit = true;
|
||||
}
|
||||
}
|
||||
void setSampleRate(float _sampleRate);
|
||||
|
||||
float getBufferSize() const {
|
||||
return bufferSize;
|
||||
}
|
||||
float getBufferSize();
|
||||
|
||||
void setBufferSize(float _bufferSize) {
|
||||
AudioConfig::bufferSize = _bufferSize;
|
||||
}
|
||||
void setBufferSize(float _bufferSize);
|
||||
|
||||
bool isNeedToReInit() const {
|
||||
return needToReInit;
|
||||
}
|
||||
bool isNeedToReInit();
|
||||
|
||||
void setNeedToReInit(bool _needToReInit) {
|
||||
AudioConfig::needToReInit = _needToReInit;
|
||||
}
|
||||
void setNeedToReInit(bool _needToReInit);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,39 +4,39 @@
|
|||
|
||||
#include "Config.h"
|
||||
|
||||
std::shared_ptr<Config> Config::instance = nullptr;
|
||||
std::shared_ptr<Config> Config::m_instance = nullptr;
|
||||
|
||||
Config::Config() {
|
||||
// i want to load the config file here...
|
||||
// i want to load the m_config file here...
|
||||
initConfig();
|
||||
|
||||
theme = std::make_shared<Theme>(config);
|
||||
theme->init();
|
||||
m_theme = std::make_shared<Theme>(m_config);
|
||||
m_theme->init();
|
||||
}
|
||||
|
||||
void Config::saveAll() {
|
||||
if (config != nullptr) {
|
||||
config->saveIfNeeded();
|
||||
if (m_config != nullptr) {
|
||||
m_config->saveIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
int Config::getCurrentLook() {
|
||||
if (currentLook > 1) {
|
||||
currentLook = 0;
|
||||
if (m_currentLook > 1) {
|
||||
m_currentLook = 0;
|
||||
}
|
||||
return currentLook;
|
||||
return m_currentLook;
|
||||
}
|
||||
|
||||
void Config::initConfig() {
|
||||
PropertiesFile::Options options;
|
||||
options.applicationName = "config";
|
||||
options.applicationName = "m_config";
|
||||
options.folderName = "veno";
|
||||
options.filenameSuffix = "xml";
|
||||
config = std::make_unique<PropertiesFile>(options);
|
||||
m_config = std::make_unique<PropertiesFile>(options);
|
||||
}
|
||||
|
||||
std::shared_ptr<Theme> Config::getCurrentTheme() {
|
||||
return theme;
|
||||
return m_theme;
|
||||
}
|
||||
|
||||
double Config::getScale() {
|
||||
|
|
@ -44,30 +44,36 @@ double Config::getScale() {
|
|||
}
|
||||
|
||||
void Config::setColourForIndex(Colour *colour, ThemeColour index) {
|
||||
if (theme) {
|
||||
theme->setColour(index, colour);
|
||||
if (m_theme) {
|
||||
m_theme->setColour(index, colour);
|
||||
}
|
||||
}
|
||||
|
||||
Config::~Config() {
|
||||
config->save();
|
||||
theme.reset();
|
||||
config.reset();
|
||||
m_config->save();
|
||||
m_theme.reset();
|
||||
m_config.reset();
|
||||
}
|
||||
|
||||
//LEAK DETECTOR FIX!
|
||||
void Config::registerEditor(AudioProcessorEditor *editor, const std::string &name) {
|
||||
editors[name] = editor;
|
||||
m_editors[name] = editor;
|
||||
}
|
||||
|
||||
void Config::removeEditor(const std::string &name) {
|
||||
editors.erase(name);
|
||||
if (editors.empty()) {
|
||||
instance = nullptr;
|
||||
m_editors.erase(name);
|
||||
if (m_editors.empty()) {
|
||||
m_instance = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//for LCD :P let's be a bit funny xD
|
||||
int Config::getEditorCount() {
|
||||
editors.size();
|
||||
return m_editors.size();
|
||||
}
|
||||
|
||||
std::shared_ptr<Config> Config::getInstance() {
|
||||
if (!m_instance)
|
||||
m_instance = std::make_shared<Config>();
|
||||
return m_instance;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,17 +12,13 @@
|
|||
|
||||
class Config {
|
||||
private:
|
||||
std::shared_ptr<PropertiesFile> config = nullptr;
|
||||
std::shared_ptr<Theme> theme = nullptr;
|
||||
static std::shared_ptr<Config> instance;
|
||||
int currentLook = 0; //nah move the bitch logic from current to next
|
||||
std::unordered_map<std::string, AudioProcessorEditor *> editors;
|
||||
std::shared_ptr<PropertiesFile> m_config = nullptr;
|
||||
std::shared_ptr<Theme> m_theme = nullptr;
|
||||
static std::shared_ptr<Config> m_instance;
|
||||
int m_currentLook = 0; //nah move the bitch logic from current to next
|
||||
std::unordered_map<std::string, AudioProcessorEditor *> m_editors;
|
||||
public:
|
||||
static std::shared_ptr<Config> getInstance() {
|
||||
if (!instance)
|
||||
instance = std::make_shared<Config>();
|
||||
return instance;
|
||||
}
|
||||
static std::shared_ptr<Config> getInstance();
|
||||
|
||||
void saveAll();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue