Browse Source

Allow varying sample rate

tags/v1.0.1
Jim Tupper 6 years ago
parent
commit
32aa9a15eb
2 changed files with 12 additions and 2 deletions
  1. +1
    -1
      eurorack
  2. +11
    -1
      src/Stages.cpp

+ 1
- 1
eurorack

@@ -1 +1 @@
Subproject commit e9aac2ab705e7b7e902b43a1bbd9e01d25cd42a2
Subproject commit 041b00526bbffd8fa59d4b08f8a43238e8437b16

+ 11
- 1
src/Stages.cpp View File

@@ -110,7 +110,10 @@ struct Stages : Module {
}

void onReset() override {
stages::kSampleRate = engineGetSampleRate();

abloop = false;

for (size_t i = 0; i < NUM_CHANNELS; ++i) {
segment_generator[i].Init();
oscillator[i].Init();
@@ -152,6 +155,13 @@ struct Stages : Module {
}
}

void onSampleRateChange() override {
stages::kSampleRate = engineGetSampleRate();
for (int i = 0; i < NUM_CHANNELS; i++) {
// segment_generator[i].InitRamps();
}
}

void stepBlock() {
// Get parameters
float primaries[NUM_CHANNELS];
@@ -282,7 +292,7 @@ struct Stages : Module {
int loopcount = 0;
for (int i = 0; i < NUM_CHANNELS; i++) {
float envelope = envelopeBuffer[i][blockIndex];
outputs[ENVELOPE_OUTPUTS + i].value = envelope * 10.f;
outputs[ENVELOPE_OUTPUTS + i].value = envelope * 8.f;
lights[ENVELOPE_LIGHTS + i].setBrightnessSmooth(envelope);

if (currentGroupSize <= 0) {


Loading…
Cancel
Save