VCO title bar changes based on wave shape

This commit is contained in:
2020-09-26 13:24:13 -04:00
parent 62497cade0
commit b04fdf7f70
5 changed files with 64 additions and 9 deletions

View File

@ -19,7 +19,7 @@ VCODroplet::VCODroplet(DaisyPatch* m_patch,
}
VCODroplet::~VCODroplet() {
delete wave;
// delete wave;
}
void VCODroplet::Control() {}
@ -51,10 +51,12 @@ void VCODroplet::Process(float** in, float** out, size_t size) {
void VCODroplet::Draw() {
WriteString(*Patch(), 0, 54, Font_6x8,
WaveToString(wavectrl.Process()));
SetWaveState(wavectrl.Process());
wave->DrawTile(*Patch(), GetScreenMin(), 0, GetScreenMax(), GetTitleHeight());
if(NeedUpdate()) {
//wave->AdjustXShift(1);
wave->AdjustXShift(1);
}
//testWave->DrawTile(*Patch(), 0, GetTitleHeight(), 60, GetTitleHeight()+testH);
DrawName("VCO");
AnimationInc();
}
@ -80,3 +82,33 @@ std::string VCODroplet::WaveToString(uint8_t wf) {
}
return "";
}
void VCODroplet::SetWaveState(uint8_t wf) {
switch(wf){
case Oscillator::WAVE_TRI:
wave->SetWaveShape(WaveShape::kTriangle);
return;
case Oscillator::WAVE_SQUARE:
wave->SetWaveShape(WaveShape::kSquare);
return;
case Oscillator::WAVE_SIN:
wave->SetWaveShape(WaveShape::kSine);
return;
case Oscillator::WAVE_SAW:
wave->SetWaveShape(WaveShape::kSaw);
return;
case Oscillator::WAVE_RAMP:
wave->SetWaveShape(WaveShape::kRamp);
return;
case Oscillator::WAVE_POLYBLEP_TRI:
wave->SetWaveShape(WaveShape::kTriangle);
return;
case Oscillator::WAVE_POLYBLEP_SQUARE:
wave->SetWaveShape(WaveShape::kSquare);
return;
default:
case Oscillator::WAVE_POLYBLEP_SAW:
wave->SetWaveShape(WaveShape::kSaw);
return;
}
}

View File

@ -20,9 +20,12 @@ private:
Oscillator osc;
Parameter freqctrl, wavectrl, ampctrl, finectrl;
std::string WaveToString(uint8_t);
void SetWaveState(uint8_t);
const double pi = std::acos(-1);
int sine_width = 20;
int sine_width = 21;
Wave* wave = new Wave(WaveShape::kTriangle, sine_width, GetTitleHeight());
int testH = 20;
//Wave* testWave = new Wave(WaveShape::kSaw, 30, testH);
public:
VCODroplet(DaisyPatch*, DropletState, float);
~VCODroplet();