diff --git a/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js b/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js index 3ebdfe6c3..398ecf157 100644 --- a/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js +++ b/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js @@ -1,10 +1,8 @@ import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react'; -import { useSelector } from 'react-redux'; -import { Modal, ModalHeader, ModalBody, ModalFooter, Button, FormGroup, Label, Input } from 'reactstrap'; +import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faPlay, faPause, faStop, faVolumeUp } from '@fortawesome/free-solid-svg-icons'; +import { faPlay, faPause, faStop } from '@fortawesome/free-solid-svg-icons'; import useMediaActions from '../../hooks/useMediaActions'; -import { selectBackingTrackMixers } from '../../store/features/mixersSlice'; const JKSessionBackingTrackPlayer = ({ isOpen, @@ -16,11 +14,9 @@ const JKSessionBackingTrackPlayer = ({ isPopup = false }) => { const { closeMedia } = useMediaActions(); - const backingTrackMixers = useSelector(selectBackingTrackMixers); const [isPlaying, setIsPlaying] = useState(false); const [isLooping, setIsLooping] = useState(false); - const [volume, setVolume] = useState(100); const [currentTime, setCurrentTime] = useState('0:00'); const [duration, setDuration] = useState('0:00'); const [currentPositionMs, setCurrentPositionMs] = useState(0); @@ -37,16 +33,6 @@ const JKSessionBackingTrackPlayer = ({ // Visibility tracking for performance optimization const [isVisible, setIsVisible] = useState(true); - const volumeRef = useRef(null); - const trackVolumeObjectRef = useRef({ - volL: 0, - volR: 0, - pan: 0, - mute: false, - solo: false, - loop: false - }); - // UAT-003 Investigation: Track seek attempts while paused const pendingSeekPositionRef = useRef(null); @@ -358,62 +344,6 @@ const JKSessionBackingTrackPlayer = ({ } }, [isOperating, jamClient, handleError, clearError]); - const handleVolumeChange = useCallback(async (e) => { - const newVolume = parseInt(e.target.value); - const previousVolume = volume; - setVolume(newVolume); - - try { - if (!jamClient) { - handleError('general', 'Audio engine not available', null); - setVolume(previousVolume); // Revert to previous - return; - } - - console.log('[VOL] Volume change requested:', newVolume, 'Mixers:', backingTrackMixers); - - // Volume is controlled through the mixer system - // Get the backing track mixer (use personal mixer) - const backingTrackMixer = backingTrackMixers[0]?.mixers?.personal?.mixer; - - console.log('[VOL] Backing track mixer:', backingTrackMixer); - - if (!backingTrackMixer) { - console.warn('[VOL] No backing track mixer found, volume control unavailable'); - // No mixer available, silently skip - return; - } - - // Convert 0-100 to dB range (-80 to +20) - // Using FaderHelpers conversion formula - const minDb = -80; - const maxDb = 20; - const volumeDb = minDb + (newVolume / 100) * (maxDb - minDb); - - console.log('[VOL] Setting volume to', volumeDb, 'dB'); - - // Update track volume object - trackVolumeObjectRef.current = { - ...trackVolumeObjectRef.current, - volL: volumeDb, - volR: volumeDb - }; - - // Set volume through mixer system - await jamClient.SessionSetTrackVolumeData( - backingTrackMixer.id, - backingTrackMixer.mode, - trackVolumeObjectRef.current - ); - - console.log('[VOL] Volume set successfully'); - } catch (error) { - console.error('[VOL] Volume change failed:', error); - handleError('playback', 'Failed to adjust volume', error); - setVolume(previousVolume); // Revert to previous on error - } - }, [volume, jamClient, backingTrackMixers, handleError]); - const handleLoopChange = useCallback(async (e) => { const shouldLoop = e.target.checked; const previousLoop = isLooping; @@ -568,19 +498,23 @@ const JKSessionBackingTrackPlayer = ({ {/* Popup Content */}
-
-
- {/* Row 1: Backing Track */} -
- Backing Track: - {getFileName(backingTrack)} +
+
+ {/* Title */} +
+ Backing Track: + {getFileName(backingTrack)}
{/* Error Display */} @@ -616,79 +550,118 @@ const JKSessionBackingTrackPlayer = ({
)} - {/* Row 2: Controls */} -
-
- + + - + + + + {/* Time and Seek Bar */} +
+ {currentTime} + + {duration} +
- {/* Seek bar with duration */} -
- {currentTime} - - {duration} + {/* Loop Checkbox */} +
+
- {/* Row 3: Loop Checkbox */} -
- -
- - {/* Row 4: Volume Control */} -
- - - {volume}% -
- {/* Close Button */} -
- +
@@ -705,11 +678,15 @@ const JKSessionBackingTrackPlayer = ({ -
- {/* Row 1: Backing Track */} -
- Backing Track: - {getFileName(backingTrack)} +
+ {/* Title */} +
+ Backing Track: + {getFileName(backingTrack)}
{/* Error Display */} @@ -726,13 +703,34 @@ const JKSessionBackingTrackPlayer = ({ }}>
{error}
- + {(errorType === 'network' || errorType === 'file') && ( - + )}
@@ -745,77 +743,119 @@ const JKSessionBackingTrackPlayer = ({
)} - {/* Row 2: Controls */} -
-
- + + - + + + + {/* Time and Seek Bar */} +
+ {currentTime} + + {duration} +
- {/* Seek bar with duration */} -
- {currentTime} - - {duration} + {/* Loop Checkbox */} +
+
- - {/* Row 3: Loop Checkbox */} -
- -
- - {/* Row 4: Volume Control */} -
- - - {volume}% -
- + );