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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ the project file format or the controls.
fit beside the playing one still loads after the boundary. SAVE says `SAVING K2 UNCHANGED`
when the kit playing was edited since its section brought it: the save keeps the edit in the
project's kit, and the song kit stays as stored.
- **The MIX page.** EDIT's last page, on every machine, holds the mixer's four settings as
parameters: WID the width, CHO the chorus send, SLP the SLAP level and DCK the duck depth in
percent. A turn there or on MIXER moves the same setting, and as parameters they can be locked
on a step, stored in a scene and swept by a macro. Scenes saved before keep none of them.

- **Next song.** On PROJECTS, push A queues the project under the cursor as the next song
(`NEXT FIRST`, shown on every screen). When the transport stops, at the end of a SONG chain or
on STOP, it opens while the last song's delay and reverb ring out, and under the internal clock
Expand Down
7 changes: 5 additions & 2 deletions app/app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ const char *page_name(Page page) {
case Page::asr: return "ENV"; // the whole envelope (Roland, 2026-11-26)
case Page::osc: return "OSC";
case Page::scn: return "SCAN";
case Page::mix: return "MIX";
default: return "?";
}
}
Expand Down Expand Up @@ -599,14 +600,16 @@ constexpr const char *kAsrNames[kAsrParams] = {"ATK", "SUS", "REL", "FSU"};
constexpr const char *kOscNames[kOscParams] = {"WAV", "OS2", "SUB", "DRV"};
// And the WAVE pair's SCN page (dsp/va.cpp): the scan's mode, speed, end frame and curve.
constexpr const char *kScnNames[kScnParams] = {"MOD", "SPD", "END", "CRV"};
// And every machine's MIX page (dsp/track.hpp): width, chorus send, slapback level, duck depth.
constexpr const char *kMixNames[kMixParams] = {"WID", "CHO", "SLP", "DCK"};

// EDIT's pages: the four of sound, then the track's LFO (dsp/lfo.hpp), its arpeggiator
// (core/arp.hpp), the VA machines' note envelope, ASR, and their oscillators, OSC (dsp/va.cpp),
// then the WAVE pair's scan, SCAN. Pages 8 and 9 are the hole between OSC and SCN
// then the WAVE pair's scan, SCAN, and every machine's MIX. Pages 8 and 9 are the hole between OSC and SCN
// (dsp/track.hpp): no knob on them is live on any machine, so the selection keys step over them
// as they step over a drum's ENV. Everywhere else a page is still four encoders over four
// parameters.
constexpr int kEditPages = int(Page::scn) + 1;
constexpr int kEditPages = int(Page::mix) + 1;
constexpr bool edit_page_hole(int page) { return page * kParamsPerPage >= kOscEnd &&
page * kParamsPerPage < kScnFirst; }

Expand Down
66 changes: 51 additions & 15 deletions app/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ static_assert(kSoundOscFirst == kOscFirst && kFactoryOsc == kOscFirst,
"core/'s OSC page and dsp/track.hpp's have diverged");
static_assert(kSoundScnFirst == kScnFirst && kKitScnFirst == kScnFirst && kKitOscEnd == kOscEnd,
"core/'s SCN page and dsp/track.hpp's have diverged");
static_assert(kKitMixFirst == kMixFirst && kKitMixParams == kMixParams && kKitMixDuckIndex == kMixDuck,
"core/'s MIX page and dsp/track.hpp's have diverged");

