mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 12:54:29 +01:00
V10.8.54: the creatures through one routine, Studio's project library, RESOUND on the FM-1, more banners
(the owner: "si dale" / "pasá todas esas"; "renombrar cada parte y proyecto desde Studio, management de proyectos
desde el celular"; RESOUND: "me gusta la canción pero no los sonidos")
- ANALOG WHEEL PHASE MATH/LOFI STRING's creatures through vx_gx (codex/gx-creatures 37d7a765), closer to their
own: WHEEL's worms out of their tubes waving at their harmonic, crowns of tentacles; ANALOG's isotherms
wobbling, spikes, cilia and the two oscillators orbiting; PHASE's body doubled, its tail curled; MATH's segments
doubled. WEST, VOICE, ANIMAL, FM6 and DRUM-X keep their own (protected pictures untouched).
- Editor protocol, Studio's project library (editor_backup.c ed_pj_handle; app_contract_test, backup_test):
95 PROJ_LIST () -> rc 0, NSONG, NSONG x (n, parts, flags, name[12])
parts: bit k = part A..D stored; flags: 1 the open project, 2 a GEN draft; name: part A's, ASCII
0-padded (the project's name)
96 PROJ_NAME (n, part 0..3, ASCII up to 12) -> n, part, rc (part 0's name is the project's; live, in flash)
97 PROJ_OP (op, from, to, force) -> op, from, to, rc
op 0 COPY, 1 MOVE (not the open project), 2 DELETE (from; to ignored); COPY/MOVE never onto the
open project; an occupied target only with force 1 (Studio: BACKUP_GET it first)
rc: 0 done, 1 refused (bad request, the open project as target or moved, empty part), 2 flash failed
(the target as it was), 3 playing (STOP first), 4 the target holds a project (force 0)
No BACKUP object 72+p: the names travel in PROJ_LIST and in part A's own object (40 + 4n).
- GLO + A4: RESOUND (gen.c gen_rs_prep / gen_rs_apply, the web's web_gen_resound now calls them): new sounds
for every track by its role (GEN's genre, or a seed's near the tempo), the notes, steps and song kept, the next
sections keep them (a player's sound), "RESOUND #seed"; GLO + G4 the sounds back. The GLO map's A4 RESOUND.
- Banners: RESTART (GLO + PLAY playing), a DRUM sound's mute (EDIT + black: "SD MUTED"), LANE (SEQ + black),
REC GRID n% (REC + KNOB 2), PROJECT n / LET GO: OPEN (SAVE + KNOB 1), KNOB 4: DJ FILTER / BPM (MIXER's OCT+),
"A > B NEXT BAR". A lens page's OCT+ gestures in its footer for 1.5 s on entering and while OCT+ is held
(EDIT 1 HOLD: K4 GAIN, FILTER K2 KEY TRK, REVERB / DLY K4 GATE, EUCLID, PRESETS, SCENE, PUNCH IN, TRACK GEN,
ARRANGE, TAKE, SYSTEM).
- tests/ui_render.c builds and runs its scenes again (dk_keep gone in V10.8.21; STEREO's title; pages since gone
drawn where they are).
Layout recorded again (FELUCCA_REPIN=keep); the plain build passes. Image 580784 of 584336 (3552 B free), BT
segment 72680 of 73728 (1048 B free), RAM code 32700 (the calls into the image moved; no RAM code added), pool
spare 8480. audio.c as V23's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
This commit is contained in:
15 files changed
+2739
-2354
No files matched your search
@@ -264,8 +264,88 @@ static __attribute__((noinline)) uint32_t ed_bk_write(const uint8_t *a, uint32_t
|
||||
memcpy(ED_BK_RAW + ed_bk_pos, ed_bk_buf, count); ed_bk_pos += count;
|
||||
return 0;
|
||||
}
|
||||
/* (V10.8.54, Studio's project library; the owner: "renombrar cada parte y proyecto desde Studio en tiempo real y hacer
|
||||
* management de proyectos desde el celular") three requests, stopped only for the writes:
|
||||
* 95 PROJ_LIST () -> rc 0, NSONG, per project: n, parts (bit k: A..D stored), flags (1 open, 2 a GEN draft), its
|
||||
* name (section A's), 12 bytes 0-padded
|
||||
* 96 PROJ_NAME (n, part 0..3, ASCII .. up to 12) -> n, part, rc: the part's name (part A's: the project's), live
|
||||
* 97 PROJ_OP (op 0 COPY / 1 MOVE / 2 DELETE, from, to, force) -> op, from, to, rc: COPY / MOVE a whole project to
|
||||
* another (not the open one); an occupied target only with force 1 (Studio backs it up first: BACKUP_GET)
|
||||
* rc 0 done, 1 refused (a bad request, the open project as the target, an empty part), 2 the flash failed (as it was), 3
|
||||
* playing (STOP first), 4 the target holds a project (force 0) */
|
||||
enum { ED_PROJ_LIST = 95, ED_PROJ_NAME, ED_PROJ_OP };
|
||||
#if FELUCCA_FLASH
|
||||
BTAPP_FN static uint32_t ed_pj_name(uint32_t s, uint32_t k, const char *nm) /* a part of another project renamed */
|
||||
{
|
||||
int n = st_load(ed_bk_song_obj(s, k), &proj_wire, sizeof proj_wire);
|
||||
if (n <= 0 || !proj_import(&proj_scratch, &proj_wire, n)) return 1;
|
||||
if (!proj_name_pack(&proj_scratch, nm)) return 2;
|
||||
return st_save(ed_bk_song_obj(s, k), &proj_wire, sizeof proj_wire) ? 2u : 0u;
|
||||
}
|
||||
BTAPP_FN static uint32_t ed_pj_copy(uint32_t from, uint32_t to) /* its four parts, then its rows in the index */
|
||||
{
|
||||
song_index_t *index = (song_index_t *)proj_wire_u.raw;
|
||||
for (uint32_t k = 0; k < 4u; k++) {
|
||||
int n = from == song_cur ? (project_used(k) ? (int)sizeof proj_wire : 0) : st_load(ed_bk_song_obj(from, k), &proj_wire, sizeof proj_wire);
|
||||
if (from == song_cur && n) memcpy(&proj_wire, &proj_slot[k], sizeof proj_wire);
|
||||
if (st_save(ed_bk_song_obj(to, k), &proj_wire, n > 0 ? (uint32_t)n : 0u)) return 2;
|
||||
}
|
||||
if (song_saved_index(index)) return 2;
|
||||
index->rows[to] = index->rows[from];
|
||||
memcpy(index->scene[to], index->scene[from], sizeof index->scene[to]);
|
||||
memcpy(index->tsrc[to], index->tsrc[from], sizeof index->tsrc[to]);
|
||||
memcpy(index->tvar[to], index->tvar[from], sizeof index->tvar[to]);
|
||||
if (st_save(OBJ_SONGIDX, index, sizeof *index)) return 2;
|
||||
song_index_target(index, to);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
static uint32_t ed_pj_handle(uint32_t cmd, const uint8_t *a, uint32_t n)
|
||||
{
|
||||
char nm[PROJ_NAME_LEN + 1u];
|
||||
uint32_t rc = transport_busy() ? 3u : !bt_hw_seg() || !flash_ok ? 2u : 0u, s, k;
|
||||
if (cmd == ED_PROJ_LIST) {
|
||||
ed_b(0); ed_b(NSONG);
|
||||
for (s = 0; s < NSONG; s++) {
|
||||
uint32_t m = lib_scan(s, nm);
|
||||
ed_b(s); ed_b(m); ed_b((s == song_cur) | (s == song_cur && song_draft) << 1);
|
||||
for (k = 0; k < PROJ_NAME_LEN; k++) ed_b(k < str_len(nm) ? (uint8_t)nm[k] & 127u : 0u);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (cmd == ED_PROJ_NAME) {
|
||||
s = n ? a[0] : 127u; k = n > 1u ? a[1] : 127u;
|
||||
for (uint32_t i = 0; i < PROJ_NAME_LEN + 1u; i++) nm[i] = (char)(i + 2u < n && i < PROJ_NAME_LEN ? a[i + 2u] : 0);
|
||||
if (!rc && (n < 2u || n > 14u || s >= NSONG || k > 3u)) rc = 1;
|
||||
if (!rc) rc = s == song_cur ? (uint32_t)project_rename(k, nm) :
|
||||
#if FELUCCA_FLASH
|
||||
ed_pj_name(s, k, nm);
|
||||
#else
|
||||
1u;
|
||||
#endif
|
||||
proj_wire_gen++;
|
||||
ed_b(s); ed_b(k); ed_b(rc);
|
||||
return 1;
|
||||
}
|
||||
if (cmd == ED_PROJ_OP) {
|
||||
uint32_t op = n == 4u ? a[0] : 127u, from = n == 4u ? a[1] : 127u, to = n == 4u ? a[2] : 127u;
|
||||
if (!rc && (op > 2u || from >= NSONG || (op < 2u && (to >= NSONG || to == from || to == song_cur || song_draft)) || (op == 1u && from == song_cur))) rc = 1;
|
||||
if (!rc && op < 2u && !a[3] && lib_scan(to, nm)) rc = 4;
|
||||
#if FELUCCA_FLASH
|
||||
if (!rc && op < 2u) rc = ed_pj_copy(from, to);
|
||||
#endif
|
||||
if (!rc && op) rc = song_erase_parts(from, 0) ? 2u : 0u;
|
||||
proj_wire_gen++;
|
||||
ed_b(op); ed_b(from); ed_b(to); ed_b(rc);
|
||||
if (!rc) ui_message(op == 2u ? "PROJECT DELETED" : op ? "PROJECT MOVED" : "PROJECT COPIED");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static int ed_backup_handle(uint32_t cmd, const uint8_t *a, uint32_t n)
|
||||
{
|
||||
if (cmd >= ED_PROJ_LIST && cmd <= ED_PROJ_OP)
|
||||
return (int)ed_pj_handle(cmd, a, n);
|
||||
if (cmd == ED_BACKUP_LIST) {
|
||||
uint32_t rc = n ? 1u : ed_bk_capture();
|
||||
ed_b(1); ed_b(rc); ed_b(rc ? 0u : ED_BK_N);
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#define FELUCCA_ID "FM-1_900" /* package identity (build.py: the .fwsc marker string) */
|
||||
#endif
|
||||
#ifndef FELUCCA_VERSION
|
||||
#define FELUCCA_VERSION "V10.8.53" /* (2026-11-26) V10.8.53 (the owner: "every picture from the same engine, so their room shrinks"): the pictures' shared engine (ui_gx.c: cells, a sine, chips, keys); DELAY REVERB CHORUS SENDS drawn with it, DIST's and CLIP's curve one; the big numbers in M (the V face gone), the count-in on one line, the EQ's curve, the TOOLS picture and the small beings of the lists gone; SEQ EDIT (SEQ held): KNOB 1 / 2 the selection, 3 the ACTION (STRETCH .. MUTATE, GENERATE in the selection with KNOB 4 its genre and a new seed, RANDOM on its grid 1/4 .. 1/32), 4 its amount, OCT+ does it, F#5 UNDO / REDO; GLO's mutes, UNMUTE ALL, SCL's ROOT and REC's QUANTIZE say what they did; V10.8.52 (the owner: "don't lose songs"): SAVE + C4..F4 / OCT+ over a part with music asks OVERWRITE A? (OCT+ yes, once a part until another project opens), the part it had back with GLO + G4 UNDO (again: the save again); a GEN draft saved with PROJECTS > SAVE is that project from then on (SAVE + C4, the autosave and RESTORE LAST follow it: they stayed on the music before GEN); V10.8.51 (the owner): projects of before V10.7 no longer migrated (OLD PROJECT: OPEN IN STUDIO, the slot untouched; Studio converts them: web_proj_load / web_proj_save); the MOD MATRIX AMOUNT -200 .. +198 % (100 % a full source the whole range, exactly); GEN's pieces under -1 dBFS before the master (a genre's headroom: were up to +13 dBFS); SEQ TOOLS' STRETCH SQUEEZE REPEAT on the steps held (SEL 5-8); PLAY: THE PART; V10.8.50 (the owner: "copy, paste, duplicate; select"): SEQ TOOLS C5 is DUP (the copied steps again right after them, LEN grown), step keys held + EDIT clear those steps, COPY / PASTE / DUP / CLEAR say the steps ("COPY 5-8"); V10.8.49 (the owner: SEQ TOOLS STRETCH x2, SQUEEZE /2, REPEAT x2 back on C4 D4 E4, NUDGE < / > on C#5 D#5; ABOUT's AUDIO LOAD lines and RAMP's curve out for the room); V10.8.48 (the owner: "everything lacks decay and release, all at sustain 100"; "the leads: decay, little sustain, a lot of release"; "the chords all filtered the same: the bands, the whole generator"): GEN's envelopes by role, a part's filter TYPE its own (BP, HP with KEY TRK), the GAIN making up what they take. V10.8.47 (the owner: "play and edit; the information, the names of the section: parts, song, arrange"): PART SLOTS' LOAD is PLAY/EDIT, STORE is SAVE, PLAY's LOOP is PART, a song's END LOOP is REPEAT, a part with no name its bars in the song, NOW is PLAYING, ARRANGE's tokens PART+BARS, JAM's and TAKE's SEQ is PART, CAMBIO is SWITCH. (2026-11-25) V10.8.46 (the owner): GEN: a part never still (its LFO slow and free on the filter and the shape, the stereo, a note's envelope on the shape), the rows' colours an arc, the envelopes by role, the build's high-pass in sixteenths, phonk the drift one alone; MENU > ABOUT's LAST CRASH back; V10.8.45 (the owner): the ARP on its RATE's grid of the transport while it plays, recorded on its steps; MENU > ABOUT's CPU lines and the velocity diagnostic out, the header's load a number; GEN: sections half as long, a row its own colour (the macros) and a section come again varied, DANCE's kit not longer, the build's filter sweep a bar, the envelopes. (2026-11-25) V10.8.44 (the owner): a GATE on the reverb and on the delay (FX > REVERB / DLY, OCT+ held + KNOB 4), a synth's LEVEL page (GAIN LEVEL PAN) after EDIT; V10.8.43 (BYTE's): RADIO: a STOP on the piece's last bar stops (chain.fin: the song's own END alone the next piece); GEN leaves SCL > HARMONY alone (on: the piece on the tonic chord); a lead's preset on a chord part without its fast vibrato. (2026-11-24) V10.8.42 (PR #241's ideas, in this generator): hard bass's DONK (PHASE's resonant saw), DREAM POP an organ's or a guitar's throw and its tape slower, an accented hit never thinned, IDM's roll in the phrase's turnaround; before: (2026-11-24) V10.8.41 (the owner: "the melodies and the drums sound generic", genre by genre): GEN: the riffs motifs of written rhythm and contour cells with an answer (BAILE FUNK, PHONK, DUBSTEP), JAZZ's comping written and its hats down, IDM GLITCH broken cells and placed rolls (no bursts), the basses under the drums and ducked (gen_stems' check), DUBSTEP low FOLD and chorus, CUMBIA, REGGAETON, HOUSE, HARD BASS, SHOEGAZE, DREAM POP as asked; TECHNO darker (phrygian, a line of 7 or 6 beats over the 4, its filter moving), EXPLORE its own: the minor modes, sevenths and ninths, borrowed chords, the drums edited, a cut, lines that evolve; MOOD: CALM lighter to -25, DANCE keeps a half-time's kick, EXPLORE's tempo; the FUGA genre gone (the owner); code no page reaches removed (no visible change). V10.8.40 (a user, the owner): the tempo exact and every DIV on one grid (a beat a multiple of 24 samples, the sequencer's time giving back what that cuts: fx.c beat_samples, seq.c tempo_acc; a 1/32 track was 12 ms a minute ahead of a 1/16 one at 133 BPM); a track's place from the transport's at every step (seq.c seq_anchor: after a LEN oLine truncated
|
||||
#define FELUCCA_VERSION "V10.8.54" /* (2026-11-26) V10.8.54 (the owner: "pasá todas esas", Studio's projects, RESOUND): ANALOG WHEEL PHASE MATH STRING's creatures through one routine (vx_gx; WHEEL's worms waving with their crowns, ANALOG's spikes cilia and oscillators); editor PROJ_LIST 95 / PROJ_NAME 96 / PROJ_OP 97 (Studio's library: rename a part or a project live, copy move delete a project); GLO + A4 RESOUND (new sounds for the whole song, its notes kept; GLO + G4 back); RESTART, a DRUM sound's mute, LANE, REC GRID, PROJECT n, MIXER's KNOB 4 and "A > B NEXT BAR" said; a lens page's OCT+ gestures in its footer (1.5 s, and while OCT+ is held); V10.8.53 (the owner: "every picture from the same engine, so their room shrinks"): the pictures' shared engine (ui_gx.c: cells, a sine, chips, keys); DELAY REVERB CHORUS SENDS drawn with it, DIST's and CLIP's curve one; the big numbers in M (the V face gone), the count-in on one line, the EQ's curve, the TOOLS picture and the small beings of the lists gone; SEQ EDIT (SEQ held): KNOB 1 / 2 the selection, 3 the ACTION (STRETCH .. MUTATE, GENERATE in the selection with KNOB 4 its genre and a new seed, RANDOM on its grid 1/4 .. 1/32), 4 its amount, OCT+ does it, F#5 UNDO / REDO; GLO's mutes, UNMUTE ALL, SCL's ROOT and REC's QUANTIZE say what they did; V10.8.52 (the owner: "don't lose songs"): SAVE + C4..F4 / OCT+ over a part with music asks OVERWRITE A? (OCT+ yes, once a part until another project opens), the part it had back with GLO + G4 UNDO (again: the save again); a GEN draft saved with PROJECTS > SAVE is that project from then on (SAVE + C4, the autosave and RESTORE LAST follow it: they stayed on the music before GEN); V10.8.51 (the owner): projects of before V10.7 no longer migrated (OLD PROJECT: OPEN IN STUDIO, the slot untouched; Studio converts them: web_proj_load / web_proj_save); the MOD MATRIX AMOUNT -200 .. +198 % (100 % a full source the whole range, exactly); GEN's pieces under -1 dBFS before the master (a genre's headroom: were up to +13 dBFS); SEQ TOOLS' STRETCH SQUEEZE REPEAT on the steps held (SEL 5-8); PLAY: THE PART; V10.8.50 (the owner: "copy, paste, duplicate; select"): SEQ TOOLS C5 is DUP (the copied steps again right after them, LEN grown), step keys held + EDIT clear those steps, COPY / PASTE / DUP / CLEAR say the steps ("COPY 5-8"); V10.8.49 (the owner: SEQ TOOLS STRETCH x2, SQUEEZE /2, REPEAT x2 back on C4 D4 E4, NUDGE < / > on C#5 D#5; ABOUT's AUDIO LOAD lines and RAMP's curve out for the room); V10.8.48 (the owner: "everything lacks decay and release, all at sustain 100"; "the leads: decay, little sustain, a lot of release"; "the chords all filtered the same: the bands, the whole generator"): GEN's envelopes by role, a part's filter TYPE its own (BP, HP with KEY TRK), the GAIN making up what they take. V10.8.47 (the owner: "play and edit; the information, the names of the section: parts, song, arrange"): PART SLOTS' LOAD is PLAY/EDIT, STORE is SAVE, PLAY's LOOP is PART, a song's END LOOP is REPEAT, a part with no name its bars in the song, NOW is PLAYING, ARRANGE's tokens PART+BARS, JAM's and TAKE's SEQ is PART, CAMBIO is SWITCH. (2026-11-25) V10.8.46 (the owner): GEN: a part never still (its LFO slow and free on the filter and the shape, the stereo, a note's envelope on the shape), the rows' colours an arc, the envelopes by role, the build's high-pass in sixteenths, phonk the drift one alone; MENU > ABOUT's LAST CRASH back; V10.8.45 (the owner): the ARP on its RATE's grid of the transport while it plays, recorded on its steps; MENU > ABOUT's CPU lines and the velocity diagnostic out, the header's load a number; GEN: sections half as long, a row its own colour (the macros) and a section come again varied, DANCE's kit not longer, the build's filter sweep a bar, the envelopes. (2026-11-25) V10.8.44 (the owner): a GATE on the reverb and on the delay (FX > REVERB / DLY, OCT+ held + KNOB 4), a synth's LEVEL page (GAIN LEVEL PAN) after EDIT; V10.8.43 (BYTE's): RADIO: a STOP on the piece's last bar stops (chain.fin: the song's own END alone the next piece); GEN leaves SCL > HARMONY alone (on: the piece on the tonic chord); a lead's preset on a chord part without its fast vibrato. (2026-11-24) V10.8.42 (PR #241's ideas, in this generator): hard bass's DONK (PHASE's resonant saw), DREAM POP an organ's or a guitar's throw and its tape slower, an accented hit never thinned, IDM's roll in the phrase's turnaround; before: (2026-11-24) V10.8.41 (the owner: "the melodies and the drums sound generic", genre by genre): GEN: the riffs motifs of written rhythm and contour cells with an answer (BAILE FUNK, PHONK, DUBSTEP), JAZZ's comping written and its hats down, IDM GLITCH broken cells and placed rolls (no bursts), the basses under the drums and ducked (gen_stems' check), DUBSTEP low FOLD and chorus, CUMBIA, REGGAETON, HOUSE, HARD BASS, SHOEGAZE, DREAM POP as asked; TECHNO darker (phrygian, a line of 7 or 6 beats over the 4, its filter moving), EXPLORE iLine truncated
|
||||
#endif
|
||||
#if FELUCCA_OTA && !FELUCCA_FLASH
|
||||
#error "FELUCCA_OTA needs FELUCCA_FLASH"
|
||||
|
||||
@@ -3748,3 +3748,100 @@ static void gen_panel(void)
|
||||
cv_text_in(4, 128, 232, &AF_X, v, song_draft ? T_ACCENT : T_TEXT, T_SURF);
|
||||
}
|
||||
#include "gen_track.c"
|
||||
|
||||
/* (V10.8.54, the owner on the RADIO: "a song I like but not its sounds") RESOUND: every track's notes, steps and song kept,
|
||||
* new sounds for all of them at once, each by its role (a bass a bass's, the chords a chord's, the drums a kit), out of
|
||||
* GEN's own picker with a seed of its own. A GEN piece (a draft: its roles and genre known): that genre's sounds
|
||||
* (EXPLORE: EXPLORE's); a project of the player's: the roles by what each track plays (gls_role), the genre a seed's among
|
||||
* those whose tempo is near the song's. On the FM-1 GLO + A4 (layer_key): the music playing; the next sections keep the
|
||||
* new sounds (sec_apply: a sound the player changed is held), SAVE keeps them, GLO + G4 undoes it. The emulator's RADIO
|
||||
* (web_gen_resound) also gives the four stored parts the new sounds. gen_rs_prep: the roles and the genre (0: nothing to
|
||||
* resound); gen_rs_apply: the sounds on the tracks (GEN's state as it was after) */
|
||||
static struct { uint8_t role[NTRK]; int16_t gi; uint16_t seed; } gen_rs __attribute__((section(".pool"))); /* (in the pool: no global of
|
||||
* the RAM region moves) the roles, the genre (-1 EXPLORE), the seed */
|
||||
#define rs_role gen_rs.role
|
||||
#define rs_gi gen_rs.gi
|
||||
#define rs_seed gen_rs.seed
|
||||
BTAPP_FN static uint32_t gen_rs_prep(uint32_t seed)
|
||||
{
|
||||
uint32_t k, any = 0, h = seed % 10000u, gen = song_draft && gs.g;
|
||||
for (k = 0; k < NTRK; k++) {
|
||||
uint32_t r = gen && k < trk_live ? gs.role[k] : k < trk_live ? gls_role(&trk[k]) : RL_N;
|
||||
if (k < trk_live && drum_track(&trk[k])) r = RL_DRUM;
|
||||
else if (r == RL_DRUM) r = RL_N; /* (a part GEN gave the drums on a track not DRUM-X's) */
|
||||
rs_role[k] = (uint8_t)(r < RL_N ? r : RL_N);
|
||||
any |= r < RL_N;
|
||||
}
|
||||
if (gen) rs_gi = (int16_t)(gs.gi < NGENRE ? gs.gi : -1);
|
||||
else { /* (a seed's genre, its tempo near the song's) */
|
||||
uint32_t bpm = (uint32_t)song.g[G_BPM], x = h * 2654435761u + 1u, i, gi = 0;
|
||||
for (i = 0; i < 32u; i++) {
|
||||
x ^= x << 13; x ^= x >> 17; x ^= x << 5;
|
||||
gi = x % NGENRE;
|
||||
if (bpm + 24u >= GENRE[gi].bpm_lo && bpm <= GENRE[gi].bpm_hi + 24u) break;
|
||||
}
|
||||
rs_gi = (int16_t)gi;
|
||||
}
|
||||
rs_seed = (uint16_t)h;
|
||||
return any;
|
||||
}
|
||||
BTAPP_FN static void gen_rs_apply(void)
|
||||
{
|
||||
struct { __typeof__(gp) p; __typeof__(gs) s; ggenre_t g; __typeof__(gx) x; uint32_t q; } save = {gp, gs, gmut, gx, gq};
|
||||
uint32_t i, k, n;
|
||||
memset(&gs, 0, sizeof gs); memset(&gx, 0, sizeof gx); gx.eng = -1;
|
||||
gp.seed = rs_seed;
|
||||
for (i = 0; i < GP_N; i++) gp.amt[i] = GA_AUTO;
|
||||
gseed(GS_PICK);
|
||||
if (rs_gi < 0) { gx.on = 1; gx_genre(&gmut); gs.gi = NGENRE; }
|
||||
else { gs.gi = (uint8_t)rs_gi; gmut = GENRE[gs.gi]; }
|
||||
gs.g = &gmut;
|
||||
gen_pick();
|
||||
gmut.kit = (uint8_t)((gmut.kit + 1u + gr() % (KIT_N - 1u)) % KIT_N); /* (another kit than the genre's) */
|
||||
gs.energy = gp.energy; gs.complex = (uint8_t)(gp.complex ? gp.complex : 50u);
|
||||
for (k = 0; k < RL_N; k++) gs.trk_of[k] = NTRK;
|
||||
for (k = 0; k < NTRK; k++) {
|
||||
uint32_t r = rs_role[k];
|
||||
gs.role[k] = (uint8_t)(r < RL_N ? r : RL_TEX);
|
||||
if (r >= RL_N) continue;
|
||||
gs.act[r] = 1;
|
||||
if (gs.trk_of[r] == NTRK) gs.trk_of[r] = (uint8_t)k;
|
||||
}
|
||||
gs.fm6 = 0; gs.ftl = 0;
|
||||
gseed(GS_SOUND);
|
||||
for (n = gr() % NTRK, k = 0; k < NTRK; k++) { /* (gen_make's order: from a throw's own track on) */
|
||||
uint32_t ti = (k + n) % NTRK, r = rs_role[ti];
|
||||
track_t *t = &trk[ti];
|
||||
if (ti >= trk_live || r >= RL_N) continue;
|
||||
if (r == RL_DRUM) { if (drum_track(t)) gen_kit(t); continue; }
|
||||
if (drum_track(t)) continue; /* (a kit's track playing a melody: its kit kept) */
|
||||
{ /* (another sound than the one it had: the picker asked again, up to 8 times, till the engine or the preset
|
||||
* differs) */
|
||||
uint32_t e0 = t->eng_req, p0 = t->preset, tries;
|
||||
uint8_t fm6 = gs.fm6, ftl = gs.ftl, odd = gx.odd;
|
||||
for (tries = 0; tries < 8u; tries++) {
|
||||
gs.fm6 = fm6; gs.ftl = ftl; gx.odd = odd;
|
||||
if (gx.on) gx.eng = gx_engine(r);
|
||||
gen_sound(t, r, r == RL_BASS ? gmut.snd[GP_BASS] : r == RL_PAD ? gmut.snd[GP_CHORDS] : r == RL_LEAD ? gmut.snd[GP_LEAD] :
|
||||
r == RL_ARP ? gmut.snd[GP_ARP] : gmut.tex);
|
||||
gx.eng = -1;
|
||||
if (gx.on) gx_sound(t, r);
|
||||
if (t->eng_req != e0 || t->preset != p0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
gseed(GS_MIX);
|
||||
for (k = 0; k < NTRK && k < trk_live; k++)
|
||||
if (rs_role[k] < RL_N) { gen_mix(&trk[k], rs_role[k]); gen_fxs(&trk[k], rs_role[k]); gen_evolve(&trk[k], rs_role[k]); }
|
||||
gp = save.p; gs = save.s; gmut = save.g; gx = save.x; gq = save.q;
|
||||
}
|
||||
static void rs_banner(void) { char b[8]; fmt_int(b, (int32_t)rs_seed); ui_say("RESOUND #", b); ui.force = 1; }
|
||||
/* GLO + A4: a new seed each press (the time's) */
|
||||
static void gen_resound_key(void)
|
||||
{
|
||||
if (!bt_hw_seg()) { seg_missing(); return; }
|
||||
if (!gen_rs_prep(fm1_ms * 2654435761u >> 18)) { ui_message("NOTHING TO RESOUND"); return; }
|
||||
undo_mark(); /* (GLO + G4: the sounds as they were) */
|
||||
gen_rs_apply();
|
||||
rs_banner();
|
||||
}
|
||||
@@ -351,7 +351,8 @@ static int section_jump(uint32_t s)
|
||||
if (song_stage(s, SEC_LIVE))
|
||||
return 1;
|
||||
live.req = (int8_t)s;
|
||||
ui_say(b, " NEXT BAR");
|
||||
if (live.cur >= 0 && live.cur != (int8_t)s) { b[0] = (char)('A' + live.cur); b[1] = ' '; b[2] = '>'; b[3] = ' '; b[4] = (char)('A' + s); b[5] = 0; }
|
||||
ui_say(b, " NEXT BAR"); /* (V10.8.54: "A > B NEXT BAR") */
|
||||
return 0;
|
||||
}
|
||||
/* (V10.6s) SAVE > CLIPS: track k's cell of part s in on the next bar (stopped: now, and PLAY): the other tracks play on
|
||||
|
||||
@@ -687,6 +687,7 @@ static uint32_t page_first(uint32_t fam)
|
||||
static int lens_on(void) { return !ui.home && !page_over && PAGES[ui.page].fam == FAM_SEQ; }
|
||||
static int save_on(void) { return !ui.home && !page_over && PAGES[ui.page].fam == FAM_SAVE; }
|
||||
static void page_entered(void);
|
||||
static uint32_t lz_hint_ms __attribute__((section(".pool"))); /* (V10.8.54) the page entered at: its OCT+ hint (ui_draw.c lz_hint) */
|
||||
static void page_flash(void);
|
||||
#define FX_NMOD 6u
|
||||
static const char *const FX_MOD[FX_NMOD] = {"DELAY", "REVERB", "CHORUS", "SLICER", "PUNCH IN", "MASTER"}; /* (snd2: MASTER */
|
||||
@@ -882,6 +883,7 @@ static void page_entered(void)
|
||||
br_armed = 0;
|
||||
if (pg->graph == GR_SLOTS && !song_draft) song_save_target = song_cur; /* (PROJECTS: this project picked first) */
|
||||
ui.knob_ms = fm1_ms; /* (0.9.0) HUD: the knob row whole again on a new page */
|
||||
lz_hint_ms = fm1_ms; /* (V10.8.54) its OCT+ gestures said in the footer */
|
||||
if (!ui.home && pg->fam == FAM_FX && fx_trk_k(ui.page) < 0 && pg->graph != GR_BUSES)
|
||||
ui.fxmod = (uint8_t)fx_mod_of(ui.page); /* (FX: the effect shown, BUSES' tile lit) */
|
||||
if (!ui.home && pg->graph == GR_EVENTS) /* AUTO LIST: + ADD LOCK on the SEQ cursor's step */
|
||||
|
||||
@@ -1103,6 +1103,20 @@ static __attribute__((noinline)) void draw_crumbs(int32_t y, uint16_t fg, uint16
|
||||
cv_free_text(x, y, f, b + k, last, T_BG, mx - x);
|
||||
}
|
||||
}
|
||||
/* (V10.8.54, the owner: "que cada función diga lo que hace") a lens page with OCT+ gestures: its footer says them, 1.5 s
|
||||
* on entering the page and while OCT+ is held, in place of the breadcrumb. Its page's title, then what OCT+ does */
|
||||
static const char *const LZ_HINT[] = {"EDIT 1", "HOLD: K4 GAIN", "FILTER", "HOLD: K2 KEY TRK", "REVERB", "HOLD: K4 GATE",
|
||||
"DLY", "HOLD: K4 GATE", "EUCLID", "MUTATE \xB7 HOLD: K4 EVERY", "PRESETS", "KEEP",
|
||||
"SCENE", "DICE", "PUNCH IN", "EDITOR", "TRACK GEN", "MAKE", "ARRANGE", "ADD ROW", "TAKE", "GO", "SYSTEM", "OPEN"};
|
||||
static const char *lz_hint(void)
|
||||
{
|
||||
uint32_t i;
|
||||
if (ui.home || (fm1_ms - lz_hint_ms > 1500u && !((fm1_in.buttons >> panel.btn[B_OCTUP]) & 1u)))
|
||||
return 0;
|
||||
for (i = 0; i < NELEM(LZ_HINT); i += 2u)
|
||||
if (str_eq(cur_page()->title, LZ_HINT[i])) return LZ_HINT[i + 1u];
|
||||
return 0;
|
||||
}
|
||||
static void draw_foot(void)
|
||||
{
|
||||
char s[48], ti[20];
|
||||
@@ -1122,6 +1136,7 @@ static void draw_foot(void)
|
||||
sig += str_hash(str_hash(act_ready() ? 7u : 3u, ha), hb);
|
||||
}
|
||||
sig += (uint32_t)accw * 977u + (uint32_t)clip.n * 7919u; /* (seq2h) the clipboard's [n] */
|
||||
sig += lz && lz_hint() ? 31337u : 0u;
|
||||
if (!ui.force && sig == ui.foot_sig)
|
||||
return;
|
||||
ui.foot_sig = sig;
|
||||
@@ -1140,6 +1155,10 @@ static void draw_foot(void)
|
||||
GFX_HOOK_ALIGN(0, 0, 240, 0, AL_H | AL_CELLS | AL_N(16), "footer step bars centred");
|
||||
(void)foot_strip(12, 1, 0);
|
||||
}
|
||||
if (lz && lz_hint()) { /* (V10.8.54) OCT+'s gestures said */
|
||||
khint_t kh = {KC_OCTUP, lz_hint()};
|
||||
cv_key_row(8, 232, ry - 2, &kh, 1, 3u, T_BG);
|
||||
} else
|
||||
draw_crumbs(ry, T_DIM, accw ? T_ACCENT : T_DIM); /* (0.8.5) row 2: the breadcrumb (the track's engine and sound:
|
||||
* the header's centre) */
|
||||
cv_blit(0, foot_y());
|
||||
|
||||
+186
-2
@@ -61,6 +61,9 @@
|
||||
* ADD (MEDUSA, the jellyfish of its partials, until V10.7.13: gone for GEN's FORM MY LOOP; the being now)
|
||||
* Each takes a rectangle (vx_draw: EDIT's left panel, HOME's middle, or a whole panel) and scales to it.
|
||||
* State: vxs (in the pool: no global of the RAM region moves). MENU > ANIM OFF: they rest. */
|
||||
#ifndef VX_GX
|
||||
#define VX_GX 1 /* (V10.8.54: the creatures through vx_gx; 0: their own) */
|
||||
#endif
|
||||
#define VX_POOL __attribute__((section(".pool")))
|
||||
#define VX_CODE __attribute__((noinline)) /* (each creature its own function: its size on its own) */
|
||||
#define VX_SEG BTAPP_FN /* (V10.48) LOFI's, ANIMAL's and STRING's creatures in the Bluetooth
|
||||
@@ -1530,6 +1533,8 @@ static VX_CODE void vx_west(const track_t *t, const int32_t *A, int32_t en_home)
|
||||
vxs.kc = 0;
|
||||
}
|
||||
|
||||
#define VX_K_STRING 7u
|
||||
#if !VX_GX /* (prototype, codex/gx-creatures: vx_gx draws them) */
|
||||
/* -------------------------------------------------------------------------------------------- PHASE --- */
|
||||
/* the bent phase of PHASE's wave w at dcw (0..65535), as eng_phase.c's pd_wave bends it (the mock-up's pdPhase) */
|
||||
static uint32_t vx_pd(uint32_t w, uint32_t dcw, uint32_t ph)
|
||||
@@ -1762,7 +1767,6 @@ static VX_SEG void vx_lofi(const track_t *t, const int32_t *A, int32_t en_home)
|
||||
/* (0.9.9-snd5) STRING and ADD keep their time, level and newest note in vxs's slots of PHASE (7) and WHEEL (5): one creature
|
||||
* is drawn at a time (EDIT's, HOME's), so a slot shared costs a glance at most when the track changes, and no byte of the
|
||||
* pool (at its floor) */
|
||||
#define VX_K_STRING 7u
|
||||
/* ---------------------------------------------------------------------------------------- (snd5) STRING --- */
|
||||
/* TEJEDORA II: a radial web, a ray a voice (its line, one period, along it); the spider stands on the newest ray at POS
|
||||
* and plucks it with the exciter EXCITE draws; STRETCH warps the spiral, BODY and SIZE the cocoon hanging at the side */
|
||||
@@ -1864,6 +1868,7 @@ static VX_SEG void vx_string(const track_t *t, const int32_t *A, int32_t en_home
|
||||
vxs.kc = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* (snd5) ADD's creature: gone in V10.7.13+ (room for GEN's FORM MY LOOP): ADD draws the being (ui_being.c) */
|
||||
|
||||
/* (V10.54) INPUT: the audio interface's two inputs as meters (lit: the ones SOURCE takes), GATE's level across them,
|
||||
@@ -1951,6 +1956,174 @@ static VX_SEG void vx_input(const track_t *t, const int32_t *A, int32_t en_home)
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- (prototype, codex/gx-creatures) one engine --- */
|
||||
/* (the owner: "todos los gráficos del sistema vengan del mismo motor") ANALOG's cell, WHEEL's tube worms, WEST's folded
|
||||
* wave, PHASE's snail, LOFI's caterpillar and STRING's spider drawn by one routine from a row of VX_G: the wave each
|
||||
* draws is the sound out (the scope's last 256 samples, as LOFI's was), not each engine's own model of it; the shape
|
||||
* (kind), its count (n) and the three knobs it follows (pa pb pc: P_E0 + them) its row's. They keep the family's face
|
||||
* (vx_bface), the heat, the squash of a note and the time that runs with the sound */
|
||||
#if VX_GX
|
||||
enum { GK_CELL, GK_TUBES, GK_SNAIL, GK_CHAIN, GK_WEB };
|
||||
typedef struct { const engine_t *e; uint8_t k, kind, n, pa, pb, pc, uk; int8_t dy; } vxg_t;
|
||||
static const vxg_t VX_G[] = {
|
||||
{&ENG_ANALOG, 3, GK_CELL, 3, 4, 5, 6, 112, 32}, /* CUT RES DRIVE */
|
||||
{&ENG_WHEEL, 5, GK_TUBES, 9, 6, 5, 4, 100, 0}, /* DRIVE CLICK PERC */
|
||||
{&ENG_PHASE, 7, GK_SNAIL, 96, 2, 7, 6, 110, 24}, /* DCW FB SUB */
|
||||
{&ENG_LOFI, 8, GK_CHAIN, 8, 1, 2, 3, 112, 0},
|
||||
{&ENG_STRING, 7, GK_WEB, 6, 2, 4, 3, 95, 0}, /* BRIGHT STRETCH POS */
|
||||
};
|
||||
static int32_t vx_gw(int32_t i) { return vxs.wv[i & 127]; } /* the wave out, Q12 (-4096 .. 4096) */
|
||||
static VX_SEG void vx_gx(const track_t *t, const int32_t *A, int32_t en_home, const vxg_t *g)
|
||||
{
|
||||
const int16_t *p = t->p;
|
||||
vxf_t f = vx_uf(A, g->uk, g->dy);
|
||||
uint32_t k = g->k, mt = vxs.mt[k], age, w0 = scope_w - 256u, i, n = g->n;
|
||||
int32_t en = vx_level(t, k, en_home), pa = p[P_E0 + g->pa] * 2, pb = p[P_E0 + g->pb] * 2, pc = p[P_E0 + g->pc] * 2;
|
||||
int32_t pk = 3000, j, sq, q[2 * 25], x, y, r, sway = (og_sin(vx_ang(mt, 60)) * en) >> 15;
|
||||
age = vx_age(t, k, 0);
|
||||
sq = vx_sq(102 + (en * 154 >> 8), age);
|
||||
vxs.kc = 1;
|
||||
for (i = 0; i < 256u; i++) { j = scope_buf[(w0 + i) & (SCOPE_N - 1u)]; j = j < 0 ? -j : j; pk = j > pk ? j : pk; }
|
||||
for (i = 0; i < 128u; i++) { /* (two samples a point, smoothed) */
|
||||
int32_t a0 = scope_buf[(w0 + 2u * i - 1u) & (SCOPE_N - 1u)] + scope_buf[(w0 + 2u * i) & (SCOPE_N - 1u)] * 2 +
|
||||
scope_buf[(w0 + 2u * i + 1u) & (SCOPE_N - 1u)];
|
||||
vxs.wv[i] = en ? (int16_t)(a0 * 1024 / pk) : 0;
|
||||
}
|
||||
switch (g->kind) {
|
||||
case GK_CELL: { /* a cell: three isotherms of the wave (mirrored: closed), DRIVE's
|
||||
* spikes where it clips, RES a ring at CUT, its cilia, the two
|
||||
* oscillators orbiting under it */
|
||||
int32_t R = 432 + (en * 52 >> 8), am = 72 + (en * 64 >> 8), c[4] = {0, 32, 256 + sq / 5, 256 - sq / 5};
|
||||
uint32_t a0 = vx_ang(mt, 4), a1 = vx_ang(mt, 100);
|
||||
for (j = 0; j < 3; j++) {
|
||||
int32_t sc = 256 - j * 70, pr = 0;
|
||||
uint32_t pt = 0;
|
||||
for (i = 0; i <= 64u; i++) {
|
||||
uint32_t th = i * 1024u + a0;
|
||||
r = (R * sc >> 8) + ((vx_gw((int32_t)(i <= 32u ? i : 64u - i) * 4) * am >> 12) * sc >> 8) + ((og_sin(3u * th + a1) * 10) >> 15);
|
||||
if (i) vx_pl(&f, c, pt, pr, th, r, 36 + j * 54 + en / 4 + pc / 5);
|
||||
pt = th; pr = r;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 48u; i++) { /* the spikes (DRIVE's length where the wave is high), the cilia */
|
||||
int32_t v = vx_gw((int32_t)(i <= 24u ? i : 48u - i) * 5);
|
||||
uint32_t th = i * 65536u / 48u + a0;
|
||||
v = v < 0 ? -v : v;
|
||||
if (v > 1200) vx_pl(&f, c, th, R + 40, th, R + 120 + pc + v / 40, 154 + pc / 4);
|
||||
vx_pl(&f, c, th, R + am + 16, th + 1043u, R + am + 32 + vx_hash(i + (mt >> 8)) / 8, 50 + en / 4);
|
||||
}
|
||||
if (pb > 20) vx_ring(&f, 0, 32, R * (56 + pa / 2) / 256, R * (56 + pa / 2) / 256, 102 + pb / 2);
|
||||
for (j = 0; j < 2; j++) { /* the two oscillators, orbiting */
|
||||
uint32_t a = j ? 32768u - vx_ang(mt, 30) : vx_ang(mt, 30);
|
||||
vx_ring(&f, (og_cos(a) * 64) >> 15, 32 + 144 + ((og_sin(a) * 26) >> 15), j ? 30 : 42, j ? 30 : 42, 200 + en / 5);
|
||||
}
|
||||
vx_bface(&f, 0, -48, 240, en * 294 >> 8, age < 90u, pc);
|
||||
break;
|
||||
}
|
||||
case GK_TUBES: /* tube worms: a drawbar each (its digit under it) out of its tube,
|
||||
* waving at its harmonic, its crown as many tentacles as that; the
|
||||
* sound sways them */
|
||||
vx_line(&f, -62 * 16, 30 * 16, 62 * 16, 30 * 16, 31 + (en * 77 >> 8));
|
||||
for (i = 0; i < n; i++) {
|
||||
int32_t l = drw_level(p, i), X = (-48 + (int32_t)i * 12) * 16, top = 30 * 16 - (6 + l * 7) * 16, th = 64 + l * 35, hx = X, hy, m;
|
||||
int32_t b = (og_sin(vx_ang(mt, 90) + i * 7000u) * (8 + en / 3)) >> 15;
|
||||
th = th < 30 * 16 - top ? th : 30 * 16 - top;
|
||||
hy = 30 * 16 - th;
|
||||
vx_line(&f, X - 42, 30 * 16, X - 38, hy, 46 + en / 5); vx_line(&f, X + 42, 30 * 16, X + 38, hy, 46 + en / 5);
|
||||
vx_ring(&f, X, hy, 42, 14, 64 + en / 5);
|
||||
if (!vx_small) { char d[2] = {(char)('0' + l), 0}; vx_text(f.cx + ((X * f.s) >> 8), f.cy + ((36 * 16 * f.s) >> 8), d, l ? T_MID : T_DIM); }
|
||||
if (!l) continue;
|
||||
for (j = 1; j <= 8; j++) { /* (two walls, waving at the drawbar's harmonic) */
|
||||
x = X + b * j * j / 64 + ((og_sin((uint32_t)(j * VW_RAT[i] * 65536 / 256) - vx_ang(mt, 200 + (int32_t)i * 16)) * (8 + en / 10)) >> 15);
|
||||
y = 30 * 16 - th - j * (30 * 16 - th - top) / 8;
|
||||
vx_line(&f, hx - 26, hy, x - 26, y, 51 + l * 10 + en / 6); vx_line(&f, hx + 26, hy, x + 26, y, 51 + l * 10 + en / 6);
|
||||
hx = x; hy = y;
|
||||
}
|
||||
hy -= 42;
|
||||
m = clamp(((int32_t)VW_RAT[i] + 4) / 8, 2, 8);
|
||||
for (j = 0; j < m; j++) { /* its crown */
|
||||
uint32_t a = 65536u - (uint32_t)(4915 + 22938 * j / (m - 1));
|
||||
r = 104 + ((og_sin(vx_ang(mt, 200) + (uint32_t)(j + (int32_t)i) * 10430u) * 20 >> 15) * (64 + en) >> 8);
|
||||
vx_pl(&f, (const int32_t[4]){hx, hy, 256, 256}, a, 52, a, r, 77 + l * 13);
|
||||
}
|
||||
vx_ring(&f, hx, hy, 51, 48, 82 + l * 13 + en / 6);
|
||||
vx_face(&f, hx, hy - 6, 18, 16, age < 90u && l > 3, hy + 19, 10, 0, 10, 243, 218, 154);
|
||||
}
|
||||
break;
|
||||
case GK_SNAIL: { /* a snail: its shell the wave on a spiral, chambered, its body
|
||||
* and foot the wave, eyestalks pulling in on a note */
|
||||
int32_t cx = -8 * 16, cy = -10 * 16 - sq / 4, a2 = 24 + pb / 8, ox = 0, oy = 0, X, Y;
|
||||
for (i = 0; i < n; i++) {
|
||||
uint32_t a = i * 65536u * 5u / 2u / n + vx_ang(mt, 3);
|
||||
r = (int32_t)i * 26 * 16 / (int32_t)n + 32 + (vx_gw((int32_t)i) * a2 >> 12) * (int32_t)i / (int32_t)n;
|
||||
x = cx + ((og_cos(a) * r) >> 15); y = cy + ((og_sin(a) * r * 9 / 10) >> 15);
|
||||
if (i) vx_line(&f, ox, oy, x, y, 80 + (int32_t)i * 140 / (int32_t)n + en / 4);
|
||||
if (i % 6u == 0u) vx_line(&f, cx, cy, x, y, 60 + (int32_t)i * 120 / (int32_t)n);
|
||||
ox = x; oy = y;
|
||||
}
|
||||
for (i = 0, x = 0; i <= 48u; i++) { /* the body (over the foot) */
|
||||
int32_t X = (-50 + (int32_t)i * 2) * 16, Y = 14 * 16 + (vx_gw((int32_t)i * 2) * (2 + pc / 32) >> 8) - (i > 36u ? ((int32_t)i - 36) * 16 : 0);
|
||||
if (i) { vx_line(&f, x, y, X, Y, 120 + en / 2); vx_line(&f, x, y + 24, X, Y + 24, 90 + en / 2); }
|
||||
x = X; y = Y;
|
||||
}
|
||||
for (i = 0, x = -50 * 16, y = 14 * 16; i <= 12u; i++) { /* its tail, curled */
|
||||
uint32_t a = i * 5461u + 16384u;
|
||||
r = 96 - (int32_t)i * 6;
|
||||
X = -58 * 16 + ((og_cos(a) * r) >> 15); Y = 8 * 16 + ((og_sin(a) * r) >> 15);
|
||||
vx_line(&f, x, y, X, Y, 154 + en / 4);
|
||||
x = X; y = Y;
|
||||
}
|
||||
vx_line(&f, -54 * 16, 20 * 16, 54 * 16, 20 * 16, 30 + en / 4);
|
||||
r = age < 300u ? 6 : 12;
|
||||
for (j = -1; j <= 1; j += 2) {
|
||||
vx_line(&f, 46 * 16, -6 * 16, (46 + j * 4) * 16, (-6 - r) * 16, 154);
|
||||
vx_dot(&f, (46 + j * 4) * 16, (-6 - r) * 16, 40, 243);
|
||||
}
|
||||
vx_bface(&f, 46 * 16, -2 * 16, 120, en * 294 >> 8, age < 90u, pa);
|
||||
break;
|
||||
}
|
||||
case GK_CHAIN: /* a caterpillar: its back the wave, its segments the byte's bits
|
||||
* (their heat along it), legs lifting with them */
|
||||
for (i = 0; i < n; i++) {
|
||||
int32_t X = (-50 + (int32_t)i * 11) * 16, Y = (vx_gw((int32_t)i * 16) * 5 * 16 >> 12) - sq / 6, bit = vx_gw(127) >> (i + 4) & 1;
|
||||
vx_ring(&f, X, Y, 104 + bit * 16, 104 + bit * 16, 20 + (int32_t)i * 22 + en / 5);
|
||||
vx_ring(&f, X, Y, 88 + bit * 16, 88 + bit * 16, 40 + (int32_t)i * 22 + en / 5);
|
||||
vx_ring(&f, X, Y, 40, 40, 30 + (int32_t)i * 22);
|
||||
vx_line(&f, X - 40, Y + 100, X - 56, Y + 170 - bit * 30, 30 + (int32_t)i * 22);
|
||||
vx_line(&f, X + 40, Y + 100, X + 56, Y + 170 - bit * 30, 30 + (int32_t)i * 22);
|
||||
}
|
||||
y = (vx_gw(127) * 5 * 16 >> 12) - sq / 6;
|
||||
vx_line(&f, 42 * 16, y - 160, 36 * 16, y - 320, 154); vx_line(&f, 50 * 16, y - 160, 56 * 16, y - 320, 154);
|
||||
vx_dot(&f, 36 * 16, y - 320, 32, 243); vx_dot(&f, 56 * 16, y - 320, 32, 243);
|
||||
vx_ring(&f, 46 * 16, y, 190, 190, 200 + en / 5);
|
||||
vx_bface(&f, 46 * 16, y, 170, en * 294 >> 8, age < 90u, pa);
|
||||
vx_line(&f, -60 * 16, 26 * 16, 60 * 16, 26 * 16, 30 + en / 4);
|
||||
break;
|
||||
case GK_WEB: { /* a spider on its web: the rings the string's wave, POS its place
|
||||
* on the top thread, its cocoon under it */
|
||||
int32_t cx = -6 * 16, cy = -6 * 16, R = 44 * 16;
|
||||
for (j = 1; j <= 4; j++) {
|
||||
for (i = 0; i < 24u; i++) {
|
||||
uint32_t a = i * 65536u / 24u;
|
||||
r = R * j / 4 + (vx_gw((int32_t)(i <= 12u ? i : 24u - i) * 9 + j * 17) * (8 + pb / 16) * 16 >> 12) * (5 - j) / 4;
|
||||
q[2 * i] = cx + ((og_cos(a) * r) >> 15); q[2 * i + 1] = cy + ((og_sin(a) * r * 4 / 5) >> 15);
|
||||
}
|
||||
vx_curve(&f, q, 24, 1, 24 + pa / 8 + en / 6);
|
||||
}
|
||||
for (i = 0; i < n * 2u; i++) { uint32_t a = i * 65536u / (n * 2u); vx_line(&f, cx, cy, cx + ((og_cos(a) * R) >> 15), cy + ((og_sin(a) * R * 4 / 5) >> 15), 20 + pa / 8); }
|
||||
x = cx + (pc - 128) * 3; y = cy - 40 + sway / 4;
|
||||
for (j = -1; j <= 1; j += 2)
|
||||
for (i = 0; i < 4u; i++) vx_line(&f, x, y, x + j * (90 + (int32_t)i * 20), y - 90 + (int32_t)i * 60, 205);
|
||||
vx_ring(&f, x, y, 70, 70, 230);
|
||||
vx_dot(&f, x - 20, y - 10, 24, 255); vx_dot(&f, x + 20, y - 10, 24, 255);
|
||||
vx_line(&f, cx + 34 * 16, cy, cx + 34 * 16, cy + R, 40);
|
||||
vx_ring(&f, cx + 34 * 16, cy + R + 60, 50 + pc / 4, 90 + pc / 4, 64 + en / 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
vxs.kc = 0;
|
||||
}
|
||||
#endif
|
||||
/* ------------------------------------------------------------------------------------------------ the glue --- */
|
||||
/* the engine's own creature in the rectangle x y w h (px: EDIT's left panel 8 14 108 112, HOME's middle 146 x 112, or a
|
||||
* whole panel: each fits itself to it), en_home: HOME's level for the track (-1: its own); 0 when the engine has none
|
||||
@@ -1960,14 +2133,17 @@ static int32_t vx_fit(int32_t w, int32_t h, int32_t uw, int32_t uh) /* a unit'
|
||||
return w * 256 / uw < h * 256 / uh ? w * 256 / uw : h * 256 / uh;
|
||||
}
|
||||
typedef struct { const engine_t *e; void (*f)(const track_t *, const int32_t *, int32_t); } vxe_t;
|
||||
#if !VX_GX
|
||||
static const vxe_t VX_F[] = {{&ENG_ANALOG, vx_analog}, {&ENG_WHEEL, vx_wheel}, {&ENG_WEST, vx_west}, {&ENG_PHASE, vx_phase},
|
||||
{&ENG_LOFI, vx_lofi}, {&ENG_STRING, vx_string}}; /* (0.9.9-snd5; V10.7.13+: ADD's gone, room for
|
||||
* FORM MY LOOP: it draws the being) */
|
||||
#endif
|
||||
static int vx_draw(const track_t *t, int32_t x, int32_t y, int32_t w, int32_t h, int32_t en_home)
|
||||
{
|
||||
const engine_t *e = trk_engp(t);
|
||||
int32_t A[4] = {x, y, w, h}, cx = x * 16 + w * 8, cy = y * 16 + h * 8, s;
|
||||
if (!bt_hw_seg() && (e == &ENG_LOFI || e == &ENG_ANIMAL || e == &ENG_STRING || e == &ENG_PHASE))
|
||||
if (!bt_hw_seg() && (e == &ENG_LOFI || e == &ENG_ANIMAL || e == &ENG_STRING || e == &ENG_PHASE ||
|
||||
(VX_GX && (e == &ENG_ANALOG || e == &ENG_WHEEL))))
|
||||
return 0; /* (V10.48: those creatures live in the segment; V10.6g PHASE's too) */
|
||||
if (e == &ENG_FORMANT) { /* (the tract ~80 x 62 units about (-20, 37): the crown off) */
|
||||
s = vx_fit(w, h, 80, 62);
|
||||
@@ -1985,10 +2161,18 @@ static int vx_draw(const track_t *t, int32_t x, int32_t y, int32_t w, int32_t h,
|
||||
vx_fm6(t, A, en_home, 6u, 0);
|
||||
else { /* (0.9.9-snd5: the creatures drawn the same way, a table) */
|
||||
uint32_t i;
|
||||
#if VX_GX
|
||||
if (e == &ENG_WEST) { vx_west(t, A, en_home); return 1; } /* (WEST keeps its own: a diagram, not a being) */
|
||||
for (i = 0; i < NELEM(VX_G) && VX_G[i].e != e; i++) {}
|
||||
if (i == NELEM(VX_G))
|
||||
return 0;
|
||||
vx_gx(t, A, en_home, &VX_G[i]);
|
||||
#else
|
||||
for (i = 0; i < NELEM(VX_F) && VX_F[i].e != e; i++) {}
|
||||
if (i == NELEM(VX_F))
|
||||
return 0;
|
||||
VX_F[i].f(t, A, en_home);
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3006,6 +3006,7 @@ static void ui_input_frame(void)
|
||||
}
|
||||
if (b == B_OCTUP && !fm1_in.notes && !ui.home && !ui.menu && !ui.confirm && cur_page()->scope == SC_TRK) {
|
||||
mix_k4 ^= 1u; /* (V10.8.38, the owner) MIXER: OCT+ turns KNOB 4 BPM <-> DJ FILTER */
|
||||
ui_message(mix_k4 ? "KNOB 4: DJ FILTER" : "KNOB 4: BPM"); /* (V10.8.54: said) */
|
||||
ui.force = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
+21
-3
@@ -744,6 +744,7 @@ static void session_dice(uint32_t seed)
|
||||
static const char *const GLO_GROUP[4]; /* (the DRUM group's names, below) */
|
||||
#define GLO_ALL ((uint32_t)NTRK)
|
||||
#define GLO_TAP 7u
|
||||
#define GLO_RESOUND 9u /* (V10.8.54) A4: RESOUND, new sounds for the whole song (gen.c) */
|
||||
#define GLO_UNDO 8u /* (0.6.21) G4: UNDO the last big change (project.c undo_do) */
|
||||
/* (V10.6) A4 FREEZE, B4 REVERT ALL and SEQ's D5 REVERT gone with MUTATE */
|
||||
static __attribute__((noinline)) void layer_key(uint32_t l, uint32_t k)
|
||||
@@ -770,12 +771,15 @@ static __attribute__((noinline)) void layer_key(uint32_t l, uint32_t k)
|
||||
glo_tap();
|
||||
} else if (p == GLO_UNDO) {
|
||||
undo_ui();
|
||||
} else if (p == GLO_RESOUND) {
|
||||
gen_resound_key();
|
||||
}
|
||||
} else if (l == LAYER_SCL) {
|
||||
TSEL->p[P_ROOT] = (int16_t)((k + 5u) % 12u); /* the key's note name (F3 = F) */
|
||||
ui_say("ROOT ", NN12[TSEL->p[P_ROOT]]);
|
||||
} else if (l == LAYER_EDIT && key_black(k) && p < NLANE && drum_track(TSEL)) {
|
||||
dx_mute_set(dx_mute ^ DXM_LANE(p)); /* DRUM: black keys 1..8 mute each sound (lit = sounding) */
|
||||
ui_say(drum_lane_abbr(TSEL, p), dx_mute & DXM_LANE(p) ? " MUTED" : " ON");
|
||||
} else if (l == LAYER_EDIT && !key_black(k) && p <= LY_RECALL) {
|
||||
if (chain_busy())
|
||||
ui_message("SONG PLAYS: STOP IT TO EDIT");
|
||||
@@ -793,8 +797,10 @@ static __attribute__((noinline)) void layer_key(uint32_t l, uint32_t k)
|
||||
nudge_key(p == 9u); /* (V10.8.49) C#5 / D#5: NUDGE < / > */
|
||||
else if (p == 10u)
|
||||
se_undo(); /* (V10.8.52) F#5: UNDO / REDO the last edit */
|
||||
else if (p < NLANE && drum_track(TSEL))
|
||||
else if (p < NLANE && drum_track(TSEL)) {
|
||||
ui.lane = (uint8_t)p; /* (black keys 1..8: the lane, as on the grid) */
|
||||
ui_say("LANE ", drum_lane_abbr(TSEL, p));
|
||||
}
|
||||
} else if (l == LAYER_SAVE && !key_black(k)) {
|
||||
song_key(p);
|
||||
}
|
||||
@@ -834,12 +840,22 @@ static void layer_knob(uint32_t k, int32_t s)
|
||||
se_knob(k, s);
|
||||
ui.force = 1;
|
||||
} else if (l == LAYER_SAVE) { /* KNOB 1: the song (in when SAVE lets go); 2..4: none */
|
||||
if (k == 0u)
|
||||
if (k == 0u) {
|
||||
char b[4];
|
||||
lys.song = (uint8_t)(clamp((int32_t)(lys.song ? lys.song - 1u : song_cur) + (s > 0 ? 1 : -1), 0,
|
||||
NSONG - 1) + 1);
|
||||
fmt_int(b, lys.song);
|
||||
ui_say("PROJECT ", b); /* (V10.8.54: in when SAVE lets go) */
|
||||
str_cpy(ui.msg2, "LET GO: OPEN", sizeof ui.msg2);
|
||||
}
|
||||
} else if (l == LAYER_REC) { /* K1 CLICK, K2 REC Q */
|
||||
if (k == 1u)
|
||||
if (k == 1u) {
|
||||
char b[6];
|
||||
TSEL->p[P_HRQ] = (int16_t)clamp(TSEL->p[P_HRQ] + accel(EN_K2, s, 127), 0, 127);
|
||||
fmt_int(b, TSEL->p[P_HRQ] * 100 / 127);
|
||||
str_cpy(b + str_len(b), "%", 2);
|
||||
ui_say("REC GRID ", b);
|
||||
}
|
||||
else if (k < RL_N)
|
||||
rec_set(k, (uint32_t)clamp((int32_t)rp_get(RL_F[k]) + s, 0, 2));
|
||||
} else if (l) { /* the page's knobs, wherever the page is */
|
||||
@@ -871,6 +887,7 @@ static int layer_play(void)
|
||||
ui_message("RESTART: CLK IS EXT");
|
||||
return 1;
|
||||
}
|
||||
if (song.playing) ui_message("RESTART");
|
||||
transport_req = song.playing ? 3u : 1u;
|
||||
return 1;
|
||||
}
|
||||
@@ -1562,6 +1579,7 @@ static __attribute__((noinline)) void layer_state(uint32_t l)
|
||||
for (k = 0; glo_drums() && k < 4u; k++)
|
||||
lst_chip(GLO_GROUP[k], (dx_mute >> k) & 1u ? "MUTE" : "ON", !((dx_mute >> k) & 1u));
|
||||
lst_chip("UNDO", undo_ok ? "READY" : "-", undo_ok);
|
||||
lst_chip("A4", "RESOUND", 1);
|
||||
} else if (l == LAYER_REC) {
|
||||
b[0] = 'T'; b[1] = (char)('1' + song.sel); b[2] = 0;
|
||||
lst_chip("ARMED", b, (song.rec >> song.sel) & 1u);
|
||||
|
||||
@@ -360,6 +360,32 @@ static void backup(void)
|
||||
transport_req = 0;
|
||||
}
|
||||
|
||||
/* (V10.8.54) Studio's project library: PROJ_LIST 95, PROJ_NAME 96, PROJ_OP 97 (editor_backup.c ed_pj_handle) */
|
||||
static void projects(void)
|
||||
{
|
||||
const uint8_t *r;
|
||||
uint32_t n, i, k;
|
||||
reset();
|
||||
ok("PROJ_LIST / PROJ_NAME / PROJ_OP are 95 96 97", ED_PROJ_LIST == 95 && ED_PROJ_NAME == 96 && ED_PROJ_OP == 97);
|
||||
APP0(ED_PROJ_LIST);
|
||||
r = frame(ED_PROJ_LIST, &n);
|
||||
g_new(); g_b(0, "rc"); g_b(NSONG, "NSONG");
|
||||
for (i = 0; i < NSONG; i++) { g_b(i, "n"); g_any("parts"); g_any("flags"); for (k = 0; k < 12u; k++) g_any("name"); }
|
||||
g_check("PROJ_LIST: rc, NSONG, NSONG x (n, parts, flags, 12 name bytes)", r, n);
|
||||
ok("PROJ_LIST: the open project flagged", r && n >= 5u && (r[2 + song_cur * 15u + 2u] & 1u));
|
||||
APP(ED_PROJ_NAME, 9, 0, 'X'); /* (no such project) */
|
||||
r = frame(ED_PROJ_NAME, &n);
|
||||
g_new(); g_b(9, "n"); g_b(0, "part"); g_any("rc");
|
||||
ok("PROJ_NAME 9 0 X: n, part, rc (refused: 1, or 2 without flash)", g_check("PROJ_NAME: n, part, rc", r, n) && r[2] && r[2] != 3u);
|
||||
{ int a_[4] = {0, 1, (int)song_cur, 0}; app(ED_PROJ_OP, a_, 4); } /* (a copy over the open project) */
|
||||
r = frame(ED_PROJ_OP, &n);
|
||||
g_new(); g_b(0, "op"); g_b(1, "from"); g_b(song_cur, "to"); g_any("rc");
|
||||
ok("PROJ_OP COPY onto the open project: refused (1, or 2 without flash)", g_check("PROJ_OP: op, from, to, rc", r, n) && r[3] && r[3] != 3u);
|
||||
APP(ED_PROJ_OP, 5, 0, 1, 0); /* (no such op) */
|
||||
r = frame(ED_PROJ_OP, &n);
|
||||
ok("PROJ_OP 5: refused", r && n == 4u && r[3]);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ the pushes */
|
||||
static void pushes(void)
|
||||
{
|
||||
@@ -812,6 +838,7 @@ int main(int argc, char **argv)
|
||||
contract_constants();
|
||||
requests();
|
||||
backup();
|
||||
projects();
|
||||
pushes();
|
||||
pushes_10();
|
||||
push_ui();
|
||||
|
||||
@@ -458,6 +458,33 @@ int main(void)
|
||||
b.nslot = 3;
|
||||
bad += check("a bank with the wrong slot count is refused", put_all(7, &b, sizeof b, st_crc32(&b, sizeof b)) == 2u);
|
||||
}
|
||||
{ /* (V10.8.54) Studio's project library: PROJ_LIST / PROJ_NAME / PROJ_OP */
|
||||
static const uint8_t cp[4] = {0, 0, 2, 0}, mv[4] = {1, 2, 3, 0}, del[4] = {2, 3, 0, 0}, nm[5] = {2, 0, 'N', 'E', 'W'};
|
||||
reset();
|
||||
trk[0].step[0] = (step_t){{60}, 1, ST_NOTE, 0, 96, 0, 0};
|
||||
project_save_as(0, "MYSONG");
|
||||
call(ED_PROJ_OP, cp, 4);
|
||||
bad += check("PROJ_OP COPY 1 -> 3: done", rep_n == 4u && rep[3] == 0u);
|
||||
call(ED_PROJ_LIST, 0, 0);
|
||||
bad += check("PROJ_LIST: project 3 has part A, named MYSONG", rep[0] == 0u && rep[1] == NSONG && rep[2 + 2u * 15u] == 2u &&
|
||||
rep[2 + 2u * 15u + 1u] == 1u && !memcmp(&rep[2 + 2u * 15u + 3u], "MYSONG", 6));
|
||||
call(ED_PROJ_OP, cp, 4);
|
||||
bad += check("PROJ_OP COPY over it again, force 0: 4 (occupied)", rep[3] == 4u);
|
||||
call(ED_PROJ_NAME, nm, 5);
|
||||
call(ED_PROJ_LIST, 0, 0);
|
||||
bad += check("PROJ_NAME 3 A NEW: renamed in flash", !memcmp(&rep[2 + 2u * 15u + 3u], "NEW", 4));
|
||||
call(ED_PROJ_OP, mv, 4);
|
||||
call(ED_PROJ_LIST, 0, 0);
|
||||
bad += check("PROJ_OP MOVE 3 -> 4: 3 empty, 4 NEW", rep[2 + 2u * 15u + 1u] == 0u && rep[2 + 3u * 15u + 1u] == 1u &&
|
||||
!memcmp(&rep[2 + 3u * 15u + 3u], "NEW", 4));
|
||||
call(ED_PROJ_OP, del, 4);
|
||||
call(ED_PROJ_LIST, 0, 0);
|
||||
bad += check("PROJ_OP DELETE 4: empty", rep[2 + 3u * 15u + 1u] == 0u);
|
||||
song.playing = 1;
|
||||
call(ED_PROJ_OP, cp, 4);
|
||||
bad += check("playing: 3 (STOP first)", rep[3] == 3u);
|
||||
song.playing = 0;
|
||||
}
|
||||
printf("backup test %s\n", bad ? "FAILED" : "passed");
|
||||
return bad != 0;
|
||||
}
|
||||
@@ -71,6 +71,17 @@ int main(void)
|
||||
bad += test_rec();
|
||||
bad += test_rec_layer();
|
||||
bad += test_rec_combos();
|
||||
{ /* (V10.8.54) GLO + A4: RESOUND, the notes kept, new sounds; GLO + G4 the sounds back */
|
||||
uint32_t e0, p0, sig;
|
||||
ui_power_on(); song.sel = 0;
|
||||
my_steps(&trk[0]); sig = steps_sig(&trk[0]);
|
||||
e0 = trk[0].eng_req; p0 = trk[0].preset;
|
||||
ly_white(B_GLO, GLO_RESOUND);
|
||||
bad += check("GLO+A4 RESOUND: the notes kept, another sound, its banner",
|
||||
steps_sig(&trk[0]) == sig && (trk[0].eng_req != e0 || trk[0].preset != p0) && !strncmp(ui.msg, "RESOUND #", 9));
|
||||
ly_white(B_GLO, GLO_UNDO);
|
||||
bad += check("GLO+G4 after RESOUND: the sound back", trk[0].eng_req == e0 && trk[0].preset == p0 && steps_sig(&trk[0]) == sig);
|
||||
}
|
||||
return bad != 0;
|
||||
}
|
||||
|
||||
+4
-4
@@ -868,8 +868,8 @@ static void nav_scene(uint32_t sec, const char *nm)
|
||||
ui.home = 0; ui.page = (uint8_t)i; page_entered(); pf_on = 0;
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, "nav_scene: no page \"%s\"\n", nm);
|
||||
exit(2);
|
||||
fprintf(stderr, "nav_scene: no page \"%s\" (a page since gone: the scene drawn where it is)\n", nm);
|
||||
return;
|
||||
}
|
||||
pf_on = 0;
|
||||
}
|
||||
@@ -1086,7 +1086,7 @@ static void setup(int s)
|
||||
ui.home = 1; page_flash(); pf_ms = fm1_ms - 200u;
|
||||
break;
|
||||
case S_DXIMG: /* (0.6.48) DRUM IMAGE 40 */
|
||||
set_engine_of(TSEL, ENGI_DRUM); TSEL->p[P_DXIMG] = 40; go_title("STEREO");
|
||||
set_engine_of(TSEL, ENGI_DRUM); TSEL->p[P_DXIMG] = 40; go_page(GR_DXIMG); /* (its title "" now: the tabs name it) */
|
||||
break;
|
||||
case S_DXSEND: /* (0.6.48) SEND: the snare to the REVERB, 70 % */
|
||||
set_engine_of(TSEL, ENGI_DRUM); dx_ui_lane = 1; dx_snd[1] = 3u << 6 | 47u; dx_lay[1] = 0x26; go_title("SOUND 4");
|
||||
@@ -1244,7 +1244,7 @@ static void setup(int s)
|
||||
case S_DLG_DICE_SOUND: case S_DLG_DICE_SEQ: case S_DLG_DICE_FX: { /* (0.8.5) the DICE dialog: BEFORE / NOW */
|
||||
uint32_t k = s == S_DLG_DICE_SOUND ? CF_DICE_SOUND : s == S_DLG_DICE_SEQ ? CF_DICE_SEQ : CF_DICE_FX;
|
||||
go_title("EDIT 1"); song.playing = 0;
|
||||
dk_keep(k); dk_vis_take();
|
||||
dk_vis_take(); /* (V10.8.21: dk_keep gone with the SEQ dice) */
|
||||
if (k == CF_DICE_SOUND) { TSEL->p[ENGINES[TSEL->eng_req]->knob[0]] = 100; TSEL->p[ENGINES[TSEL->eng_req]->knob[2]] = 5; }
|
||||
else if (k == CF_DICE_SEQ) for (uint32_t i = 0; i < 16u; i += 3u) { TSEL->step[i].time = ST_NOTE; TSEL->step[i].n = 1; TSEL->step[i].note[0] = (uint8_t)(48 + i); }
|
||||
else { TSEL->p[P_DIST] = 90; TSEL->p[P_CHOR] = 60; }
|
||||
|
||||
+2254
-2261
File diff suppressed because it is too large.
Load diff
+7
-82
@@ -603,58 +603,10 @@ static void web_gen_run(void)
|
||||
* The emulator's alone: nothing here is in the FM-1's binary. */
|
||||
#define WEB_RL_N (RL_TEX + 1u) /* (gen's RL_N: ui_layer.c, after it, has its own) */
|
||||
static project_store_t web_rs_bk[4]; /* the parts before the last RESOUND */
|
||||
static uint8_t web_rs_ok, web_rs_role[NTRK];
|
||||
static int16_t web_rs_gi; /* the genre's index, -1 EXPLORE */
|
||||
static uint16_t web_rs_seed;
|
||||
static uint8_t web_rs_ok;
|
||||
static uint32_t web_rs_last = 0xFFFFFFFFu, web_rs_sig;
|
||||
static void web_rs_apply(void) /* the sounds on the tracks playing (gs gp gmut gx gq: the caller's) */
|
||||
{
|
||||
uint32_t i, k, n;
|
||||
memset(&gs, 0, sizeof gs); memset(&gx, 0, sizeof gx); gx.eng = -1;
|
||||
gp.seed = web_rs_seed;
|
||||
for (i = 0; i < GP_N; i++) gp.amt[i] = GA_AUTO;
|
||||
gseed(GS_PICK);
|
||||
if (web_rs_gi < 0) { gx.on = 1; gx_genre(&gmut); gs.gi = NGENRE; }
|
||||
else { gs.gi = (uint8_t)web_rs_gi; gmut = GENRE[gs.gi]; }
|
||||
gs.g = &gmut;
|
||||
gen_pick();
|
||||
gmut.kit = (uint8_t)((gmut.kit + 1u + gr() % (KIT_N - 1u)) % KIT_N); /* (another kit than the genre's) */
|
||||
gs.energy = gp.energy; gs.complex = (uint8_t)(gp.complex ? gp.complex : 50u);
|
||||
for (k = 0; k < WEB_RL_N; k++) gs.trk_of[k] = NTRK;
|
||||
for (k = 0; k < NTRK; k++) {
|
||||
uint32_t r = web_rs_role[k];
|
||||
gs.role[k] = (uint8_t)(r < WEB_RL_N ? r : RL_TEX);
|
||||
if (r >= WEB_RL_N) continue;
|
||||
gs.act[r] = 1;
|
||||
if (gs.trk_of[r] == NTRK) gs.trk_of[r] = (uint8_t)k;
|
||||
}
|
||||
gs.fm6 = 0; gs.ftl = 0;
|
||||
gseed(GS_SOUND);
|
||||
for (n = gr() % NTRK, k = 0; k < NTRK; k++) { /* (gen_make's order: from a throw's own track on) */
|
||||
uint32_t ti = (k + n) % NTRK, r = web_rs_role[ti];
|
||||
track_t *t = &trk[ti];
|
||||
if (ti >= trk_live || r >= WEB_RL_N) continue;
|
||||
if (r == RL_DRUM) { if (drum_track(t)) gen_kit(t); continue; }
|
||||
if (drum_track(t)) continue; /* (a kit's track playing a melody: its kit kept) */
|
||||
{ /* (another sound than the one it had: GEN's picker asked again, up to 8 times, till the engine or the preset
|
||||
* differs; its FM6 count and filter type as before each ask) */
|
||||
uint32_t e0 = t->eng_req, p0 = t->preset, tries;
|
||||
uint8_t fm6 = gs.fm6, ftl = gs.ftl, odd = gx.odd;
|
||||
for (tries = 0; tries < 8u; tries++) {
|
||||
gs.fm6 = fm6; gs.ftl = ftl; gx.odd = odd;
|
||||
if (gx.on) gx.eng = gx_engine(r);
|
||||
gen_sound(t, r, r == RL_BASS ? gmut.snd[GP_BASS] : r == RL_PAD ? gmut.snd[GP_CHORDS] : r == RL_LEAD ? gmut.snd[GP_LEAD] :
|
||||
r == RL_ARP ? gmut.snd[GP_ARP] : gmut.tex);
|
||||
gx.eng = -1;
|
||||
if (gx.on) gx_sound(t, r);
|
||||
if (t->eng_req != e0 || t->preset != p0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
gseed(GS_MIX);
|
||||
for (k = 0; k < NTRK && k < trk_live; k++)
|
||||
if (web_rs_role[k] < WEB_RL_N) { gen_mix(&trk[k], web_rs_role[k]); gen_fxs(&trk[k], web_rs_role[k]); gen_evolve(&trk[k], web_rs_role[k]); }
|
||||
}
|
||||
#define web_rs_role rs_role /* (V10.8.54: the roles, the genre and the picking are the
|
||||
* firmware's own, gen.c gen_rs_prep / gen_rs_apply: GLO + A4) */
|
||||
/* a stored part's sounds made the new ones (its steps, pattern, mutes kept): every track with a part its engine, preset,
|
||||
* sound parameters (not param_kept's), FM6 patch, GAIN, KEY TRK; LEVEL and PAN the new ones where the part had the old
|
||||
* ones (a part's own mix kept); the DRUM-X kit where a track plays drums */
|
||||
@@ -693,42 +645,15 @@ static void web_rs_parts(const project_t *N, const project_t *O) /* the four s
|
||||
EXPORT uint32_t web_gen_resound_seed(void) { return web_rs_last; }
|
||||
EXPORT uint32_t web_gen_resound(uint32_t seed)
|
||||
{
|
||||
struct { __typeof__(gp) p; __typeof__(gs) s; ggenre_t g; __typeof__(gx) x; uint32_t q; } save = {gp, gs, gmut, gx, gq};
|
||||
uint32_t k, any = 0, h = seed % 10000u, gen = song_draft && gs.g;
|
||||
if (!bt_hw_seg()) return 1;
|
||||
for (k = 0; k < NTRK; k++) { /* the roles: GEN's own, else by what each track plays */
|
||||
uint32_t r = gen && k < trk_live ? gs.role[k] : k < trk_live ? gls_role(&trk[k]) : WEB_RL_N;
|
||||
if (k < trk_live && drum_track(&trk[k])) r = RL_DRUM;
|
||||
else if (r == RL_DRUM) r = WEB_RL_N; /* (a part GEN gave the drums on a track not DRUM-X's) */
|
||||
web_rs_role[k] = (uint8_t)(r < WEB_RL_N ? r : WEB_RL_N);
|
||||
any |= r < WEB_RL_N;
|
||||
}
|
||||
if (!any) return 1;
|
||||
if (gen) web_rs_gi = (int16_t)(gs.gi < NGENRE ? gs.gi : -1);
|
||||
else { /* (a seed's genre, its tempo near the song's: gls_genre's EXPLORE) */
|
||||
uint32_t bpm = (uint32_t)song.g[G_BPM], x = h * 2654435761u + 1u, i, gi = 0;
|
||||
for (i = 0; i < 32u; i++) {
|
||||
x ^= x << 13; x ^= x >> 17; x ^= x << 5;
|
||||
gi = x % NGENRE;
|
||||
if (bpm + 24u >= GENRE[gi].bpm_lo && bpm <= GENRE[gi].bpm_hi + 24u) break;
|
||||
}
|
||||
web_rs_gi = (int16_t)gi;
|
||||
}
|
||||
web_rs_seed = (uint16_t)h;
|
||||
if (!bt_hw_seg() || !gen_rs_prep(seed)) return 1;
|
||||
undo_mark(); /* (GLO + G4: the part playing as it was) */
|
||||
project_capture(&web_rs_old);
|
||||
memcpy(web_rs_bk, proj_slot, sizeof proj_slot);
|
||||
web_rs_apply();
|
||||
gp = save.p; gs = save.s; gmut = save.g; gx = save.x; gq = save.q;
|
||||
gen_rs_apply();
|
||||
project_capture(&web_rs_new);
|
||||
web_rs_parts(&web_rs_new, &web_rs_old);
|
||||
web_rs_ok = 1; web_rs_last = h; web_rs_sig = gp.sig;
|
||||
{
|
||||
char b[8];
|
||||
fmt_int(b, (int32_t)h);
|
||||
ui_say("RESOUND #", b);
|
||||
}
|
||||
ui.force = 1;
|
||||
web_rs_ok = 1; web_rs_last = rs_seed; web_rs_sig = gp.sig;
|
||||
rs_banner();
|
||||
return 0;
|
||||
}
|
||||
EXPORT uint32_t web_gen_resound_undo(void)
|
||||
|
||||
Reference in new issue
Block a user