diff --git a/src/components/Client.tsx b/src/components/Client.tsx
index b23dd76..c19ea08 100644
--- a/src/components/Client.tsx
+++ b/src/components/Client.tsx
@@ -4,6 +4,7 @@ import { SnapControl, Snapcast } from '../snapcontrol';
import { Box, Button, Grid, InputAdornment, Menu, MenuItem, Slider, Stack, TextField, Typography, IconButton } from '@mui/material';
import { Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material';
import { VolumeUp as VolumeUpIcon, VolumeOff as VolumeOffIcon, MoreVert as MoreVertIcon } from '@mui/icons-material';
+import { getPersistentValue, setPersistentValue } from '../config';
type ClientProps = {
@@ -22,11 +23,13 @@ export default function Client(props: ClientProps) {
const [name, setName] = useState(props.client.config.name);
const [tmpLatency, setTmpLatency] = useState(props.client.config.latency);
const [latency, setLatency] = useState(props.client.config.latency);
+ const persistantMaxVolumeKey = `${props.client.id}-maxVolume`;
+ const [maxVolume, setMaxVolume] = useState(Number(getPersistentValue(persistantMaxVolumeKey, "100") ?? 100));
function handleVolumeChange(value: number) {
console.debug("handleVolumeChange: " + value);
props.client.config.volume.percent = value;
- props.snapcontrol.setVolume(props.client.id, value, false);
+ props.snapcontrol.setVolume(props.client.id, value, maxVolume, false);
// setState({});
props.onVolumeChange();
}
@@ -105,7 +108,7 @@ export default function Client(props: ClientProps) {
{ handleMuteClicked() }}>
{props.client.config.volume.muted ? : }
- { handleVolumeChange(value as number) }} />
+ { handleVolumeChange(value as number) }} />
@@ -147,6 +150,11 @@ export default function Client(props: ClientProps) {
}
}}
/>
+ ) => { setPersistentValue(persistantMaxVolumeKey, event.target.value); setMaxVolume(Number(event.target.value)) }}
+ value={maxVolume}
+ />