static_assert(kLfoTrigFree == uint8_t(LfoTrig::free) && kLfoTrigRetrig == uint8_t(LfoTrig::retrig) &&
kLfoTrigOneShot == uint8_t(LfoTrig::one_shot) &&
Expand Down Expand Up @@ -407,7 +409,10 @@ bool Engine::make_room_for_poly_voice(int track, uint8_t note) {
// note to a machine asks here first, so this is the one place that holds it back.
if (frozen_[track].on()) return false;
PolyMachine *target = polys_[track];
if (target == nullptr || !target->would_add_voice(note)) return true;
if (target == nullptr) return true;
// WID as this step sounds it, a lock on it included: the note is laid out at this width.
target->set_width(width_sanitized(sounding(track).v[kMixWidth]));
if (!target->would_add_voice(note)) return true;

// A unison note (WID, core/width.hpp) takes two voices, so it makes room for two. The first
// decides whether the note plays; past it, the machine steals one of its own if it must.
Expand Down Expand Up @@ -443,10 +448,22 @@ bool Engine::make_room_for_poly_voice(int track, uint8_t note) {

void Engine::sync_widths() {
for (int t = 0; t < kTracks; t++) {
if (machines_[t] != nullptr) machines_[t]->set_width(width_sanitized(project_.kit.tracks[t].width));
if (machines_[t] != nullptr) machines_[t]->set_width(width_sanitized(sounding(t).v[kMixWidth]));
}
}

// The kit's width, chorus, slap and duck fields into MIX's parameter bytes, after a MIXER turn:
// the base the knobs turn, and the sounding copy unless a lock holds it, as Cmd::set_param does.
void Engine::mix_params_from_kit(int track) {
for (int k = 0; k < kMixParams; k++) {
const int p = kMixFirst + k;
params_[track].v[p] = kit_mix_field(project_.kit.tracks[track], k);
if ((locked_[track] >> p & 1u) == 0) effective_[track].v[p] = params_[track].v[p];
}
perform_dirty_ = true;
sync_widths();
}

// --- the CPU guard ----------------------------------------------------------------------------

void Engine::run_cpu_guard() {
Expand Down Expand Up @@ -507,8 +524,8 @@ void Engine::prepare_machine(int track) {
// The sound's 16, the ASR and OSC pages' 8 and SCN's 4: a WAVE reads all of them (dsp/track.hpp). The
// LFO and arp bytes between them are not compared, so turning an LFO knob does not re-prepare
// a machine.
static_assert(kOscFirst == kAsrFirst + kAsrParams && kTrackParams == kScnFirst + kScnParams,
"ASR and OSC are eight bytes compared as one run, SCN the last four");
static_assert(kOscFirst == kAsrFirst + kAsrParams && kScnEnd == kScnFirst + kScnParams,
"ASR and OSC are eight bytes compared as one run, SCN four more; MIX is the chain's");
if (prepare_memo_ && machine_prepared_for_[track] == machine &&
same_bytes(machine_prepared_[track].v, params.v, kParams) &&
same_bytes(machine_prepared_[track].v + kAsrFirst, params.v + kAsrFirst,
Expand All @@ -527,18 +544,25 @@ void Engine::prepare_chain(int track) {
// a dry plan prepares exactly what it did before.
ChainMix mix = mix_[track];
mix.level *= perf_plan_.tracks;
// Send C, the chorus: a kit byte read here, at control rate, so nothing else has to copy it.
mix.chorus = float(chorus_send_sanitized(project_.kit.tracks[track].chorus)) *
(1.0f / float(kChorusSendMax));
// MIX (WID CHO SLP DCK) from the sounding bytes, so a lock, a scene or a macro on one is
// heard; unmoved they are the kit's fields (mix_params_from_kit).
// Send C, the chorus.
mix.chorus = float(chorus_send_sanitized(params.v[kMixChorus])) * (1.0f / float(kChorusSendMax));
// WID on a mono track widens its highs in the chain; a POLY track's WID is its voices' and
// a GRAIN track's its grains' (machine_plays_width).
if (machines_[track] != nullptr) machines_[track]->set_width(width_sanitized(params.v[kMixWidth]));
mix.width = machine_plays_width(machine_id_[track])
? 0.0f
: float(width_sanitized(project_.kit.tracks[track].width)) * (1.0f / float(kWidthMax));
// SLAP: the kit's four bytes, the division at the tempo. Off, the chain reads none of the
// other three, so they stay 0: a tempo change then does not prepare the chain again.
: float(width_sanitized(params.v[kMixWidth])) * (1.0f / float(kWidthMax));
// DCK, in percent as the kit holds it; the source track never ducks under itself.
const uint8_t depth = params.v[kMixDuck];
mix.duck = track == duck_source_ ? 0.0f
: float(depth > kDuckDepthMax ? kDuckDepthMax : depth) / 100.0f;
// SLAP: its level from the bytes, the other three the kit's, the division at the tempo. Off,
// the chain reads none of the other three, so they stay 0: a tempo change then does not
// prepare the chain again.
const KitTrack &kt = project_.kit.tracks[track];
mix.slap = float(slap_sanitized(kt.slap)) * (1.0f / float(kSlapMax));
mix.slap = float(slap_sanitized(params.v[kMixSlap])) * (1.0f / float(kSlapMax));
mix.slap_frames = 0.0f;
mix.slap_feedback = 0.0f;
mix.slap_tone_hz = 0.0f;
Expand Down Expand Up @@ -677,6 +701,11 @@ bool Engine::apply_sound(const Command &command, int track, int) {
// before the copy runs. The next step rebuilds effective_ from the kit anyway,
// so a lock on this parameter still wins from then on.
effective_[track].v[command.a] = clamp_7bit(value);
// MIX's bytes are the kit's width, chorus, slap and duck fields as well.
if (command.a >= kMixFirst) {
kit_mix_from_param(project_.kit.tracks[track], command.a, params_[track].v[command.a]);
if (command.a == kMixDuck) apply_duck();
}
}
break;

Expand Down Expand Up @@ -840,11 +869,13 @@ bool Engine::apply_sound(const Command &command, int track, int) {
if (command.c == 1) {
uint8_t &send = project_.kit.tracks[track].chorus;
send = send == 0 ? kChorusSendToggle : uint8_t(0);
mix_params_from_kit(track);
break;
}
const int next = int(project_.kit.tracks[track].chorus) + int(int8_t(command.b));
project_.kit.tracks[track].chorus =
uint8_t(next < 0 ? 0 : (next > int(kChorusSendMax) ? int(kChorusSendMax) : next));
mix_params_from_kit(track);
break;
}

Expand All @@ -860,10 +891,11 @@ bool Engine::apply_sound(const Command &command, int track, int) {
if (command.c == 1) {
if (command.a == 0) *field = *field == 0 ? kSlapToggle : uint8_t(0);
else if (command.a == 1) *field = uint8_t(*field >= top ? 0 : *field + 1);
break;
} else {
const int next = int(*field) + int(int8_t(command.b));
*field = uint8_t(next < 0 ? 0 : (next > top ? top : next));
}
const int next = int(*field) + int(int8_t(command.b));
*field = uint8_t(next < 0 ? 0 : (next > top ? top : next));
if (command.a == 0) mix_params_from_kit(track);
break;
}

Expand All @@ -877,7 +909,7 @@ bool Engine::apply_sound(const Command &command, int track, int) {
const int next = int(width) + int(int8_t(command.b));
width = uint8_t(next < 0 ? 0 : (next > int(kWidthMax) ? int(kWidthMax) : next));
}
if (machines_[track] != nullptr) machines_[track]->set_width(width);
mix_params_from_kit(track);
break;
}

Expand Down Expand Up @@ -1655,6 +1687,7 @@ bool Engine::apply_mixer(const Command &command, int track, int) {
break;
}
apply_duck();
if (DuckField(command.a) == DuckField::depth) mix_params_from_kit(track);
break;
}

Expand Down Expand Up @@ -2988,6 +3021,7 @@ void Engine::kit_from_params() {
for (int t = 0; t < kTracks; t++) {
KitTrack &track = project_.kit.tracks[t];
for (int i = 0; i < kTrackParams; i++) track.params[i] = params_[t].v[i];
for (int p = kMixFirst; p < kMixEnd; p++) kit_mix_from_param(track, p, params_[t].v[p]);
track.level = mix_[t].level;
// `machine` and `sample` are not derived from anything the engine owns yet: a track's
// machine is fixed at init until M6 makes it switchable, and sample paths arrive with
Expand Down Expand Up @@ -3044,6 +3078,8 @@ void Engine::params_from_kit() {
rewire_machines();

for (int t = 0; t < kTracks; t++) {
// MIX's bytes are the fields KIT.BIN, the factory and a kit recall set.
kit_mix_to_params(project_.kit.tracks[t]);
const KitTrack &track = project_.kit.tracks[t];
for (int i = 0; i < kTrackParams; i++) {
params_[t].v[i] = track.params[i] > 127 ? uint8_t(127) : track.params[i];
Expand Down
1 change: 1 addition & 0 deletions app/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ class Engine {
bool run_choke(int t, float *mono, uint32_t frames, float *right = nullptr);
// Each POLY track's machine takes its kit's WID (core/width.hpp).
void sync_widths();
void mix_params_from_kit(int track);
uint32_t choke_at_[kTracks] = {kNoChokeFrame, kNoChokeFrame, kNoChokeFrame, kNoChokeFrame,
kNoChokeFrame, kNoChokeFrame, kNoChokeFrame, kNoChokeFrame};
float choke_gain_[kTracks] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
Expand Down
7 changes: 7 additions & 0 deletions app/ui_editview.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
return EditView::bars;
case Page::scn:
return machine_reads_scn(id) ? EditView::wave_scan : EditView::bars;
case Page::mix:
return EditView::bars;
}
return EditView::bars;
}
Expand Down Expand Up @@ -494,6 +496,11 @@
add("EACH NOTE: POS TO END");
}
break;
case Page::mix:
// The duck's source never ducks under itself, so its DCK does nothing.
if (int(engine_.project().kit.duck.source) == selected_) add("SOURCE: NO DCK");
add("ALSO ON MIXER");
break;
}
*out = 0;
}
Expand Down
18 changes: 18 additions & 0 deletions app/ui_mixer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@
// The same for any track: a macro's target names its parameter on its own track's machine.
const char *track_param_name_on(int track, int index) const {
if (!track_param_real(index)) return "---";
if (index >= kMixFirst) return kMixNames[index - kMixFirst];
if (index >= kScnFirst) {
if (machine_is_kick(engine_.machine_id(track))) return kKickTapNames[index - kScnFirst];
if (machine_is_fm(engine_.machine_id(track))) return kFmOpsNames[index - kScnFirst];
Expand Down Expand Up @@ -664,6 +665,23 @@
append(out, "MAN");
return;
}
// MIX: OFF at 0 for WID, CHO and SLP as MIXER shows them; WID on a POLY track with U
// from unison up; DCK the percent it is.
if (index >= kMixFirst && index < kMixEnd) {
if (index == kMixDuck) {
append_number(out, value);
*out++ = '%';
} else if (value == 0) {
append(out, "OFF");
} else {
if (index == kMixWidth && machine_is_poly(engine_.machine_id(selected_)) &&
value >= kWidthUnison) {
*out++ = 'U';
}
append_number(out, value);
}
return;
}
if (machine_is_wave(engine_.machine_id(selected_)) && append_wave_value(out, index, value)) return;
if (machine_is_fm(engine_.machine_id(selected_)) && append_fm_value(out, index, value)) return;
if (machine_is_grain(engine_.machine_id(selected_)) && append_grain_value(out, index, value)) return;
Expand Down
2 changes: 2 additions & 0 deletions core/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ void factory_kit(Kit &kit) {
// 1-4 still steps the hats to 48. The kick, bass, acid and chord stay where they were.
kit.tracks[kHats].width = 40;
kit.tracks[kPerc].width = 32;
// MIX's parameter bytes are those fields (core/project.hpp, kit_mix_to_params).
for (int t = 0; t < kTracks; t++) kit_mix_to_params(kit.tracks[t]);
}

// --- the sends and the master ---------------------------------------------
Expand Down
15 changes: 13 additions & 2 deletions core/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,14 +627,19 @@ constexpr const char *kGrainOscWords[4] = {"SCAN SPEED", "PITCH SPRAY", "", ""};
// The WAVE pair's SCAN page (dsp/va.cpp, "SCN").
constexpr const char *kScnWords[4] = {"SCAN MODE", "SCAN SPEED", "SCAN END FRAME", "SCAN CURVE"};
constexpr int kScanHelpPage = 10;
// Every machine's MIX page (dsp/track.hpp): the mixer's four as parameters.
constexpr const char *kMixWords[4] = {"STEREO WIDTH", "CHORUS SEND", "SLAPBACK LEVEL", "DUCK DEPTH"};
constexpr int kMixHelpPage = 11;

const char *const kEditPageNames[kHelpEditPages] = {"SRC", "FLTR", "AMP", "FX", "LFO", "ARP",
"ENV", "OSC", "---", "---", "SCAN"};
"ENV", "OSC", "---", "---", "SCAN", "MIX"};

// Does the machine read EDIT's page 6 (ASR), 7 (OSC) or 10 (SCAN)? Nobody reads the hole.
// Does the machine read EDIT's page 6 (ASR), 7 (OSC) or 10 (SCAN)? Nobody reads the hole, and
// every machine has MIX.
bool reads_page(uint8_t machine, int page) {
if (page == 6) return machine_has_asr_page(machine);
if (page == 7) return machine_has_osc_page(machine);
if (page == kMixHelpPage) return true;
return page == kScanHelpPage && machine_has_scn_page(machine);
}

Expand Down Expand Up @@ -799,6 +804,11 @@ void knob_rows(const HelpPlace &place, bool slc_auto, char rows[kHelpRows][kHelp
add_row(rows, count, "RAND DRFT");
add_row(rows, count, "SPD 64+ SYNCED");
break;
case kMixHelpPage:
add_row(rows, count, "THE MIXER SETTINGS");
add_row(rows, count, "LOCK OR SCENE THEM");
add_row(rows, count, "DCK IN PERCENT");
break;
default: break;
}
if (page == 0 && machine_is_wave(place.machine)) add_row(rows, count, "TBL 16 TABLES 8 EACH");
Expand Down Expand Up @@ -1079,6 +1089,7 @@ const char *help_param_words(uint8_t machine, int index) {
}
if (machine_is_fm(machine)) return slot == 0 ? "MODULATOR WAVE" : slot == 1 ? "ACCENT TO INDEX" : "";
return machine_reads_scn(machine) ? kScnWords[slot] : "";
case kMixHelpPage: return kMixWords[slot];
default: return "";
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/help.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ enum class HelpScreen : uint8_t {
count
};

// SRC FLTR AMP FX LFO ARP ASR OSC, two pages of the hole, SCAN: as app/app.hpp's kEditPages.
constexpr int kHelpEditPages = 11;
// SRC FLTR AMP FX LFO ARP ASR OSC, two pages of the hole, SCAN, MIX: as app/app.hpp's kEditPages.
constexpr int kHelpEditPages = 12;
constexpr int kHelpMixerPages = 23; // as app/app.hpp's kMixerPageCount
constexpr int kHelpRows = 10; // rows under the title, above the page line
constexpr int kHelpChars = 21; // one line of Enaga's font on the 128-pixel screen
Expand Down
Loading