diff --git a/packages/app/constants/settings/components/compressorValues/index.jsx b/packages/app/constants/settings/components/compressorValues/index.jsx
new file mode 100644
index 00000000..b41818fc
--- /dev/null
+++ b/packages/app/constants/settings/components/compressorValues/index.jsx
@@ -0,0 +1,161 @@
+import React from "react"
+import Slider from "@mui/material/Slider"
+
+import "./index.less"
+
+export default (props) => {
+ const [values, setValues] = React.useState(props.ctx.currentValue ?? {})
+
+ const handleOnChange = (key, value) => {
+ setValues((prev) => {
+ return {
+ ...prev,
+ [key]: value
+ }
+ })
+ }
+
+ const handleChangeCommitted = (key, value) => {
+ props.ctx.dispatchUpdate(values)
+ }
+
+ React.useEffect(() => {
+ setValues(props.ctx.currentValue)
+ }, [props.ctx.currentValue])
+
+ return
+
+
+
+ Threshold
+
+
+
handleChangeCommitted("threshold", value)}
+ onChange={(e, value) => handleOnChange("threshold", value)}
+ value={values.threshold}
+ orientation="vertical"
+ aria-label="Threshold"
+ valueLabelDisplay="auto"
+ step={0.1}
+ min={-100}
+ max={0}
+ disabled={props.disabled}
+ />
+
+
+
+ {values.threshold} dB
+
+
+
+
+
+
+ Knee
+
+
+
+
handleChangeCommitted("knee", value)}
+ onChange={(e, value) => handleOnChange("knee", value)}
+ value={values.knee}
+ orientation="vertical"
+ aria-label="Knee"
+ valueLabelDisplay="auto"
+ step={0.1}
+ min={0}
+ max={40}
+ disabled={props.disabled}
+ />
+
+
+
+ {values.knee} dB
+
+
+
+
+
+
+ Ratio
+
+
+
+
handleChangeCommitted("ratio", value)}
+ onChange={(e, value) => handleOnChange("ratio", value)}
+ value={values.ratio}
+ orientation="vertical"
+ aria-label="Ratio"
+ valueLabelDisplay="auto"
+ step={0.1}
+ min={1}
+ max={20}
+ disabled={props.disabled}
+ />
+
+
+ {values.ratio} : 1
+
+
+
+
+
+
+ Attack
+
+
+
+
handleChangeCommitted("attack", value)}
+ onChange={(e, value) => handleOnChange("attack", value)}
+ value={values.attack}
+ orientation="vertical"
+ aria-label="Attack"
+ valueLabelDisplay="auto"
+ step={0.1}
+ min={0}
+ max={1}
+ disabled={props.disabled}
+ />
+
+
+
+ {values.attack} s
+
+
+
+
+
+
+ Release
+
+
+
+
handleChangeCommitted("release", value)}
+ onChange={(e, value) => handleOnChange("release", value)}
+ value={values.release}
+ orientation="vertical"
+ aria-label="Release"
+ valueLabelDisplay="auto"
+ step={0.1}
+ min={0}
+ max={1}
+ disabled={props.disabled}
+ />
+
+
+ {values.release} s
+
+
+
+
+}
\ No newline at end of file
diff --git a/packages/app/constants/settings/components/compressorValues/index.less b/packages/app/constants/settings/components/compressorValues/index.less
new file mode 100644
index 00000000..616d1266
--- /dev/null
+++ b/packages/app/constants/settings/components/compressorValues/index.less
@@ -0,0 +1,30 @@
+.compressorValues {
+ display: flex;
+ flex-direction: row;
+
+ padding: 20px;
+
+ width: 100%;
+
+ &.disabled {
+ opacity: 0.5;
+ }
+
+ transition: all 150ms ease-in-out;
+
+ .compressorValues_slider {
+ display: flex;
+ flex-direction: column;
+
+ align-items: center;
+
+ height: 100%;
+ width: 100%;
+
+ gap: 20px;
+
+ .MuiSlider-vertical {
+ min-height: 300px;
+ }
+ }
+}
\ No newline at end of file
diff --git a/packages/app/constants/settings/player/index.jsx b/packages/app/constants/settings/player/index.jsx
index a11884b6..80d23797 100755
--- a/packages/app/constants/settings/player/index.jsx
+++ b/packages/app/constants/settings/player/index.jsx
@@ -1,3 +1,5 @@
+import loadable from "@loadable/component"
+
export default {
id: "player",
icon: "PlayCircleOutlined",
@@ -40,6 +42,56 @@ export default {
},
storaged: true,
disabled: true,
+ },
+ {
+ id: "player.compressor",
+ title: "Compression",
+ icon: "MdGraphicEq",
+ group: "general",
+ description: "Enable compression for audio output",
+ component: "Switch",
+ experimental: true,
+ beforeSave: (value) => {
+ if (value) {
+ app.cores.player.compressor.attach()
+ } else {
+ app.cores.player.compressor.detach()
+ }
+ },
+ storaged: true,
+ },
+ {
+ id: "player.compressor.values",
+ title: "Compression adjustment",
+ icon: "Sliders",
+ group: "general",
+ description: "Adjust compression values (Warning: may cause distortion when changing values)",
+ experimental: true,
+ extraActions: [
+ {
+ id: "reset",
+ title: "Reset",
+ icon: "MdRefresh",
+ onClick: (ctx) => {
+ const values = app.cores.player.compressor.resetDefaultValues()
+
+ ctx.updateCurrentValue(values)
+ }
+ }
+ ],
+ defaultValue: () => {
+ return app.cores.player.compressor.values
+ },
+ onUpdate: (value) => {
+ app.cores.player.compressor.modifyValues(value)
+
+ return value
+ },
+ component: loadable(() => import("../components/compressorValues")),
+ dependsOn: {
+ "player.compressor": true
+ },
+ storaged: false,
}
]
}
\ No newline at end of file