Skip to content

Commit 3e3be16

Browse files
committed
Better cleanup, fix issue with noise simulation
1 parent 00ac3df commit 3e3be16

File tree

10 files changed

+40
-23
lines changed

10 files changed

+40
-23
lines changed

backend/extern/afv-native

backend/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@
3434
"author": "Pierre Ferran",
3535
"license": "GPL-3.0-only",
3636
"engines": {
37-
"node": ">=20.0.0 <=21.0.0"
37+
"node": ">=20.0.0 <=23.0.0"
3838
}
3939
}

backend/src/InputHandler.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ InputHandler::InputHandler()
1616
timer.start(Poco::TimerCallback<InputHandler>(*this, &InputHandler::onTimer));
1717
}
1818

19-
InputHandler::~InputHandler() { timer.stop(); }
19+
InputHandler::~InputHandler()
20+
{
21+
timer.stop();
22+
uioHookWrapper_->stop();
23+
}
2024

2125
void InputHandler::startPttSetup(int pttIndex, bool listenForJoysticks)
2226
{

backend/src/Shared.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "Shared.hpp"
22
#include "Helpers.hpp"
33

4-
const semver::version VERSION = semver::version { 1, 3, 2 };
4+
const semver::version VERSION = semver::version { 1, 3, 3 };
55
const std::string CLIENT_NAME = std::string("TrackAudio-") + VERSION.to_string();
66
std::unique_ptr<afv_native::api::atcClient> mClient = nullptr;
77

backend/src/main.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -838,15 +838,24 @@ void SetSession(const Napi::CallbackInfo& info)
838838
Napi::Boolean Exit(const Napi::CallbackInfo& info)
839839
{
840840
PLOGI << "Awaiting to exit TrackAudio...";
841+
842+
MainThreadShared::mApiServer.reset();
843+
MainThreadShared::mRemoteDataHandler.reset();
844+
MainThreadShared::inputHandler.reset();
845+
MainThreadShared::vuMeterThread.reset();
846+
841847
NapiHelpers::_requestExit.store(true);
842848
if (mClient->IsVoiceConnected()) {
843849
PLOGI << "Connection to network detected, forcing disconnect...";
844850
mClient->Disconnect();
845851
}
846852

847-
MainThreadShared::mApiServer.reset();
848-
MainThreadShared::mRemoteDataHandler.reset();
849-
MainThreadShared::inputHandler.reset();
853+
if (mClient->IsAudioRunning()) {
854+
PLOGI << "Audio running, stopping...";
855+
mClient->StopAudio();
856+
}
857+
858+
850859

851860
mClient.reset();
852861
PLOGI << "Exiting TrackAudio...";

backend/vcpkg

Submodule vcpkg updated 605 files

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "trackaudio",
33
"productName": "TrackAudio",
4-
"version": "1.3.2",
4+
"version": "1.3.3",
55
"main": "./out/main/index.js",
66
"author": "github.com/pierr3",
77
"description": "TrackAudio - Audio for VATSIM Client",

src/main/index.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,18 @@ app
431431
console.log(`Error initializing app: ${err.message}`);
432432
});
433433

434+
app.on('before-quit', () => {
435+
// Perform cleanup
436+
if (TrackAudioAfv.IsConnected()) {
437+
TrackAudioAfv.Disconnect();
438+
}
439+
TrackAudioAfv.Exit();
440+
});
441+
434442
// Quit when all windows are closed, except on macOS. There, it's common
435443
// for applications and their menu bar to stay active until the user quits
436444
// explicitly with Cmd + Q.
437445
app.on('window-all-closed', () => {
438-
TrackAudioAfv.Exit();
439446
app.quit();
440447
});
441448

@@ -575,15 +582,12 @@ ipcMain.handle(
575582
}
576583
);
577584

578-
ipcMain.handle(
579-
'audio-remove-frequency',
580-
(_, frequency: number, callsign?: string) => {
581-
if (callsign) {
582-
TrackAudioAfv.RemoveFrequency(frequency, callsign);
583-
}
584-
TrackAudioAfv.RemoveFrequency(frequency);
585+
ipcMain.handle('audio-remove-frequency', (_, frequency: number, callsign?: string) => {
586+
if (callsign) {
587+
TrackAudioAfv.RemoveFrequency(frequency, callsign);
585588
}
586-
);
589+
TrackAudioAfv.RemoveFrequency(frequency);
590+
});
587591

588592
ipcMain.handle(
589593
'audio-set-frequency-state',

0 commit comments

Comments
 (0)