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
@@ -1,5 +1,4 @@
|
||||
import type { BeatPoint } from './sequencer';
|
||||
import { INSTRUMENT_BY_ID } from './instruments';
|
||||
import {
|
||||
PLAYBACK_SUBSTEPS_PER_STEP,
|
||||
TOTAL_STEPS,
|
||||
@@ -48,12 +47,10 @@ export function wrapStepPosition(step: number, totalSteps: number): number {
|
||||
return ((step % totalSteps) + totalSteps) % totalSteps;
|
||||
}
|
||||
|
||||
export function getCategoryOrbitRadius(categoryIndex: number, categoryCount: number): number {
|
||||
return ORBIT_RADIUS * (categoryCount + 1 - categoryIndex) / (categoryCount + 1);
|
||||
export function getSoundOrbitRadius(soundIndex: number, soundCount: number): number {
|
||||
return ORBIT_RADIUS * (soundCount + 1 - soundIndex) / (soundCount + 1);
|
||||
}
|
||||
|
||||
export const getSoundOrbitRadius = getCategoryOrbitRadius;
|
||||
|
||||
export function getPlaybackTick(step: number, totalSteps: number): number {
|
||||
const totalPlaybackTicks = totalSteps * PLAYBACK_SUBSTEPS_PER_STEP;
|
||||
return Math.round(step * PLAYBACK_SUBSTEPS_PER_STEP) % totalPlaybackTicks;
|
||||
@@ -67,8 +64,7 @@ export function getStackedPosition(
|
||||
): CirclePoint {
|
||||
const siblings = beats
|
||||
.filter((candidate) => (
|
||||
INSTRUMENT_BY_ID[candidate.soundId].categoryId
|
||||
=== INSTRUMENT_BY_ID[beat.soundId].categoryId
|
||||
candidate.soundId === beat.soundId
|
||||
&& getPlaybackTick(candidate.step, totalSteps) === getPlaybackTick(beat.step, totalSteps)
|
||||
))
|
||||
.sort((first, second) => first.id.localeCompare(second.id));
|
||||
|
||||
Reference in new issue
Block a user