Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
DEFAULT_DECK_PREFS.quantise,
(on) => prefs.setQuantise(on)
),
setting(
() => prefs.loadAtFirstCue,
DEFAULT_DECK_PREFS.loadAtFirstCue,
(on) => prefs.setLoadAtFirstCue(on)
),
setting(
() => prefs.cuePlacement,
DEFAULT_DECK_PREFS.cuePlacement,
Expand Down Expand Up @@ -76,6 +81,12 @@
on={prefs.quantise}
onflip={() => prefs.setQuantise(!prefs.quantise)}
/>
<SettingToggle
label="Load at first cue"
description="Loaded tracks are cued to their first hot cue or memory cue."
on={prefs.loadAtFirstCue}
onflip={() => prefs.setLoadAtFirstCue(!prefs.loadAtFirstCue)}
/>
<SettingChoice
label="Place new cues at"
description="Where to place hotcues and memory cues."
Expand Down
11 changes: 8 additions & 3 deletions app/src/renderer/src/lib/deck/prefs.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ export type TempoReadout = 'absolute' | 'relative'

export const DEFAULT_DECK_PREFS = {
quantise: true,
loadAtFirstCue: true,
cuePlacement: 'cuePoint' as CuePlacement,
tempoReadout: 'absolute' as TempoReadout
}

/** Deck preferences that hold for every deck at once, kept between sessions. */
export class DeckPrefs {
quantise = $state(storedFlag('quantise', DEFAULT_DECK_PREFS.quantise))
cuePlacement = $state(
storedChoice<CuePlacement>('cuePlacement', ['playhead', 'cuePoint'], DEFAULT_DECK_PREFS.cuePlacement)
)
loadAtFirstCue = $state(storedFlag('loadAtFirstCue', DEFAULT_DECK_PREFS.loadAtFirstCue))
cuePlacement = $state(storedChoice<CuePlacement>('cuePlacement', ['playhead', 'cuePoint'], DEFAULT_DECK_PREFS.cuePlacement))
snapPlayhead = $state(storedFlag('snapPlayhead'))
unlimitedMemoryCues = $state(storedFlag('unlimitedMemoryCues'))
tempoReadout = $state(
Expand All @@ -29,6 +29,11 @@ export class DeckPrefs {
storeFlag('quantise', on)
}

setLoadAtFirstCue(on: boolean): void {
this.loadAtFirstCue = on
storeFlag('loadAtFirstCue', on)
}

setSnapPlayhead(on: boolean): void {
this.snapPlayhead = on
storeFlag('snapPlayhead', on)
Expand Down
11 changes: 11 additions & 0 deletions app/src/renderer/src/lib/player.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,17 @@ export class Player {
const opened = this.session.open(track)
this.display.reload()
await opened
const stillThisTrack = this.track?.id === track.id
const cuePointUntouched = this.cuePoint === 0
if (this.prefs.loadAtFirstCue && stillThisTrack && cuePointUntouched) this.cueAtFirstCue()
}

private cueAtFirstCue(): void {
const first = this.displayCues.reduce<Cue | null>(
(earliest, cue) => (!earliest || cue.start < earliest.start ? cue : earliest),
null
)
if (first) this.cueAt(first.start / 1000)
}

private play(): void {
Expand Down
Loading