From f5a5643f4b338c94ed5d8e5775d0469ff5996035 Mon Sep 17 00:00:00 2001 From: Benoit Date: Mon, 25 May 2026 22:17:48 +0200 Subject: [PATCH] feat: ajout VU-metres temps reel dans matrice routing - Hook React useAudioLevels pour WebSocket audio-levels - Composant VUMeter (mini, horizontal, vertical) - Integration VU-metres dans headers/labels matrice - Indicateur etat connexion WebSocket (Live/Offline) - Affichage RMS, peak, detection clipping - Design responsive avec animations clipping --- client/src/components/AudioRoutingMatrix.css | 41 ++++++ client/src/components/AudioRoutingMatrix.jsx | 34 ++++- client/src/components/VUMeter.css | 131 +++++++++++++++++ client/src/components/VUMeter.jsx | 102 +++++++++++++ client/src/hooks/useAudioLevels.js | 143 +++++++++++++++++++ 5 files changed, 447 insertions(+), 4 deletions(-) create mode 100644 client/src/components/VUMeter.css create mode 100644 client/src/components/VUMeter.jsx create mode 100644 client/src/hooks/useAudioLevels.js diff --git a/client/src/components/AudioRoutingMatrix.css b/client/src/components/AudioRoutingMatrix.css index 73b8c88..c10f702 100644 --- a/client/src/components/AudioRoutingMatrix.css +++ b/client/src/components/AudioRoutingMatrix.css @@ -19,6 +19,24 @@ font-weight: 600; } +.ws-status { + font-size: 0.8rem; + font-weight: 600; + padding: 4px 10px; + border-radius: 12px; + white-space: nowrap; +} + +.ws-status.connected { + color: #44ff44; + background: rgba(68, 255, 68, 0.1); +} + +.ws-status.disconnected { + color: #888; + background: rgba(136, 136, 136, 0.1); +} + .routing-section { margin-bottom: var(--spacing-xl); } @@ -82,6 +100,29 @@ word-break: break-word; } +.label-content { + display: flex; + flex-direction: column; + gap: 4px; + width: 100%; +} + +.label-text { + flex: 1; +} + +.header-content { + display: flex; + flex-direction: column; + gap: 4px; + width: 100%; + align-items: center; +} + +.header-text { + text-align: center; +} + .matrix-cell { background: var(--color-bg); padding: var(--spacing-sm); diff --git a/client/src/components/AudioRoutingMatrix.jsx b/client/src/components/AudioRoutingMatrix.jsx index eba927f..0c70749 100644 --- a/client/src/components/AudioRoutingMatrix.jsx +++ b/client/src/components/AudioRoutingMatrix.jsx @@ -1,9 +1,12 @@ import React, { useState, useEffect } from 'react'; import './AudioRoutingMatrix.css'; +import VUMeter from './VUMeter.jsx'; +import { useAudioLevels } from '../hooks/useAudioLevels.js'; const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3000'; function AudioRoutingMatrix({ groups, channelNames }) { + const { levels, connected: wsConnected } = useAudioLevels(); const [routing, setRouting] = useState({ inputToGroup: {}, groupToOutput: {}, gains: {} }); const [loading, setLoading] = useState(true); const [showOnlyNamedChannels, setShowOnlyNamedChannels] = useState(false); @@ -165,7 +168,15 @@ function AudioRoutingMatrix({ groups, channelNames }) { return (
-

Matrice de routing audio

+
+

Matrice de routing audio

+ + {wsConnected ? '● Live' : '○ Offline'} + +