Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ the project file format or the controls.
swing and a section's BPM still play. Off in a new project, saved with the project: one byte
on the end of PROJECT.BIN's MIDI section, which older builds ignore and which reads as off in
an older file.
- **LOUD.** MIXER's CLIP page, knob C (LUD): one knob that turns PSH, CLP, MNO and the drum
bus's GLU together along one curve, from `OFF` (none of them) through `40` (the factory
master) to `127`, about 6 LU louder than the factory with the peaks under -2 dB. A stage turned
on its own page shows `OWN` until LUD is turned again. Nothing new in the file: the four
bytes are the setting.
- **KEYS LAYOUT.** A FUNC menu row under TEMPO GUARD. `SCALE` turns KEYS's pads into the key:
the lower pads are its degrees from the root, the upper pads the same an octave up, so no pad
is out of key. On a chord track (VA POLY, WAVE POLY, FM4, MID) a lower pad plays its degree's
triad and names it (`T7 A3 MIN`). `PIANO` in a new project; saved as one byte on the end of
PROJECT.BIN's MIDI section, which older builds ignore and which reads as `PIANO` in an older
file.
- **GEN ALL**, the FUNC menu's last row (FUNC+HOME, UP, OK): a new part on every unmuted track at
once, each of its own GEN TYPE, with the track menu's DENSITY, RANGE, LEAP and WHAT. One undo
level takes every track back; the menu stays open, so OK again is the next idea. LOAD DEMO is
Expand Down
14 changes: 12 additions & 2 deletions app/app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "engine.hpp"
#include "help.hpp" // the FUNC help's pages, one set per screen
#include "energy.hpp" // ENERGY: FUNC + VALUE, on every screen
#include "loud.hpp" // LOUD: the CLIP page's macro on the master
#include "transpose.hpp" // TRANSPOSE: FUNC + the screen keys
#include "varispeed.hpp" // VariSpeed: FUNC + C in PERFORM, tempo and pitch together
#include "liverand.hpp" // LIVE RND: FUNC + D in PERFORM
Expand Down Expand Up @@ -155,6 +156,10 @@ struct MixerPage {

constexpr int kMixerTrackPages = 2;

// The slot that is LOUD (core/loud.hpp) rather than one master byte: it moves PSH, CLP, MNO and
// GLU together, so it sits beside CLP and MNO, which it turns where the player can see them.
constexpr int8_t kMixerLoudField = -2;

constexpr MixerPage kMixerPages[] = {
{"TRK 1-4", false, {-1, -1, -1, -1}}, // the faders, handled on their own
{"TRK 5-8", false, {-1, -1, -1, -1}},
Expand Down Expand Up @@ -197,9 +202,10 @@ constexpr MixerPage kMixerPages[] = {
{"IN+", false, {-1, -1, -1, -1}},
// The reverb return's rumble stage (RDR drive, RLP low-pass; RDK the duck is on ROUTE) and the
// master's clipper and mono lows (CLP, MNO): the techno shaping, 2026-11-29. Before MST so
// that MST and EQ stay the last two pages, one and two presses round from TRK 1-4.
// that MST and EQ stay the last two pages, one and two presses round from TRK 1-4. LUD on C
// is the LOUD macro (the second review's proposal 12, 2026-11-30).
{"RUMBLE", false, {int8_t(SendField::reverb_drive), int8_t(SendField::reverb_low_pass), -1, -1}},
{"CLIP", true, {int8_t(MasterField::clip), int8_t(MasterField::mono_low), -1, -1}},
{"CLIP", true, {int8_t(MasterField::clip), int8_t(MasterField::mono_low), kMixerLoudField, -1}},
// The drum bus: every KICK, SNARE, HAT and PERC track's dry sound, driven, boomed, glued.
{"DRUMS", true, {int8_t(MasterField::drum_drive), int8_t(MasterField::drum_boom),
int8_t(MasterField::drum_glue), int8_t(MasterField::drum_low)}},
Expand Down Expand Up @@ -1031,6 +1037,10 @@ class Strata : public enaga::App {
int16_t pad_held_note_[kPianoPads] = {-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1}; // KEYS: piano pads
uint8_t pad_held_track_[kPianoPads] = {};
// A SCALE chord pad's notes (pad_chord), so the release lets each go; 0 or 1 is one note,
// pad_held_note_'s.
uint8_t pad_chord_notes_[kPianoPads][kChordMaxNotes] = {};
uint8_t pad_chord_count_[kPianoPads] = {};
int macro_learn_ = -1; // MACRO LEARN: the macro EDIT's pushes assign to
bool learn_ended_ = false; // and when it ended, for the CLR guard
uint32_t learn_ended_at_ms_ = 0;
Expand Down
6 changes: 6 additions & 0 deletions app/commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ enum class Cmd : uint8_t {
// the value the mixer runs on, and for the delay's time it needs the tempo to do it.
set_sends, // a: SendField, b: int8 delta
set_master, // a: MasterField, b: int8 delta
// LOUD (core/loud.hpp): b an int8 delta along the curve, from where the master's four bytes
// are on it (or its PSH, off it); the engine writes all four.
set_loud,
// The sidechain duck (core/project.hpp, KitDuck): a: DuckField, b: int8 delta; track is the
// track whose depth moves for DuckField::depth. Kit bytes, so a kit save keeps them.
set_duck,
Expand Down Expand Up @@ -392,6 +395,9 @@ enum class Cmd : uint8_t {
// TEMPO GUARD (core/project.hpp, `tempo_guard`): a: 1 on, 0 off. On, a plain turn or tap of
// VALUE leaves the tempo alone (app/ui_gestures.hpp). Saved with the project.
set_tempo_guard,
// KEYS LAYOUT (core/project.hpp, `keys_scale`): a: 1 SCALE, 0 PIANO. Only the pads read it
// (app/ui_browsers.hpp); the engine keeps it so it is saved with the project.
set_keys_layout,
// The user's MIDI CH (Enaga's setting, 0-15), which only the main context reads: posted at
// start and whenever it changes. a: the channel. Live state, not saved.
set_midi_channel,
Expand Down
13 changes: 13 additions & 0 deletions app/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "energy.hpp" // ENERGY: the amount held to its range, the tiers
#include "transpose.hpp" // TRANSPOSE: which tracks move, and the note moved
#include "autorec.hpp" // AUTO REC: the threshold steps
#include "loud.hpp" // LOUD: the master's four bytes along one curve
#include "chainloops.h" // strata_choke_fade, a choke group's fade
#include "masterloops.h" // strata_master_peak, for the input meter
#include "pcm.hpp" // a streamed file's bytes to int16, in top_up_streams
Expand Down Expand Up @@ -1640,6 +1641,10 @@ bool Engine::apply_notes(const Command &command, int track, int) {
project_.settings.tempo_guard = command.a != 0;
break;

case Cmd::set_keys_layout:
project_.settings.keys_scale = command.a != 0;
break;

case Cmd::set_midi_channel:
midi_channel_ = uint8_t(command.a & 0x0Fu);
break;
Expand Down Expand Up @@ -1757,6 +1762,14 @@ bool Engine::apply_mixer(const Command &command, int track, int) {
apply_mixer_bytes();
break;

case Cmd::set_loud:
// From the engine's own bytes, not the UI's reading of them: a sweep's clicks
// arrive faster than the UI sees each land (edit_mixer_field says why).
loud_apply(project_.settings.master,
loud_start(project_.settings.master) + int(int8_t(command.b)));
apply_mixer_bytes();
break;

case Cmd::set_input: {
if (command.a >= uint8_t(kInputFields)) {
status_.bump_refused();
Expand Down
3 changes: 3 additions & 0 deletions app/storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ bool mutates_project(Cmd cmd) {
// setting was lost the moment the app restarted.
case Cmd::set_sends:
case Cmd::set_master:
case Cmd::set_loud:
// And the kill EQ's switches, which sit in the same section.
case Cmd::eq_kill:
// The live-record quantize amount, which has a field in PROJECT.BIN and until now was
Expand All @@ -203,6 +204,8 @@ bool mutates_project(Cmd cmd) {
case Cmd::set_program_out:
// And TEMPO GUARD, after it.
case Cmd::set_tempo_guard:
// And KEYS LAYOUT, after that.
case Cmd::set_keys_layout:
// A LOCK tap puts the send and master bytes and the live mutes back.
case Cmd::lock_tap:
// Track Launch: the lane sources and pins are PROJECT.BIN's section 8, and CAPTURE moves
Expand Down
69 changes: 55 additions & 14 deletions app/ui_browsers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,57 @@

// --- KEYS: the pads as a piano ---------------------------------------

// The note a piano pad plays: C of the current octave plus its semitone, -1 for the two
// octave pads. Chromatic, as a keyboard is; the LEDs show which notes are in the scale.
// KEYS LAYOUT (FUNC menu): the pads as a piano, or as the key's scale.
bool keys_scale() const { return engine_.project().settings.keys_scale; }

// The note a piano pad plays, -1 for the two octave pads. PIANO: C of the current octave
// plus its semitone, chromatic as a keyboard is; the LEDs show which notes are in the scale.
// SCALE: the lower pads are the key's degrees from the root of the current octave, the eighth
// the octave, and an upper pad plays the lower pad to its left an octave up, so every pad is
// in the key (review 2026-11-29, proposal 5). Under CHROMATIC a degree is a semitone.
int pad_note(int pad) const {
if (pad < 0 || pad >= kPianoPads || kPianoSemitone[pad] < 0) return -1;
return clamp_int(kPadOctaveNote + keys_octave_ * 12 + kPianoSemitone[pad], 0, 127);
const int c = kPadOctaveNote + keys_octave_ * 12;
if (!keys_scale()) return clamp_int(c + kPianoSemitone[pad], 0, 127);
const int root = clamp_int(c + int(engine_.key_root() % 12), 0, 127);
const int note = int(scale_step(uint8_t(root), engine_.key_root(),
int(engine_.key_scale()), pad / 2));
return clamp_int(note + (pad % 2 == 1 ? 12 : 0), 0, 127);
}

// SCALE on a chord track (the POLY three, MID): a lower pad plays its degree's triad, the
// key's own (core/chord.hpp: a major stack folded into the key is the diatonic triad on
// every degree). The upper pads stay single notes, a melody over the chords. Writes the
// notes into `notes` and returns how many: 1 where a pad plays one note.
int pad_chord(int pad, uint8_t note, uint8_t *notes) const {
notes[0] = note;
if (!keys_scale() || pad % 2 == 1 || !records_chords(selected_)) return 1;
const int n = chord_expand(note, chord_pack(ChordType::major, 0), engine_.key_root(),
int(engine_.key_scale()), notes, 3);
return n < 1 ? 1 : n;
}

void release_pad(int pad) {
if (pad < 0 || pad >= kPianoPads || pad_held_note_[pad] < 0) return;
post(Cmd::release_note, uint8_t(pad_held_track_[pad]), 0, uint8_t(pad_held_note_[pad]));
const int count = pad_chord_count_[pad] < 1 ? 1 : int(pad_chord_count_[pad]);
for (int i = 0; i < count; i++) {
const uint8_t note = count == 1 ? uint8_t(pad_held_note_[pad]) : pad_chord_notes_[pad][i];
post(Cmd::release_note, uint8_t(pad_held_track_[pad]), 0, note);
record_note_up(pad_held_track_[pad], note);
}
mod_pressure_release(pad_held_track_[pad]);
record_note_up(pad_held_track_[pad], uint8_t(pad_held_note_[pad]));
pad_held_note_[pad] = -1;
pad_chord_count_[pad] = 0;
// The macro bend this pad's pressure made goes back to where the knob left it.
if (pressure_pad_ == pad) {
pressure_pad_ = -1;
post(Cmd::set_macro, 0, 0, 0, macro_position_[0]);
}
}

// A piano pad played: the note held until the pad comes up, at the pad's own velocity, on
// the selected track, recorded like a STEP key in KEYS. The two pads with no black key walk
// the octave.
// A piano pad played: the note (or SCALE's chord) held until the pad comes up, at the pad's
// own velocity, on the selected track, recorded like a STEP key in KEYS: a chord's notes
// join on one step (record_note). The two pads with no black key walk the octave.
void play_pad(int pad, int velocity) {
if (kPianoSemitone[pad] == kPadOctaveDown || kPianoSemitone[pad] == kPadOctaveUp) {
walk_keys_octave(kPianoSemitone[pad] == kPadOctaveDown ? -1 : +1);
Expand All @@ -37,22 +65,35 @@
const uint8_t note = uint8_t(pad_note(pad));
const uint8_t vel = uint8_t(velocity < 1 ? 1 : (velocity > 127 ? 127 : velocity));
release_pad(pad);
pad_held_note_[pad] = int16_t(note);
uint8_t notes[kChordMaxNotes];
const int count = pad_chord(pad, note, notes);
pad_held_note_[pad] = int16_t(notes[0]);
pad_held_track_[pad] = uint8_t(selected_);
post(Cmd::trigger_note, uint8_t(selected_), 0, note, vel, 1);
record_note(selected_, note, vel);
pad_chord_count_[pad] = uint8_t(count);
for (int i = 0; i < count; i++) {
pad_chord_notes_[pad][i] = notes[i];
post(Cmd::trigger_note, uint8_t(selected_), 0, notes[i], vel, 1);
record_note(selected_, notes[i], vel);
}
char *out = notice_buffer_;
append(out, "T");
append_number(out, uint32_t(selected_) + 1);
append(out, " ");
append(out, note_name(note));
append_number(out, uint32_t(note_octave(note) < 0 ? 0 : note_octave(note)));
append(out, note_name(notes[0]));
append_number(out, uint32_t(note_octave(notes[0]) < 0 ? 0 : note_octave(notes[0])));
// A chord says its quality from its third and fifth: MIN, MAJ or DIM.
if (count >= 3) {
const int third = int(notes[1]) - int(notes[0]);
const int fifth = int(notes[2]) - int(notes[0]);
append(out, fifth == 6 ? " DIM" : (third == 3 ? " MIN" : (third == 4 ? " MAJ" : " CHD")));
}
*out = 0;
notice(notice_buffer_);
}

// KEYS lights the pads as a keyboard: the root bright, the scale's other notes dim in the
// selected track's colour, the rest dark, a held pad white; the two octave pads dim white.
// In SCALE every pad is in the key, so the roots are bright and the rest dim.
void light_piano_pads() {
const uint8_t root = engine_.key_root();
const int scale = int(engine_.key_scale());
Expand All @@ -61,7 +102,7 @@
const int note = pad_note(pad);
if (note < 0) { leds_.pad(pad, 2, 2, 2); continue; }
if (pad_held_note_[pad] >= 0) { leds_.pad(pad, 10, 10, 10); continue; }
const bool at_root = note % 12 == root;
const bool at_root = note % 12 == root % 12;
const bool in_scale = scale_fold(uint8_t(note), root, scale) == uint8_t(note);
const uint8_t level = at_root ? 10 : (in_scale ? 2 : 0);
leds_.pad(pad, uint8_t(colour.r * level / 10), uint8_t(colour.g * level / 10),
Expand Down
31 changes: 30 additions & 1 deletion app/ui_mixer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@
// fourteen of them live (core/project.hpp). There is no app-side copy to drift.
uint8_t mixer_byte(int page, int slot) const {
const int8_t field = kMixerPages[page].field[slot];
if (field < 0) return 0;
const ProjectSettings &settings = engine_.project().settings;
if (field == kMixerLoudField) return uint8_t(loud_start(settings.master));
if (field < 0) return 0;
return kMixerPages[page].master ? settings.master[field] : settings.sends[field];
}

void edit_mixer_field(int page, int slot, int delta) {
if (page < 0 || page >= kMixerPageCount || slot < 0 || slot >= 4) return;
const int8_t field = kMixerPages[page].field[slot];
if (field == kMixerLoudField) {
edit_loud(delta);
return;
}
if (field < 0) return; // an empty slot on the routing page
const bool master = kMixerPages[page].master;

Expand All @@ -33,6 +38,22 @@
notice(master ? master_field_name(uint8_t(field)) : send_field_name(uint8_t(field)));
}

// LOUD on the CLIP page: one click two steps along the curve, said as "LOUD 42" (or "LOUD
// OFF"), and logged, since the emulator cannot read the screen (tests/scenario_loud.sh). The
// figure is the UI's guess from the project it last saw; the engine moves from its own.
void edit_loud(int delta) {
post_delta(Cmd::set_loud, 0, 0, 0, delta * kLoudClick);
const int now = loud_start(engine_.project().settings.master) + delta * kLoudClick;
const int shown = now < 0 ? 0 : (now > kLoudMax ? kLoudMax : now);
char *out = notice_buffer_;
append(out, "LOUD ");
if (shown == 0) append(out, "OFF");
else append_number(out, uint32_t(shown));
*out = 0;
notice(notice_buffer_);
enaga::log(notice_buffer_);
}

// The chorus sends (KitTrack::chorus) on CHO 1-4 and CHO 5-8: an encoder is a track's send,
// one click two counts as a send knob on EDIT's FX page is, and said as "T3 CHORUS 64".
void edit_chorus_send(int page, int slot, int delta) {
Expand Down Expand Up @@ -310,6 +331,14 @@
void append_mixer_value(char *&out, int page, int slot) {
const int8_t field = kMixerPages[page].field[slot];
const uint8_t byte = mixer_byte(page, slot);
if (field == kMixerLoudField) {
// OWN when one of the four was turned on its own page: the curve no longer says
// what the master does, and the next turn of LUD puts all four back on it.
if (loud_position(engine_.project().settings.master) < 0) append(out, "OWN");
else if (byte == 0) append(out, "OFF");
else append_number(out, byte);
return;
}
if (!kMixerPages[page].master && field == int8_t(SendField::delay_seconds)) {
append(out, delay_division_name(byte));
return;
Expand Down
5 changes: 4 additions & 1 deletion app/ui_mixview.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@
append_slap_value(v, slot, int(slap_byte(slot)));
} else {
const int8_t field = kMixerPages[mixer_bank_].field[slot];
if (field < 0) {
if (field == kMixerLoudField) {
append(n, "LUD");
append_mixer_value(v, mixer_bank_, slot);
} else if (field < 0) {
append(n, "---");
empty = true;
} else {
Expand Down
12 changes: 12 additions & 0 deletions app/ui_perfmix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
reload, clear, demo,
click, count_in, rec_mode, quantize, autofill, glide,
transpose, loop_len, chain, song, prog_out, tempo_guard,
keys_layout,
count };
static constexpr int kMenuItems = int(MenuItem::count);
static constexpr int kMenuSetFirst = int(MenuItem::click); // where SET begins
Expand All @@ -40,6 +41,7 @@
case MenuItem::song: return "CHAIN END";
case MenuItem::prog_out: return "PROG CHG OUT";
case MenuItem::tempo_guard: return "TEMPO GUARD";
case MenuItem::keys_layout: return "KEYS LAYOUT";
case MenuItem::autofill: return "AUTO-FILL";
case MenuItem::quantize: return "QUANTIZE";
case MenuItem::rec_mode: return "REC MODE";
Expand Down Expand Up @@ -71,6 +73,9 @@
case MenuItem::tempo_guard:
append(out, tempo_guarded() ? "ON" : "OFF");
break;
case MenuItem::keys_layout:
append(out, keys_scale() ? "SCALE" : "PIANO");
break;
case MenuItem::autofill:
append(out, auto_fill_name(engine_.auto_fill()));
break;
Expand Down Expand Up @@ -809,6 +814,13 @@
notice_logged(on ? "TEMPO GUARD ON" : "TEMPO GUARD OFF");
break;
}
case MenuItem::keys_layout: {
// A switch, as TEMPO GUARD: PIANO or SCALE (app/ui_browsers.hpp, pad_note).
const bool scale = !keys_scale();
post(Cmd::set_keys_layout, 0, 0, scale ? 1 : 0);
notice_logged(scale ? "KEYS SCALE" : "KEYS PIANO");
break;
}
case MenuItem::autofill: {
// Off, 4, 8 or 16 bars. It wraps, since "off" is one of the four rather than an
// end stop.
Expand Down
Loading