@@ -19,6 +19,7 @@ import {
1919} from 'src/components'
2020import { ModalContext } from 'src/contexts'
2121import { useStats } from 'src/hooks/useStats'
22+ import { useChessSound } from 'src/hooks/useChessSound'
2223import { Color , PlayGameConfig , TimeControl } from 'src/types'
2324import { usePlayController } from 'src/hooks/usePlayController'
2425import { PlayControllerContext } from 'src/contexts/PlayControllerContext/PlayControllerContext'
@@ -46,6 +47,7 @@ const useHandBrainPlayController = (
4647 playGameConfig : PlayGameConfig ,
4748) => {
4849 const controller = usePlayController ( id , playGameConfig )
50+ const { playSound } = useChessSound ( )
4951 const isBrain = playGameConfig . isBrain
5052
5153 const [ selectedPiece , setSelectedPiece ] = useState < PieceSymbol | undefined > (
@@ -170,6 +172,7 @@ const useHandBrainPlayController = (
170172 const moveTime = controller . updateClock ( )
171173 controller . setMoves ( [ ...controller . moves , nextMove ] )
172174 controller . setMoveTimes ( [ ...controller . moveTimes , moveTime ] )
175+ playSound ( false )
173176 } ,
174177 playGameConfig . simulateMaiaTime ? moveDelay * 1000 : 0 ,
175178 )
@@ -213,6 +216,7 @@ const useHandBrainPlayController = (
213216 )
214217 const nextMove = maiaMoves [ 'top_move' ]
215218 makeMove ( nextMove )
219+ playSound ( false )
216220 }
217221 } ,
218222 [
@@ -247,7 +251,6 @@ const useHandBrainPlayController = (
247251 controller . reset ( )
248252 }
249253
250- // Logging
251254 useEffect ( ( ) => {
252255 const gameOverState = controller . game . termination ?. type || 'not_over'
253256
0 commit comments