Basic graph rendering system

This commit is contained in:
2022-01-09 22:13:14 -05:00
parent 746a00a56b
commit 65a26b8e31
9 changed files with 136 additions and 25 deletions

View File

@ -105,6 +105,7 @@ ADDroplet::ADDroplet(DaisyPatch* m_patch,
Droplet(m_patch,
m_state) {
sample_rate = m_sample_rate;
SetAnimationRate(20);
ad[0].Init(Patch(),
sample_rate,
&m_state);
@ -113,6 +114,9 @@ ADDroplet::ADDroplet(DaisyPatch* m_patch,
sample_rate,
&m_state);
}
title_graph = new Graph(GetScreenMax()-GetScreenMin(),
GetTitleHeight());
}
ADDroplet::~ADDroplet() {}
@ -185,8 +189,17 @@ void ADDroplet::Draw() {
DrawSolidRect(Patch(), GetScreenMin(), 10, GetScreenMin()+1, 29, true);
}
}
if(NeedUpdate()) {
title_graph->Update();
}
title_graph->SetPixelPercentage(ad[0].GetSignal());
//title_graph->SetPixelPercentage(0.99f);
title_graph->Draw(Patch(), 0, 0);
DrawName("AD");
AnimationInc();
}
void ADDroplet::UpdateStateCallback() {

View File

@ -8,6 +8,7 @@
#include "droplet.h"
#include "../util.h"
#include "../graphics/graph.h"
using namespace daisy;
using namespace daisysp;
@ -47,6 +48,7 @@ class ADDroplet: public Droplet {
private:
AD ad[2];
float sample_rate;
Graph* title_graph;
public:
/*
@ -56,8 +58,8 @@ public:
* @param m_state droplet position
*/
ADDroplet(DaisyPatch* m_patch,
DropletState m_state,
float sample_rate);
DropletState m_state,
float sample_rate);
/*
* Destructor for vco droplet.