mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Implemented performance mode
This commit is contained in:
1 parent
063463efdd
commit
9df73ddcd2
9 files changed
+552
-211
No files matched your search
@@ -11,6 +11,7 @@
|
||||
// ← / → beat jump, or move an engaged loop
|
||||
// Shift+← / → step between grid markers
|
||||
// Cmd/Ctrl+↑ / ↓ loop / jump size (Shift+↑/↓ is the track table's)
|
||||
// P performance mode on / off (not a deck's key)
|
||||
//
|
||||
// Keys are read from `e.code` (layout- and Shift-independent). A new or changed
|
||||
// key needs `lib/shortcuts.ts` (the keyboard map) updating by hand.
|
||||
@@ -40,6 +41,8 @@ export interface DeckKeyTargets {
|
||||
focused: DeckShortcuts | null
|
||||
/** The other deck, in performance mode (else null: Alt does nothing). */
|
||||
other: DeckShortcuts | null
|
||||
/** P: performance mode on / off. */
|
||||
togglePerformance?: () => void
|
||||
}
|
||||
|
||||
export type DeckKeyAction =
|
||||
@@ -140,7 +143,12 @@ export function useDeckKeys(targets: RefObject<DeckKeyTargets>): void {
|
||||
// Ignore while typing in a field.
|
||||
const t = e.target as HTMLElement | null
|
||||
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return
|
||||
const { focused, other } = targets.current
|
||||
const { focused, other, togglePerformance } = targets.current
|
||||
if (e.code === 'KeyP' && !e.repeat && !e.altKey && !e.metaKey && !e.ctrlKey && !e.shiftKey && togglePerformance) {
|
||||
e.preventDefault()
|
||||
togglePerformance()
|
||||
return
|
||||
}
|
||||
const r = keyAction(e, (toOther) => (toOther ? other : focused)?.slotCount ?? 0, other != null)
|
||||
const sc = r && (r.toOther ? other : focused)
|
||||
if (!r || !sc) return
|
||||
|
||||
@@ -99,6 +99,14 @@ const PATHS = {
|
||||
fadeOut: <path d="M3 5l18 14H3z" strokeLinejoin="round" />,
|
||||
eject: <path d="M12 4l8 9H4zM4 18h16" strokeLinejoin="round" />,
|
||||
grid: <path d="M5 3v18M10 3v18M15 3v18M20 3v18" />,
|
||||
// Two platters and a crossfader: performance mode.
|
||||
decks: (
|
||||
<>
|
||||
<circle cx="6.5" cy="10" r="4" />
|
||||
<circle cx="17.5" cy="10" r="4" />
|
||||
<path d="M9 19h6M12 17.5v3" />
|
||||
</>
|
||||
),
|
||||
mouse: (
|
||||
<>
|
||||
<rect x="6" y="3" width="12" height="18" rx="6" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// What every shortcut does, for the keyboard map in `ShortcutsDialog`.
|
||||
// Written out BY HAND, not derived from the handlers: keep it in step with
|
||||
// `PrepStrip` (deck), `TrackTable` (track list) and `SettingsMenu` (`?`).
|
||||
// `lib/deckKeys.ts` (deck), `TrackTable` (track list) and `SettingsMenu` (`?`).
|
||||
import { cueTypeColor, GRID_MARKER_ACTIVE_COLOR } from './cues'
|
||||
import { IS_MAC } from './modKey'
|
||||
|
||||
@@ -47,7 +47,7 @@ const STEMS: [string, string][] = [
|
||||
const STEM_CODES = ['KeyQ', 'KeyW', 'KeyE', 'KeyR']
|
||||
|
||||
/** The digit keys of a bank of `slots` pads: 1–9, then 0 for the tenth, as
|
||||
* `PrepStrip`'s `slotForDigit` reads them. */
|
||||
* `deckKeys`' `slotForDigit` reads them. */
|
||||
export function padCodes(slots: number): string[] {
|
||||
return Array.from({ length: Math.min(slots, 10) }, (_, i) => (i === 9 ? 'Digit0' : `Digit${i + 1}`))
|
||||
}
|
||||
@@ -79,6 +79,13 @@ export function bindings(slots: number): Bindings {
|
||||
})
|
||||
Object.assign(b.base, {
|
||||
Space: [{ area: 'deck', label: 'Play / pause', text: 'Play / pause' }],
|
||||
KeyP: [
|
||||
{
|
||||
area: 'deck',
|
||||
label: 'Decks',
|
||||
text: 'Performance mode: a second deck, to try transitions. Click a deck to aim the keys at it. Press again to leave.',
|
||||
},
|
||||
],
|
||||
KeyC: [
|
||||
{ area: 'deck', label: 'CUE', color: 'var(--color-gold)', text: 'CUE: jump back to the cue point, set it while paused, or hold to preview' },
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user