# M7: Sequences tab Branch: `m7-sequences-tab` → `main` ## What changed **Sequences can be added, edited and removed.** - Click an empty slot, then **Add sequence**: it is named "Sequence NN" (the slot number), 2 bars long, at the BPM of the sequence edited last (otherwise 120). - **Name, BPM and length** are saved when you leave a field or press Enter. Go checks them: a name that isn't allowed in file names is refused, BPM must be 20–999, length 1–999 bars. A refused value shows an error and the field goes back to the stored value. - BPM accepts decimals (the device stores BPM as a decimal number). - **Remove sequence** asks first, saying whether recorded notes will be deleted. The last sequence can't be removed (Go refuses and the banner says so). - **Shortening a sequence that has recorded notes** asks first. The notes past the new end are left in the file, because what the device does with them isn't known yet (checkpoint B5). - Sequences with notes show `notes` in the grid and a line in the panel. **Go service**: `AddSequence`, `RemoveSequence`, `SetSequence`. ## Testing On the server: `go vet` and `go test ./...` pass. - **M7 done-when, through the service:** the calls the UI makes (name, two pads, tuning, set sequence 1, add sequence 2, set it) export a file byte-identical to `testdata/accepted/MpckitT1.xpj`, the M2 golden output. - Also tested: add, edit, refused edits (empty name, BPM 19 and 1000, 0 bars) keeping the old values, adding twice, removing, and refusing to remove the last sequence. The frontend is untested here (no Node). **On the laptop** (create `C:\temp\m7` first): 1. `npm run check` in `frontend`: 0 errors, 0 warnings. 2. **Done-when, in the app.** New project, named `MpckitT1`. - Pads: A01 = `testdata\accepted\MpckitT1_[ProjectData]\Linn 9000 kick.wav`; B01 = `…\Linn 9000 kick001.wav`, Semitones +5. - Sequences tab: A01: name `Verse`, BPM `96`, length `8`. - Select slot A02 → **Add sequence**: it comes up at 96 BPM. Name `Chorus`, length `4`. - **Export to folder** `C:\temp\m7`, then: ``` go run ./tools/xpjdiff C:\temp\m7\MpckitT1.xpj testdata\accepted\MpckitT1.xpj ``` prints `identical`. 3. **Refused values:** BPM `19`, length `0`, or an empty name each show an error, and the field goes back. 4. **Remove:** remove Chorus (asks, then it's gone); removing Verse then shows "cannot remove the only sequence". 5. **Notes:** Load `testdata\device\DemoFile.xpj`. Both sequences show `notes`. Shortening "Sequence 02" from 4 to 2 bars asks first; Cancel puts 4 back. Remove says its notes will be deleted.