com.adrenak.univoice 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,22 @@ namespace Adrenak.UniVoice {
16
16
  /// </summary>
17
17
  public Dictionary<T, IAudioOutput> PeerOutputs { get; private set; } = new Dictionary<T, IAudioOutput>();
18
18
 
19
+ /// <summary>
20
+ /// Whether input audio will be processed. If set to false, any input audio captured by
21
+ /// <see cref="Input"/> would be ignored and would neither be processed by the <see cref="InputFilters"/> nor send via the <see cref="Client"/>
22
+ /// This can be used to create "Push to talk" style features without having to use <see cref="IAudioClient{T}.YourVoiceSettings"/>
23
+ /// </summary>
24
+ public bool InputEnabled { get; set; } = true;
25
+
26
+ /// <summary>
27
+ /// Whether any incoming audio from peers would be processed. If set to false, all incoming peer audio is ignored, and would
28
+ /// neither be processed by the <see cref="OutputFilters"/> nor outputted to the <see cref="IAudioOutput"/> of any peer.
29
+ /// This can be used to easily mute all the peers on the network.
30
+ /// Note that this doesn't stop the audio data from arriving and would consume bandwidth. Do stop reception completely
31
+ /// use <see cref="IAudioClient{T}.YourVoiceSettings"/>
32
+ /// </summary>
33
+ public bool OutputsEnabled { get; set; } = true;
34
+
19
35
  /// <summary>
20
36
  /// The input <see cref="IAudioFilter"/> that will be applied to the outgoing audio for all the peers.
21
37
  /// Note that filters are executed in the order they are present in this list
@@ -69,7 +85,10 @@ namespace Adrenak.UniVoice {
69
85
  PeerOutputs.Remove(id);
70
86
  };
71
87
 
72
- client.OnReceivedPeerAudioFrame += (id, audioFrame) => {
88
+ Client.OnReceivedPeerAudioFrame += (id, audioFrame) => {
89
+ if (!OutputsEnabled)
90
+ return;
91
+
73
92
  if (!PeerOutputs.ContainsKey(id))
74
93
  return;
75
94
 
@@ -94,6 +113,9 @@ namespace Adrenak.UniVoice {
94
113
  input.Dispose();
95
114
  input = value;
96
115
  input.OnFrameReady += frame => {
116
+ if (!InputEnabled)
117
+ return;
118
+
97
119
  if (InputFilters != null) {
98
120
  foreach (var filter in InputFilters)
99
121
  frame = filter.Run(frame);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.adrenak.univoice",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "displayName": "Adrenak.UniVoice",
5
5
  "description": "Voice chat/VoIP framework for Unity.",
6
6
  "unity": "2021.2",