comments
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
# Configures properties for the RtAudio engine
|
||||
|
||||
# Number of samples per second
|
||||
sampleRate: 44100
|
||||
sampleRate: 96000
|
||||
# unconfigurable: sampleFormat; [-1, 1] float
|
||||
|
||||
# number of audio channels
|
||||
|
||||
35
config/keymap.yaml
Normal file
35
config/keymap.yaml
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
# keymap.yaml
|
||||
# Configures a computer keyboard mapping of keys to midi notes for when you don't have a midi device available
|
||||
# (there's probably tools available that are able to make your keyboard act as a midi device but this was easier)
|
||||
|
||||
# so Qt key enum => midi note id
|
||||
# { Qt::Key_Shift, 47 }, // B 2
|
||||
# { Qt::Key_Z, 48 }, // C 3
|
||||
# { Qt::Key_S, 49 }, // C#
|
||||
# { Qt::Key_X, 50 }, // D
|
||||
# { Qt::Key_D, 51 }, // D#
|
||||
# { Qt::Key_C, 52 }, // E
|
||||
# { Qt::Key_V, 53 }, // F
|
||||
# { Qt::Key_G, 54 }, // F#
|
||||
# { Qt::Key_B, 55 }, // G
|
||||
# { Qt::Key_H, 56 }, // G#
|
||||
# { Qt::Key_N, 57 }, // A
|
||||
# { Qt::Key_J, 58 }, // A#
|
||||
# { Qt::Key_M, 59 }, // B 3
|
||||
# { Qt::Key_Q, 60 }, // C 4
|
||||
# { Qt::Key_2, 61 }, // C#
|
||||
# { Qt::Key_W, 62 }, // D
|
||||
# { Qt::Key_3, 63 }, // D#
|
||||
# { Qt::Key_E, 64 }, // E
|
||||
# { Qt::Key_R, 65 }, // F
|
||||
# { Qt::Key_5, 66 }, // F#
|
||||
# { Qt::Key_T, 67 }, // G
|
||||
# { Qt::Key_6, 68 }, // G#
|
||||
# { Qt::Key_Y, 69 }, // A
|
||||
# { Qt::Key_7, 70 }, // A#
|
||||
# { Qt::Key_U, 71 }, // B 4
|
||||
# { Qt::Key_I, 72 }, // C 5
|
||||
|
||||
# so we'll also need a mapping of the key strings to the qt::Key enum values
|
||||
# and then a mapping of note strings to midi ids
|
||||
@@ -69,8 +69,6 @@ struct ParamDefault {
|
||||
float max;
|
||||
};
|
||||
|
||||
// TODO: make these configurable via yml file too
|
||||
// later TODO: and then when I have full on profile saving there will be a default profile to load from
|
||||
constexpr std::array<ParamDefault, static_cast<size_t>(ParamId::Count)> PARAM_DEFS {{
|
||||
{ 100.0f, 20.0f, 600.0f}, // Osc1Freq
|
||||
{ 2.0f, 0.0f, 0.0f}, // OscWaveSelector1
|
||||
|
||||
@@ -35,9 +35,17 @@ bool AudioEngine::start() {
|
||||
RtAudio::StreamOptions options;
|
||||
options.flags = RTAUDIO_MINIMIZE_LATENCY;
|
||||
|
||||
// TODO: error check this please
|
||||
audio_.openStream(¶ms, nullptr, RTAUDIO_FLOAT32, sampleRate_, &bufferFrames_, &AudioEngine::audioCallback, this, &options);
|
||||
audio_.startStream();
|
||||
RtAudioErrorType status = audio_.openStream(¶ms, nullptr, RTAUDIO_FLOAT32, sampleRate_, &bufferFrames_, &AudioEngine::audioCallback, this, &options);
|
||||
if(status != RTAUDIO_NO_ERROR) {
|
||||
std::cout << "Error opening RtAudio stream" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
status = audio_.startStream();
|
||||
if(status != RTAUDIO_NO_ERROR) {
|
||||
std::cout << "Error starting RtAudio stream" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// sanity check
|
||||
std::cout << "sample rate: " << sampleRate_ << " buffer frames: " << bufferFrames_ << std::endl;
|
||||
|
||||
@@ -49,7 +49,8 @@ private:
|
||||
ScopeBuffer scope_ { 1024 }; // stores audio samples for visualization
|
||||
|
||||
RtAudio audio_{AUDIO_API}; // audio device
|
||||
// TODO: id like a yml config file or something for these
|
||||
|
||||
// Configurable in the audio.yaml file, assigned defaults if the file is not found
|
||||
uint32_t sampleRate_ = 44100;
|
||||
uint32_t bufferFrames_ = 512; // time per buffer = BF/SR (256/44100 = 5.8ms)
|
||||
uint32_t channels_ = 2; // stereo
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
// TODO: make configurable
|
||||
#define SYNTH_OSCILLATOR_COUNT 3
|
||||
// if there's different oscillator amounts then we need to be able to dynamically create the ui for each of them
|
||||
|
||||
struct SmoothedParam {
|
||||
float current = 0.0f;
|
||||
@@ -63,7 +64,6 @@ private:
|
||||
// filters
|
||||
Filter filter1_;
|
||||
Filter filter2_;
|
||||
// TODO: I think the filter's state being uninitialized is what's causing popping when a voice starts for the first time
|
||||
|
||||
// paramstore pointer
|
||||
SmoothedParam* params_;
|
||||
|
||||
Reference in New Issue
Block a user