Cleaned code

This commit is contained in:
Christian Colglazier 2020-09-20 14:51:37 -04:00
parent 1c771c5657
commit b356fea100
7 changed files with 19 additions and 23 deletions

View File

@ -14,7 +14,7 @@ using namespace daisy;
enum class DropletState {kFull, kLeft, kRight};
class Droplet {
public:
public:
DaisyPatch* patch;
DropletState state;
Droplet(DaisyPatch*, DropletState);

View File

@ -1,12 +1,10 @@
#include "noise_droplet.h"
NoiseDroplet::NoiseDroplet(DaisyPatch* m_patch,
float sample_rate,
DropletState m_state) :
Droplet(m_patch,
m_state) {
noise.Init();
filter.Init();
}
void NoiseDroplet::Control() {}

View File

@ -10,11 +10,10 @@
#include "../util.h"
class NoiseDroplet: public Droplet {
private:
private:
daisysp::WhiteNoise noise;
daisysp::NlFilt filter;
public:
NoiseDroplet(DaisyPatch*, float, DropletState);
public:
NoiseDroplet(DaisyPatch*, DropletState);
void Control();
void Process(float**, float**, size_t);
void Draw();

View File

@ -1,8 +1,8 @@
#include "vco_droplet.h"
VCODroplet::VCODroplet(DaisyPatch* m_patch,
float sample_rate,
DropletState m_state) :
DropletState m_state,
float sample_rate) :
Droplet(m_patch,
m_state){
int num_waves = Oscillator::WAVE_LAST;
@ -46,7 +46,8 @@ void VCODroplet::Process(float** in, float** out, size_t size) {
void VCODroplet::Draw() {
DrawName(patch, "VCO");
WriteString(*patch, 0, 54, Font_6x8, WaveToString(wavectrl.Process()));
WriteString(*patch, 0, 54, Font_6x8,
WaveToString(wavectrl.Process()));
}
std::string VCODroplet::WaveToString(uint8_t wf) {

View File

@ -13,12 +13,12 @@ using namespace daisy;
using namespace daisysp;
class VCODroplet: public Droplet {
private:
private:
Oscillator osc;
Parameter freqctrl, wavectrl, ampctrl, finectrl;
std::string WaveToString(uint8_t);
public:
VCODroplet(DaisyPatch*, float, DropletState);
public:
VCODroplet(DaisyPatch*, DropletState, float);
void Control();
void Process(float**, float**, size_t);
void Draw();

View File

@ -2,14 +2,9 @@
using namespace daisy;
DaisyPatch patch;
Menu menu(&patch);
Droplet* droplet;
float samplerate;
int main(void) {
patch.Init();
samplerate = patch.AudioSampleRate();
sample_rate = patch.AudioSampleRate();
droplet = GetDroplet();
patch.StartAdc();
patch.StartAudio(AudioThrough);
@ -56,7 +51,6 @@ void ProcessOled() {
static void AudioThrough(float **in,
float **out,
size_t size) {
patch.UpdateAnalogControls();
droplet->Process(in, out, size);
}
@ -64,12 +58,11 @@ Droplet* GetDroplet() {
switch(menu.GetState()) {
case MenuState::kVCO:
return new VCODroplet(&patch,
samplerate,
DropletState::kFull);
DropletState::kFull,
sample_rate);
case MenuState::kNoise:
default:
return new NoiseDroplet(&patch,
samplerate,
DropletState::kFull);
}
}

View File

@ -14,6 +14,11 @@
#include "droplets/noise_droplet.h"
#include "droplets/vco_droplet.h"
DaisyPatch patch;
Menu menu(&patch);
Droplet* droplet;
float sample_rate;
void ProcessControls();
void ProcessOled();
void ProcessOutputs();