Clipper 1.0: the sequencer of SLOOP 2.7.2 on the FM-1

- SEQ tapped: the NOTES page (after SLOOP 2.7.2), the pattern as a piano roll: KNOB 1 the note (a chord's
  one by one), 2 pitch, 3 length, 4 force (GHOST..HARD, ACC), PRESETS zoom 8..64; OCT+ held: the note's sheet
  (SLIDE, NUDGE, FILL, MOVE, COPY, DELETE); EDIT tapped deletes the note
- step entry from a MIDI keyboard (SLOOP 2.6); MENU > SEQ > STEP ADVANCE (SLOOP 2.7.1), in the side record
- EDIT, ARP and GLO held are layers again: erase, SHIFT, LENGTH, TRANSPOSE, undo / redo; note repeat;
  fill, fill bar, tap tempo, level (no mute / solo: one instrument). FX and SAVE held still let the keys play
- SEQ + a step held + KNOB 2: its velocity (SLOOP 2.6)
- recording: several held notes each to their own key-up (2.7.1), MONO / LEGATO lines recorded and played
  legato (SF_LEG, 2.7.2); the MIDI clock tempo averaged (2.7.2)
- undo swaps the nudges back too; SHIFT and LENGTH x2 move the nudges with their steps
- tests: clipper_ui (NOTES, sheet, STEP ADVANCE, MIDI entry, layers, legato), seq2 (2.7 overdub, 2.7.1 / 2.7.2
  recording, MIDI clock), hostsim (a chord's notes end on their own), ui_pages (NOTES title)
- docs: README, QUICKSTART, DEMARRAGE-RAPIDE-FR, release notes, docs/test-sequencer.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RDUenQzjQ4Kk2jQVG85bwq
This commit is contained in:
isod89andClaude Opus 5.5 committed 2026-10-19 19:53:25 -04:00
1 parent e807013f96
commit de1a410b70
19 files changed
+1489 -163

No files matched your search

+4 -2
View File
@@ -62,6 +62,7 @@ Sur la FM-1, Clipper se reconnaît à son écran de démarrage (**1.0 EXPERIMENT
- **Le delay a un MODE** (DLY 2 → **MODE**) : **MONO** comme avant, **PING** (le premier écho à gauche à TIME, le suivant à droite à deux fois TIME, et ainsi de suite), **TAPE** (le pleurage et le scintillement font bouger les échos ; les répétitions saturent en s'empilant). Changer de MODE se fait en fondu.
- **Gardé avec le son** : les presets utilisateur gardent toutes les valeurs de la 1.0 dans une « queue » après la banque (SLOOP et les anciennes versions de Clipper lisent la banque comme avant et ne la voient pas) ; les projets les gardent dans les nudges de la piste 3 tant que la piste 3 n'a pas de pas (un projet dont la piste 3 a des pas les charge à leurs valeurs par défaut).
- **A4 en Hz** (GLO → TUNING → **A4**, de 400 à 480 Hz, et dans la carte Tuning de l'éditeur) : 432, 415 (baroque), 442 / 443 (orchestres)… sous tous les systèmes d'accordage, gardé avec les réglages. (Demandé dans un commentaire de la vidéo de lancement.)
- **Le séquenceur de SLOOP 2.7.2 sur la FM-1** : SEQ appuyé ouvre la page **NOTES**, le motif en piano roll où chaque note se règle (KNOB 1 la note, celles d'un accord une par une ; 2 la hauteur ; 3 la durée ; 4 la force, de GHOST à HARD et ACC ; PRESETS le zoom, de 8 à 64 pas), et **OCT+ maintenu** ouvre sa fiche (SLIDE, NUDGE, FILL, MOVE, COPY, DELETE) ; EDIT appuyé efface la note. Le clavier et **un clavier MIDI** écrivent le pas (MENU > **SEQ** > **STEP ADVANCE** OFF : le curseur reste, pour réessayer un accord). **EDIT, ARP et GLO redeviennent des couches** quand on les maintient : EDIT efface une note du motif (pendant la lecture, ou tout le motif à l'arrêt) et règle SHIFT, LENGTH x2 / moitié, TRANSPOSE, avec annuler / refaire sur OCT- / OCT+ ; ARP répète une touche sur la grille (enregistré en ratchets) ; GLO lance un fill (touche 9 maintenue, touche 10 la mesure suivante), le tap tempo (touche 16) et le volume (KNOB 1). SEQ + un pas tenu + KNOB 2 règle sa vélocité. À l'enregistrement, plusieurs notes tenues continuent chacune jusqu'à ce que leur touche soit lâchée, et sur un son MONO ou LEGATO une note jouée par-dessus la précédente est enregistrée et rejouée legato (sans nouvelle attaque). Le tempo d'une horloge MIDI maître s'affiche stable (140 reste 140). FX et SAVE maintenus laissent toujours jouer le clavier.
- **Un séquenceur pro dans l'éditeur web** (onglet Sequencer, avec le séquenceur de pas de la FM-1 tel qu'il est) : **undo / redo** (Ctrl+Z / Ctrl+Shift+Z, 64 pas, les modifications à la main aussi) ; une **plage** (Maj+clic sur la grille) pour chaque outil ; **transposer** (±1, ±12), **décaler** en boucle, **inverser** (les accords gardent leur durée), **doubler** la longueur, **copier / coller** (Ctrl+C / Ctrl+V), effacer ; des **accords** sur la note de chaque pas (maj, min, 7, m7, sus, add9... ou les triades et septièmes de la tonalité), accents et slides sur une plage ; des **générateurs** : rythmes euclidiens, mélodies aléatoires dans la gamme (densité, sauts, liaisons, accents, slides, accords, une graine pour en retrouver une), 22 motifs tout faits (basses acid, octaves, offbeat et rolling, arpèges, Berlin school, stabs et progressions d'accords, gates) et un **texte de motif** pour écrire les tiens (`1 3 5 8'`, `1+3+5>`, `-` liaison, `.` silence), **humaniser** (vélocité et nudge) ; des **lignes** à dessiner pour la vélocité, le nudge, le ratchet (x1 à x4) et le niveau (GHOST à HARD), et des colonnes ratchet / niveau dans la liste des pas ; une **bibliothèque de motifs** : une banque dans le navigateur, des fichiers `.clipper-pattern.json` (notes, liaisons, accents, slides, vélocités, ratchets, niveaux, nudges, fills, locks, longueur).
- **Corrigé** : l'arpège qui s'allumait tout seul en changeant de son. Quatre sons apportent un arpège (8BIT ARP, ACID ARP, ARP PLUCK, TURING JUNO), et depuis la 0.7 un arpège en marche continuait d'un son à l'autre : passer sur l'un d'eux laissait l'arpège allumé pour tous les sons suivants. Maintenant, l'arpège d'un son s'éteint au son suivant ; seul un arpège que tu allumes (ou changes) toi-même continue.
- **Corrigé** : les valeurs 1.0 des presets utilisateur (SPREAD, LFO 3, les macros, les slots 7 à 12...) n'étaient pas relues après avoir éteint la FM-1, et le démarrage écrivait après la fin de leur table (une erreur de la première version de la 1.0).
@@ -174,8 +175,9 @@ Tous deux proposés dans les discussions de Felucca (#145, #146) comme des faço
| **HOME** | L'écran du synthé : le nom du son, sa famille, son numéro dans la liste, le moteur et un oscilloscope. Les 4 knobs règlent les contrôles principaux du son. |
| **PRESETS** | Tous les sons, un par un. |
| **ALGORITHM** | Saute à la famille suivante (PAD, BASS, LEAD, PLCK, KEYS, STAB, FX…). |
| **FX, EDIT, ARP, GLO, SAVE** | Un appui ouvre les pages. Bouton maintenu, le clavier joue toujours. Pages FX : FX, FILTER (avec MODL, le modèle de filtre), INSERT, INSERT 2, DLY, REVERB, CHORUS, EQ+COMP. Pages GLO : GLOBAL (tempo, swing, métronome, accord fin), MASTER, **TUNING** (l'accordage), SYSTEM (MIDI, synchro, CPU / LATE / PEAK). |
| **SEQ, SEL** | Maintenus : SEQ montre les 16 pas sur les touches, SEL la tonalité et les accords. Un appui ouvre leurs pages. |
| **FX, EDIT, ARP, GLO, SAVE** | Un appui ouvre les pages. FX ou SAVE maintenu, le clavier joue toujours (EDIT, ARP et GLO maintenus sont des couches du séquenceur, voir plus bas). Pages FX : FX, FILTER (avec MODL, le modèle de filtre), INSERT, INSERT 2, DLY, REVERB, CHORUS, EQ+COMP. Pages GLO : GLOBAL (tempo, swing, métronome, accord fin), MASTER, **TUNING** (l'accordage), SYSTEM (MIDI, synchro, CPU / LATE / PEAK). |
| **SEQ, SEL, EDIT, ARP, GLO** | Maintenus, les couches du séquenceur (comme SLOOP 2.7.2) : SEQ les 16 pas sur les touches (un pas tenu : KNOB 1 la note, 2 la vélocité, 3 le ratchet, 4 le nudge, PRESETS un lock), SEL la tonalité et les accords, EDIT efface (une touche : cette note sort du motif ; les knobs SHIFT, LENGTH, TRANSPOSE ; OCT- / OCT+ annuler / refaire), ARP répète une note sur la grille, GLO un fill (touche 9), un fill sur la mesure suivante (touche 10), le tap tempo (touche 16), le volume (KNOB 1). Un appui ouvre leurs pages. |
| **SEQ appuyé : NOTES** | Le motif en piano roll. KNOB 1 passe de note en note (celles d'un accord une par une), KNOB 2 la hauteur, KNOB 3 la durée, KNOB 4 la force (GHOST SOFT NORM HARD ACC), PRESETS le zoom ; le clavier ou un clavier MIDI écrit le pas ; EDIT appuyé efface la note ; **OCT+ maintenu** : la fiche de la note (SLIDE, NUDGE, FILL, MOVE, COPY, DELETE ; KNOB 1 la ligne, KNOB 2 la valeur, OCT+ fait, OCT- ferme). MENU > SEQ > STEP ADVANCE OFF : le curseur reste après un accord. |
| **REC** | Enregistre ce que tu joues dans le pattern. REC maintenu efface le pattern. |
| **MIDI** | Omni : tous les canaux jouent le synthé. |
+3 -2
View File
@@ -26,8 +26,9 @@ Elsewhere than Windows: see [BUILDING.md](BUILDING.md).
| **HOME** | The synth screen: the sound's name, its family, its number in the list, the engine and a scope. The four knobs play the sound's main controls. |
| **PRESETS** | Every sound, one by one, factory and user presets. |
| **ALGORITHM** | Jumps to the next family (PAD, BASS, LEAD, PLCK, KEYS, STAB, FX…). |
| **FX, EDIT, ARP, GLO, SAVE** | A tap opens the pages; while one is held, the keys still play. FX pages: FX (sends), FILTER (and MODL, the filter model), INSERT, INSERT 2, DLY, DLY 2 (the delay's MODE), REVERB (TYPE: ROOM, PLATE, HALL, SHIMMER), CHORUS, EQ+COMP. EDIT: the engine's pages, MACROS, VOICE 1–3 (SPREAD on VOICE 3), the envelopes, LFOs and the 12-slot MATRIX. GLO: GLOBAL (tempo, swing, metronome, fine tune), MASTER, **TUNING** (the system, its root, and **A4** from 400 to 480 Hz: 432, 415, 442...), SYSTEM (MIDI, sync, CPU / LATE / PEAK). SAVE: PRESETS, USER (your presets), TOOLS. |
| **SEQ, SEL** | Held: SEQ shows the 16 steps on the keys, SEL the key and the chords. A tap opens their pages. |
| **FX, EDIT, ARP, GLO, SAVE** | A tap opens the pages; while FX or SAVE is held, the keys still play (EDIT, ARP and GLO held are sequencer layers, see below). FX pages: FX (sends), FILTER (and MODL, the filter model), INSERT, INSERT 2, DLY, DLY 2 (the delay's MODE), REVERB (TYPE: ROOM, PLATE, HALL, SHIMMER), CHORUS, EQ+COMP. EDIT: the engine's pages, MACROS, VOICE 1–3 (SPREAD on VOICE 3), the envelopes, LFOs and the 12-slot MATRIX. GLO: GLOBAL (tempo, swing, metronome, fine tune), MASTER, **TUNING** (the system, its root, and **A4** from 400 to 480 Hz: 432, 415, 442...), SYSTEM (MIDI, sync, CPU / LATE / PEAK). SAVE: PRESETS, USER (your presets), TOOLS. |
| **SEQ, SEL, EDIT, ARP, GLO** | Held, the sequencer's layers (as SLOOP 2.7.2): SEQ the 16 steps on the keys (a step held: KNOB 1 note, 2 velocity, 3 ratchet, 4 nudge, PRESETS a lock), SEL the key and the chords, EDIT erase (a key: that note out of the pattern; KNOBs SHIFT, LENGTH, TRANSPOSE; OCT- / OCT+ undo / redo), ARP note repeat, GLO fill (key 9), fill bar (key 10), tap tempo (key 16), level (KNOB 1). A tap opens their pages. |
| **SEQ tapped: NOTES** | The pattern as a piano roll. KNOB 1 walks the notes, KNOB 2 pitch, KNOB 3 length, KNOB 4 force (GHOST SOFT NORM HARD ACC), PRESETS zoom; the keys or a MIDI keyboard write the step; EDIT tapped deletes the note; **OCT+ held**: the note's sheet (SLIDE, NUDGE, FILL, MOVE, COPY, DELETE; KNOB 1 the row, KNOB 2 the value, OCT+ does it, OCT- closes). MENU > SEQ > STEP ADVANCE OFF: the cursor stays after a chord. |
| **REC** | Records what you play into the pattern. Hold REC to clear the pattern. |
| **MIDI** | Omni: every channel plays the synth. |
+4 -2
View File
@@ -62,6 +62,7 @@ SLOOP is a groovebox. **Clipper is a synthesizer** with 23 engines and 407 sound
- **The delay has a MODE** (DLY 2 → **MODE**): **MONO** as before, **PING** (the first echo left at TIME, the next right at twice TIME, back and forth), **TAPE** (wow and flutter swing the echoes; the repeats saturate as they pile up). A change of MODE cross-fades.
- **Kept with the sound**: user presets keep every 1.0 value in a tail after the bank (SLOOP and older Clipper versions read the bank as before and never see it); projects keep them in track 3's nudges while track 3 has no steps (a project whose track 3 has steps loads them at their defaults).
- **A4 in Hz** (GLO → TUNING → **A4**, 400 to 480 Hz, and in the editor's Tuning card): 432, 415 (baroque), 442 / 443 (orchestras)... under every tuning system, kept with the settings. (Asked for in a comment on the launch video.)
- **The sequencer of SLOOP 2.7.2 on the FM-1**: SEQ tapped is the **NOTES** page, a piano roll of the pattern where each note is edited (KNOB 1 the note, a chord's one by one; 2 the pitch; 3 the length; 4 the force, GHOST to HARD and ACC; PRESETS the zoom, 8 to 64 steps) and **OCT+ held** opens its sheet (SLIDE, NUDGE, FILL, MOVE, COPY, DELETE); EDIT tapped deletes the note. The keys and **a MIDI keyboard** write the step under edit (MENU > **SEQ** > **STEP ADVANCE** OFF: the cursor stays, for trying a chord again). **EDIT, ARP and GLO are layers again** when held: EDIT erases a note from the pattern (as it plays, or all of it stopped) and turns SHIFT, LENGTH x2 / half, TRANSPOSE, with undo / redo on OCT- / OCT+; ARP repeats a key on the grid (note repeat, recorded as ratchets); GLO calls a fill (key 9 held, key 10 the next bar), taps the tempo (key 16) and sets the level (KNOB 1). SEQ + a step held + KNOB 2 sets its velocity. Recording: several notes held each go on until their own key is let go, and on a MONO or LEGATO sound a note played over the one before is recorded and played back legato (no new attack). A MIDI clock master's tempo reads steady (140 stays 140). FX and SAVE held still let the keys play.
- **A pro sequencer in the web editor** (Sequencer tab, works with the FM-1's step sequencer as it is): **undo / redo** (Ctrl+Z / Ctrl+Shift+Z, 64 steps, edits by hand too); a **range** (shift-click on the grid) for every tool; **transpose** (±1, ±12), **shift** round, **reverse** (chords keep their length), **double** the length, **copy / paste** (Ctrl+C / Ctrl+V), clear; **chords** from each step's note (maj, min, 7, m7, sus, add9... or the key's own triads and sevenths), accents and slides on a range; **generators**: Euclidean rhythms, random melodies in the key (density, leaps, ties, accents, slides, chords, a seed to get one back), 22 ready-made patterns (acid, octave, offbeat and rolling basses, arpeggios, Berlin school, chord stabs and progressions, gates) and a **pattern text** to write your own (`1 3 5 8'`, `1+3+5>`, `-` tie, `.` rest), **humanize** (velocity and nudge); **lanes** to draw velocity, nudge, ratchet (x1 to x4) and level (GHOST to HARD), and ratchet / level columns in the step list; a **pattern library**: a bank in the browser, `.clipper-pattern.json` files (notes, ties, accents, slides, velocities, ratchets, levels, nudges, fills, locks, length).
- **Fixed**: the arp turning itself on while browsing. Four sounds bring an arp with them (8BIT ARP, ACID ARP, ARP PLUCK, TURING JUNO), and since 0.7 a running arp went on through sound changes, so passing one of them left the arp on for every sound after it. Now an arp a sound brings goes off with the next sound; only an arp you turn on (or change) yourself runs on.
- **Fixed**: the user presets' 1.0 values (SPREAD, LFO 3, the macros, slots 7 to 12...) were not read back after the FM-1 was switched off, and the boot wrote past the end of their table (a slip in 1.0's first build).
@@ -188,8 +189,9 @@ Clipper 1.0 is experimental. What it needs most, roughly in order:
| **FX pages** | FX (sends), FILTER (the sound's DJ filter and MODL, the filter model), INSERT, DLY, REVERB, CHORUS, EQ+COMP. |
| **GLO pages** | GLOBAL (tempo, swing, CLICK the metronome, fine tune), MASTER (DUST, the master FILT), **TUNING** (the system and its root, for every sound), SYSTEM (MIDI, sync, and the CPU / LATE / PEAK readout). |
| **ALGORITHM** | Jumps to the next family: PAD, BASS, LEAD, PLCK, KEYS, STAB, FX and the rest. |
| **FX, EDIT, ARP, GLO, SAVE** | A tap opens the pages. While one of them is held, the keys still play, so you can hold EDIT and play. |
| **SEQ, SEL** | Held, they are the two layers a synth needs: SEQ shows the 16 steps on the keys, SEL the key and the chords. A tap opens their pages. |
| **FX, SAVE** | A tap opens the pages. While one of them is held, the keys still play. |
| **SEQ, SEL, EDIT, ARP, GLO** | Held, they are the sequencer's layers, as on SLOOP 2.7.2: SEQ the 16 steps on the keys (a step held: KNOB 1 its note, 2 its velocity, 3 ratchet, 4 nudge, PRESETS a lock), SEL the key and the chords, EDIT erase (a key: that note out of the pattern) with SHIFT, LENGTH x2 / half and TRANSPOSE on the knobs and OCT- / OCT+ undo / redo, ARP note repeat on the grid, GLO a fill (key 9 held), a fill bar (key 10), tap tempo (key 16) and the level. A tap opens their pages. |
| **SEQ tapped: NOTES** | The pattern as a piano roll: KNOB 1 walks the notes (a chord's one by one), KNOB 2 the pitch, KNOB 3 the length, KNOB 4 the force (GHOST, SOFT, NORM, HARD, ACC); PRESETS zooms (8 to 64 steps); the keys or a MIDI keyboard write the step; EDIT tapped deletes the note; OCT+ held opens its sheet (SLIDE, NUDGE, FILL, MOVE, COPY, DELETE). MENU > SEQ > STEP ADVANCE OFF keeps the cursor where it is. |
| **REC** | Records what you play into the pattern. Hold REC to clear the pattern. |
| **MIDI** | Omni: every channel plays the synth. |
+1 -1
View File
@@ -9,7 +9,7 @@
- **23 engines, 407 sounds**: HYBRID (three oscillators, two filters, a 16-slot matrix), FMX (six operators after the opsix), FM6 (DX7, loads `.syx` banks), DIGITAL, WAVE (wavetables, and your own), WSEQ (wave sequencing), VECTOR, JUNO (with its chorus), ANALOG (eight filter models), ACID, STRINGS, MACRO, PHASE, VPS, TERRAIN, PHYS (physical models), TRIO, LOFI, WHEEL, VOICE, NOISE, GRAIN and SAMPLE (on Clipper's own synthesized sources).
- **On every engine**: a 12-slot modulation matrix, LFO 2 and 3, ENV 2 (one-shot or looping), the MOD SEQ, four macros (BRITE, TIMBR, MOTN, SPACE, also on CC 16-19), SPREAD (each voice its own place in the stereo field), VINTAGE, an insert effect.
- **Effects**: distortion, chorus, a tempo-synced delay (mono, ping-pong, tape), room, plate, hall and shimmer reverbs, a master EQ, compressor and limiter.
- **Playing**: 8 voices on both cores (12 / 16 as a build option), poly unison, layer / split / multi, a 15-mode arpeggiator with a Turing machine, a step sequencer, MPE, MIDI over USB and TRS, microtuning with Scala scales; the FM-1 is a USB audio interface too.
- **Playing**: 8 voices on both cores (12 / 16 as a build option), poly unison, layer / split / multi, a 15-mode arpeggiator with a Turing machine, the step sequencer of SLOOP 2.7.2 (the NOTES piano roll and its note sheet, erase / shift / transpose, note repeat, fills, locks, nudges, legato recording), MPE, MIDI over USB and TRS, microtuning with Scala scales; the FM-1 is a USB audio interface too.
- **A web editor** (Chrome or Edge, nothing to install) for every parameter, a pro step sequencer (undo, transpose, reverse, Euclidean and random generators, ready-made patterns, velocity and ratchet lanes, a pattern library), the HYBRID and FMX patches, DX7 banks, wavetables, the tuning, and full backups.
## New in 1.0
+36
View File
@@ -0,0 +1,36 @@
# Clipper 1.0: testing the sequencer on an FM-1
The sequencer of SLOOP 2.7.2, brought to Clipper's single instrument. Everything below passes the host tests; this list is for checking it on a real FM-1. If a step fails, note its number and what the screen shows (a photo helps).
## 1. The NOTES page (SEQ tapped)
1. Make a short pattern: a bass with a long note and a chord (SEQ tapped, play notes on the keys: each chord or note goes into the step under edit, then the next step).
2. The page is called **NOTES**: the notes are bars as long as they last, the note under edit is outlined in white with its name, a line moves while playing.
3. **KNOB 1** walks from note to note; on a chord, its notes one by one (PITCH shows 1/3, 2/3...); it skips a long note's ties.
4. **KNOB 2** changes the pitch of that note only. **KNOB 3** makes it longer or shorter. **KNOB 4 FORCE**: GHOST (dark), SOFT (hollow), NORM, HARD, ACC (a white cap); you hear the difference when it plays.
5. **PRESETS** zooms: 8, 16, 32, 64 steps. The sound does not change.
6. **EDIT tapped** deletes the note under edit (a chord keeps its others); **EDIT + OCT-** brings it back.
7. **OCT+ tapped**: the keyboard octave, as before. **OCT+ held** half a second: the note's sheet (SLIDE, NUDGE, FILL, MOVE, COPY, DELETE). KNOB 1 picks the row, KNOB 2 sets it, OCT+ does it, OCT- closes.
8. **MOVE** + KNOB 2: the note moves a step per detent; against another note: *NO ROOM*. **COPY** + OCT+: a copy right after it. **DELETE** + OCT+: the note goes.
9. With a **MIDI keyboard**: on the NOTES page, a chord played on the keyboard writes the step, letting go moves on.
10. MENU (HOME held) > **SEQ** > **STEP ADVANCE OFF**: play a wrong chord, let go: the cursor stays; play the right one: it replaces it. Power off and on: OFF is kept. Set it back to ON.
## 2. EDIT, ARP and GLO held (layers again)
1. **EDIT held**: the ERASE screen. Stopped, EDIT + a key: that note leaves the whole pattern. Playing, hold EDIT + a key for a bar: it leaves the steps the playhead passes.
2. EDIT + **KNOB 1** SHIFT (the pattern one step later / earlier), **KNOB 2** LENGTH (x2 / half), **KNOB 3** TRANSPOSE. EDIT + **OCT-** undo, **OCT+** redo.
3. **ARP held** + a key, playing: the note repeats on the grid (ARP + KNOB 1: the rate). While recording, the repeats are written as ratchets.
4. **GLO held**: key 9 held = a fill (steps set to FILL in the sheet play, NO FILL steps are silent); key 10 = the next bar is a fill; key 16 = tap tempo; KNOB 1 = the sound's level. Keys 1 to 8 do nothing.
5. **SEQ held + a step held + KNOB 2**: that step's velocity (1 to 127).
6. **FX** and **SAVE** held: the keys still play, as before.
## 3. Recording
1. A pad (POLY): REC, hold a note, play another on top, let the second go, then the first later. On playback the first note goes on to where you let it go.
2. A chord built note by note (hold A, then B, then C), all let go together: each note starts on its step, they end together.
3. A bass in VOICE **LEGATO**, GLIDE 0: REC, play a line where each note is pressed before the previous one is let go. On playback the notes follow each other with no new attack. Played detached, each note starts again.
4. With a DAW sending MIDI clock (GLO > SYSTEM > SYNC = USB) at 140: the BPM shows 140 and stays there.
## 4. Nothing broken
PLAY / STOP, the arpeggiator, SEL held (key and chords), the sound pages, user presets, the web editor's Sequencer tab.
+8
View File
@@ -311,6 +311,11 @@ enum { ST_NOTE, ST_TIE, ST_REST };
#define SF_CONT0 8u
#define SF_CONT(k) (SF_CONT0 << (k))
#define SF_CONT_ALL (15u * SF_CONT0)
/* SLOOP 2.7.2: bit 7 of a NOTE step's flags (MONO / LEGATO / UNISON parts): played legato, recorded while the note
* before was still held: the note before is held to it and this one takes over as a held key does (LEGATO: the
* envelope goes on; a glide only with GLIDE or a SLIDE), not released and played again (seq.c rec_note, seq_step).
* An older version ignores it (the note plays again there) */
#define SF_LEG 0x80u
/* the dynamics of a note or a drum hit (2 bits each in the steps): played without velocity
* (OCT- / OCT+ held on the drum track, the step page) or from a MIDI velocity */
enum { LV_NORM, LV_GHOST, LV_SOFT, LV_HARD };
@@ -416,6 +421,9 @@ typedef struct track {
uint8_t rh_last; /* the last of them; rh_bak: what it held (an early release puts it back) */
uint32_t rh_last_abs; /* (its step of the transport grid) */
step_t rh_bak;
uint8_t rh_end; /* (SLOOP 2.7.1) one of them let go, others still held: the next step, only those go on */
uint8_t rh_rs; /* (2.7.1) rh_start is such a step (rh_last, rh_last_abs: it) */
uint8_t rh_offn, rh_off[4]; /* (2.7.1) the ones let go since the hold's last NOTE step (they end there) */
uint32_t pass; /* loops played since PLAY (a recording pass: one undo) */
/* mono */
uint8_t mono_stack[8];
+3
View File
@@ -94,6 +94,9 @@ static uint32_t lights_keep;
* default), 27 KNOB ACCEL OFF (ui_input.c), 31 the REC screen's QUANT OFF (seq.c rec_quant_off) */
static uint8_t cpu1_off; /* menu 2ND CORE: 1 = OFF, the whole render on core 0 (cpu1.c) */
static uint8_t knob_accel_off; /* menu KNOB ACCEL: 1 = OFF, one value a detent however fast */
static uint8_t step_adv_off; /* (1.0, after SLOOP 2.7.1) menu SEQ > STEP ADVANCE: 1 = OFF, the NOTES page's
* cursor stays where it is when the keys are let go (KNOB 1 moves it);
* kept in the settings' side record (project.c) */
static uint8_t usb_rate; /* (0.7) menu USB RATE: 0 AUTO, 1 44.1, 2 48 kHz (usb.c usb_rate_mode, at the
* next start; kept in the settings' side record, project.c) */
static uint32_t lights_word(void)
+1 -1
View File
@@ -582,7 +582,7 @@ static const page_t PAGES[] = {
{"SPICE", FAM_ARP, SC_TRACK, GR_NONE, {P_SPICE, P_DICE, P_SLOOP, 0xFF}}, /* (0.8) the arp's and the steps' notes
* vary; (0.9) TURNG: MUTAT SEED LOOP */
#endif
{"STEP", FAM_SEQ, SC_STEP, GR_ROLL, {0, 1, 2, 3}},
{"NOTES", FAM_SEQ, SC_STEP, GR_ROLL, {0, 1, 2, 3}}, /* (1.0, after SLOOP 2.7.2: the NOTES editor; "STEP" before) */
{"PATTERN", FAM_SEQ, SC_TRACK, GR_STEPS, {P_SLEN, P_SDIV, P_SSWING, P_SGATE}},
{"SONG", CLIPPER_SYNTH ? FAM_TRK : FAM_SEQ, SC_SONG, GR_NONE, {0xFF, 0xFF, 0xFF, 0xFF}}, /* (Clipper: out of reach) */
{"TRACKS", FAM_TRK, SC_TRK, GR_TRK, {0, 1, 2, 3}}, /* REC button; TRACK LEVEL LEN PAN */
+3 -1
View File
@@ -862,7 +862,7 @@ static void autosave_resume(void) /* power-on: the project as it wa
#define CLIP_SIDE_MAGIC 0x37504C43u /* "CLP7" */
typedef struct {
uint32_t magic;
uint8_t usb_rate, clk_out, rsv[2];
uint8_t usb_rate, clk_out, flags, rsv; /* (1.0) flags: bit 0 STEP ADVANCE OFF (0 before 1.0: ON) */
uint16_t fav[FAV_N];
uint32_t crc;
} clip_side_t;
@@ -891,6 +891,7 @@ static void side_fill(side2_t *s) /* what the side record hol
r->magic = CLIP_SIDE_MAGIC;
r->usb_rate = (uint8_t)(usb_rate % 3u);
r->clk_out = (uint8_t)(clk_out != 0u);
r->flags = (uint8_t)(step_adv_off != 0u);
memcpy(r->fav, fav, sizeof fav);
r->crc = st_crc32(r, sizeof *r - 4u);
#if CLIPPER_SYNTH
@@ -905,6 +906,7 @@ static void side_take(const side2_t *s) /* a side record read back:
if (r->magic == CLIP_SIDE_MAGIC && r->crc == st_crc32(r, sizeof *r - 4u)) {
usb_rate = (uint8_t)(r->usb_rate % 3u);
clk_out = (uint8_t)(r->clk_out & 1u);
step_adv_off = (uint8_t)(r->flags & 1u);
memcpy(fav, r->fav, sizeof fav);
}
#if CLIPPER_SYNTH
+197 -24
View File
@@ -49,6 +49,25 @@ static int8_t kb_oct[27]; /* the octave buttons when the key w
static uint8_t last_note = 60;
static uint8_t pen_n = 1, pen_note[4] = {60}; /* the last chord / note played: the SEQ layer writes it */
static uint8_t pen_lane; /* the last drum lane played: the SEQ layer's lane */
/* 1.0, after SLOOP 2.6: the MIDI keyboard's notes. mi_pen: the notes held on the instrument (the SEQ layer's pen, as the
* keys: the notes down together are a chord). step_in_q: every note-on / note-off of the instrument from MIDI, note | on
* << 7, for the NOTES page's entry (ui_input.c midi_entry): the audio side writes, the UI reads; a full queue drops and
* says so */
static uint32_t mi_pen[4];
#define STEP_IN_Q 32u
static volatile uint16_t step_in_q[STEP_IN_Q];
static volatile uint32_t step_in_w;
static volatile uint8_t step_in_lost;
static uint32_t step_in_r;
static void step_in_push(uint32_t ev)
{
if (step_in_w - step_in_r >= STEP_IN_Q) {
step_in_lost = 1;
return;
}
step_in_q[step_in_w % STEP_IN_Q] = (uint16_t)ev;
step_in_w++;
}
static volatile uint8_t transport_req; /* 1 start, 2 stop (from the UI); 3 start from a MIDI START */
static volatile uint8_t panic_req; /* bit per track: release every sounding note (preset / engine change) */
static volatile uint8_t arp_keep_req; /* (2.7) bit per track: a sound loaded under its running arp: the arp's notes stay */
@@ -126,9 +145,10 @@ static volatile uint8_t ly_lock = LY_PLAY;
static uint32_t layer_buttons(void) { return fm1_in.buttons | (ly_lock != LY_PLAY ? ly_bit[ly_lock % LY_COUNT] : 0u); }
/* the layer the keys are in: the held function button (FX, EDIT, ARP, SEQ, SEL, GLO in that order),
* else the locked one */
/* Clipper: the layers a synth keeps: SEQ (the steps) and SEL (key and chords). FX, EDIT, ARP, GLO and SAVE only
* open their pages; held, the keys still play */
static int ly_on(uint32_t l) { return !CLIPPER_SYNTH || l == LY_STEP || l == LY_SCALE; }
/* Clipper: the layers a synth keeps: SEQ (the steps), SEL (key and chords) and (1.0, the sequencer of SLOOP 2.7.2)
* EDIT (erase, SHIFT, LENGTH, TRANSPOSE, undo / redo), ARP (note repeat) and GLO (fill, fill bar, tap tempo, the level).
* FX and SAVE only open their pages; held, the keys still play */
static int ly_on(uint32_t l) { return !CLIPPER_SYNTH || (l != LY_FX && l != LY_SONG); }
static uint32_t layer_now(void)
{
uint32_t b = layer_buttons(), l;
@@ -509,6 +529,9 @@ static void step_add(track_t *t, uint32_t idx, uint32_t note, uint32_t vel, uint
s->vel = (uint8_t)vel;
}
#ifndef UI_SMALL
#define UI_SMALL /* (gfx.c: minsize; the host tests: nothing) */
#endif
/* ---- SLOOP 2.7: overdub over held notes ----
* A pattern holds its notes with TIE steps (the notes of the NOTE step before them go on). A note recorded into a TIE
* used to make that step a NOTE of its own, which ends the held notes there. Now (POLY parts) the step becomes a NOTE
@@ -516,7 +539,7 @@ static void step_add(track_t *t, uint32_t idx, uint32_t note, uint32_t vel, uint
* oldest held one makes room); the step after it, when a TIE, becomes the new note's end: a NOTE of the held notes
* only, all going on (step_pure_cont). While the new note is held, rec_hold moves that end along. Step entry (SEQ +
* key) still replaces what plays. */
static uint32_t chain_notes(const track_t *t, uint32_t idx, uint8_t *out) /* what goes on into TIE step idx */
UI_SMALL static uint32_t chain_notes(const track_t *t, uint32_t idx, uint8_t *out) /* what goes on into TIE step idx */
{
uint32_t len = trk_len(t), k;
for (k = 1; k < len; k++) {
@@ -531,11 +554,11 @@ static uint32_t chain_notes(const track_t *t, uint32_t idx, uint8_t *out) /* w
}
return 0;
}
static int step_pure_cont(const step_t *s) /* a NOTE whose notes all go on: the end of an overdubbed note */
UI_SMALL static int step_pure_cont(const step_t *s) /* a NOTE whose notes all go on: the end of an overdubbed note */
{
return s->time == ST_NOTE && s->n && s->n <= 4u && ((s->flags & SF_CONT_ALL) / SF_CONT0) == (1u << s->n) - 1u;
}
static void chain_end(track_t *t, uint32_t j, const uint8_t *keep, uint32_t n) /* TIE j: only keep goes on */
UI_SMALL static void chain_end(track_t *t, uint32_t j, const uint8_t *keep, uint32_t n) /* TIE j: only keep goes on */
{
step_t *s = &t->step[j % NSTEP];
uint32_t i;
@@ -549,7 +572,7 @@ static void chain_end(track_t *t, uint32_t j, const uint8_t *keep, uint32_t n)
s->n = (uint8_t)i;
s->time = ST_NOTE;
}
static uint32_t cont_notes(const step_t *s, uint32_t except, uint8_t *out) /* its notes going on, but except */
UI_SMALL static uint32_t cont_notes(const step_t *s, uint32_t except, uint8_t *out) /* its notes going on, but except */
{
uint32_t i, n = 0;
for (i = 0; i < s->n && i < 4u; i++)
@@ -558,22 +581,94 @@ static uint32_t cont_notes(const step_t *s, uint32_t except, uint8_t *out) /*
return n;
}
/* (2.7.1) several notes held while recording (POLY): each goes on until its own key is let go. A note recorded over a
* held one makes its step a NOTE of the held ones going on + the new one (as over a pattern's held notes, above); one let
* go while others are held ends there: the step it ends on becomes a NOTE of the others only, all going on (hold_restart),
* and TIEs carry them on. Before, the hold followed the newest note only and the others ended with it */
UI_SMALL static int rh_has(const track_t *t, uint32_t note) /* a note of this hold: held, or let go since its last NOTE */
{
uint32_t i;
for (i = 0; i < t->rh_n; i++)
if (t->rh_note[i] == note)
return 1;
for (i = 0; i < t->rh_offn; i++)
if (t->rh_off[i] == note)
return 1;
return 0;
}
UI_SMALL static int rh_held(const track_t *t, uint32_t note)
{
uint32_t i;
for (i = 0; i < t->rh_n; i++)
if (t->rh_note[i] == note)
return 1;
return 0;
}
UI_SMALL static void hold_marker_clear(track_t *t, uint32_t j, uint32_t also) /* an end marker of only this hold's notes: gone */
{
step_t *s = &t->step[j % NSTEP];
uint32_t i;
if (!step_pure_cont(s))
return;
for (i = 0; i < s->n; i++)
if (!rh_has(t, s->note[i]) && s->note[i] != also)
return;
memset(s, 0, sizeof *s);
s->time = ST_REST;
}
UI_SMALL static void hold_restart(track_t *t, uint32_t j, uint32_t len, uint32_t abs) /* step j: only the notes still held go on */
{
step_t *s = &t->step[j % NSTEP];
uint8_t c[4];
uint32_t n = chain_notes(t, j, c), i, k, m = 0;
for (i = 0; i < n; i++) { /* (what sounded into j, but the ones let go) */
for (k = 0; k < t->rh_offn && t->rh_off[k] != c[i]; k++)
;
if (k == t->rh_offn)
c[m++] = c[i];
}
hold_marker_clear(t, (j + 1u) % len, 0x100u);
memset(s, 0, sizeof *s);
for (i = 0; i < m; i++) {
s->note[i] = c[i];
s->flags |= (uint8_t)SF_CONT(i);
}
s->n = (uint8_t)m;
s->time = m ? ST_NOTE : ST_REST;
t->rh_start = (uint8_t)j;
t->rh_last = (uint8_t)j;
t->rh_last_abs = abs;
t->rh_ties = 0;
t->rh_rs = 1;
t->rh_end = 0;
t->rh_offn = 0;
}
/* live recording into a synth part: the nearest step (rec_target). Held on: each further step the
* sequencer enters while the note is held becomes a TIE (rec_hold), up to the pattern length and
* never over a step with notes (overdub keeps them); a release before the middle of the last one
* puts that step back (rec_release), so a short note stays one step. A note recorded into another
* step ends the hold before (the step model ties the notes of one step only). */
static void rec_note(track_t *t, uint32_t note, uint32_t vel, uint32_t rat, int hold)
UI_SMALL static void rec_note(track_t *t, uint32_t note, uint32_t vel, uint32_t rat, int hold)
{
uint32_t len = trk_len(t), later, abs = rec_target(t, &later), idx = abs % len, k;
int was_empty = !(t->step[idx % NSTEP].time == ST_NOTE && t->step[idx % NSTEP].n);
step_t *st = &t->step[idx % NSTEP];
uint8_t ch[4], keep[4];
uint32_t nc, nk = 0;
uint32_t nc = 0, nk = 0, merged = 0;
undo_mark(t, UNDO_REC(t));
if (t->p[P_VOICE] == V_POLY && !rat && st->time == ST_TIE && (nc = chain_notes(t, idx, ch)) != 0) {
if (t->p[P_VOICE] == V_POLY && !rat && hold && t->rh_n && st->time != ST_TIE && !(st->time == ST_NOTE && st->n) &&
idx == ((t->rh_ties || t->rh_rs ? t->rh_last : t->rh_start) + 1u) % len) {
nc = t->rh_n; /* (2.7.1) the step the hold goes on into, not tied yet: as a TIE */
memcpy(ch, t->rh_note, nc);
st->time = ST_TIE;
} else if (t->p[P_VOICE] == V_POLY && !rat && st->time == ST_TIE) {
nc = chain_notes(t, idx, ch);
}
if (nc) {
merged = hold != 0;
for (k = 0; k < nc; k++) /* (2.7) over held notes: they go on, this one starts */
if (ch[k] != note)
if (ch[k] != note && !(t->rh_n && rh_has(t, ch[k]) && !rh_held(t, ch[k]))) /* (2.7.1: not one let go) */
keep[nk++] = ch[k];
while (nk > 3u) { /* (four at most: the oldest one ends here) */
for (k = 0; k + 1u < nk; k++)
@@ -593,7 +688,13 @@ static void rec_note(track_t *t, uint32_t note, uint32_t vel, uint32_t rat, int
if ((idx + 1u) % len != idx)
chain_end(t, (idx + 1u) % len, keep, nk);
} else {
uint32_t last = t->rh_ties || t->rh_rs ? t->rh_last : t->rh_start;
int leg = t->p[P_VOICE] != V_POLY && !rat && hold && t->rh_n && !(t->rh_n == 1u && t->rh_note[0] == note) &&
idx != t->rh_start && (idx == (last + 1u) % len || (t->rh_ties && idx == last && st->time == ST_TIE));
step_add(t, idx, note, vel, vel_lvl(vel), rat);
if (leg) /* (2.7.2) MONO / LEGATO: played over the note before, still held
* into this step (or to it): legato, as it sounded */
st->flags |= (uint8_t)SF_LEG;
for (k = 0; k < st->n; k++) /* (2.7) played again: it starts here */
if (st->note[k] == note)
st->flags &= (uint8_t)~SF_CONT(k);
@@ -612,10 +713,15 @@ static void rec_note(track_t *t, uint32_t note, uint32_t vel, uint32_t rat, int
}
if (!hold)
return;
if (!t->rh_n || t->rh_start != idx) { /* a new hold (one in another step ends) */
if (merged) { /* (2.7.1) over held ones: they stay held, from this step on */
t->rh_start = (uint8_t)idx;
t->rh_ties = 0;
t->rh_rs = t->rh_end = t->rh_offn = 0;
} else if (!t->rh_n || t->rh_start != idx) { /* a new hold (one in another step ends) */
t->rh_n = 0;
t->rh_start = (uint8_t)idx;
t->rh_ties = 0;
t->rh_rs = t->rh_end = t->rh_offn = 0;
}
for (k = 0; k < t->rh_n && t->rh_note[k] != note; k++)
;
@@ -643,7 +749,7 @@ static void rec_hit(track_t *t, uint32_t lane, uint32_t lvl, uint32_t rat)
}
/* the sequencer enters step idx (before playing it): a recorded note still held ties into it */
static void rec_hold(track_t *t, uint32_t idx, uint32_t len, uint32_t abs)
UI_SMALL static void rec_hold(track_t *t, uint32_t idx, uint32_t len, uint32_t abs)
{
step_t *s;
if (!t->rh_n)
@@ -655,6 +761,10 @@ static void rec_hold(track_t *t, uint32_t idx, uint32_t len, uint32_t abs)
if (idx == t->rh_start)
return; /* (recorded ahead into the step now starting) */
s = &t->step[idx];
if (t->rh_end && (s->time == ST_TIE || s->time == ST_REST || !s->n || step_pure_cont(s))) {
hold_restart(t, idx, len, abs); /* (2.7.1) one let go: from here the others only */
return;
}
if (step_pure_cont(s)) { /* (2.7) the end of a note over held ones: it goes on, the end moves */
uint8_t keep[4];
uint32_t nk = cont_notes(s, 0x100u, keep);
@@ -681,19 +791,41 @@ static void rec_hold(track_t *t, uint32_t idx, uint32_t len, uint32_t abs)
}
/* a key of a recorded note is up: the hold ends with the last one */
static void rec_release(track_t *t, uint32_t note)
UI_SMALL static void rec_release(track_t *t, uint32_t note)
{
uint32_t i, k = 0, into, slen, half, lat;
uint32_t i, k = 0, into, slen, half, lat, early, len = trk_len(t);
for (i = 0; i < t->rh_n; i++)
if (t->rh_note[i] != note)
t->rh_note[k++] = t->rh_note[i];
if (k == t->rh_n || (t->rh_n = (uint8_t)k))
return; /* not one of them, or others still held */
if (!t->rh_ties || trk_grid(t, &into, &slen) != t->rh_last_abs)
return;
if (k == t->rh_n)
return; /* not one of them */
early = trk_grid(t, &into, &slen) == t->rh_last_abs;
half = slen / 2u;
lat = REC_LAT * (uint32_t)song.g[G_BPM];
if (into <= half + (lat < half ? lat : half) && t->step[t->rh_last].time == ST_TIE)
early = early && into <= half + (lat < half ? lat : half); /* (let go early in the hold's last step) */
if (k) { /* (2.7.1) others still held: this one ends, they go on */
t->rh_n = (uint8_t)k;
if (t->p[P_VOICE] != V_POLY)
return;
if (t->rh_offn < 4u)
t->rh_off[t->rh_offn++] = (uint8_t)note;
if (t->rh_ties && early && t->step[t->rh_last].time == ST_TIE)
hold_restart(t, t->rh_last, len, t->rh_last_abs); /* (not held into this step: it ends before it) */
else
t->rh_end = 1; /* (held into this step: it ends with it) */
return;
}
t->rh_n = 0;
hold_marker_clear(t, ((t->rh_ties || t->rh_rs ? t->rh_last : t->rh_start) + 1u) % len, note); /* (2.7.1) an end left
* ahead of notes all let go */
if (t->rh_rs && !t->rh_ties && early && step_pure_cont(&t->step[t->rh_last])) {
memset(&t->step[t->rh_last], 0, sizeof t->step[t->rh_last]); /* (2.7.1) let go early in a step the others went on */
t->step[t->rh_last].time = ST_REST; /* into: not held into it */
}
t->rh_end = t->rh_rs = t->rh_offn = 0;
if (!t->rh_ties || !early)
return;
if (t->step[t->rh_last].time == ST_TIE)
t->step[t->rh_last] = t->rh_bak; /* released early in it: not held into this step */
}
@@ -2256,8 +2388,9 @@ static void seq_step(track_t *t, const step_t *s, uint32_t slen, uint32_t skip)
uint32_t i, j, gate = slen * (uint32_t)t->p[P_SGATE] / 128u;
uint32_t slide_in = t->seq_hold && t->seq_n;
const step_t *nx = &t->step[(t->seq_idx + 1u) % trk_len(t)];
uint32_t next_tie = nx->time == ST_TIE || (nx->time == ST_NOTE && (nx->flags & SF_CONT_ALL)); /* (2.7: notes going on
* into the next step: held to it, it says which end) */
uint32_t next_tie = nx->time == ST_TIE || (nx->time == ST_NOTE && (nx->flags & (SF_CONT_ALL | SF_LEG))); /* (2.7: notes
* going on into the next step: held to it, it says which end;
* SLOOP 2.7.2: a legato note next: held to it) */
#if CLIPPER_SYNTH
step_t vs; /* (0.8) SPICE: this step's variation, on a copy */
if (t->p[P_SPICE] && s->time == ST_NOTE && s->n && !s->rat && !(s->flags & SF_CONT_ALL)) {
@@ -2323,7 +2456,8 @@ static void seq_step(track_t *t, const step_t *s, uint32_t slen, uint32_t skip)
hits = 1u + ((s->rat >> (2u * i)) & 3u);
gate /= hits;
}
t->slide_glide = (uint8_t)slide_in;
t->slide_glide = (uint8_t)(slide_in && (!(s->flags & SF_LEG) || /* (2.7.2: legato alone: no glide of its own) */
(t->step[(t->seq_idx + trk_len(t) - 1u) % trk_len(t)].flags & SF_SLIDE)));
if (!slide_in)
seq_release(t);
for (i = 0; i < s->n; i++)
@@ -2706,12 +2840,15 @@ static void __attribute__((noinline)) midi_cc(track_t *t, uint32_t cc, uint32_t
* (the slicer, delay and arp follow it). START restarts from the top, CONTINUE carries on where it
* stopped, STOP stops. With no pulse for 0.5 s, the internal tempo takes over (PLAY works as ever). */
#define MCLK_PULSE_U (BEAT_U / 24u)
#define MCLK_NB 8u /* (2.7.2) the tempo: the mean of the last 8 beats */
static struct {
uint32_t pos, done; /* units: the master's position (pulses since START), ours */
uint32_t last_ms, iv_ms; /* the last pulse, the interval between pulses (smoothed) */
uint32_t beat_ms; /* when pulse 0 of the last 24 came: the tempo */
uint8_t have, n24; /* a pulse since START; pulses towards the next tempo reading */
uint8_t alive; /* pulses are coming (from the SYNC source) */
uint8_t nb, bi; /* (2.7.2) the last beats' lengths (bdt[], up to MCLK_NB, bi the next) */
uint16_t bdt[MCLK_NB];
} mclk;
static int mclk_on(void) /* the clock drives the sequencer */
@@ -2719,6 +2856,28 @@ static int mclk_on(void) /* the clock drives the sequen
return song.g[G_SYNC] && mclk.alive && fm1_ms - mclk.last_ms < 500u;
}
/* (2.7.2) the tempo from a beat of dt ms. A beat timed to the millisecond reads +-1 BPM at random (140: 428.6 ms; the
* computer, USB and our blocks move a pulse by a few ms), so: the mean of the last 8 beats, in tenths of a BPM; once
* there are 8, BPM changes only when the mean is 0.8 away (a steady 140 stays 140; a tempo ramp still goes through). A
* beat 5 BPM or more away is a new tempo: taken at once (the 8 start again). The sequencer follows the pulses either
* way: this is the BPM shown (and what follows it: delay, slicer, arp) */
static void mclk_tempo(uint32_t dt)
{
uint32_t k, sum = 0, t10;
int32_t one = (int32_t)((60000u + dt / 2u) / dt), cur = song.g[G_BPM];
if (mclk.nb && (one - cur >= 5 || cur - one >= 5))
mclk.nb = 0;
mclk.bdt[mclk.bi] = (uint16_t)dt;
mclk.bi = (uint8_t)((mclk.bi + 1u) % MCLK_NB);
if (mclk.nb < MCLK_NB)
mclk.nb++;
for (k = 0; k < mclk.nb; k++)
sum += mclk.bdt[(mclk.bi + MCLK_NB - 1u - k) % MCLK_NB];
t10 = (600000u * mclk.nb + sum / 2u) / sum; /* (<= 8 x 600000 + 6000: fits 32 bits) */
if (mclk.nb < MCLK_NB || (int32_t)t10 - cur * 10 >= 8 || cur * 10 - (int32_t)t10 >= 8)
song.g[G_BPM] = (int16_t)clamp((int32_t)((t10 + 5u) / 10u), 40, 240);
}
static void mclk_event(uint32_t st, uint32_t src) /* a realtime message; src 1 USB, 2 TRS */
{
uint32_t now = fm1_ms;
@@ -2745,13 +2904,14 @@ static void mclk_event(uint32_t st, uint32_t src) /* a realtime message; src 1
}
if (!mclk.alive || now - mclk.last_ms >= 500u) { /* (re)started: count a fresh beat */
mclk.n24 = 0;
mclk.nb = 0;
mclk.beat_ms = now;
} else if (++mclk.n24 == 24u) { /* a beat: the tempo */
uint32_t dt = now - mclk.beat_ms;
mclk.n24 = 0;
mclk.beat_ms = now;
if (dt >= 250u && dt <= 1500u) /* 40..240 BPM */
song.g[G_BPM] = (int16_t)clamp((int32_t)((60000u + dt / 2u) / dt), 40, 240);
mclk_tempo(dt);
}
mclk.alive = 1;
mclk.last_ms = now;
@@ -2938,6 +3098,8 @@ static void events_block(uint32_t n)
}
if (pr)
arp_keep_req = 0;
if (pr)
mi_pen[0] = mi_pen[1] = mi_pen[2] = mi_pen[3] = 0; /* (1.0: the MIDI pen's notes held: never stuck either) */
keyboard_block();
drum_audition_poll(); /* (the editor's DRUM SYNTH page) */
strum_block(n); /* (voice.c: the strummed notes due) */
@@ -2990,6 +3152,13 @@ static void events_block(uint32_t n)
trk_note_off1(t, d1);
#endif
} else if (st == 0x90u && d2) {
if (t == TSEL) { /* (1.0, SLOOP 2.6) the SEQ layer's pen: this note, or the chord held */
if (!(mi_pen[0] | mi_pen[1] | mi_pen[2] | mi_pen[3]) || pen_n >= 4u)
pen_n = 0;
pen_note[pen_n++] = (uint8_t)d1;
mi_pen[d1 >> 5] |= 1u << (d1 & 31u);
step_in_push(d1 | 0x80u); /* (the NOTES page's entry) */
}
#if CLIPPER_SYNTH
mpe_cur_ch = (uint8_t)(mpe_mode ? ch : 0u); /* (voice.c voice_start: the voice's channel) */
input_on(t, d1, d2);
@@ -2998,6 +3167,10 @@ static void events_block(uint32_t n)
input_on(t, d1, d2);
#endif
} else {
if (t == TSEL) {
mi_pen[d1 >> 5] &= ~(1u << (d1 & 31u));
step_in_push(d1);
}
input_off(t, d1);
}
}
+200
View File
@@ -50,6 +50,9 @@ static struct {
uint8_t bank; /* SEQ: 16-step bank (follows the cursor) */
uint8_t cursor; /* SEQ: step being edited (STEP page KNOB 1 moves it) */
uint8_t entry_open; /* SEQ: keys held since the first press of this entry */
uint8_t note_k; /* (1.0, SLOOP 2.7.2) NOTES: the note of the cursor's chord (0..n-1) */
uint8_t zoom; /* (1.0) NOTES: the steps shown, NV_ZOOM[1 + zoom] (PRESETS) */
uint8_t sheet; /* (1.0) NOTES: the note's sheet (OCT+ held) open: 1 + its row; 0 closed */
uint8_t hot_col, hot_t; /* column whose knob was just turned (drawn white) */
uint8_t menu; /* 0 off, 1 list, 2 about (HOME held) */
uint8_t menu_sel;
@@ -125,6 +128,37 @@ static void page_entered(void)
}
static int step_on(const step_t *st) { return st->time == ST_NOTE && st->n; }
/* (1.0, SLOOP 2.6) a note's length: its step and the TIEs after it (inside LEN); note_set_len makes it want steps
* long: shorter, its last TIEs become RESTs; longer, the RESTs after it become TIEs, up to the next step with notes
* (or LEN). Returns its length now */
static uint32_t note_len(const track_t *t, uint32_t i)
{
uint32_t len = (uint32_t)clamp(t->p[P_SLEN], 1, NSTEP), n = 1;
while (i + n < len && t->step[i + n].time == ST_TIE)
n++;
return n;
}
static uint32_t note_set_len(track_t *t, uint32_t i, uint32_t want)
{
uint32_t len = (uint32_t)clamp(t->p[P_SLEN], 1, NSTEP), n = note_len(t, i);
for (; n > want && n > 1u; n--) {
if (!t->step[i + n - 1u].n) /* (a TIE holding notes, from an older pattern, keeps them) */
memset(&t->step[i + n - 1u], 0, sizeof(step_t));
t->step[i + n - 1u].time = ST_REST;
}
for (; n < want && i + n < len && !t->step[i + n].n; n++) {
memset(&t->step[i + n], 0, sizeof(step_t));
t->step[i + n].time = ST_TIE;
}
return n;
}
/* (1.0, SLOOP 2.6) a synth step's velocity as it plays (seq.c step_vel: ACC 127, else its VEL, 96 when 0, through its
* first note's level) */
static uint32_t step_vel_shown(const step_t *st)
{
uint32_t base = (st->flags & SF_ACCENT) ? 127u : (st->vel ? st->vel : 96u);
return lvl_vel(st->lvl & 3u, base);
}
/* step i of track t has something to play (synth: notes, drums: a lane) */
static int trk_step_on(const track_t *t, uint32_t i)
{
@@ -150,8 +184,11 @@ static int undo_swap(int redo)
uint32_t i;
for (i = 0; i < NSTEP; i++) {
step_t x = t->step[i];
int8_t m = t->micro[i];
t->step[i] = undo.st[i];
undo.st[i] = x;
t->micro[i] = undo.micro[i]; /* (1.0, as SLOOP 2.7: and its nudge; undo_mark kept it) */
undo.micro[i] = m;
}
}
len = t->p[P_SLEN];
@@ -171,12 +208,175 @@ static void cursor_set(int32_t c)
ui.cursor = (uint8_t)((c % len + len) % len);
ui.bank = (uint8_t)(ui.cursor / 16u);
ui.entry_open = 0;
ui.note_k = 0;
}
static void cursor_fix(void) /* LEN got shorter: onto the last step */
{
if (ui.cursor >= (uint32_t)TSEL->p[P_SLEN])
cursor_set(TSEL->p[P_SLEN] - 1);
if (ui.note_k && ui.note_k >= TSEL->step[ui.cursor].n)
ui.note_k = (uint8_t)(TSEL->step[ui.cursor].n ? TSEL->step[ui.cursor].n - 1u : 0u);
}
/* ---- 1.0, after SLOOP 2.7.2: SEQ > NOTES, the note editor (after Melodee's NOTES page, keremimo, GPL-3.0: the idea,
* not its code). The note under edit: step ui.cursor, note ui.note_k of its chord. KNOB 1 walks the notes (a chord's one
* by one) and the empty steps; a note's TIEs are its length, not stops. KNOB 2 its pitch, KNOB 3 its length
* (note_set_len), KNOB 4 its FORCE, PRESETS the zoom; OCT+ held its sheet (SLIDE, NUDGE, FILL, MOVE, COPY, DELETE) */
static const uint8_t NV_ZOOM[4] = {8, 16, 32, 64};
static const char *const FORCE_N[5] = {"GHOST", "SOFT", "NORM", "HARD", "ACC"};
static const uint8_t F_LVL[4] = {LV_GHOST, LV_SOFT, LV_NORM, LV_HARD};
static const char *const SHEET_N[6] = {"SLIDE", "NUDGE", "FILL", "MOVE", "COPY", "DELETE"};
static const char *const FILL_N[3] = {"NORMAL", "FILL", "NO FILL"};
static void note_walk(int32_t dir)
{
track_t *t = TSEL;
uint32_t len = trk_len(t), i = ui.cursor % len, guard = len;
const step_t *st = &t->step[i];
if (dir > 0 && step_on(st) && ui.note_k + 1u < st->n) {
ui.note_k++;
return;
}
if (dir < 0 && step_on(st) && ui.note_k) {
ui.note_k--;
return;
}
do /* (the TIEs belong to the note before them) */
i = dir > 0 ? (i + 1u) % len : (i + len - 1u) % len;
while (--guard && t->step[i].time == ST_TIE);
cursor_set((int32_t)i);
if (dir < 0 && step_on(&t->step[i]))
ui.note_k = (uint8_t)(t->step[i].n - 1u); /* (back: the chord's last note) */
}
static uint32_t note_force(const step_t *st, uint32_t k) /* 0 GHOST .. 3 HARD, 4 ACC (the step's accent) */
{
uint32_t l = (st->lvl >> (2u * k)) & 3u;
if (st->flags & SF_ACCENT)
return 4u;
return l == LV_GHOST ? 0u : l == LV_SOFT ? 1u : l == LV_HARD ? 3u : 2u;
}
static void note_force_set(step_t *st, uint32_t k, uint32_t f)
{
uint32_t sh = 2u * k;
st->lvl = (uint8_t)((st->lvl & ~(3u << sh)) | (uint32_t)F_LVL[f > 3u ? 3u : f] << sh);
st->flags = (uint8_t)((st->flags & ~SF_ACCENT) | (f == 4u ? SF_ACCENT : 0u));
}
static uint8_t drop2(uint32_t v, uint32_t k) /* a 2-bit field per note: note k's taken out */
{
return (uint8_t)((v & ((1u << (2u * k)) - 1u)) | ((v >> (2u * k + 2u)) << (2u * k)));
}
static void note_del(track_t *t, uint32_t i, uint32_t k) /* one note of a chord; the last one: the step */
{
step_t *st = &t->step[i];
uint32_t j, c;
if (!step_on(st))
return;
if (st->n <= 1u) {
note_set_len(t, i, 1); /* (its TIEs: RESTs) */
step_clear(st);
return;
}
for (j = k; j + 1u < st->n; j++)
st->note[j] = st->note[j + 1u];
st->lvl = drop2(st->lvl, k);
st->rat = drop2(st->rat, k);
c = (st->flags & SF_CONT_ALL) / SF_CONT0;
c = (c & ((1u << k) - 1u)) | ((c >> (k + 1u)) << k);
st->flags = (uint8_t)((st->flags & ~SF_CONT_ALL) | c * SF_CONT0);
st->n--;
}
static int step_free(const track_t *t, uint32_t i) /* nothing there: no note, no TIE */
{
return !step_on(&t->step[i]) && t->step[i].time != ST_TIE;
}
/* a note (its step, TIEs, nudge, fill, locks) one step on or back (copy: to just after it, the original stays);
* the steps it goes to must be free, inside the pattern. Returns where it is now, or -1 */
static int32_t note_shift(track_t *t, uint32_t i, int32_t dir, int copy)
{
uint32_t len = trk_len(t), n = note_len(t, i), j, to;
if (!step_on(&t->step[i]))
return -1;
to = copy ? i + n : dir > 0 ? i + 1u : i - 1u;
if ((!copy && dir < 0 && i == 0u) || to + n > len)
return -1;
for (j = 0; j < n; j++)
if ((to + j < i || to + j >= i + n) && !step_free(t, to + j))
return -1;
fm1_irq_off();
if (copy) {
for (j = 0; j < n; j++)
t->step[to + j] = t->step[i + j];
} else if (dir > 0) {
for (j = n; j > 0; j--)
t->step[i + j] = t->step[i + j - 1u];
step_clear(&t->step[i]);
} else {
for (j = 0; j < n; j++)
t->step[i - 1u + j] = t->step[i + j];
step_clear(&t->step[i + n - 1u]);
}
t->micro[to] = t->micro[i];
step_fill_set(t, to, step_fill(t, i));
for (j = 0; j < NLOCK; j++)
if (t->lock[j].step == i) {
if (!copy)
t->lock[j].step = (uint8_t)to;
else {
int k = lock_find(t, to, t->lock[j].param, 1);
if (k >= 0) {
t->lock[k].step = (uint8_t)to;
t->lock[k].param = t->lock[j].param;
t->lock[k].val = t->lock[j].val;
}
}
}
if (!copy) {
t->micro[i] = 0;
step_fill_set(t, i, FC_NORM);
}
fm1_irq_on();
return (int32_t)to;
}
/* OCT+ on the NOTES page: a tap acts on release (the octave, as everywhere), a hold (0.4 s) opens the sheet. Returns
* pressed without OCT+ while it is down; *ev: 1 tapped, 2 held. OCT- pressed meanwhile: OCT+ as before */
static uint8_t octp;
static uint32_t octp_t;
static uint32_t octp_filter(uint32_t pressed, uint32_t *ev)
{
uint32_t ub = 1u << panel.btn[B_OCTUP];
*ev = 0;
if (pressed & ub) {
octp = 1;
octp_t = fm1_ms;
pressed &= ~ub;
}
if (octp == 1u && (fm1_in.buttons & (1u << panel.btn[B_OCTDN]))) {
octp = 0;
return pressed | ub; /* (both: the octave back to 0, as before) */
}
if (octp && !(fm1_in.buttons & ub)) {
*ev = octp == 1u;
octp = 0;
} else if (octp == 1u && fm1_ms - octp_t >= 400u) {
octp = 2;
*ev = 2;
}
return pressed;
}
/* the sheet over the NOTES page: six rows, the one KNOB 1 picks lit, values on the right */
static void sheet_draw(int32_t x, int32_t y, const char *const *lab, const char *const *val, uint32_t sel, uint16_t acc)
{
int32_t w = 124, k;
cv_rect(x - 1, y - 1, w + 2, 6 * 16 + 4, C_LINE);
cv_rect(x, y, w, 6 * 16 + 2, C_BLACK);
for (k = 0; k < 6; k++) {
int32_t ry = y + 2 + k * 16;
if ((uint32_t)k == sel)
cv_rect(x + 1, ry - 1, w - 2, 15, acc);
cv_text(x + 5, ry, &FONT_S, lab[k], (uint32_t)k == sel ? C_WHITE : C_HI);
if (val[k] && val[k][0])
cv_text(x + w - 5 - text_w(&FONT_S, val[k]), ry, &FONT_S, val[k], (uint32_t)k == sel ? C_WHITE : C_AMB);
}
}
static void note_name(char *b, uint32_t n)
+120 -61
View File
@@ -250,51 +250,108 @@ static void graph_steps(const track_t *t, uint16_t c)
cv_rect(x - 1, y + 16, 3, 3, C_WHITE);
}
}
/* STEP page: the cursor's 16-step bank as a little piano roll */
/* (1.0, after SLOOP 2.7.2) SEQ > NOTES: the pattern as a piano roll (cv_oy 0, the whole strip). Each note a bar as
* long as its step and TIEs, its FORCE as its fill (GHOST dark, SOFT hollow, NORM / HARD full, ACC a white cap), a
* SLIDE's line to the next; the note under edit outlined in white, its name over it; the C rows named on the left, the
* beats ruled; the playhead a line. The rows follow the note under edit when the pattern spans more than 18 semitones */
static void graph_roll(const track_t *t, uint16_t c)
{
uint32_t i, j, len = (uint32_t)t->p[P_SLEN], base = ui.bank * 16u;
int32_t lo = 127, hi = 0, prev_y = -1;
uint32_t len = trk_len(t), nv = NV_ZOOM[clamp(1 + (int8_t)ui.zoom, 0, 3)], v0, i, j;
int32_t lo = 127, hi = 0, x0 = 22, w = 240 - 22 - 2, top = 14, bot = H_GRAPH - 4, rh, sel_note = last_note, cx;
const step_t *cs = &t->step[ui.cursor];
char b[12];
if (nv > len)
nv = len;
v0 = ui.cursor / nv * nv;
for (i = 0; i < len; i++)
for (j = 0; j < t->step[i].n; j++) {
if (t->step[i].note[j] < lo)
lo = t->step[i].note[j];
if (t->step[i].note[j] > hi)
hi = t->step[i].note[j];
if (t->step[i].note[j] < lo) lo = t->step[i].note[j];
if (t->step[i].note[j] > hi) hi = t->step[i].note[j];
}
if (lo > hi) {
lo = 48;
hi = 72;
if (step_on(cs))
sel_note = cs->note[ui.note_k % cs->n];
if (lo > hi)
lo = hi = sel_note;
if (hi - lo < 11) { /* (an octave at least: rows of a sane height) */
lo = clamp((lo + hi) / 2 - 6, 0, 115);
hi = lo + 11;
}
if (hi - lo < 12)
hi = lo + 12;
for (i = 0; i < 16u; i++) {
uint32_t si = base + i;
const step_t *st = &t->step[si];
int32_t x = (int32_t)i * 15, yb = 86;
if (si >= len)
break;
if (si == ui.cursor)
cv_rect(x + 5, 92, 3, 3, C_WHITE);
if (song.playing && si == t->seq_idx)
cv_rect(x + 1, 97, 12, 1, C_WHITE);
if (st->time == ST_TIE && prev_y >= 0) {
cv_rect(x, prev_y, 14, 1, C_GRAY);
continue;
if (hi - lo > 17) { /* (a wide pattern: 18 rows around the note under edit) */
lo = clamp(sel_note - 8, lo, hi - 17);
hi = lo + 17;
}
lo = clamp(lo - 1, 0, 127), hi = clamp(hi + 1, 0, 127);
rh = (bot - top) / (hi - lo + 1);
fmt_int(b, (int32_t)v0 + 1);
str_cpy(b + str_len(b), "-", 2);
fmt_int(b + str_len(b), (int32_t)(v0 + nv > len ? len : v0 + nv));
cv_text(2, 0, &FONT_S, b, C_GRAY);
str_cpy(b, "ZOOM ", 12);
fmt_int(b + 5, (int32_t)nv);
cv_text(238 - text_w(&FONT_S, b), 0, &FONT_S, b, C_DIM);
for (i = (uint32_t)lo; i <= (uint32_t)hi; i++) { /* rows: the black keys' bands, the C's ruled and named */
int32_t y = bot - ((int32_t)i - lo + 1) * rh;
uint32_t pc = i % 12u;
if ((0x54Au >> pc) & 1u)
cv_rect(x0, y, w, rh, TE_G1);
if (!pc) {
note_name(b, i);
cv_text(0, y + rh / 2 - 6, &FONT_S, b, C_DIM);
cv_rect(x0, y + rh - 1, w, 1, C_GRAY);
}
if (!step_on(st)) {
cv_rect(x + 6, yb, 2, 1, C_DIM);
prev_y = -1;
}
for (i = 0; i <= nv; i++) /* the beats (4 steps), a tick on each step */
if (i % 4u == 0u)
cv_rect(x0 + (int32_t)i * w / (int32_t)nv, top, 1, bot - top, i % 16u ? C_DIM : C_GRAY);
else if (nv <= 32u)
cv_rect(x0 + (int32_t)i * w / (int32_t)nv, bot + 1, 1, 2, C_DIM);
for (i = 0; i < len; i++) { /* the notes (one starting before the view: its part in it) */
const step_t *st = &t->step[i];
uint32_t n = note_len(t, i), f;
int32_t xa, xb, y;
if (!step_on(st) || i + n <= v0 || i >= v0 + nv)
continue;
}
xa = x0 + ((int32_t)i - (int32_t)v0) * w / (int32_t)nv + 1;
xb = x0 + ((int32_t)(i + n) - (int32_t)v0) * w / (int32_t)nv - 1;
xa = xa < x0 ? x0 : xa;
xb = xb > x0 + w ? x0 + w : xb;
for (j = 0; j < st->n; j++) {
int32_t y = 80 - (st->note[j] - lo) * 74 / (hi - lo);
cv_rect(x + 2, y, 10, 1, (st->flags & SF_ACCENT) ? C_WHITE : c);
if (j == 0)
prev_y = y;
if (st->note[j] < lo || st->note[j] > hi)
continue;
y = bot - ((int32_t)st->note[j] - lo + 1) * rh + 1;
f = note_force(st, j);
cv_rect(xa, y, xb - xa, rh - 1, f ? c : TE_DIM[song.sel & 3u]);
if (f == 1u && rh > 4) /* SOFT: hollow */
cv_rect(xa + 1, y + 1, xb - xa - 2, rh - 3, C_BLACK);
if (f == 4u) /* ACC: a white cap */
cv_rect(xa, y, xb - xa, 2, C_WHITE);
if ((st->flags & SF_SLIDE) && j == 0u)
cv_rect(xb, y + rh / 2 - 1, 4, 2, c);
if (i == ui.cursor && j == ui.note_k % st->n) { /* the note under edit */
cv_rect(xa - 2, y - 2, xb - xa + 4, 1, C_WHITE), cv_rect(xa - 2, y + rh - 1, xb - xa + 4, 1, C_WHITE);
cv_rect(xa - 2, y - 2, 1, rh + 2, C_WHITE), cv_rect(xb + 1, y - 2, 1, rh + 2, C_WHITE);
note_name(b, st->note[j]);
cv_text(xa, y - 15 < top ? y + rh + 1 : y - 15, &FONT_S, b, C_WHITE);
}
}
if (st->flags & SF_SLIDE)
cv_line(x + 11, prev_y, x + 17, prev_y + 2, c);
}
cx = x0 + ((int32_t)ui.cursor - (int32_t)v0) * w / (int32_t)nv;
if (!step_on(cs) && sel_note >= lo && sel_note <= hi) { /* an empty step: a frame where a note would go */
int32_t y = bot - (sel_note - lo + 1) * rh + 1, xw = w / (int32_t)nv - 2;
cv_rect(cx + 1, y - 1, xw, 1, C_WHITE), cv_rect(cx + 1, y + rh - 1, xw, 1, C_WHITE);
cv_rect(cx + 1, y - 1, 1, rh, C_WHITE), cv_rect(cx + xw, y - 1, 1, rh, C_WHITE);
}
if (song.playing && t->seq_idx >= v0 && t->seq_idx < v0 + nv) { /* the playhead */
int32_t x = x0 + ((int32_t)t->seq_idx - (int32_t)v0) * w / (int32_t)nv;
cv_rect(x, top, 1, bot - top, C_HI);
cv_rect(x - 2, top, 5, 2, C_HI);
}
if (ui.sheet) { /* OCT+ held: the note's sheet */
char nu[8];
const char *val[6] = {cs->flags & SF_SLIDE ? "ON" : "OFF", nu, FILL_N[step_fill(t, ui.cursor) % 3u], "", "", ""};
fmt_int(nu, t->micro[ui.cursor]);
if (t->micro[ui.cursor] > 0) { nu[0] = '+'; fmt_int(nu + 1, t->micro[ui.cursor]); }
sheet_draw(112, 6, SHEET_N, val, ui.sheet - 1u, TE_DIM[song.sel & 3u]);
}
}
static void graph_scale(const track_t *t, uint16_t c)
@@ -397,8 +454,9 @@ static uint32_t graph_signature(void)
h ^= (uint32_t)project_used(i) << (20u + i);
if (pg->graph == GR_STEPS || pg->graph == GR_ROLL) {
uint32_t ph = song.playing ? t->seq_idx : 0xFFFFu;
if (pg->graph == GR_ROLL && ph / 16u != ui.bank)
ph = 0xFFFFu; /* the roll shows the cursor's bank only */
if (pg->graph == GR_ROLL) /* (1.0 NOTES: the note under edit, the zoom, the sheet) */
h ^= ui.note_k * 104729u + ui.zoom * 7u + ui.sheet * 977u + (uint32_t)t->micro[ui.cursor] * 31337u +
step_fill(t, ui.cursor) * 3u + last_note * 65537u;
h ^= steps_hash(t) + ph * 31u + ui.cursor * 7919u;
}
return h;
@@ -772,6 +830,7 @@ static void draw_graph(void)
graph_steps(t, c);
break;
case GR_ROLL:
cv_oy = 0;
graph_roll(t, c);
break;
case GR_SCALE:
@@ -824,9 +883,9 @@ static void draw_graph(void)
}
}
top = (ui.home && CLIPPER_SYNTH) || (!ui.home && !drum_note && (pg->graph == GR_BROWSE || pg->graph == GR_SLOTS || pg->graph == GR_USER ||
big_page(pg))); /* these draw from the top */
pg->graph == GR_ROLL || big_page(pg))); /* these draw from the top */
cv_oy = 0;
if (ui.hot_t && settings.zoom && !(top && big_page(pg) && !drum_note)) { /* (the big values show it already) */ /* focus (menu ZOOM): the touched value, large and white */
if (ui.hot_t && settings.zoom && !(top && (big_page(pg) || pg->graph == GR_ROLL) && !drum_note)) { /* (the big values show it already) */ /* focus (menu ZOOM): the touched value, large and white */
int32_t x;
top = 1;
cv_rect(0, 0, 150, 50, C_BLACK);
@@ -983,33 +1042,33 @@ static void draw_columns(void)
draw_column(3, "SAVE", "--", "", C_HI, -1, ICON_AUTO);
return;
}
if (cur_page()->scope == SC_STEP) {
static const char *const TIME_N[3] = {"NOTE", "TIE", "REST"};
if (cur_page()->scope == SC_STEP) { /* (1.0, SLOOP 2.7.2) NOTES: NOTE PITCH LEN FORCE of the note under edit */
const step_t *st = &TSEL->step[ui.cursor];
char u[8];
if (st->n) {
note_name(val, st->note[0]);
u[0] = 0;
if (st->n > 1) {
str_cpy(u, "+", 8);
fmt_int(u + 1, st->n - 1);
char sn[8], sl[8], u[8], ln[8];
int on = step_on(st);
uint32_t k = on ? ui.note_k % st->n : 0u;
fmt_int(sn, (int32_t)ui.cursor + 1);
str_cpy(sl, "/", 8);
fmt_int(sl + 1, TSEL->p[P_SLEN]);
draw_column(0, "NOTE", sn, sl, VAL(0u), -1, ICON_AUTO);
u[0] = 0;
if (on) {
note_name(val, st->note[k]);
if (st->n > 1u) { /* a chord: which of its notes */
fmt_int(u, (int32_t)k + 1);
str_cpy(u + str_len(u), "/", 2);
fmt_int(u + str_len(u), st->n);
}
} else {
str_cpy(val, "--", 12);
u[0] = 0;
}
{
static const char *const FLAG_N[4] = {"-", "ACC", "SLD", "A+S"};
char sn[8], sl[8];
fmt_int(sn, (int32_t)ui.cursor + 1);
str_cpy(sl, "/", 8);
fmt_int(sl + 1, TSEL->p[P_SLEN]);
draw_column(0, "STEP", sn, sl, VAL(0u), -1, ICON_AUTO);
draw_column(1, "NOTE", val, u, step_on(st) ? VAL(1u) : C_DIM, -1, ICON_AUTO);
draw_column(2, "TIME", TIME_N[st->time % 3u], "", VAL(2u), -1, ICON_AUTO);
draw_column(3, "FLAG", FLAG_N[(st->flags & SF_ACCENT ? 1u : 0u) | (st->flags & SF_SLIDE ? 2u : 0u)], "",
VAL(3u), -1, ICON_AUTO);
}
draw_column(1, "PITCH", val, u, on ? VAL(1u) : C_DIM, -1, ICON_AUTO);
if (on)
fmt_int(ln, (int32_t)note_len(TSEL, ui.cursor));
else
str_cpy(ln, "--", 8);
draw_column(2, "LEN", ln, on ? "STEP" : "", on ? VAL(2u) : C_DIM, -1, ICON_AUTO);
draw_column(3, "FORCE", on ? FORCE_N[note_force(st, k)] : "--", "", on ? VAL(3u) : C_DIM, -1, ICON_AUTO);
return;
}
for (c = 0; c < 4u; c++) {
+221 -33
View File
@@ -127,7 +127,7 @@ static uint32_t keys_lit(void)
return (blink ? scale_keys(1) : 0u) | keys_sounding(t) | fm1_in.notes;
return scale_keys(0) & ~(blink ? 0u : scale_keys(1));
case LY_MIX: /* tracks heard: 1..4; soloed: 5..8; a fill: 9, armed / on: 10; tap: the beat */
for (i = 0; i < 4u; i++) {
for (i = 0; i < 4u && !CLIPPER_SYNTH; i++) { /* (Clipper: one instrument, no mute / solo) */
if (!trk_silent(&trk[i]))
m |= 1u << key_of_white(i);
if ((song.solo >> i) & 1u)
@@ -313,39 +313,141 @@ static void tracks_edit(uint32_t slot, int32_t steps)
*vp = (int16_t)clamp(*vp + accel(EN_K1 + slot, steps, d->names ? 0 : d->max - d->min), d->min, d->max);
}
/* (1.0, after SLOOP 2.7.2) NOTES: one undo per note edited (its pitch, length, force: EDIT + OCT- brings them back) */
static void note_mark(void)
{
static uint32_t sess, at = 0xFFFFu;
uint32_t here = ui.cursor | (uint32_t)song.sel << 8;
if (here != at || !undo.valid || undo.undone || undo.sess != sess) {
sess = (undo_sess += 4u) | 3u;
at = here;
}
undo_mark(TSEL, sess);
}
static int on_notes_page(void)
{
return !ui.home && song.seq_mode && cur_page()->scope == SC_STEP && !is_drum(TSEL);
}
/* the note's sheet (OCT+ held): KNOB 1 the row, KNOB 2 its value (MOVE: a step a detent); OCT+ acts (SLIDE on / off,
* COPY: just after it, then MOVE moves the copy; DELETE), OCT- closes */
static void note_sheet_knob(uint32_t slot, int32_t steps)
{
track_t *t = TSEL;
step_t *st = &t->step[ui.cursor];
uint32_t row = ui.sheet - 1u;
if (slot == 0u) {
ui.sheet = (uint8_t)(1 + clamp((int32_t)row + steps, 0, 5));
return;
}
if (slot != 1u)
return;
note_mark();
switch (row) {
case 0:
st->flags = (uint8_t)(steps > 0 ? st->flags | SF_SLIDE : st->flags & ~SF_SLIDE);
break;
case 1:
t->micro[ui.cursor] = (int8_t)clamp(t->micro[ui.cursor] + steps, MICRO_MIN, MICRO_MAX);
break;
case 2:
step_fill_set(t, ui.cursor, (uint32_t)clamp((int32_t)step_fill(t, ui.cursor) % 3 + (steps > 0 ? 1 : -1), 0, 2));
break;
case 3: {
int32_t n = steps;
while (n) {
int32_t to = note_shift(t, ui.cursor, n, 0), k = ui.note_k;
if (to < 0) {
ui_message(step_on(st) ? "NO ROOM" : "NO NOTE");
break;
}
cursor_set(to);
ui.note_k = (uint8_t)k;
st = &t->step[ui.cursor];
n += n > 0 ? -1 : 1;
}
break;
}
default:
break;
}
sync_reload = 1;
}
static void note_sheet_do(void) /* OCT+ tapped in the sheet */
{
track_t *t = TSEL;
uint32_t row = ui.sheet - 1u;
note_mark();
if (row == 0u) {
t->step[ui.cursor].flags ^= SF_SLIDE;
} else if (row == 4u) {
int32_t to = note_shift(t, ui.cursor, 1, 1), k = ui.note_k;
if (to < 0) {
ui_message(step_on(&t->step[ui.cursor]) ? "NO ROOM" : "NO NOTE");
return;
}
cursor_set(to);
ui.note_k = (uint8_t)k;
ui.sheet = 4; /* (MOVE: KNOB 2 moves the copy) */
ui_message("COPIED");
} else if (row == 5u) {
note_del(t, ui.cursor, ui.note_k);
cursor_fix();
ui.sheet = 0;
ui_message("NOTE DELETED");
}
sync_reload = 1;
}
/* the NOTES page's knobs (SEQ > NOTES): KNOB 1 NOTE, KNOB 2 PITCH, KNOB 3 LEN, KNOB 4 FORCE */
static void step_edit(uint32_t slot, int32_t steps)
{
step_t *st = &TSEL->step[ui.cursor];
uint32_t i;
if (is_drum(TSEL))
return; /* (the drum track: its grid) */
track_t *t = TSEL;
step_t *st = &t->step[ui.cursor];
uint32_t k = ui.note_k;
if (is_drum(t))
return;
if (ui.sheet) {
note_sheet_knob(slot, steps);
return;
}
switch (slot) {
case 0: /* STEP: the cursor */
cursor_set(ui.cursor + steps);
case 0: /* NOTE: the notes, a chord's one by one, and the empty steps */
for (; steps > 0; steps--)
note_walk(1);
for (; steps < 0; steps++)
note_walk(-1);
break;
case 1: /* NOTE: transpose the step */
if (!st->n) {
case 1: /* PITCH: the note's; an empty step gets your last note */
note_mark();
if (!step_on(st)) {
memset(st, 0, sizeof *st);
st->note[0] = last_note;
st->n = 1;
st->time = ST_NOTE;
ui.note_k = 0;
break;
}
for (i = 0; i < st->n; i++)
st->note[i] = (uint8_t)clamp(st->note[i] + steps, 1, 127);
st->time = ST_NOTE;
st->flags &= (uint8_t)~SF_CONT_ALL; /* (0.7: new pitches start here, not held over from before) */
last_note = st->note[0];
st->note[k] = (uint8_t)clamp(st->note[k] + steps, 1, 127);
st->flags &= (uint8_t)~SF_CONT(k); /* (0.7: a new pitch starts here, not held over from before) */
last_note = st->note[k];
break;
case 2:
st->time = (uint8_t)clamp((int32_t)st->time + (steps > 0 ? 1 : -1), ST_NOTE, ST_REST);
case 2: /* LEN: the note and the TIEs after it (note_set_len) */
if (step_on(st)) {
uint32_t was = note_len(t, ui.cursor), n;
note_mark();
fm1_irq_off();
n = note_set_len(t, ui.cursor, (uint32_t)clamp((int32_t)was + steps, 1, NSTEP));
fm1_irq_on();
if (steps > 0 && n == was)
ui_message(ui.cursor + n < (uint32_t)clamp(t->p[P_SLEN], 1, NSTEP) ? "NOTE AHEAD" : "END OF PATTERN");
}
break;
default: { /* FLAG: - / ACC / SLD / A+S */
uint32_t f = (st->flags & SF_ACCENT ? 1u : 0u) | (st->flags & SF_SLIDE ? 2u : 0u);
f = (uint32_t)clamp((int32_t)f + (steps > 0 ? 1 : -1), 0, 3);
st->flags = (uint8_t)((st->flags & ~(SF_ACCENT | SF_SLIDE)) | (f & 1u ? SF_ACCENT : 0u) | (f & 2u ? SF_SLIDE : 0u));
default: /* FORCE: GHOST SOFT NORM HARD, ACC (the step's accent) */
if (step_on(st)) {
note_mark();
note_force_set(st, k, (uint32_t)clamp((int32_t)note_force(st, k) + (steps > 0 ? 1 : -1), 0, 4));
}
break;
}
}
}
/* a new project: every track empty, the default sounds, 90 BPM (TOOLS > NEW) */
@@ -489,13 +591,64 @@ static void edit_param(uint32_t slot, int32_t steps)
}
}
/* 1.0, after SLOOP 2.6: the NOTES page's entry from a MIDI keyboard, as from the keys (seq_entry): the notes played
* together become the cursor step, as they sounded (no chord built: the keyboard plays the notes it sends); letting them
* all go moves on (STEP ADVANCE). Called every frame (the queue is read even off the page) */
static uint32_t mi_held[4];
static uint8_t mi_ok; /* the last frame reached the page's entry (seq_entry: no layer,
* hold or menu in the way) */
static uint32_t midi_held(void) { return mi_held[0] | mi_held[1] | mi_held[2] | mi_held[3]; }
static void midi_entry(void) /* (top of ui_input: every frame) */
{
track_t *t = TSEL;
int on_page = mi_ok && on_notes_page() && !song.rec && !rec_wait && !ft_on && !ui.sheet;
mi_ok = 0;
if (step_in_lost) { /* (the queue overflowed: what is in it and what is held are
* unknown: all dropped) */
step_in_lost = 0;
step_in_r = step_in_w;
mi_held[0] = mi_held[1] = mi_held[2] = mi_held[3] = 0;
}
while (step_in_r != step_in_w) {
uint32_t ev = step_in_q[step_in_r % STEP_IN_Q], note = ev & 127u;
step_t *st = &t->step[ui.cursor];
step_in_r++;
if (!(ev & 0x80u)) {
mi_held[note >> 5] &= ~(1u << (note & 31u));
continue;
}
if (!on_page)
continue;
mi_held[note >> 5] |= 1u << (note & 31u);
if (!ui.entry_open) {
ui.entry_open = 1;
undo_mark(t, (undo_sess += 4u) | 3u);
st->n = 0;
st->lvl = st->rat = 0;
st->flags &= (uint8_t)~(SF_CONT_ALL | SF_LEG); /* (step entry: the step's own notes only) */
st->time = ST_NOTE;
ui.note_k = 0;
}
if (!voice_poly(t->p[P_VOICE])) {
st->note[0] = (uint8_t)note;
st->n = 1;
} else if (st->n < 4u) {
st->note[st->n++] = (uint8_t)note;
}
last_note = (uint8_t)note;
}
if (!on_page)
mi_held[0] = mi_held[1] = mi_held[2] = mi_held[3] = 0;
}
/* SEQ step entry, acid style: the keys pressed together (POLY: up to 4, MONO:
* the last one) become the cursor step; releasing all keys moves on. Not while recording or armed:
* the keys record live then (they would be written twice) */
* the last one) become the cursor step; releasing all keys moves on (1.0: MENU > SEQ > STEP ADVANCE OFF: the cursor
* stays). Not while recording or armed: the keys record live then (they would be written twice) */
static void seq_entry(uint32_t pressed)
{
track_t *t = TSEL;
step_t *st = &t->step[ui.cursor];
mi_ok = 1; /* (next frame, midi_entry may write) */
uint32_t k;
if (is_drum(t) || song.rec || rec_wait || ft_on)
return;
@@ -511,8 +664,9 @@ static void seq_entry(uint32_t pressed)
undo_mark(t, (undo_sess += 4u) | 3u);
st->n = 0;
st->lvl = st->rat = 0;
st->flags &= (uint8_t)~SF_CONT_ALL; /* (0.7: step entry: the step's own notes only) */
st->flags &= (uint8_t)~(SF_CONT_ALL | SF_LEG); /* (0.7: step entry: the step's own notes only) */
st->time = ST_NOTE;
ui.note_k = 0;
}
if (t->p[P_CHORD] && voice_poly(t->p[P_VOICE])) { /* chord mode (2.4.1): the chord as it sounded (CHORD+,
* VLEAD), not only its root; (not played yet: built here) */
@@ -534,8 +688,13 @@ static void seq_entry(uint32_t pressed)
}
last_note = (uint8_t)note;
}
if (ui.entry_open && !fm1_in.notes)
cursor_set(ui.cursor + 1);
if (ui.entry_open && !fm1_in.notes && !midi_held()) {
if (step_adv_off)
ui.entry_open = 0; /* (1.0, SLOOP 2.7.1) STEP ADVANCE OFF: the cursor stays, the
* next keys write the step again (a chord tried again) */
else
cursor_set(ui.cursor + 1);
}
}
/* HOME: tap on release, hold 0.7 s fires once. t0 = press time | 1,
@@ -576,11 +735,16 @@ static void layer_tap(uint32_t layer)
studio_open(SC_DRUM);
break;
}
if (layer == LY_ERASE && song.seq_mode && cur_page()->scope == SC_STEP && !is_drum(TSEL)) {
undo_mark(TSEL, (undo_sess += 4u) | 3u); /* STEP page: EDIT clears the step */
step_clear(&TSEL->step[ui.cursor]);
cursor_set(ui.cursor + 1);
ui_message("STEP CLEARED");
if (layer == LY_ERASE && on_notes_page()) { /* NOTES (1.0, SLOOP 2.7.2): EDIT deletes the note (a chord's
* others stay) */
undo_mark(TSEL, (undo_sess += 4u) | 3u);
if (!step_on(&TSEL->step[ui.cursor]))
ui_message("NO NOTE");
else {
note_del(TSEL, ui.cursor, ui.note_k);
cursor_fix();
ui_message("NOTE DELETED");
}
break;
}
open_family(layer == LY_STEP ? FAM_SEQ : FAM_EDIT);
@@ -868,12 +1032,15 @@ static void ui_input(void)
}
}
kb_grid = (uint8_t)grid_keys_on(); /* (seq.c: the keys are the grid's steps) */
midi_entry(); /* (1.0: the NOTES page's MIDI notes: read every frame) */
if (ui.menu) { /* HOME / REC taps do nothing here */
punch.hold = 0;
if (!ui.home_t0)
menu_input(pressed);
return;
}
if (!on_notes_page())
ui.sheet = 0; /* (1.0: the sheet is the NOTES page's) */
layered = layers_input(notes, &pressed, home);
if (home_eat && !((fm1_in.buttons >> panel.btn[B_HOME]) & 1u)) { /* (the HOME that unlocked: let go) */
if (home == BT_TAP)
@@ -930,6 +1097,23 @@ static void ui_input(void)
}
}
cursor_fix(); /* LEN may have changed (knob, editor, load) */
if (on_notes_page()) { /* (1.0, SLOOP 2.7.2) OCT+ held: the note's sheet; tapped: as
* before */
uint32_t ev, ob = 1u << panel.btn[B_OCTDN];
pressed = octp_filter(pressed, &ev);
if (ev == 2u && !ui.sheet)
ui.sheet = 1;
else if (ev == 1u && ui.sheet)
note_sheet_do();
else if (ev == 1u)
pressed |= 1u << panel.btn[B_OCTUP];
if (ui.sheet && (pressed & ob)) {
ui.sheet = 0;
pressed &= ~ob;
}
if (ev)
ui.force = 1;
}
for (id = 0; id < 14u; id++) {
if (!((pressed >> id) & 1u))
continue;
@@ -966,8 +1150,12 @@ static void ui_input(void)
break;
}
}
if (song.seq_mode && cur_page()->scope == SC_STEP)
seq_entry(notes);
if (song.seq_mode && cur_page()->scope == SC_STEP && !ui.sheet)
seq_entry(notes); /* (and the MIDI keyboard's: midi_entry) */
if (on_notes_page() && (s = panel_enc(EN_PRESET)) != 0) { /* (1.0) NOTES: PRESETS zooms, 8 .. 64 steps */
ui.zoom = (uint8_t)(clamp((int32_t)(int8_t)ui.zoom + (s > 0 ? 1 : -1), -1, 2));
ui.force = 1;
}
if ((s = panel_enc(EN_PRESET)) != 0 && (ui.home || cur_page()->graph == GR_BROWSE || cur_fam() == FAM_TRK)) {
/* PRESETS browses the selected part's presets (all engines, then user presets) on HOME, the PRESETS
+34 -10
View File
@@ -61,15 +61,17 @@ static void pattern_rotate(track_t *t, int32_t d) /* every step one later
layer_undo_mark(t);
fm1_irq_off();
if (d > 0) {
int8_t m = t->micro[len - 1u];
keep = t->step[len - 1u];
for (i = len - 1u; i > 0; i--)
t->step[i] = t->step[i - 1u];
t->step[0] = keep;
t->step[i] = t->step[i - 1u], t->micro[i] = t->micro[i - 1u]; /* (1.0: the nudges with their steps) */
t->step[0] = keep, t->micro[0] = m;
} else {
int8_t m = t->micro[0];
keep = t->step[0];
for (i = 0; i + 1u < len; i++)
t->step[i] = t->step[i + 1u];
t->step[len - 1u] = keep;
t->step[i] = t->step[i + 1u], t->micro[i] = t->micro[i + 1u];
t->step[len - 1u] = keep, t->micro[len - 1u] = m;
}
fm1_irq_on();
}
@@ -80,7 +82,7 @@ static void pattern_length(track_t *t, int32_t d) /* x2 (the pattern again
fm1_irq_off();
if (d > 0 && len * 2u <= NSTEP) {
for (i = 0; i < len; i++)
t->step[len + i] = t->step[i];
t->step[len + i] = t->step[i], t->micro[len + i] = t->micro[i]; /* (1.0: and the nudges) */
t->p[P_SLEN] = (int16_t)(len * 2u);
} else if (d < 0 && len >= 2u) {
t->p[P_SLEN] = (int16_t)(len / 2u);
@@ -184,6 +186,8 @@ static void steps_held_edit(uint32_t knob, int32_t s)
{
track_t *t = TSEL;
uint32_t w, i;
/* (1.0, SLOOP 2.6) the accelerated turn once for every step held (a second call would see no time pass) */
int32_t sv = knob == 1u && !is_drum(t) ? accel(EN_K2, s, 126) : 0;
layer_undo_mark(t);
step_pend_off &= (uint16_t)~ui.step_held; /* (edited: kept when let go) */
fm1_irq_off();
@@ -218,6 +222,13 @@ static void steps_held_edit(uint32_t knob, int32_t s)
step_t *st = &t->step[idx];
if (!step_on(st))
continue;
if (knob == 1u) { /* VEL (1.0, SLOOP 2.6): the step's velocity, 1..127; every note
* at it (NORM) */
st->vel = (uint8_t)clamp((int32_t)step_vel_shown(st) + sv, 1, 127);
st->lvl = 0;
st->flags &= (uint8_t)~SF_ACCENT; /* (ACC would play it at 127) */
continue;
}
for (i = 0; i < st->n; i++) {
uint32_t sh = 2u * i, lv = (st->lvl >> sh) & 3u, rt = (st->rat >> sh) & 3u;
if (knob == 0u) {
@@ -408,6 +419,8 @@ static void layer_key(uint32_t layer, uint32_t k, uint32_t down)
return;
}
case LY_MIX:
if (CLIPPER_SYNTH && w >= 0 && w < 8)
return; /* (Clipper: one instrument, no mute / solo) */
if (w >= 0 && w < 4) {
trk[w].p[P_MUTE] = (int16_t)!trk[w].p[P_MUTE];
} else if (w >= 4 && w < 8) {
@@ -541,6 +554,8 @@ static void layer_knobs(uint32_t layer)
break;
case LY_MIX: {
int16_t *lv = k == TRK_DRUM ? &song.g[G_DRLVL] : &trk[k].p[P_LEVEL];
if (CLIPPER_SYNTH && k)
break; /* (Clipper: KNOB 1 the sound's LEVEL, the others nothing) */
*lv = (int16_t)clamp(*lv + accel(EN_K1 + k, s, 127), 0, 127);
break;
}
@@ -782,8 +797,17 @@ static void layer_screen_draw(void)
for (w = 0; w < 16u && !((ui.step_held >> w) & 1u); w++)
;
idx = (page * 16u + w) % NSTEP;
lab[1] = "level", lab[2] = "ratchet", lab[3] = "nudge";
lab[1] = is_drum(t) ? "level" : "vel", lab[2] = "ratchet", lab[3] = "nudge";
str_cpy(v[1], "- +", 8);
if (!is_drum(t)) { /* (1.0, SLOOP 2.6) the first held step's velocity */
const step_t *st = &t->step[idx];
if (step_on(st)) {
fmt_int(v[1], (int32_t)step_vel_shown(st));
ratio[1] = (int32_t)step_vel_shown(st) * 1000 / 127;
} else {
str_cpy(v[1], "--", 8);
}
}
str_cpy(v[2], "x1 x4", 8);
{
int32_t m = t->micro[idx];
@@ -861,8 +885,8 @@ static void layer_screen_draw(void)
}
case LY_MIX: { /* mute 1..4, solo 1..4, fill / fill bar, tap */
col = C_WHITE;
str_cpy(sub, "mute solo fill tap", sizeof sub);
for (i = 0; i < 4u; i++) {
str_cpy(sub, CLIPPER_SYNTH ? "fill bar tap" : "mute solo fill tap", sizeof sub);
for (i = 0; i < 4u && !CLIPPER_SYNTH; i++) { /* (Clipper: one instrument, no mute / solo) */
int m = trk[i].p[P_MUTE] != 0, so = (song.solo >> i) & 1u;
str_cpy(tl[i].lab, "mute 1", 8);
tl[i].lab[5] = (char)('1' + i);
@@ -886,9 +910,9 @@ static void layer_screen_draw(void)
tl[15].fg = tl[15].bg == C_WHITE ? C_BLACK : C_WHITE;
str_cpy(tl[14].lab, "tap>", 8);
tl[14].bg = C_BLACK;
for (i = 0; i < 4u; i++) {
for (i = 0; i < (CLIPPER_SYNTH ? 1u : 4u); i++) {
uint32_t lv = trk_level(i);
static const char *const L[4] = {"1", "2", "3", "4"};
static const char *const L[4] = {CLIPPER_SYNTH ? "level" : "1", "2", "3", "4"};
lab[i] = L[i];
fmt_int(v[i], (int32_t)lv * 100 / 127);
ratio[i] = (int32_t)lv * 1000 / 127;
+22 -15
View File
@@ -9,21 +9,22 @@
/* 0.7 (after SLOOP 2.7): SCREEN + KNOB ACCEL, AUDIO + USB RATE (four rows: the fourth takes the help's place), MIDI
* (CLOCK OUT, MPE), SYS (2ND CORE, CALIBRATION, ABOUT) */
#if CLIPPER_SYNTH /* Clipper 0.4: MPE (MIDI: OFF or the member channels' bend range) */
enum { MI_COLOR, MI_ZOOM, MI_ACCEL, MI_LIGHTS, MI_KEYS, MI_NOTES, MI_LOWCUT, MI_USB, MI_SERIAL, MI_RATE, MI_CLKOUT, MI_MPE,
enum { MI_COLOR, MI_ZOOM, MI_ACCEL, MI_LIGHTS, MI_KEYS, MI_NOTES, MI_LOWCUT, MI_USB, MI_SERIAL, MI_RATE, MI_ADV, MI_CLKOUT,
MI_MPE, MI_CPU1, MI_PANEL, MI_ABOUT, MI_COUNT };
static const char *const MI_NAME[MI_COUNT] = {"COLOR", "ZOOM", "KNOB ACCEL", "LIGHTS", "KEYS", "NOTES", "SPEAKER LOWCUT",
"USB AUDIO", "USB SERIAL", "USB RATE", "STEP ADVANCE", "CLOCK OUT (USB)",
"MPE (CH 2-16)", "2ND CORE", "HARDWARE CALIBRATION", "ABOUT"};
#else
enum { MI_COLOR, MI_ZOOM, MI_ACCEL, MI_LIGHTS, MI_KEYS, MI_NOTES, MI_LOWCUT, MI_USB, MI_SERIAL, MI_RATE, MI_ADV, MI_CLKOUT,
MI_CPU1, MI_PANEL, MI_ABOUT, MI_COUNT };
static const char *const MI_NAME[MI_COUNT] = {"COLOR", "ZOOM", "KNOB ACCEL", "LIGHTS", "KEYS", "NOTES", "SPEAKER LOWCUT",
"USB AUDIO", "USB SERIAL", "USB RATE", "CLOCK OUT (USB)", "MPE (CH 2-16)",
"USB AUDIO", "USB SERIAL", "USB RATE", "STEP ADVANCE", "CLOCK OUT (USB)",
"2ND CORE", "HARDWARE CALIBRATION", "ABOUT"};
#else
enum { MI_COLOR, MI_ZOOM, MI_ACCEL, MI_LIGHTS, MI_KEYS, MI_NOTES, MI_LOWCUT, MI_USB, MI_SERIAL, MI_RATE, MI_CLKOUT, MI_CPU1,
MI_PANEL, MI_ABOUT, MI_COUNT };
static const char *const MI_NAME[MI_COUNT] = {"COLOR", "ZOOM", "KNOB ACCEL", "LIGHTS", "KEYS", "NOTES", "SPEAKER LOWCUT",
"USB AUDIO", "USB SERIAL", "USB RATE", "CLOCK OUT (USB)", "2ND CORE",
"HARDWARE CALIBRATION", "ABOUT"};
#endif
enum { MS_SCREEN, MS_LIGHTS, MS_AUDIO, MS_MIDI, MS_SYSTEM, MS_COUNT };
static const char *const MS_NAME[MS_COUNT] = {"SCREEN", "LIGHTS", "AUDIO", "MIDI", "SYS"}; /* (AUDIO: and USB) */
static const uint8_t MS_FIRST[MS_COUNT + 1] = {MI_COLOR, MI_LIGHTS, MI_LOWCUT, MI_CLKOUT, MI_CPU1, MI_COUNT}; /* rows of each */
/* (1.0, after SLOOP 2.7.1) SEQ: STEP ADVANCE */
enum { MS_SCREEN, MS_LIGHTS, MS_AUDIO, MS_SEQ, MS_MIDI, MS_SYSTEM, MS_COUNT };
static const char *const MS_NAME[MS_COUNT] = {"SCREEN", "LIGHTS", "AUDIO", "SEQ", "MIDI", "SYS"}; /* (AUDIO: and USB) */
static const uint8_t MS_FIRST[MS_COUNT + 1] = {MI_COLOR, MI_LIGHTS, MI_LOWCUT, MI_ADV, MI_CLKOUT, MI_CPU1, MI_COUNT}; /* rows of each */
static int mi_cpu1_have(void) /* the second core is running (cpu1.c; the host tests have none) */
{
#if FELUCCA_CPU1
@@ -66,6 +67,7 @@ static const char *mi_value(uint32_t i, uint16_t *c)
case MI_RATE: return USB_RATE_NAME[usb_rate % 3u]; /* (0.7) for hosts that record one rate badly */
case MI_CPU1: return cpu1_off ? "OFF" : "ON"; /* (0.7) the second core renders half the voices */
case MI_CLKOUT: return clk_out ? "ON" : "OFF"; /* (0.7) the MIDI clock out on USB while SYNC is INT */
case MI_ADV: return step_adv_off ? "OFF" : "ON"; /* (1.0) the NOTES page's cursor moves on when the keys are let go */
#if CLIPPER_SYNTH
case MI_MPE: return MPE_NAME[mpe_mode % MPE_MODES];
#endif
@@ -81,7 +83,8 @@ static void draw_menu(void)
uint32_t sig = ui.menu * 7u + ui.menu_sel * 131u + settings.palette * 1009u + settings.lowcut * 7919u +
settings.zoom * 104729u + lights_lvl * 1299709u + lights_keys * 15485863u +
lights_notes * 32452843u + usb_full * 49979687u + usb_serial * 86028121u +
knob_accel_off * 179424673u + usb_rate * 373587883u + cpu1_off * 674506111u + clk_out * 982451653u
knob_accel_off * 179424673u + usb_rate * 373587883u + cpu1_off * 674506111u + clk_out * 982451653u +
step_adv_off * 236887691u
#if CLIPPER_SYNTH
+ mpe_mode * 2654435761u
#endif
@@ -133,13 +136,14 @@ static void draw_menu(void)
cv_text(4, 185, &FONT_S, "PHASE: CRISPYZEBRA (GPL)", C_DIM);
cv_text(4, 198, &FONT_S, "VOICE: REF. KLATTSCH (MIT)", C_DIM);
} else {
int32_t x = 4;
for (i = 0; i < MS_COUNT; i++) { /* the sections as tabs: this one lit */
int32_t x = 2;
for (i = 0; i < MS_COUNT; i++) { /* the sections as tabs: this one lit (1.0: six, 4 apart: the
* last ends at 240) */
int32_t w = text_w(&FONT_S, MS_NAME[i]);
if (i == sec)
cv_rect(x - 2, 3, w + 4, 18, C_LINE);
cv_text(x, 4, &FONT_S, MS_NAME[i], i == sec ? C_WHITE : C_DIM);
x += w + 10;
x += w + 4;
}
for (i = MS_FIRST[sec]; i < MS_FIRST[sec + 1u]; i++) {
uint32_t r = i - MS_FIRST[sec];
@@ -230,6 +234,9 @@ static void mi_set(uint32_t i, int32_t s)
else if (!s)
usb_rate = (uint8_t)((usb_rate + 1u) % 3u);
break;
case MI_ADV: /* (1.0) right ON, left OFF; OCT+ toggles */
step_adv_off = (uint8_t)(s > 0 ? 0u : s < 0 ? 1u : !step_adv_off);
break;
case MI_CLKOUT: /* (0.7) right ON, left OFF; OCT+ toggles */
clk_out = (uint8_t)(s > 0 ? 1u : s < 0 ? 0u : !clk_out);
break;
+275 -5
View File
@@ -6,8 +6,10 @@
* PRESETS browses the sounds, ALGORITHM jumps from kind to kind (and back); not on a page that edits the sound
* one instrument: an old project / the editor selecting another track comes back to track 1; tracks 2..4 and the
* drums are silent even with patterns and notes; MIDI plays the instrument on every channel (omni, 10 too)
* no groovebox layer: FX / EDIT / ARP / GLO / SAVE held, the keys still play; tapped (or held long), their pages;
* SAVE opens the SAVE pages (no song); SEQ and SEL keep their layers (steps; the key)
* FX and SAVE held, the keys still play; tapped (or held long), their pages; SAVE opens the SAVE pages (no song);
* SEQ and SEL keep their layers (steps; the key); 1.0 (the sequencer of SLOOP 2.7.2): EDIT (erase, SHIFT, LENGTH,
* TRANSPOSE, undo), ARP (note repeat) and GLO (fill, fill bar, tap, the level) are layers again; SEQ > NOTES, the note
* editor and its sheet; MENU > SEQ > STEP ADVANCE; step entry from a MIDI keyboard
* the pages: no SLICER, no DRUMS, no SONG page; MASTER without DUCK and ROLL; VOICE 2 without MUTE
* the REC screen: the instrument alone; REC held: "PATTERN CLEARED"
* screens to DIR/clipper-*.ppm for review. */
@@ -145,9 +147,7 @@ int main(int argc, char **argv)
/* the buttons with no layer: held, the keys play; their pages on release */
{
static const struct { uint32_t b, fam; const char *n; } B[] = {
{B_FX, FAM_FX, "FX"}, {B_EDIT, FAM_EDIT, "EDIT"}, {B_ARP, FAM_ARP, "ARP"}, {B_GLO, FAM_GLO, "GLO"},
{B_SAVE, FAM_SAVE, "SAVE"}};
static const struct { uint32_t b, fam; const char *n; } B[] = {{B_FX, FAM_FX, "FX"}, {B_SAVE, FAM_SAVE, "SAVE"}};
char what[96];
for (i = 0; i < NELEM(B); i++) {
go_home(); frames(2);
@@ -182,6 +182,276 @@ int main(int argc, char **argv)
check(ui.layer == LY_SCALE, "SEL held: the key layer");
release(B_SCL); frames(2);
}
/* 1.0, the sequencer of SLOOP 2.7.2: EDIT, ARP and GLO are layers again */
{
track_t *t = TSEL;
uint32_t j;
int ok;
uint8_t n60[1] = {60}, n64[1] = {64};
transport_req = 2; frames(4);
go_home(); frames(2);
t->p[P_SLEN] = 16; t->p[P_CHORD] = 0; song.octave = 0;
for (j = 0; j < NSTEP; j++) step_clear(&t->step[j]);
for (j = 0; j < 16u; j += 4u) put_step(t, j, 1, j % 8u ? n64 : n60, ST_NOTE, 0);
press(B_EDIT); frames(12);
ok = ui.layer == LY_ERASE;
ui.force = 1; frame(); ppm("clipper-layer-edit");
{ /* EDIT + a key, stopped: that note gone from the whole pattern */
uint32_t k;
for (k = 0; k < 27u && kb_map(t, k) != 64u; k++)
;
ok &= k < 27u;
key(k); frames(2);
}
ok &= step_on(&t->step[0]) && !step_on(&t->step[4]) && step_on(&t->step[8]) && !step_on(&t->step[12]) && voices_part(0) == 0u;
check(ok, "EDIT held: the erase layer; EDIT + E4 (stopped) erases every E4 (the C4s stay), nothing plays");
press(B_OCTDN); release(B_OCTDN); frames(2);
check(step_on(&t->step[4]) && step_on(&t->step[12]), "EDIT + OCT-: undo (the E4s back)");
encs[panel.enc[EN_K1]] = 1; frames(2); /* SHIFT: every step one later */
ok = step_on(&t->step[1]) && !step_on(&t->step[0]) && t->step[1].note[0] == 60u;
encs[panel.enc[EN_K3]] = 1; frames(2); encs[panel.enc[EN_K3]] = 1; frames(2); /* TRANSPOSE +2 (a semitone a turn) */
ok &= t->step[1].note[0] == 62u && t->step[5].note[0] == 66u;
encs[panel.enc[EN_K2]] = 1; frames(2); /* LENGTH x2 */
ok &= t->p[P_SLEN] == 32 && t->step[17].note[0] == 62u;
release(B_EDIT); frames(4);
check(ok && ui.home, "EDIT + KNOB 1 SHIFT, KNOB 3 TRANSPOSE, KNOB 2 LENGTH x2; let go: HOME again (no page)");
press(B_EDIT); press(B_OCTDN); release(B_OCTDN); release(B_EDIT); frames(4);
check(t->p[P_SLEN] == 16 && t->step[0].note[0] == 60u && ui.home, "EDIT + OCT-: the whole hold's turns undone at once");
tap(B_EDIT); frames(2);
check(!ui.home && cur_page()->fam == FAM_EDIT, "EDIT tapped: its pages");
go_home(); frames(2);
press(B_GLO); frames(12);
ok = ui.layer == LY_MIX;
ui.force = 1; frame(); ppm("clipper-layer-glo");
fm1_in.notes |= 1u << key_of_white(8); frames(2);
ok &= fill_now != 0;
fm1_in.notes &= ~(1u << key_of_white(8)); frames(2);
ok &= !fill_now;
key(key_of_white(0)); frames(2);
ok &= !t->p[P_MUTE] && !trk[1].p[P_MUTE] && voices_part(0) == 0u; /* (no mute keys: nothing, nothing plays) */
t->p[P_LEVEL] = 100;
encs[panel.enc[EN_K1]] = -10; encs[panel.enc[EN_K2]] = -10; frames(2);
ok &= t->p[P_LEVEL] < 100 && trk[1].p[P_LEVEL] == trk[1].p[P_LEVEL];
{
int16_t l1 = trk[1].p[P_LEVEL];
encs[panel.enc[EN_K2]] = -10; frames(2);
ok &= trk[1].p[P_LEVEL] == l1;
}
release(B_GLO); frames(4);
t->p[P_LEVEL] = 100;
check(ok, "GLO held: key 9 a fill while held; keys 1..8 nothing (one instrument); KNOB 1 the sound's level, KNOB 2 nothing");
press(B_ARP); frames(12);
ok = ui.layer == LY_ROLL;
transport_req = 1; frames(4);
for (j = 0; j < NSTEP; j++) step_clear(&t->step[j]);
{
uint32_t k, on = 0, prev = 0, f;
for (k = 0; k < 27u && kb_map(t, k) != 67u; k++)
;
fm1_in.notes |= 1u << k;
for (f = 0; f < 120u; f++) { /* about a second at 120 BPM: a roll of 1/16s (8 a second) */
uint32_t g = 0, i;
frame();
for (i = 0; i < NVOICE; i++)
g += t->v[i].active && t->v[i].gate && t->v[i].note == 67;
on += g && !prev;
prev = g;
}
fm1_in.notes &= ~(1u << k); frames(4);
ok &= on >= 4u;
printf("clipper: ARP roll: %u hits in 120 frames\n", on);
}
transport_req = 2; frames(4);
release(B_ARP); frames(30);
check(ok, "ARP held: the roll layer; a key repeats on the grid (note repeat)");
go_home(); frames(2);
}
/* 1.0, after SLOOP 2.7.2: SEQ > NOTES, the note editor and its sheet */
{
track_t *t = TSEL;
uint32_t j;
int ok;
transport_req = 2; frames(2);
song.rec = 0; rec_wait = 0; song.octave = 0; layer_unlock();
t->p[P_VOICE] = V_POLY; t->p[P_CHORD] = 0;
go_home(); frame();
t->p[P_SLEN] = 16;
for (j = 0; j < NSTEP; j++) step_clear(&t->step[j]);
memset(t->micro, 0, sizeof t->micro); memset(t->fill, 0, sizeof t->fill);
t->step[0].n = 1; t->step[0].note[0] = 48; t->step[0].time = ST_NOTE; /* C3, 2 steps */
t->step[1].time = ST_TIE;
t->step[4].n = 3; t->step[4].note[0] = 60; t->step[4].note[1] = 64; t->step[4].note[2] = 67;
t->step[4].time = ST_NOTE; /* a chord on step 5 */
t->step[8].n = 1; t->step[8].note[0] = 55; t->step[8].time = ST_NOTE;
open_family(FAM_SEQ); frame();
check(!strcmp(PAGES[ui.page].title, "NOTES"), "SEQ tapped: the NOTES page (STEP before 1.0)");
cursor_set(0); ui.force = 1; frame();
encs[panel.enc[EN_K1]] = 1; frame();
ok = ui.cursor == 2u && ui.note_k == 0u; /* (step 2 is the note's TIE: passed) */
encs[panel.enc[EN_K1]] = 2; frame();
ok &= ui.cursor == 4u && ui.note_k == 0u;
encs[panel.enc[EN_K1]] = 2; frame();
ok &= ui.cursor == 4u && ui.note_k == 2u; /* the chord's notes one by one */
encs[panel.enc[EN_K1]] = -1; frame();
ok &= ui.cursor == 4u && ui.note_k == 1u;
check(ok, "NOTES: KNOB 1 walks the notes, a chord's one by one, past a note's TIEs");
encs[panel.enc[EN_K2]] = 1; frame();
check(t->step[4].note[0] == 60u && t->step[4].note[1] == 65u && t->step[4].note[2] == 67u,
"NOTES: KNOB 2 changes that note's pitch only (E4 -> F4, the chord's others stay)");
encs[panel.enc[EN_K3]] = 2; frame();
check(note_len(t, 4) == 3u && t->step[5].time == ST_TIE && t->step[6].time == ST_TIE, "NOTES: KNOB 3 its length (3 steps: two TIEs)");
encs[panel.enc[EN_K4]] = 1; frame();
ok = note_force(&t->step[4], 1) == 3u && ((t->step[4].lvl >> 2) & 3u) == LV_HARD && !(t->step[4].flags & SF_ACCENT);
encs[panel.enc[EN_K4]] = 1; frame();
ok &= note_force(&t->step[4], 1) == 4u && (t->step[4].flags & SF_ACCENT);
encs[panel.enc[EN_K4]] = -1; frame(); encs[panel.enc[EN_K4]] = -1; frame();
encs[panel.enc[EN_K4]] = -1; frame(); encs[panel.enc[EN_K4]] = -1; frame();
ok &= note_force(&t->step[4], 1) == 0u && ((t->step[4].lvl >> 2) & 3u) == LV_GHOST && !(t->step[4].flags & SF_ACCENT);
check(ok, "NOTES: KNOB 4 its FORCE: HARD, ACC (the step's accent), down to GHOST");
{
uint32_t total, p0 = preset_pos(&total);
encs[panel.enc[EN_PRESET]] = 1; frame();
ok = (int8_t)ui.zoom == 1;
encs[panel.enc[EN_PRESET]] = -1; frame(); encs[panel.enc[EN_PRESET]] = -1; frame();
ok &= (int8_t)ui.zoom == -1;
encs[panel.enc[EN_PRESET]] = 1; frame();
check(ok && (int8_t)ui.zoom == 0 && preset_pos(&total) == p0, "NOTES: PRESETS zooms (16 -> 32, then 8; the sound stays)");
}
ui.force = 1; frame(); ppm("clipper-notes-chord");
tap(B_OCTUP); frame();
check(song.octave == 1 && !ui.sheet, "NOTES: OCT+ tapped: the octave up, as before (on release)");
song.octave = 0;
press(B_OCTUP); frames(30);
ok = ui.sheet == 1u && song.octave == 0;
release(B_OCTUP); frame();
check(ok && ui.sheet == 1u && song.octave == 0, "NOTES: OCT+ held 0.4 s: the note's sheet (the octave stays)");
ui.force = 1; frame(); ppm("clipper-notes-sheet");
tap(B_OCTUP); frame();
ok = (t->step[4].flags & SF_SLIDE) != 0;
encs[panel.enc[EN_K1]] = 1; frame();
encs[panel.enc[EN_K2]] = 3; frame();
ok &= ui.sheet == 2u && t->micro[4] == 3;
encs[panel.enc[EN_K1]] = 1; frame();
encs[panel.enc[EN_K2]] = 1; frame();
ok &= step_fill(t, 4) == FC_FILL;
check(ok, "NOTES sheet: SLIDE (OCT+), NUDGE +3, FILL (KNOB 1 the row, KNOB 2 its value)");
encs[panel.enc[EN_K1]] = 1; frame();
encs[panel.enc[EN_K2]] = -1; frame();
ok = ui.cursor == 3u && t->step[3].n == 3u && t->step[3].note[1] == 65u && note_len(t, 3) == 3u && !step_on(&t->step[4]) &&
t->step[6].time == ST_REST && t->micro[3] == 3 && t->micro[4] == 0 && step_fill(t, 3) == FC_FILL;
encs[panel.enc[EN_K2]] = -1; frame();
ok &= ui.cursor == 2u && t->step[2].n == 3u;
encs[panel.enc[EN_K2]] = -1; frame();
ok &= ui.cursor == 2u && !strcmp(ui.msg, "NO ROOM"); /* (step 1: the C3's TIE) */
check(ok, "NOTES sheet: MOVE, KNOB 2 a step a detent (with its TIEs, nudge, fill); not over another note");
encs[panel.enc[EN_K1]] = 1; frame();
tap(B_OCTUP); frame();
ok = step_on(&t->step[2]) && step_on(&t->step[5]) && t->step[5].note[1] == 65u && ui.cursor == 5u && ui.sheet == 4u;
check(ok, "NOTES sheet: COPY (OCT+): just after it, the copy picked, MOVE next");
encs[panel.enc[EN_K1]] = 2; frame();
tap(B_OCTUP); frame();
ok = step_on(&t->step[5]) && t->step[5].n == 2u && ui.sheet == 0u;
check(ok, "NOTES sheet: DELETE (OCT+): that note (the chord keeps its others), the sheet closes");
press(B_OCTUP); frames(30); release(B_OCTUP); frame();
tap(B_OCTDN); frame();
check(!ui.sheet && song.octave == 0, "NOTES: OCT- closes the sheet (the octave stays)");
press(B_EDIT); release(B_EDIT); frames(2);
check(t->step[5].n == 1u && step_on(&t->step[5]), "NOTES: EDIT tapped deletes the note under edit only");
press(B_EDIT); release(B_EDIT); frames(2);
check(!step_on(&t->step[5]) && t->step[6].time == ST_REST, "NOTES: the chord's last note: the step and its TIEs go");
press(B_EDIT); press(B_OCTDN); release(B_OCTDN); release(B_EDIT); frames(2);
check(step_on(&t->step[5]), "NOTES: EDIT + OCT- brings it back (undo)");
cursor_set(0); ui.force = 1; frame(); ppm("clipper-notes");
frames(20); /* (EDIT let go: KNOB 1..4 quiet 250 ms, #39) */
/* the keys write the step under edit; STEP ADVANCE (MENU > SEQ) */
{
uint32_t kc, ke, kg;
for (kc = 0; kc < 27u && kb_map(t, kc) != 60u; kc++) ;
for (ke = 0; ke < 27u && kb_map(t, ke) != 64u; ke++) ;
for (kg = 0; kg < 27u && kb_map(t, kg) != 67u; kg++) ;
cursor_set(10); frame();
fm1_in.notes |= 1u << kc | 1u << ke; frame(); fm1_in.notes = 0; frame();
ok = t->step[10].n == 2u && t->step[10].note[1] == 64u && ui.cursor == 11u;
step_adv_off = 1;
cursor_set(12); frame();
fm1_in.notes |= 1u << kc | 1u << ke; frame(); fm1_in.notes = 0; frame(); /* a wrong chord */
ok &= ui.cursor == 12u && t->step[12].n == 2u;
fm1_in.notes |= 1u << kc | 1u << ke | 1u << kg; frame(); fm1_in.notes = 0; frame();
ok &= ui.cursor == 12u && t->step[12].n == 3u && t->step[12].note[2] == 67u; /* the chord again: the step anew */
encs[panel.enc[EN_K1]] = 1; frame(); encs[panel.enc[EN_K1]] = 1; frame();
encs[panel.enc[EN_K1]] = 1; frame();
ok &= ui.cursor == 13u && ui.note_k == 0u;
step_adv_off = 0;
check(ok, "NOTES: the keys write the step under edit (and move on); STEP ADVANCE OFF: the cursor stays, a chord again rewrites it");
/* a MIDI keyboard on the NOTES page (1.0, after SLOOP 2.6) */
cursor_set(13); frame();
midi_in(0x90u, 62, 100); midi_in(0x90u, 65, 100); frames(2);
midi_in(0x80u, 62, 0); midi_in(0x80u, 65, 0); frames(3);
ok = t->step[13].n == 2u && t->step[13].note[0] == 62u && t->step[13].note[1] == 65u && ui.cursor == 14u;
midi_in(0x95u, 69, 90); frames(2); midi_in(0x85u, 69, 0); frames(3); /* (omni: any channel) */
ok &= t->step[14].n == 1u && t->step[14].note[0] == 69u && ui.cursor == 15u;
check(ok, "NOTES: a MIDI keyboard writes the step too (a chord: the notes held together; let go: the next step)");
go_home(); frames(2);
midi_in(0x90u, 71, 100); frames(2); midi_in(0x80u, 71, 0); frames(3);
check(t->step[15].time != ST_NOTE || t->step[15].note[0] != 71u, "off the NOTES page, MIDI writes no step");
frames(100);
}
/* (SLOOP 2.7.2) a legato step (SF_LEG) on the instrument: the note before is held into it, the voice takes the
* new note with no new attack; the same step without SF_LEG: the note before ends, a new attack */
{
uint32_t pass, att[2] = {0, 0}, gated_all[2] = {1, 1}, seen55[2] = {0, 0};
int16_t atk = t->p[P_ATK], sus = t->p[P_SUS];
go_home(); frames(2);
for (pass = 0; pass < 2u; pass++) {
uint32_t f, i, v0 = NVOICE;
for (j = 0; j < NSTEP; j++) step_clear(&t->step[j]);
memset(t->micro, 0, sizeof t->micro); memset(t->fill, 0, sizeof t->fill);
t->p[P_SLEN] = 16; t->p[P_VOICE] = V_LEGATO; t->p[P_GLIDE] = 0; t->p[P_ATK] = 70; t->p[P_SUS] = 100;
t->step[0].n = 1, t->step[0].note[0] = 48, t->step[0].time = ST_NOTE;
t->step[1].time = t->step[2].time = t->step[3].time = ST_TIE;
t->step[4].n = 1, t->step[4].note[0] = 55, t->step[4].time = ST_NOTE;
t->step[4].flags = (uint8_t)(pass ? 0u : SF_LEG);
t->step[5].time = ST_TIE;
transport_req = 1;
for (f = 0; f < 60u; f++) { /* (8 steps at 120 BPM: 1 s) */
uint32_t g = 0, idx;
frame();
idx = t->seq_idx;
for (i = 0; i < NVOICE; i++)
if (t->v[i].active && t->v[i].gate) {
g++;
if (v0 == NVOICE && t->v[i].note == 48)
v0 = i;
if (t->v[i].note == 55 && !seen55[pass]) {
seen55[pass] = 1;
att[pass] = i != v0 || t->v[i].stage == 1u || t->v[i].env < 1000;
}
}
if (song.playing && idx >= 1u && idx <= 3u && f > 2u && !g)
gated_all[pass] = 0;
if (idx >= 6u)
break;
}
transport_req = 2; frames(10);
}
t->p[P_VOICE] = V_POLY; t->p[P_ATK] = atk; t->p[P_SUS] = sus;
check(seen55[0] && !att[0] && gated_all[0] && seen55[1] && att[1],
"a LEGATO step (SF_LEG, 1.0): the note before held into it, the same voice takes it, no new attack (without: a new one)");
}
/* the menu: MENU > SEQ > STEP ADVANCE */
{
ui.menu = 1; ui.menu_sel = MI_ADV; ui.force = 1; frame(); ppm("clipper-menu-seq");
check(mi_sec(MI_ADV) == MS_SEQ && !strcmp(MS_NAME[MS_SEQ], "SEQ") && !strcmp(MI_NAME[MI_ADV], "STEP ADVANCE"),
"MENU: a SEQ section (STEP ADVANCE), between AUDIO and MIDI");
encs[panel.enc[EN_K1]] = -1; frame();
ok = step_adv_off == 1u;
encs[panel.enc[EN_K1]] = 1; frame();
ok &= step_adv_off == 0u;
ui.menu = 0; ui.force = 1; frame();
check(ok, "MENU > SEQ: KNOB 1 STEP ADVANCE OFF / ON (kept: synth9_test)");
}
go_home(); frames(2);
}
/* the pages a synth keeps */
check(!page_named("SLICER") && !page_named("DRUMS") && !page_named("SONG") && page_named("MASTER") && page_named("VOICE 2"),
"pages: no SLICER, DRUMS or SONG; MASTER and VOICE 2 stay");
+6 -3
View File
@@ -582,7 +582,9 @@ static int rec_test(void)
input_off(t1, 64);
rec_run_to(t1, 12, 50);
ok_half = rec_step_is(t1, 10, ST_NOTE, 1, 64) && rec_step_is(t1, 11, ST_TIE, 0, 0) && rec_step_is(t1, 12, ST_REST, 0, 0);
/* (d) a two-key chord held 2.6 steps: ties until the last key is up */
/* (d) a two-key chord, one key up early in step 15, the other held 2.6 steps: Clipper 1.0 (SLOOP 2.7.1), each note
* to its own end: step 15 the one still held going on (a NOTE of it, CONT), step 16 a TIE (before, the chord tied
* until its last key) */
rec_run_to(t1, 13, 5);
input_on(t1, 67, 100);
input_on(t1, 71, 100);
@@ -591,7 +593,8 @@ static int rec_test(void)
rec_run_to(t1, 15, 60);
input_off(t1, 71);
rec_run_to(t1, 0, 10);
ok_chord = t1->step[13].n == 2u && rec_step_is(t1, 14, ST_TIE, 0, 0) && rec_step_is(t1, 15, ST_TIE, 0, 0) &&
ok_chord = t1->step[13].n == 2u && t1->step[14].time == ST_NOTE && t1->step[14].n == 1u && t1->step[14].note[0] == 71u &&
(t1->step[14].flags & SF_CONT(0)) && rec_step_is(t1, 15, ST_TIE, 0, 0) &&
t1->step[0].time != ST_TIE;
/* (e) LEN 4, held for 10 steps: the note fills the pattern (3 TIEs), not more */
rec_run_to(t2, 1, 10);
@@ -627,7 +630,7 @@ static int rec_test(void)
printf("tracks: recording lengths: held 3.3 steps -> NOTE TIE TIE (the 4th step put back) %s; 0.3 step -> one "
"step %s; past the middle of the next -> NOTE TIE %s\n", ok_len ? "ok" : "FAIL", ok_short ? "ok" : "FAIL",
ok_half ? "ok" : "FAIL");
printf("tracks: recording lengths: a chord ties until its last key %s; capped at LEN 4 %s; MONO legato A..B -> "
printf("tracks: recording lengths: a chord, each note to its own key-up (1.0, SLOOP 2.7.1) %s; capped at LEN 4 %s; MONO legato A..B -> "
"A TIE B TIE %s\n", ok_chord ? "ok" : "FAIL", ok_cap ? "ok" : "FAIL", ok_mono ? "ok" : "FAIL");
printf("tracks: recording with SWING 50 %%: nearest swung step, as heard (0.55 into a long step stays, 0.56 into a "
"short one moves on) %s\n", ok_swing ? "ok" : "FAIL");
+348
View File
@@ -603,6 +603,74 @@ static void t_mclk(void)
mi_r = mi_w;
}
/* (2.7.2) a master at a steady 140 whose pulses come a few ms early or late (a computer, USB): BPM shows 140, not
* 139 / 140 / 141 by turns; a master at 139.5 shows one value; a tempo ramp and a jump are still followed */
static void mclk_jrun(double *t, uint32_t *np, double bpm, double until, uint32_t *seen, uint32_t *changes)
{
static uint32_t rng = 12345u;
double per = 60000.0 / bpm / 24.0;
int32_t last = song.g[G_BPM];
while (*t < until) {
for (;;) { /* pulse n at n * per, +-2.5 ms (not adding up) */
double at;
rng = rng * 1103515245u + 12345u;
at = (double)*np * per + ((double)((rng >> 16) % 51u) - 25.0) / 10.0;
if (at > *t)
break;
mclk_push(0xF80Fu);
(*np)++;
}
fm1_ms = (uint32_t)*t;
run_block();
if (seen && song.g[G_BPM] >= 100 && song.g[G_BPM] < 200)
seen[song.g[G_BPM] - 100] = 1;
if (changes && song.g[G_BPM] != last)
(*changes)++;
last = song.g[G_BPM];
*t += (double)CTL * 1000.0 / FS;
}
}
static void t_mclk_jitter(void)
{
double t = 0;
uint32_t np = 0, seen[100], k, n, ch = 0;
reset(90);
mi_r = mi_w;
song.g[G_SYNC] = 1;
mclk_jrun(&t, &np, 140.0, 2000.0, 0, 0); /* settle (the first beats) */
memset(seen, 0, sizeof seen);
mclk_jrun(&t, &np, 140.0, 62000.0, seen, &ch); /* a minute at 140 */
for (n = 0, k = 0; k < 100u; k++)
n += seen[k];
printf("seq2: 140 +-2.5 ms: %u value(s), %u change(s), BPM %d\n", n, ch, song.g[G_BPM]);
check(n == 1u && seen[40] && ch == 0u, "MIDI clock (2.7.2): a steady 140 with jittery pulses shows 140, steady");
{ /* the master at 139.5 (between two): one value for a minute */
double t0 = t;
np = (uint32_t)(t / (60000.0 / 139.5 / 24.0)) + 1u;
mclk_jrun(&t, &np, 139.5, t0 + 3000.0, 0, 0);
ch = 0;
mclk_jrun(&t, &np, 139.5, t + 60000.0, 0, &ch);
check(ch == 0u && (song.g[G_BPM] == 139 || song.g[G_BPM] == 140),
"MIDI clock (2.7.2): a master at 139.5 shows one value, steady");
}
{ /* a ramp 140 -> 146 over 16 beats, then a jump to 100: followed */
double bpm = 140.0;
np = (uint32_t)(t / (60000.0 / bpm / 24.0)) + 1u;
for (k = 0; k < 16u; k++, bpm += 6.0 / 16.0) {
np = (uint32_t)(t / (60000.0 / bpm / 24.0)) + 1u;
mclk_jrun(&t, &np, bpm, t + 60000.0 / bpm, 0, 0);
}
mclk_jrun(&t, &np, 146.0, t + 3000.0, 0, 0);
check(song.g[G_BPM] >= 145 && song.g[G_BPM] <= 146, "MIDI clock (2.7.2): a ramp to 146 is followed");
np = (uint32_t)(t / (60000.0 / 100.0 / 24.0)) + 1u;
mclk_jrun(&t, &np, 100.0, t + 1500.0, 0, 0);
check(song.g[G_BPM] == 100, "MIDI clock (2.7.2): a jump to 100 is taken within two beats");
}
song.g[G_SYNC] = 0;
mi_r = mi_w;
fm1_ms = (uint32_t)t + 1000u; /* (the master gone) */
}
/* the REC screen's MODE and START (SLOOP 2.3): an empty project records at the tempo set (TEMPO) or
* takes it from the playing (FREE); COUNT: PLAY clicks one bar, then the loop and the recording start */
static void t_recmode(void)
@@ -873,6 +941,283 @@ static void t_micro(void)
for (i = 0; i < 16u; i++) TDRUM->micro[i] = 0;
}
static int32_t voice_of(const track_t *t, uint32_t note) /* a gated voice playing note: its age, else -1 */
{
uint32_t i;
for (i = 0; i < NVOICE; i++)
if (t->v[i].active && t->v[i].gate && t->v[i].note == note)
return (int32_t)t->v[i].age;
return -1;
}
static void t_overdub(void)
{
track_t *t = &trk[0];
double sb = (double)FS * 60.0 / 120.0 / 4.0 / CTL, lat = (double)REC_LAT / CTL;
uint32_t into, slen, k, i;
int32_t a60, a64;
int ok;
reset(120);
t->p[P_VOICE] = V_POLY;
t->p[P_SLEN] = 16;
t->step[0].time = ST_NOTE; t->step[0].n = 2; t->step[0].note[0] = 60; t->step[0].note[1] = 64; t->step[0].vel = 100;
for (i = 1; i < 16u; i++) { memset(&t->step[i], 0, sizeof t->step[i]); t->step[i].time = ST_TIE; }
song.sel = 0;
transport_req = 1;
run_block();
while (trk_grid(t, &into, &slen) != 4u) run_block();
a60 = voice_of(t, 60), a64 = voice_of(t, 64);
song.rec = 1u; /* overdub, while it plays */
while (trk_grid(t, &into, &slen) != 8u) run_block();
for (k = 0; k < (uint32_t)(lat + 0.5) + 2u; k++) run_block();
input_on(t, 67, 100);
for (k = 0; k < (uint32_t)(sb * 0.6); k++) run_block(); /* held a little over half a step */
input_off(t, 67);
ok = t->step[8].time == ST_NOTE && t->step[8].n == 3 && t->step[8].note[2] == 67 && (t->step[8].flags & SF_CONT(0)) &&
(t->step[8].flags & SF_CONT(1)) && !(t->step[8].flags & SF_CONT(2)) && step_pure_cont(&t->step[9]) &&
t->step[9].n == 2 && t->step[10].time == ST_TIE;
check(ok, "2.7 overdub: a note over the held pad: step 9 = pad going on + the new note; step 10 its end (pad only)");
song.rec = 0;
while (trk_grid(t, &into, &slen) != 15u) run_block(); /* this bar, on: the pad still the same voices */
ok = a60 >= 0 && voice_of(t, 60) == a60 && voice_of(t, 64) == a64 && voice_of(t, 67) < 0;
check(ok, "2.7 overdub: the pad goes on under it (same voices, never cut), the new note ended");
while (trk_grid(t, &into, &slen) != 16u + 9u) run_block(); /* the next bar, on step 10 */
for (k = 0; k < 8u; k++) run_block();
{
int32_t b60 = voice_of(t, 60);
uint32_t has67 = voice_of(t, 67) >= 0;
while (trk_grid(t, &into, &slen) != 16u + 11u) run_block();
ok = b60 >= 0 && b60 != a60 && voice_of(t, 60) == b60 && voice_of(t, 64) >= 0 && !has67;
}
check(ok, "2.7 overdub, played back: the pad from step 1, held through steps 9-10, the new note only on 9");
transport_req = 2; run_block();
/* held three steps: its end moves to step 12 */
reset(120);
t->p[P_VOICE] = V_POLY;
t->p[P_SLEN] = 16;
t->step[0].time = ST_NOTE; t->step[0].n = 2; t->step[0].note[0] = 60; t->step[0].note[1] = 64; t->step[0].vel = 100;
for (i = 1; i < 16u; i++) { memset(&t->step[i], 0, sizeof t->step[i]); t->step[i].time = ST_TIE; }
song.sel = 0;
song.rec = 1u;
transport_req = 1;
run_block();
while (trk_grid(t, &into, &slen) != 8u) run_block();
for (k = 0; k < (uint32_t)(lat + 0.5) + 2u; k++) run_block();
input_on(t, 67, 100);
while (trk_grid(t, &into, &slen) != 11u) run_block();
for (k = 0; k < (uint32_t)(sb * 0.7); k++) run_block();
input_off(t, 67);
ok = t->step[8].n == 3 && t->step[9].time == ST_TIE && t->step[10].time == ST_TIE && t->step[11].time == ST_TIE &&
step_pure_cont(&t->step[12]) && t->step[13].time == ST_TIE;
if (!ok)
for (i = 8; i < 14u; i++) printf("seq2: step %u time %u n %u flags %02x\n", i + 1, t->step[i].time, t->step[i].n, t->step[i].flags);
check(ok, "2.7 overdub: held four steps: ties to step 12, its end on 13");
transport_req = 2; run_block();
/* as on the FM-1: a note recorded held over 32 steps, then an overdub pass, another note pressed on step 17 */
reset(120);
t->p[P_VOICE] = V_POLY;
t->p[P_SLEN] = 32;
song.sel = 0;
song.rec = 1u;
transport_req = 1;
run_block();
input_on(t, 60, 100);
while (trk_grid(t, &into, &slen) != 31u) run_block();
for (k = 0; k < (uint32_t)(sb * 0.8); k++) run_block();
input_off(t, 60);
song.rec = 0;
ok = t->step[0].time == ST_NOTE && t->step[0].note[0] == 60 && t->step[1].time == ST_TIE && t->step[31].time == ST_TIE;
while (trk_grid(t, &into, &slen) != 32u + 16u) run_block();
song.rec = 1u;
for (k = 0; k < 20u; k++) run_block();
a60 = voice_of(t, 60);
input_on(t, 64, 100);
for (k = 0; k < 3u; k++) run_block();
ok &= a60 >= 0 && voice_of(t, 60) == a60 && voice_of(t, 64) >= 0;
for (k = 0; k < (uint32_t)(sb * 0.5); k++) run_block();
input_off(t, 64);
for (k = 0; k < (uint32_t)(sb * 2.0); k++) run_block();
ok &= voice_of(t, 60) == a60 && voice_of(t, 64) < 0 && t->step[16].n == 2 && (t->step[16].flags & SF_CONT(0)) &&
step_pure_cont(&t->step[17]);
song.rec = 0;
while (trk_grid(t, &into, &slen) != 64u + 20u) run_block(); /* the next pass: still the one note, held */
ok &= voice_of(t, 60) >= 0;
check(ok, "2.7 overdub as played: 32 steps held, a note pressed on step 17 of the next pass: the held note goes on");
transport_req = 2; run_block();
song.rec = 0;
}
/* SLOOP 2.7.1 (a YouTube comment): several notes held while recording, on a POLY part. Each goes on until its own key is let
* go: "hit record, hold a note, play another one on top" used to end the first one with the second */
typedef struct { uint8_t t; uint8_t n; uint8_t a, b, c; uint8_t cont; } want_t; /* time, n, notes, CONT bits */
static int steps_are(const track_t *t, const want_t *w, uint32_t nw)
{
uint32_t i, ok = 1;
for (i = 0; i < nw; i++) {
const step_t *st = &t->step[i];
uint32_t good = st->time == w[i].t;
if (good && w[i].t == ST_NOTE)
good = st->n == w[i].n && st->note[0] == w[i].a && (w[i].n < 2u || st->note[1] == w[i].b) &&
(w[i].n < 3u || st->note[2] == w[i].c) && ((st->flags & SF_CONT_ALL) / SF_CONT0) == w[i].cont;
if (!good) {
printf("seq2: step %u: time %u n %u notes %u %u %u cont %x\n", i + 1, st->time, st->n, st->note[0], st->note[1],
st->note[2], (st->flags & SF_CONT_ALL) / SF_CONT0);
ok = 0;
}
}
return (int)ok;
}
static void rec_go_to(track_t *t, uint32_t step, double frac) /* the transport onto step (0-based), frac of it */
{
double sb = (double)FS * 60.0 / 120.0 / 4.0 / CTL;
uint32_t into, slen, k;
while (trk_grid(t, &into, &slen) != step) run_block();
for (k = 0; k < (uint32_t)(sb * frac); k++) run_block();
}
static void rec_start16(track_t *t)
{
reset(120);
t->p[P_VOICE] = V_POLY;
t->p[P_SLEN] = 16;
song.sel = 0;
song.rec = 1u;
transport_req = 1;
run_block();
}
static void t_hold2(void)
{
track_t *t = &trk[0];
int ok;
enum { N = ST_NOTE, T = ST_TIE, R = ST_REST };
{ /* note 1 held, note 2 on top and let go first: note 1 goes on to its own end */
static const want_t W[16] = {{N, 1, 60, 0, 0, 0}, {T}, {T}, {T}, {N, 2, 60, 64, 0, 1}, {T}, {T}, {T},
{N, 1, 60, 0, 0, 1}, {T}, {T}, {T}, {R}, {R}, {R}, {R}};
int32_t a;
uint32_t into, slen;
rec_start16(t);
rec_go_to(t, 0, 0.2); input_on(t, 60, 100);
rec_go_to(t, 4, 0.3); input_on(t, 64, 100);
rec_go_to(t, 8, 0.3); input_off(t, 64);
rec_go_to(t, 12, 0.3); input_off(t, 60);
song.rec = 0;
ok = steps_are(t, W, 16);
while (trk_grid(t, &into, &slen) != 16u + 2u) run_block();
a = voice_of(t, 60);
rec_go_to(t, 16 + 6, 0.5);
ok &= a >= 0 && voice_of(t, 60) == a && voice_of(t, 64) >= 0;
rec_go_to(t, 16 + 10, 0.5);
ok &= voice_of(t, 60) == a && voice_of(t, 64) < 0;
rec_go_to(t, 16 + 13, 0.5);
ok &= voice_of(t, 60) < 0;
check(ok, "2.7.1 recording: hold a note, play another on top, let it go: the first goes on (one voice) to its own end");
transport_req = 2; run_block();
}
{ /* note 1 let go first: note 2 goes on alone */
static const want_t W[12] = {{N, 1, 60, 0, 0, 0}, {T}, {T}, {T}, {N, 2, 60, 64, 0, 1}, {T}, {N, 1, 64, 0, 0, 1}, {T},
{T}, {T}, {R}, {R}};
rec_start16(t);
rec_go_to(t, 0, 0.2); input_on(t, 60, 100);
rec_go_to(t, 4, 0.3); input_on(t, 64, 100);
rec_go_to(t, 6, 0.3); input_off(t, 60);
rec_go_to(t, 10, 0.3); input_off(t, 64);
song.rec = 0;
check(steps_are(t, W, 12), "2.7.1 recording: the first let go first: it ends there, the second goes on to its end");
transport_req = 2; run_block();
}
{ /* a chord built note by note, all let go together */
static const want_t W[10] = {{N, 1, 60, 0, 0, 0}, {T}, {N, 2, 60, 64, 0, 1}, {T}, {N, 3, 60, 64, 67, 3}, {T}, {T}, {T},
{R}, {R}};
rec_start16(t);
rec_go_to(t, 0, 0.2); input_on(t, 60, 100);
rec_go_to(t, 2, 0.3); input_on(t, 64, 100);
rec_go_to(t, 4, 0.3); input_on(t, 67, 100);
rec_go_to(t, 8, 0.2); input_off(t, 60); input_off(t, 64); input_off(t, 67);
song.rec = 0;
check(steps_are(t, W, 10), "2.7.1 recording: a chord built note by note: each note starts on its step, all held to the end");
transport_req = 2; run_block();
}
{ /* note 2 played late in a step (it goes into the next one, not tied yet) */
static const want_t W[12] = {{N, 1, 60, 0, 0, 0}, {T}, {T}, {T}, {T}, {N, 2, 60, 64, 0, 1}, {T}, {N, 1, 60, 0, 0, 1},
{T}, {T}, {R}, {R}};
rec_start16(t);
rec_go_to(t, 0, 0.2); input_on(t, 60, 100);
rec_go_to(t, 4, 0.85); input_on(t, 64, 100);
rec_go_to(t, 7, 0.3); input_off(t, 64);
rec_go_to(t, 10, 0.3); input_off(t, 60);
song.rec = 0;
check(steps_are(t, W, 12), "2.7.1 recording: the second note played late in a step (into the next): the first goes on");
transport_req = 2; run_block();
}
{ /* 2.7.2: LEGATO, a note played over the one held: recorded legato, played back legato (no new attack) */
static const want_t W[10] = {{N, 1, 48, 0, 0, 0}, {T}, {T}, {T}, {N, 1, 55, 0, 0, 0}, {T}, {T}, {T}, {R}, {R}};
uint32_t into, slen, st1;
rec_start16(t);
t->p[P_VOICE] = V_LEGATO;
t->p[P_ATK] = 30; /* (an attack of some length: a new one shows as stage 1) */
t->p[P_SUS] = 100;
t->p[P_GLIDE] = 0;
rec_go_to(t, 0, 0.1); input_on(t, 48, 100);
rec_go_to(t, 3, 0.9); input_on(t, 55, 100); /* (into step 5: the first still held there) */
rec_go_to(t, 5, 0.3); input_off(t, 48);
rec_go_to(t, 8, 0.2); input_off(t, 55);
song.rec = 0;
ok = steps_are(t, W, 10) && (t->step[4].flags & SF_LEG) && !(t->step[0].flags & SF_LEG);
check(ok, "2.7.2 recording LEGATO: a note played over the held one is marked legato (SF_LEG), the first is not");
while (trk_grid(t, &into, &slen) != 16u + 3u) run_block();
rec_go_to(t, 16 + 3, 0.9);
st1 = t->v[0].stage;
while (trk_grid(t, &into, &slen) != 16u + 4u) run_block();
{ /* (a new attack: stage 1 and the envelope up to its peak; legato: it stays at the sustain level) */
int32_t e1 = t->v[0].env, emax = 0;
int b, att = 0;
for (b = 0; b < 6; b++) {
run_block();
att |= t->v[0].stage == 1u;
if (t->v[0].env > emax)
emax = t->v[0].env;
}
ok = st1 == 2u && !att && emax <= e1 && t->v[0].gate && t->v[0].note == 55 && t->slide_glide == 0;
}
check(ok, "2.7.2 playback: the legato note takes over, the envelope goes on (no new attack, no glide of its own)");
rec_go_to(t, 16 + 9, 0.5);
check(!t->v[0].gate, "2.7.2 playback: the legato note ends where it was let go");
transport_req = 2; run_block();
}
{ /* 2.7.2: LEGATO, the second pressed early in a step the first is already held into (a TIE): legato too */
rec_start16(t);
t->p[P_VOICE] = V_LEGATO;
rec_go_to(t, 0, 0.1); input_on(t, 48, 100);
rec_go_to(t, 4, 0.2); input_on(t, 55, 100);
rec_go_to(t, 5, 0.3); input_off(t, 48);
rec_go_to(t, 8, 0.2); input_off(t, 55);
song.rec = 0;
check(t->step[3].time == ST_TIE && t->step[4].time == ST_NOTE && t->step[4].note[0] == 55 &&
(t->step[4].flags & SF_LEG), "2.7.2 recording LEGATO: over the held note early in a step it was tied into: legato");
transport_req = 2; run_block();
}
{ /* 2.7.2: MONO, the first let go before the second: not legato */
rec_start16(t);
t->p[P_VOICE] = V_MONO;
rec_go_to(t, 0, 0.1); input_on(t, 48, 100);
rec_go_to(t, 2, 0.3); input_off(t, 48);
rec_go_to(t, 4, 0.1); input_on(t, 55, 100);
rec_go_to(t, 6, 0.3); input_off(t, 55);
song.rec = 0;
check(t->step[4].time == ST_NOTE && t->step[4].note[0] == 55 && !(t->step[4].flags & SF_LEG),
"2.7.2 recording MONO: a note played after the first was let go is not legato");
transport_req = 2; run_block();
}
{ /* 2.7.2: POLY over a held note: as 2.7.1 (both go on), never SF_LEG */
rec_start16(t);
rec_go_to(t, 0, 0.1); input_on(t, 48, 100);
rec_go_to(t, 4, 0.1); input_on(t, 55, 100);
rec_go_to(t, 6, 0.3); input_off(t, 48); input_off(t, 55);
song.rec = 0;
check(!(t->step[4].flags & SF_LEG) && t->step[4].n == 2, "2.7.2 recording POLY: over a held note, both go on (no SF_LEG)");
transport_req = 2; run_block();
}
song.rec = 0;
}
/* SLOOP 2.4: parameter locks. A lock on P_E0 at step 3 sets t->p[P_E0] for that step, the base is back at
* step 4; a knob turned during the locked step is kept as the new base; STOP restores; a lock on a parameter
* that is not lockable is refused */
@@ -1309,6 +1654,9 @@ int main(void)
t_chords();
t_mute();
t_chordplus();
t_overdub(); /* (SLOOP 2.7, ported in 0.7) */
t_hold2(); /* (Clipper 1.0: SLOOP 2.7.1 / 2.7.2 recording) */
t_mclk_jitter(); /* (Clipper 1.0: SLOOP 2.7.2 MIDI clock tempo) */
printf("seq2: %s\n", fails ? "FAILED" : "all checks ok");
return fails;
}
+3 -3
View File
@@ -840,11 +840,11 @@ int main(int argc, char **argv)
uint32_t j, b0;
song.sel = 0; go_home(); frames(2);
for (j = 0; j < NSTEP; j++) dstep_set(&TDRUM->dstep[j], j % 16u, LV_NORM, 3);
for (j = 0; j < NPAGES; j++) if (!strcmp(PAGES[j].title, "STEP")) break;
for (j = 0; j < NPAGES; j++) if (!strcmp(PAGES[j].title, "NOTES")) break;
open_family(FAM_SEQ); ui.page = (uint8_t)j; ui.fam_last[FAM_SEQ] = (uint8_t)j; page_entered(); ui.force = 1; frames(2);
b0 = ui.page;
for (j = 0; j < 3u; j++) { encs[panel.enc[EN_ALGO]] = 1; frames(2); }
check(song.sel == TRK_DRUM && ui.page == b0 && !page_for_drum(cur_page()) && !strcmp(PAGES[ui.page].title, "STEP"),
check(song.sel == TRK_DRUM && ui.page == b0 && !page_for_drum(cur_page()) && !strcmp(PAGES[ui.page].title, "NOTES"),
"STEP on the drum track: not a page for the drums (DRUM TRACK shown, no piano roll of the drum steps)");
for (j = 0; j < NSTEP; j++) memset(&TDRUM->dstep[j], 0, sizeof(dstep_t));
song.sel = 0; go_home(); frames(4);
@@ -856,7 +856,7 @@ int main(int argc, char **argv)
song.sel = 1; go_home(); frames(2);
steps_clear(t); t->p[P_SLEN] = 16; t->p[P_VOICE] = V_POLY;
t->p[P_ROOT] = 0; t->p[P_SCALE] = 1; t->p[P_QUANT] = 0; t->p[P_CHORD] = 1; /* C major, TRIAD */
for (j = 0; j < NPAGES; j++) if (!strcmp(PAGES[j].title, "STEP")) break;
for (j = 0; j < NPAGES; j++) if (!strcmp(PAGES[j].title, "NOTES")) break;
open_family(FAM_SEQ); ui.page = (uint8_t)j; ui.fam_last[FAM_SEQ] = (uint8_t)j; page_entered(); ui.force = 1; frames(2);
cursor_set(0); frames(1);
key(k5); frames(2);