From 6a12ba53416f1ffcb3c0b65dd8b9cc8e34cd608f Mon Sep 17 00:00:00 2001 From: Joeri Exelmans Date: Fri, 31 Oct 2025 15:46:11 +0100 Subject: [PATCH] traffic light makes even more sounds --- src/App/Plant/TrafficLight/TrafficLight.tsx | 12 +++++++++++- src/App/Plant/TrafficLight/buzz.wav | Bin 0 -> 59372 bytes 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/App/Plant/TrafficLight/buzz.wav diff --git a/src/App/Plant/TrafficLight/TrafficLight.tsx b/src/App/Plant/TrafficLight/TrafficLight.tsx index 61da864..cfd6b47 100644 --- a/src/App/Plant/TrafficLight/TrafficLight.tsx +++ b/src/App/Plant/TrafficLight/TrafficLight.tsx @@ -4,6 +4,7 @@ import imgRedOverlay from "./red-overlay.webp"; import imgYellowOverlay from "./yellow-overlay.webp"; import imgGreenOverlay from "./green-overlay.webp"; import sndAtmosphere from "./atmosphere.opus"; +import sndBuzz from "./buzz.wav"; import { preload } from "react-dom"; import trafficLightConcreteSyntax from "./model.json"; @@ -45,6 +46,15 @@ export const TrafficLight = memo(function TrafficLight({state, speed, raiseUIEve return () => stopPlaying(); }, []); + useEffect(() => { + if (redOn || yellowOn || greenOn) { + const stopPlaying = playURL(sndBuzz, true); + return () => { + stopPlaying(); + }; + } + }, [redOn || yellowOn || greenOn]) + return <>