Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement Keyframer's Frame Step output to fix #36 #58

Open
wants to merge 1 commit into
base: v0.6
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Frames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ struct Frames : Module {
frames::PolyLfo poly_lfo;
bool poly_lfo_mode = false;
uint16_t lastControls[4] = {};
int16_t lastPosition = -1;

SchmittTrigger addTrigger;
SchmittTrigger delTrigger;
PulseGenerator frameStepPulse;

Frames();
void step() override;
Expand Down Expand Up @@ -196,6 +198,10 @@ void Frames::step() {
}
}
keyframer.Evaluate(timestampMod);

if (keyframer.position() != lastPosition) {
frameStepPulse.trigger(1e-3f);
}
}

// Get gains
Expand All @@ -221,6 +227,7 @@ void Frames::step() {
for (int i = 0; i < 4; i++) {
lastControls[i] = controls[i];
}
lastPosition = keyframer.position();

// Get inputs
float all = ((int)params[OFFSET_PARAM].value == 1) ? 10.0 : 0.0;
Expand All @@ -247,6 +254,9 @@ void Frames::step() {

outputs[MIX_OUTPUT].value = clamp(mix / 2.0, -10.0f, 10.0f);

float deltaTime = engineGetSampleTime();
outputs[FRAME_STEP_OUTPUT].value = frameStepPulse.process(deltaTime) ? 10.f : 0.f;

// Set lights
for (int i = 0; i < 4; i++) {
lights[GAIN1_LIGHT + i].setBrightness(gains[i]);
Expand Down