diff --git a/src/app/components/navbar.tsx b/src/app/components/navbar.tsx
index 62aefe8..5cad5c7 100644
--- a/src/app/components/navbar.tsx
+++ b/src/app/components/navbar.tsx
@@ -1,4 +1,4 @@
-import React, { useState } from "react";
+import React, { useEffect, useState } from "react";
import "../style/navbar.scss";
import Clock from "./clock";
import SettingsModal from "./settings-modal/settings-modal";
@@ -40,6 +40,16 @@ const Navbar: React.FC = () => {
state.setStationCallsign,
]);
+ useEffect(() => {
+ window.api.getConfig().then((config) => {
+ if (config) {
+ window.api.SetRadioGain((config.radioGain || 0.5)).then(() => {
+ setRadioGain(config.radioGain*100 || 50);
+ });
+ }
+ });
+ }, []);
+
const doConnect = () => {
setIsConnecting(true);
window.api.connect().then((ret) => {
@@ -145,17 +155,16 @@ const Navbar: React.FC = () => {
max="100"
step="1"
onChange={handleRadioGainChange}
+ defaultValue={radioGain}
>
- {
- platform === "linux" && (
-
- )
- }
+ {platform === "linux" && (
+
+ )}
{showModal && setShowModal(false)} />}
>
diff --git a/src/config.d.ts b/src/config.d.ts
index 59c6d94..9b9a63f 100644
--- a/src/config.d.ts
+++ b/src/config.d.ts
@@ -10,4 +10,5 @@ export interface Configuration {
pttKey: number;
hardwareType: number;
+ radioGain: number;
}
\ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
index 20f90ca..0bd6a5b 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -36,6 +36,7 @@ let currentConfiguration: Configuration = {
callsign: "",
pttKey: 0,
hardwareType: 0,
+ radioGain: 0,
};
const store = new Store();
@@ -297,6 +298,8 @@ ipcMain.handle("setup-ptt", () => {
ipcMain.handle("set-radio-gain", (_, gain: number) => {
TrackAudioAfv.SetRadioGain(gain);
+ currentConfiguration.radioGain = gain;
+ saveConfig();
});
ipcMain.handle("set-hardware-type", (_, type: number) => {