Skip to content

Commit d52565c

Browse files
committed
feat(patchbay)!: add only_speakers setting
1 parent 5a12732 commit d52565c

File tree

7 files changed

+15
-6
lines changed

7 files changed

+15
-6
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.21)
2-
project(venmic LANGUAGES CXX VERSION 5.0.0)
2+
project(venmic LANGUAGES CXX VERSION 6.0.0)
33

44
# --------------------------------------------------------------------------------------------------------
55
# Library options

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ The Rest-Server exposes three simple endpoints
5656
The setting `ignore_devices` is optional and will default to `true`.
5757
When enabled it will prevent hardware-devices like speakers and microphones from being linked to the virtual microphone.
5858

59+
The setting `only_speakers` is optional and will default to `true`.
60+
When enabled it will prevent linking against nodes that don't play to a speaker.
61+
5962
The setting `only_default_speakers` is optional and will default to `true`.
6063
When enabled it will prevent linking against nodes that don't play to the default speaker.
6164

addon/addon.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ struct patchbay : public Napi::ObjectWrap<patchbay>
171171
auto include = to_array<vencord::node>(data.Get("include"));
172172
auto exclude = to_array<vencord::node>(data.Get("exclude"));
173173
auto ignore_devices = convert<bool>(data.Get("ignore_devices"));
174+
auto only_speakers = convert<bool>(data.Get("only_speakers"));
174175
auto only_default_speakers = convert<bool>(data.Get("only_default_speakers"));
175176
auto workaround = to_array<vencord::node>(data.Get("workaround"));
176177

@@ -187,6 +188,7 @@ struct patchbay : public Napi::ObjectWrap<patchbay>
187188
.include = include.value_or(std::vector<vencord::node>{}),
188189
.exclude = exclude.value_or(std::vector<vencord::node>{}),
189190
.ignore_devices = ignore_devices.value_or(true),
191+
.only_speakers = only_speakers.value_or(true),
190192
.only_default_speakers = only_default_speakers.value_or(true),
191193
.workaround = workaround.value_or(std::vector<vencord::node>{}),
192194
});

include/vencord/patchbay.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ namespace vencord
1515
std::vector<node> exclude;
1616

1717
public:
18-
bool ignore_devices{true}; // Only link against non-device nodes
18+
bool ignore_devices{true}; // Only link against non-device nodes
19+
public:
20+
bool only_speakers{true}; // Ignore nodes that don't play to speakers
1921
bool only_default_speakers{true}; // Ignore nodes that don't play to the default speaker
2022

2123
public:

lib/module.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export interface LinkData
1818
exclude: Node[];
1919

2020
ignore_devices?: boolean;
21+
22+
only_speakers?: boolean;
2123
only_default_speakers?: boolean;
2224

2325
workaround?: Node[];

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"private": false,
1212
"license": "MPL-2.0",
1313
"author": "Curve (https://github.com/Curve)",
14-
"version": "5.0.0",
14+
"version": "6.0.0",
1515
"main": "./lib/index.js",
1616
"types": "./lib/module.d.ts",
1717
"scripts": {

src/patchbay.impl.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -305,16 +305,16 @@ namespace vencord
305305

306306
if (options.only_default_speakers && input_id != speaker->id)
307307
{
308-
logger::get()->trace("[patchbay] (on_link) {} is not connected to speaker but with {}", id, input_id);
308+
logger::get()->debug("[patchbay] (on_link) {} is not connected to speaker but with {}", id, input_id);
309309
return;
310310
}
311311

312312
auto output_props = nodes[output_id].info.props; // The node emitting sound
313313
auto input_props = nodes[input_id].info.props; // The node receiving sound
314314

315-
if (!options.only_default_speakers && input_props["device.id"].empty())
315+
if (options.only_speakers && input_props["device.id"].empty())
316316
{
317-
logger::get()->trace("[patchbay] (on_link) {} is not playing to a device: {}", id, input_id);
317+
logger::get()->debug("[patchbay] (on_link) {} is not playing to a device: {}", id, input_id);
318318
return;
319319
}
320320

0 commit comments

Comments
 (0)