diff --git a/src/renderer/features/player/components/right-controls.tsx b/src/renderer/features/player/components/right-controls.tsx index 93b3327b8..6ae0de9e0 100644 --- a/src/renderer/features/player/components/right-controls.tsx +++ b/src/renderer/features/player/components/right-controls.tsx @@ -28,12 +28,11 @@ import { LibraryItem, QueueSong, ServerType, Song } from '/@/renderer/api/types' import { useCreateFavorite, useDeleteFavorite, useSetRating } from '/@/renderer/features/shared'; import { DropdownMenu, Rating } from '/@/renderer/components'; import { PlayerbarSlider } from '/@/renderer/features/player/components/playerbar-slider'; +import { Slider } from '/@/renderer/components/slider'; const ipc = isElectron() ? window.electron.ipc : null; const remote = isElectron() ? window.electron.remote : null; -const PLAYBACK_SPEEDS = [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0]; - export const RightControls = () => { const { t } = useTranslation(); const isMinWidth = useMediaQuery('(max-width: 480px)'); @@ -110,6 +109,14 @@ export const RightControls = () => { setSideBar({ rightExpanded: !isQueueExpanded }); }; + const formatPlaybackSpeedSliderLabel = (value: number) => { + const bpm = Number(currentSong?.bpm); + if (bpm > 0) { + return `${value} x / ${(bpm * value).toFixed(1)} BPM`; + } + return `${value} x`; + }; + const isSongDefined = Boolean(currentSong?.id); const showRating = isSongDefined && server?.type === ServerType.NAVIDROME; @@ -210,7 +217,13 @@ export const RightControls = () => { align="center" spacing="xs" > - + {speed} x} @@ -222,14 +235,30 @@ export const RightControls = () => { /> - {PLAYBACK_SPEEDS.map((speed) => ( - handleSpeed(Number(speed))} - > - {speed} - - ))} + handleSpeed(1)} + />