Skip to content

Commit

Permalink
8Face mk2 - implemented "Auto"-mode #276
Browse files Browse the repository at this point in the history
  • Loading branch information
stoermelder committed Apr 18, 2024
1 parent e20e22f commit e301772
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 17 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
- Module [PRISMA](./docs/Prisma.md)
- A wave multiplier/phase shifter inspired by A-137-2

## 2.0.x
## 2.0.x (in development)

### Fixes and Changes

- Module [8FACE mk2](./docs/EightFaceMk2.md)
- Added "Auto"-mode besides "Read" and "Write" ([manual](./docs/EightFaceMk2.md#auto-mode)) (#276)
- Module [AFFIX](./docs/Affix.md), [µAFFIX](./docs/Affix.md)
- Fixed knob reset on double-click in Semitone/Octave-mode (#387)
- Module [GOTO](./docs/Goto.md)
Expand Down
7 changes: 6 additions & 1 deletion docs/EightFaceMk2.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ There are also some options on the context menu of the snapshot-buttons:
A blinking white LED signals the snapshot applied at last. Please keep in mind that you can change bound modules manually and these changes will not be recognized by 8FACE mk2.
In write-mode any input on the _CV_-port is ignored and sequencing is disabled.

## Auto-mode

Auto-mode (added in v2.0.0) stores presets automatically to the current slot right before moving on to the next slot. A typical workflow would look like this: Store a few presets using Write-mode as usual. Afterwards flip the switch to the middle "A"-position and start slow sequencing using the _SLOT_-port. Imagine slot 1 is active and slot 2 will be loaded next. Right before moving to slot 2 the current state of the module is stored into slot 1 preserving all adjustments made in the meantime. In contrast, Read-mode would simply load slot 2 and the preset stored in slot 1 will stay unchanged, discarding all changes made to the module. Note: Empty slots will stay empty, even in Auto-mode.

## Sequencing and selecting snapshots

The fun begins when you use the port labelled _CV_ for selecting snapshots by CV. Although there are 8 snapshot slots available it is possible to use less slots for sequencing: You can adjust the number of active slots (i.e. sequence length) by long-pressing a snapshot-button while in read-mode. The LEDs turn off completely for slots that are currently disabled.
Expand Down Expand Up @@ -126,4 +130,5 @@ Once placed next to 8FACE mk2 the expander works and behaves the same way 8FACE
- Added HSL color picker for bound modules' box
- Fixed broken module-id mapping when adding using STRIP or STRIP++
- Fixed crash while exceding 0..10V in Volt-mode (#377)
- Increased maximum number of expanders to 15
- Increased maximum number of expanders to 15
- Added "Auto"-mode besides "Read" and "Write" ([manual](./EightFaceMk2.md#auto-mode)) (#276)
Binary file modified res-src/EightFaceMk2.afdesign
Binary file not shown.
Binary file modified res-src/dark/EightFaceMk2.afdesign
Binary file not shown.
14 changes: 10 additions & 4 deletions res/EightFaceMk2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 10 additions & 4 deletions res/dark/EightFaceMk2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 20 additions & 6 deletions src/EightFaceMk2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct EightFaceMk2Module : EightFaceMk2Base<NUM_PRESETS> {

/** Total number of snapshots including expanders */
int presetTotal;
int presetPrev = -1;
int presetNext;
int presetCopy = -1;

Expand Down Expand Up @@ -132,7 +133,7 @@ struct EightFaceMk2Module : EightFaceMk2Base<NUM_PRESETS> {
EightFaceMk2Module() {
BASE::panelTheme = pluginSettings.panelThemeDefault;
Module::config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
Module::configParam(PARAM_RW, 0, 1, 0, "Read/write mode");
Module::configSwitch(PARAM_RW, 0.0, 2.0, 0.0, "Operating mode", {"Read", "Auto", "Write"});
Module::configInput(INPUT_CV, "Slot-selection");
Module::inputInfos[INPUT_CV]->description = "Channel 2 can retrigger the current slot in C4 mode";
Module::configInput(INPUT_RESET, "Sequencer-mode reset");
Expand Down Expand Up @@ -255,8 +256,8 @@ struct EightFaceMk2Module : EightFaceMk2Base<NUM_PRESETS> {
}
int presetCount = std::min(this->presetCount, presetTotal);

// Read mode
if (BASE::ctrlMode == CTRLMODE::READ) {
// Read & Auto modes
if (BASE::ctrlMode == CTRLMODE::READ || BASE::ctrlMode == CTRLMODE::AUTO) {
// RESET input
if (resetTrigger.process(Module::inputs[INPUT_RESET].getVoltage())) {
resetTimer.reset();
Expand Down Expand Up @@ -438,7 +439,7 @@ struct EightFaceMk2Module : EightFaceMk2Base<NUM_PRESETS> {
for (int i = 0; i < presetTotal; i++) {
EightFaceMk2Slot* slot = expSlot(i);
bool u = *(slot->presetSlotUsed);
if (BASE::ctrlMode == CTRLMODE::READ) {
if (BASE::ctrlMode == CTRLMODE::READ || BASE::ctrlMode == CTRLMODE::AUTO) {
slot->lights[0].setBrightness(preset == i ? 1.f : (presetNext == i ? 1.f : 0.f));
slot->lights[1].setBrightness(preset == i ? 1.f : (presetCount > i ? (u ? 1.f : 0.25f) : 0.f));
slot->lights[2].setBrightness(preset == i ? 1.f : 0.f);
Expand Down Expand Up @@ -502,6 +503,12 @@ struct EightFaceMk2Module : EightFaceMk2Base<NUM_PRESETS> {
if (workerPreset < 0) return;

EightFaceMk2Slot* slot = expSlot(workerPreset);
EightFaceMk2Slot* slotPrev = NULL;
if (presetPrev >= 0) {
slotPrev = expSlot(presetPrev);
}

int i = 0;
for (json_t* vJ : *slot->preset) {
json_t* idJ = json_object_get(vJ, "id");
if (!idJ) continue;
Expand All @@ -514,6 +521,10 @@ struct EightFaceMk2Module : EightFaceMk2Base<NUM_PRESETS> {
ModuleWidget* mw = b->getModuleWidget();
if (!mw) continue;

if (BASE::ctrlMode == CTRLMODE::AUTO && slotPrev && *slotPrev->presetSlotUsed) {
json_decref((*slotPrev->preset)[i]);
(*slotPrev->preset)[i] = mw->toJson();
}
if (b->needsGuiThread) {
workerGuiQueue.push(std::make_tuple(mw, vJ));
}
Expand All @@ -522,6 +533,7 @@ struct EightFaceMk2Module : EightFaceMk2Base<NUM_PRESETS> {
}
break;
}
i++;
}
}

Expand All @@ -541,6 +553,7 @@ struct EightFaceMk2Module : EightFaceMk2Base<NUM_PRESETS> {
EightFaceMk2Slot* slot = expSlot(p);
if (!isNext) {
if (p != preset || force) {
presetPrev = preset;
preset = p;
presetNext = -1;
if (!*(slot->presetSlotUsed)) return;
Expand Down Expand Up @@ -588,6 +601,7 @@ struct EightFaceMk2Module : EightFaceMk2Base<NUM_PRESETS> {
void presetSetCount(int p) {
if (preset >= p) preset = 0;
presetCount = p;
presetPrev = -1;
presetNext = -1;
}

Expand Down Expand Up @@ -872,6 +886,7 @@ struct EightFaceMk2Widget : ThemedModuleWidget<EightFaceMk2Module<NUM_PRESETS>>
BASE::addInput(createInputCentered<StoermelderPort>(Vec(22.5f, 58.9f), module, MODULE::INPUT_CV));
BASE::addInput(createInputCentered<StoermelderPort>(Vec(22.5f, 94.2f), module, MODULE::INPUT_RESET));

BASE::addChild(createLightCentered<TinyLight<WhiteLight>>(Vec(11.4f, 118.1f), module, MODULE::LIGHT_LEARN));
ModuleColorWidget<MODULE>* cw = createWidgetCentered<ModuleColorWidget<MODULE>>(Vec(22.5f, 118.1f));
cw->module = module;
BASE::addChild(cw);
Expand All @@ -885,8 +900,7 @@ struct EightFaceMk2Widget : ThemedModuleWidget<EightFaceMk2Module<NUM_PRESETS>>
BASE::addChild(createLightCentered<LargeLight<RedGreenBlueLight>>(Vec(22.5f, 140.6f + o), module, MODULE::LIGHT_PRESET + i * 3));
}

BASE::addChild(createLightCentered<TinyLight<WhiteLight>>(Vec(11.4f, 322.7f), module, MODULE::LIGHT_LEARN));
BASE::addParam(createParamCentered<CKSSH>(Vec(22.5f, 336.2f), module, MODULE::PARAM_RW));
BASE::addParam(createParamCentered<CKSSThreeH>(Vec(22.5f, 336.2f), module, MODULE::PARAM_RW));
}

~EightFaceMk2Widget() {
Expand Down
1 change: 1 addition & 0 deletions src/EightFaceMk2Base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum class SLOT_CMD {

enum class CTRLMODE {
READ,
AUTO,
WRITE
};

Expand Down
2 changes: 1 addition & 1 deletion src/EightFaceMk2Ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct EightFaceMk2ExModule : EightFaceMk2Base<NUM_PRESETS> {
}
}

void onReset() override {
void onReset() override {
for (int i = 0; i < NUM_PRESETS; i++) {
if (BASE::presetSlotUsed[i]) {
for (json_t* vJ : BASE::preset[i]) {
Expand Down

0 comments on commit e301772

Please sign in to comment.