Moved outputs size adjustments to droplets

This commit is contained in:
Christian Colglazier 2020-09-14 19:41:33 -04:00
parent e691e12646
commit c334aaa6bb
4 changed files with 9 additions and 10 deletions

View File

@ -1,7 +1,10 @@
TARGET = cascade
CPP_SOURCES = src/main.cpp src/util.cpp src/menu.cpp \
src/droplets/droplet.cpp src/droplets/noise_droplet.cpp
CPP_SOURCES = src/main.cpp \
src/util.cpp \
src/menu.cpp \
src/droplets/droplet.cpp \
src/droplets/noise_droplet.cpp
LIBDAISY_DIR = ./lib/libDaisy
DAISYSP_DIR = ./lib/daisySP

View File

@ -10,8 +10,10 @@ void Droplet::UpdateState(DropletState m_state) {
screen_min = 0;
screen_max = SSD1309_WIDTH;
if (state == DropletState::kLeft) {
chn_max = 2;
screen_max = SSD1309_WIDTH / 2;
} else if (state == DropletState::kRight) {
chn_min = 2;
screen_min = SSD1309_WIDTH / 2;
}
}

View File

@ -23,6 +23,8 @@ class Droplet {
const int kTitleHeight = 8;
int screen_min;
int screen_max;
size_t chn_min = 0;
size_t chn_max = 4;
void DrawName(daisy::DaisyPatch*,
std::string);
void UpdateState(DropletState);

View File

@ -5,7 +5,6 @@ NoiseDroplet::NoiseDroplet(DaisyPatch* m_patch,
DropletState m_state) {
noise.Init();
filter.Init();
patch = m_patch;
UpdateState(m_state);
}
@ -14,13 +13,6 @@ void NoiseDroplet::Control() {}
void NoiseDroplet::Process(float** in, float** out, size_t size) {
for (size_t i = 0; i < size; i += 2) {
float sig = noise.Process();
size_t chn_min = 0;
size_t chn_max = 4;
if (state == DropletState::kLeft) {
chn_max = 2;
} else if (state == DropletState::kRight) {
chn_min = 2;
}
for (size_t chn = chn_min; chn < chn_max; chn++) {
out[chn][i] = sig;
}