profile loading checkpoint
This commit is contained in:
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
# default.yaml
|
||||||
|
# Default voice profile
|
||||||
|
|
||||||
|
# sequences in the form [x, x, x] denote [setValue, sliderMinimum, sliderMaximum]
|
||||||
|
|
||||||
|
version: 00001
|
||||||
|
|
||||||
|
# deprecated, useless
|
||||||
|
Osc1Freq: [100, 20, 600]
|
||||||
|
|
||||||
|
# wavetable selections
|
||||||
|
OscWaveSelector1: 2
|
||||||
|
OscWaveSelector2: 1
|
||||||
|
|
||||||
|
# Oscillator frequency parameters
|
||||||
|
Osc1OctaveOffset: [0, -5, 5]
|
||||||
|
Osc1SemitoneOffset: [0, -12, 12]
|
||||||
|
Osc1PitchOffset: [0, -100, 100]
|
||||||
|
Osc2OctaveOffset: [1, -5, 5]
|
||||||
|
Osc2SemitoneOffset: [0, -12, 12]
|
||||||
|
Osc2PitchOffset: [0, -100, 100]
|
||||||
|
Osc3OctaveOffset: [1, -5, 5]
|
||||||
|
Osc3SemitoneOffset: [7, -12, 12]
|
||||||
|
Osc3PitchOffset: [1.96, -100, 100]
|
||||||
|
|
||||||
|
# Envelope generator parameters
|
||||||
|
Osc1Volume:
|
||||||
|
- [1, 0, 2] # Depth
|
||||||
|
- [0.05, 0, 2] # Attack
|
||||||
|
- [0.2, 0, 2] # Decay
|
||||||
|
- [0.7, 0, 1] # Sustain
|
||||||
|
- [0.2, 0, 2] # Release
|
||||||
|
FilterCutoff:
|
||||||
|
- [4, 0, 8] # Depth
|
||||||
|
- [0.05, 0, 2] # Attack
|
||||||
|
- [0.2, 0, 2] # Decay
|
||||||
|
- [0.2, 0, 1] # Sustain
|
||||||
|
- [0.25, 0, 2] # Release
|
||||||
|
FilterResonance:
|
||||||
|
- [3, 0, 8] # Depth
|
||||||
|
- [0.05, 0, 2] # Attack
|
||||||
|
- [0.2, 0, 2] # Decay
|
||||||
|
- [0.5, 0, 1] # Sustain
|
||||||
|
- [0.3, 0, 2] # Release
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "yaml-cpp/yaml.h"
|
#include "yaml-cpp/yaml.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
@@ -24,6 +23,7 @@ int ConfigInterface::getValue(ConfigFile file, std::string key, int defaultVal)
|
|||||||
// attempt to open file
|
// attempt to open file
|
||||||
YAML::Node config;
|
YAML::Node config;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
YAML::Node config = YAML::LoadFile(filepath);
|
YAML::Node config = YAML::LoadFile(filepath);
|
||||||
|
|
||||||
// read key if it exists
|
// read key if it exists
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
enum class ConfigFile {
|
enum class ConfigFile {
|
||||||
Audio = 0
|
Audio = 0
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
#include "ParameterStore.h"
|
#include "ParameterStore.h"
|
||||||
|
|
||||||
ParameterStore::ParameterStore() {
|
#include <iostream>
|
||||||
|
|
||||||
|
ParameterStore::ParameterStore(ConfigInterface* config) : config_(config) {
|
||||||
resetToDefaults();
|
resetToDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +32,15 @@ void ParameterStore::resetToDefaults() {
|
|||||||
for(size_t i = 0; i < PARAM_COUNT; i++) {
|
for(size_t i = 0; i < PARAM_COUNT; i++) {
|
||||||
values_[i].store(PARAM_DEFS[i].def, std::memory_order_relaxed);
|
values_[i].store(PARAM_DEFS[i].def, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config_) {
|
||||||
|
int x = config_->getValue(ConfigFile::Audio, "sampleRate", 0);
|
||||||
|
std::cout << "test: " << x << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << "pointer null" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: applying parameter profiles will work similarly to above function
|
// TODO: applying parameter profiles will work similarly to above function
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "ConfigInterface.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
@@ -107,7 +109,7 @@ class ParameterStore {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ParameterStore();
|
ParameterStore(ConfigInterface* config);
|
||||||
~ParameterStore() = default;
|
~ParameterStore() = default;
|
||||||
|
|
||||||
void set(ParamId id, float value);
|
void set(ParamId id, float value);
|
||||||
@@ -121,4 +123,6 @@ private:
|
|||||||
|
|
||||||
std::array<std::atomic<float>, PARAM_COUNT> values_;
|
std::array<std::atomic<float>, PARAM_COUNT> values_;
|
||||||
|
|
||||||
|
ConfigInterface* config_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
AudioEngine::AudioEngine(ConfigInterface* config) : synth_(params_), config_(config) {
|
AudioEngine::AudioEngine(ConfigInterface* config) : params_(ParameterStore(config)), synth_(params_), config_(config) {
|
||||||
if(audio_.getDeviceCount() < 1) {
|
if(audio_.getDeviceCount() < 1) {
|
||||||
throw std::runtime_error("No audio devices found");
|
throw std::runtime_error("No audio devices found");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ private:
|
|||||||
// calls the synth.process to generate a buffer of audio samples
|
// calls the synth.process to generate a buffer of audio samples
|
||||||
int32_t process(float* out, uint32_t nFrames);
|
int32_t process(float* out, uint32_t nFrames);
|
||||||
|
|
||||||
|
ConfigInterface* config_; // access to config files
|
||||||
ParameterStore params_; // stores the control parameters
|
ParameterStore params_; // stores the control parameters
|
||||||
NoteQueue noteQueue_; // stores note events for passing between threads
|
NoteQueue noteQueue_; // stores note events for passing between threads
|
||||||
Synth synth_; // generates audio
|
Synth synth_; // generates audio
|
||||||
ScopeBuffer scope_ { 1024 }; // stores audio samples for visualization
|
ScopeBuffer scope_ { 1024 }; // stores audio samples for visualization
|
||||||
ConfigInterface* config_; // access to config files
|
|
||||||
|
|
||||||
RtAudio audio_{AUDIO_API}; // audio device
|
RtAudio audio_{AUDIO_API}; // audio device
|
||||||
// TODO: id like a yml config file or something for these
|
// TODO: id like a yml config file or something for these
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui_;
|
Ui::MainWindow *ui_;
|
||||||
|
|
||||||
|
ConfigInterface config_;
|
||||||
AudioEngine* audio_ = nullptr;
|
AudioEngine* audio_ = nullptr;
|
||||||
KeyboardController keyboard_;
|
KeyboardController keyboard_;
|
||||||
MidiController midi_;
|
MidiController midi_;
|
||||||
ConfigInterface config_;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user