Restore sound-specific rings and refine studio UI
This commit is contained in:
1 parent
02eb8911e8
commit
e7b6c0bb3e
16 files changed
+318
-524
No files matched your search
+18
-16
@@ -33,7 +33,7 @@ import {
|
||||
TEMPO_BPM,
|
||||
} from './sequencer';
|
||||
import type { BeatPoint } from './sequencer';
|
||||
import { getStackedPosition } from './domain/timeline';
|
||||
import { getSoundOrbitRadius, getStackedPosition } from './domain/timeline';
|
||||
|
||||
describe('circular step positions', () => {
|
||||
it('derives playback timing from tempo and fine-grained subdivisions', () => {
|
||||
@@ -76,15 +76,16 @@ describe('circular step positions', () => {
|
||||
expect(getStepFromPosition(point.x, point.y)).toBeCloseTo(fractionalStep, 8);
|
||||
});
|
||||
|
||||
it('visually separates same-category instruments at the same beat tick', () => {
|
||||
it('gives each sound its own orbit and stacks repeated beats of that sound', () => {
|
||||
const beats: BeatPoint[] = [
|
||||
{ id: 'kick-a', soundId: 'kick', letter: 'a', step: 4 },
|
||||
{ id: 'snare-b', soundId: 'snare', letter: 'b', step: 4 },
|
||||
{ id: 'kick-b', soundId: 'kick', letter: 'b', step: 4 },
|
||||
];
|
||||
const kickPosition = getStackedPosition(beats[0], beats, TOTAL_STEPS, 180);
|
||||
const snarePosition = getStackedPosition(beats[1], beats, TOTAL_STEPS, 180);
|
||||
const secondKickPosition = getStackedPosition(beats[1], beats, TOTAL_STEPS, 180);
|
||||
|
||||
expect(kickPosition).not.toEqual(snarePosition);
|
||||
expect(kickPosition).not.toEqual(secondKickPosition);
|
||||
expect(getSoundOrbitRadius(0, 2)).not.toBe(getSoundOrbitRadius(1, 2));
|
||||
});
|
||||
|
||||
it('wraps fractional positions and reports loop percentages', () => {
|
||||
@@ -175,7 +176,7 @@ describe('instrument catalog and pitch', () => {
|
||||
});
|
||||
|
||||
describe('sequencer state transitions', () => {
|
||||
it('loads a template and removes every instrument in the focused category ring', () => {
|
||||
it('loads a template and removes every beat in the focused sound ring', () => {
|
||||
const templateBeats: BeatPoint[] = [
|
||||
{ id: 'kick-1', soundId: 'kick', letter: 'a', step: 0 },
|
||||
{ id: 'snare-1', soundId: 'snare', letter: 'b', step: 4 },
|
||||
@@ -189,12 +190,12 @@ describe('sequencer state transitions', () => {
|
||||
});
|
||||
|
||||
expect(loaded.selectedBeatId).toBe('kick-1');
|
||||
expect(loaded.focusedCategoryId).toBe('drums');
|
||||
expect(loaded.focusedSoundId).toBe('kick');
|
||||
|
||||
const afterRingRemoval = sequencerReducer(loaded, { type: 'focused-category-removed' });
|
||||
expect(afterRingRemoval.beats).toEqual([templateBeats[2]]);
|
||||
const afterRingRemoval = sequencerReducer(loaded, { type: 'focused-sound-removed' });
|
||||
expect(afterRingRemoval.beats).toEqual([templateBeats[1], templateBeats[2]]);
|
||||
expect(afterRingRemoval.selectedBeatId).toBeNull();
|
||||
expect(afterRingRemoval.focusedCategoryId).toBe('keys');
|
||||
expect(afterRingRemoval.focusedSoundId).toBe('snare');
|
||||
});
|
||||
|
||||
it('clears out-of-range selections when the time signature gets shorter', () => {
|
||||
@@ -216,14 +217,15 @@ describe('sequencer state transitions', () => {
|
||||
|
||||
expect(shortened.beats).toEqual(beats);
|
||||
expect(shortened.selectedBeatId).toBeNull();
|
||||
expect(shortened.focusedCategoryId).toBe('drums');
|
||||
expect(shortened.focusedSoundId).toBe('hi-hat');
|
||||
});
|
||||
|
||||
it('removes one category ring and focuses a remaining category', () => {
|
||||
it('removes one sound ring without removing other sounds in the same category', () => {
|
||||
const beats: BeatPoint[] = [
|
||||
{ id: 'kick-1', soundId: 'kick', letter: 'a', step: 0 },
|
||||
{ id: 'hat-1', soundId: 'hi-hat', letter: 'b', step: 4 },
|
||||
{ id: 'bass-1', soundId: 'bass', letter: 'a', step: 8 },
|
||||
{ id: 'bass-2', soundId: 'bass', letter: 'b', step: 12 },
|
||||
];
|
||||
const loaded = sequencerReducer(createInitialSequencerState(), {
|
||||
type: 'template-loaded',
|
||||
@@ -232,13 +234,13 @@ describe('sequencer state transitions', () => {
|
||||
beatsPerBar: 4,
|
||||
});
|
||||
const bassSelected = sequencerReducer(loaded, {
|
||||
type: 'category-selected',
|
||||
categoryId: 'bass',
|
||||
type: 'sound-selected',
|
||||
soundId: 'bass',
|
||||
});
|
||||
const removed = sequencerReducer(bassSelected, { type: 'focused-category-removed' });
|
||||
const removed = sequencerReducer(bassSelected, { type: 'focused-sound-removed' });
|
||||
|
||||
expect(removed.beats).toEqual([beats[0], beats[1]]);
|
||||
expect(removed.focusedCategoryId).toBe('drums');
|
||||
expect(removed.focusedSoundId).toBe('kick');
|
||||
expect(removed.selectedBeatId).toBeNull();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user