VCO displays wave name

This commit is contained in:
Christian Colglazier 2020-09-16 20:42:18 -04:00
parent 1ce6820633
commit d7e6b6f6e7
4 changed files with 32 additions and 2 deletions

View File

@ -5,7 +5,7 @@ VCODroplet::VCODroplet(DaisyPatch* m_patch,
DropletState m_state) { DropletState m_state) {
UpdateState(m_state); UpdateState(m_state);
patch = m_patch; patch = m_patch;
int num_waves = Oscillator::WAVE_LAST - 1; int num_waves = Oscillator::WAVE_LAST;
osc.Init(sample_rate); osc.Init(sample_rate);
freqctrl.Init(patch->controls[patch->CTRL_1], 10.0, freqctrl.Init(patch->controls[patch->CTRL_1], 10.0,
110.0f, Parameter::LINEAR); 110.0f, Parameter::LINEAR);
@ -46,4 +46,27 @@ void VCODroplet::Process(float** in, float** out, size_t size) {
void VCODroplet::Draw() { void VCODroplet::Draw() {
DrawName(patch, "VCO"); DrawName(patch, "VCO");
WriteString(*patch, 0, 54, Font_6x8, WaveToString(wavectrl.Process()));
}
std::string VCODroplet::WaveToString(uint8_t wf) {
switch(wf){
case Oscillator::WAVE_TRI:
return "Triangle";
case Oscillator::WAVE_SQUARE:
return "Square";
case Oscillator::WAVE_SIN:
return "Sine";
case Oscillator::WAVE_SAW:
return "Saw";
case Oscillator::WAVE_RAMP:
return "Ramp";
case Oscillator::WAVE_POLYBLEP_TRI:
return "Poly Triangle";
case Oscillator::WAVE_POLYBLEP_SQUARE:
return "Poly Square";
case Oscillator::WAVE_POLYBLEP_SAW:
return "Poly Saw";
}
return "";
} }

View File

@ -16,6 +16,7 @@ class VCODroplet: public Droplet {
private: private:
Oscillator osc; Oscillator osc;
Parameter freqctrl, wavectrl, ampctrl, finectrl; Parameter freqctrl, wavectrl, ampctrl, finectrl;
std::string WaveToString(uint8_t);
public: public:
VCODroplet(DaisyPatch*, float, DropletState); VCODroplet(DaisyPatch*, float, DropletState);
void Control(); void Control();

View File

@ -66,7 +66,6 @@ Droplet* GetDroplet() {
return new VCODroplet(&patch, return new VCODroplet(&patch,
samplerate, samplerate,
DropletState::kFull); DropletState::kFull);
break;
case MenuState::kNoise: case MenuState::kNoise:
default: default:
return new NoiseDroplet(&patch, return new NoiseDroplet(&patch,

View File

@ -1,3 +1,8 @@
#pragma once
#ifndef CASCADE_MAIN_H_
#define CASCADE_MAIN_H_
#include "daisysp.h" #include "daisysp.h"
#include "daisy_patch.h" #include "daisy_patch.h"
@ -14,3 +19,5 @@ void ProcessOled();
void ProcessOutputs(); void ProcessOutputs();
static void AudioThrough(float **, float **, size_t); static void AudioThrough(float **, float **, size_t);
Droplet* GetDroplet(); Droplet* GetDroplet();
#endif // CASCADE_MAIN_H_