Skip to content

Commit

Permalink
Merge branch 'main' into unicom-guard
Browse files Browse the repository at this point in the history
  • Loading branch information
pierr3 authored Oct 26, 2024
2 parents 3cbf835 + 77af85b commit 6b622bc
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 237 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,9 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run build:${{ matrix.platform }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: TrackAudio-${{ matrix.platform }}
path: dist/trackaudio-*.*
31 changes: 31 additions & 0 deletions backend/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <absl/strings/ascii.h>
#include <absl/strings/match.h>
#include <atomic>
#include <cctype>
#include <chrono>
#include <cstddef>
#include <httplib.h>
Expand Down Expand Up @@ -281,6 +282,33 @@ void SetCid(const Napi::CallbackInfo& info)
UserSession::cid = cid;
}

void SetRadioEffects(const Napi::CallbackInfo& info)
{
auto radioEffects = info[0].As<Napi::String>().Utf8Value();
radioEffects = absl::AsciiStrToLower(radioEffects);
bool enableInputFilters;
bool enableOutputEffects;

if (radioEffects == "on") {
enableInputFilters = true;
enableOutputEffects = true;
} else if (radioEffects == "input") {
enableInputFilters = true;
enableOutputEffects = false;
} else if (radioEffects == "output") {
enableInputFilters = false;
enableOutputEffects = true;
} else if (radioEffects == "off") {
enableInputFilters = false;
enableOutputEffects = false;
} else {
TRACK_LOG_WARNING("Invalid radioEffects value: {}", radioEffects);
return;
}
mClient->SetEnableInputFilters(enableInputFilters);
mClient->SetEnableOutputEffects(enableOutputEffects);
}

void SetHardwareType(const Napi::CallbackInfo& info)
{
auto hardwareTypeIndex = info[0].As<Napi::Number>().Int32Value();
Expand Down Expand Up @@ -808,6 +836,9 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)

exports.Set(Napi::String::New(env, "SetRadioGain"), Napi::Function::New(env, SetRadioGain));

exports.Set(
Napi::String::New(env, "SetRadioEffects"), Napi::Function::New(env, SetRadioEffects));

exports.Set(
Napi::String::New(env, "SetHardwareType"), Napi::Function::New(env, SetHardwareType));

Expand Down
2 changes: 2 additions & 0 deletions backend/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ declare namespace TrackAudioAfv {
export function SetFrequencyRadioGain(frequency: number, gain: number): void;
export function SetPtt(activate: boolean): void;

export function SetRadioEffects(type: string): void;

export function SetHardwareType(type: number): void;

export function StartMicTest(): void;
Expand Down
Loading

0 comments on commit 6b622bc

Please sign in to comment.