com.adrenak.univoice 2.0.2 → 3.0.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.
- package/CHANGELOG.md +67 -67
- package/CHANGELOG.md.meta +7 -7
- package/LICENSE +21 -21
- package/LICENSE.meta +7 -7
- package/README.md.meta +7 -7
- package/Runtime/Adrenak.UniVoice.Runtime.asmdef +3 -3
- package/Runtime/Adrenak.UniVoice.Runtime.asmdef.meta +7 -7
- package/Runtime/ChatroomAgent.cs +79 -34
- package/Runtime/ChatroomAgent.cs.meta +11 -11
- package/Runtime/Interfaces/IAudioInput.cs.meta +11 -11
- package/Runtime/Interfaces/IAudioOutput.cs +9 -7
- package/Runtime/Interfaces/IAudioOutput.cs.meta +11 -11
- package/Runtime/Interfaces/IAudioOutputFactory.cs.meta +11 -11
- package/Runtime/Interfaces/IChatroomNetwork.cs +11 -7
- package/Runtime/Interfaces/IChatroomNetwork.cs.meta +11 -11
- package/Runtime/Interfaces.meta +8 -8
- package/Runtime/Types/ChatroomAgentMode.cs.meta +11 -11
- package/Runtime/Types/ChatroomAudioSegment.cs +26 -26
- package/Runtime/Types/ChatroomAudioSegment.cs.meta +11 -11
- package/Runtime/Types/ChatroomPeerSettings.cs.meta +11 -11
- package/Runtime/Types.meta +8 -8
- package/Runtime.meta +9 -9
- package/package.json +29 -20
- package/package.json.meta +7 -7
- package/Runtime/Extensions.cs +0 -39
- package/Runtime/Extensions.cs.meta +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
## [2.0.2](https://github.com/adrenak/univoice/compare/v2.0.1...v2.0.2) (2022-11-02)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* remove comment about possible PeerID in IAudioOutput ([2246bb2](https://github.com/adrenak/univoice/commit/2246bb2bef234b84bdf6cd55a9faf87e09133953))
|
|
7
|
-
|
|
8
|
-
## [1.2.1](https://github.com/adrenak/univoice/compare/v1.2.0...v1.2.1) (2022-10-10)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Bug Fixes
|
|
12
|
-
|
|
13
|
-
* PeersOutputs gets filled as peers join, not when they start ([42eaeb9](https://github.com/adrenak/univoice/commit/42eaeb95eef4eea7ee559da9fdbcac78ceb941b4))
|
|
14
|
-
|
|
15
|
-
# [1.2.0](https://github.com/adrenak/univoice/compare/v1.1.4...v1.2.0) (2022-09-20)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
### Bug Fixes
|
|
19
|
-
|
|
20
|
-
* Update README.md ([5c234ee](https://github.com/adrenak/univoice/commit/5c234ee1e6aad430f72b4879a401bb98f3e68b88))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### Features
|
|
24
|
-
|
|
25
|
-
* Remove inbuilt implementations. Remove samples. ([dbfc4c0](https://github.com/adrenak/univoice/commit/dbfc4c0a1ffd99d03aefe72aec0e27debe68525a))
|
|
26
|
-
|
|
27
|
-
## [1.1.4](https://github.com/adrenak/univoice/compare/v1.1.3...v1.1.4) (2021-08-10)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Bug Fixes
|
|
31
|
-
|
|
32
|
-
* Spell-fix in README ([fcbc7c6](https://github.com/adrenak/univoice/commit/fcbc7c6c28c84415a50050d7014ecdfc39347309))
|
|
33
|
-
|
|
34
|
-
## [1.1.3](https://github.com/adrenak/univoice/compare/v1.1.2...v1.1.3) (2021-06-03)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### Bug Fixes
|
|
38
|
-
|
|
39
|
-
* Add missing mute others toggle in sample scene. ([cff9574](https://github.com/adrenak/univoice/commit/cff9574bdd4b769de519f451e489b9dcdb76f649))
|
|
40
|
-
|
|
41
|
-
## [1.1.2](https://github.com/adrenak/univoice/compare/v1.1.1...v1.1.2) (2021-06-02)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### Bug Fixes
|
|
45
|
-
|
|
46
|
-
* README fix ([d03db44](https://github.com/adrenak/univoice/commit/d03db449e1fe2557a57df75ccfc8fe4a310f308f))
|
|
47
|
-
|
|
48
|
-
## [1.1.1](https://github.com/adrenak/univoice/compare/v1.1.0...v1.1.1) (2021-06-02)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
### Bug Fixes
|
|
52
|
-
|
|
53
|
-
* Prevent sample app screen from sleeping. ([545d96f](https://github.com/adrenak/univoice/commit/545d96f16b858ba1dbdb01de5298ba62c06c2725))
|
|
54
|
-
|
|
55
|
-
# [1.1.0](https://github.com/adrenak/univoice/compare/v1.0.0...v1.1.0) (2021-06-02)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
### Features
|
|
59
|
-
|
|
60
|
-
* InbuiltAudioOutput now also accepts minimum segment count and ([294bfef](https://github.com/adrenak/univoice/commit/294bfef5677d49cd941b513c421980cf6a5e393f))
|
|
61
|
-
|
|
62
|
-
# 1.0.0 (2021-06-02)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
### Features
|
|
66
|
-
|
|
67
|
-
* Full rebuild with AirPeer 1.2.0 ([9327b2a](https://github.com/adrenak/univoice/commit/9327b2a05da766e91bad5f8e6288e5c328ded429))
|
|
1
|
+
## [2.0.2](https://github.com/adrenak/univoice/compare/v2.0.1...v2.0.2) (2022-11-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* remove comment about possible PeerID in IAudioOutput ([2246bb2](https://github.com/adrenak/univoice/commit/2246bb2bef234b84bdf6cd55a9faf87e09133953))
|
|
7
|
+
|
|
8
|
+
## [1.2.1](https://github.com/adrenak/univoice/compare/v1.2.0...v1.2.1) (2022-10-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* PeersOutputs gets filled as peers join, not when they start ([42eaeb9](https://github.com/adrenak/univoice/commit/42eaeb95eef4eea7ee559da9fdbcac78ceb941b4))
|
|
14
|
+
|
|
15
|
+
# [1.2.0](https://github.com/adrenak/univoice/compare/v1.1.4...v1.2.0) (2022-09-20)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* Update README.md ([5c234ee](https://github.com/adrenak/univoice/commit/5c234ee1e6aad430f72b4879a401bb98f3e68b88))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* Remove inbuilt implementations. Remove samples. ([dbfc4c0](https://github.com/adrenak/univoice/commit/dbfc4c0a1ffd99d03aefe72aec0e27debe68525a))
|
|
26
|
+
|
|
27
|
+
## [1.1.4](https://github.com/adrenak/univoice/compare/v1.1.3...v1.1.4) (2021-08-10)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* Spell-fix in README ([fcbc7c6](https://github.com/adrenak/univoice/commit/fcbc7c6c28c84415a50050d7014ecdfc39347309))
|
|
33
|
+
|
|
34
|
+
## [1.1.3](https://github.com/adrenak/univoice/compare/v1.1.2...v1.1.3) (2021-06-03)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* Add missing mute others toggle in sample scene. ([cff9574](https://github.com/adrenak/univoice/commit/cff9574bdd4b769de519f451e489b9dcdb76f649))
|
|
40
|
+
|
|
41
|
+
## [1.1.2](https://github.com/adrenak/univoice/compare/v1.1.1...v1.1.2) (2021-06-02)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
* README fix ([d03db44](https://github.com/adrenak/univoice/commit/d03db449e1fe2557a57df75ccfc8fe4a310f308f))
|
|
47
|
+
|
|
48
|
+
## [1.1.1](https://github.com/adrenak/univoice/compare/v1.1.0...v1.1.1) (2021-06-02)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Bug Fixes
|
|
52
|
+
|
|
53
|
+
* Prevent sample app screen from sleeping. ([545d96f](https://github.com/adrenak/univoice/commit/545d96f16b858ba1dbdb01de5298ba62c06c2725))
|
|
54
|
+
|
|
55
|
+
# [1.1.0](https://github.com/adrenak/univoice/compare/v1.0.0...v1.1.0) (2021-06-02)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Features
|
|
59
|
+
|
|
60
|
+
* InbuiltAudioOutput now also accepts minimum segment count and ([294bfef](https://github.com/adrenak/univoice/commit/294bfef5677d49cd941b513c421980cf6a5e393f))
|
|
61
|
+
|
|
62
|
+
# 1.0.0 (2021-06-02)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Features
|
|
66
|
+
|
|
67
|
+
* Full rebuild with AirPeer 1.2.0 ([9327b2a](https://github.com/adrenak/univoice/commit/9327b2a05da766e91bad5f8e6288e5c328ded429))
|
package/CHANGELOG.md.meta
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 0d7539eaf2ef9674d9822b7ae65e72b5
|
|
3
|
-
TextScriptImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 0d7539eaf2ef9674d9822b7ae65e72b5
|
|
3
|
+
TextScriptImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 Vatsal Ambastha
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Vatsal Ambastha
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/LICENSE.meta
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 789be013ec943714a826e42a9d7db452
|
|
3
|
-
DefaultImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 789be013ec943714a826e42a9d7db452
|
|
3
|
+
DefaultImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|
package/README.md.meta
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: b497ccbc9f4029f4593611f820e24235
|
|
3
|
-
TextScriptImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: b497ccbc9f4029f4593611f820e24235
|
|
3
|
+
TextScriptImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Adrenak.UniVoice.Runtime"
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "Adrenak.UniVoice.Runtime"
|
|
3
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 6b289bb677194eb40b60db3a566aab7b
|
|
3
|
-
AssemblyDefinitionImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 6b289bb677194eb40b60db3a566aab7b
|
|
3
|
+
AssemblyDefinitionImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|
package/Runtime/ChatroomAgent.cs
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Linq;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
|
+
using System.Diagnostics;
|
|
5
|
+
|
|
6
|
+
using Debug = UnityEngine.Debug;
|
|
4
7
|
|
|
5
8
|
namespace Adrenak.UniVoice {
|
|
6
9
|
/// <summary>
|
|
7
10
|
/// Provides the means to host or connect to a chatroom.
|
|
8
11
|
/// </summary>
|
|
9
12
|
public class ChatroomAgent : IDisposable {
|
|
13
|
+
const string TAG = "ChatroomAgent";
|
|
14
|
+
|
|
10
15
|
// ====================================================================
|
|
11
16
|
#region PROPERTIES
|
|
12
17
|
// ====================================================================
|
|
@@ -33,14 +38,29 @@ namespace Adrenak.UniVoice {
|
|
|
33
38
|
/// There is a <see cref="IAudioOutput"/> for each peer that gets
|
|
34
39
|
/// created using the provided <see cref="AudioOutputFactory"/>
|
|
35
40
|
/// The <see cref="IAudioOutput"/> instance corresponding to a peer is
|
|
36
|
-
/// responsible for playing the audio that we receive that peer.
|
|
41
|
+
/// responsible for playing the audio that we receive from that peer.
|
|
37
42
|
/// </summary>
|
|
38
43
|
public Dictionary<short, IAudioOutput> PeerOutputs;
|
|
39
44
|
|
|
45
|
+
/// <summary>
|
|
46
|
+
/// Fired when the <see cref="CurrentMode"/> changes.
|
|
47
|
+
/// </summary>
|
|
48
|
+
public Action<ChatroomAgentMode> OnModeChanged;
|
|
49
|
+
|
|
40
50
|
/// <summary>
|
|
41
51
|
/// The current <see cref="ChatroomAgentMode"/> of this agent
|
|
42
52
|
/// </summary>
|
|
43
|
-
public ChatroomAgentMode CurrentMode {
|
|
53
|
+
public ChatroomAgentMode CurrentMode {
|
|
54
|
+
get => _currentMode;
|
|
55
|
+
private set {
|
|
56
|
+
if(_currentMode != value) {
|
|
57
|
+
_currentMode = value;
|
|
58
|
+
OnModeChanged?.Invoke(value);
|
|
59
|
+
Debug.unityLogger.Log(TAG, "Current Mode set to " + value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
ChatroomAgentMode _currentMode = ChatroomAgentMode.Unconnected;
|
|
44
64
|
|
|
45
65
|
/// <summary>
|
|
46
66
|
/// Mutes all the peers. If set to true, no incoming audio from other
|
|
@@ -69,14 +89,14 @@ namespace Adrenak.UniVoice {
|
|
|
69
89
|
#endregion
|
|
70
90
|
|
|
71
91
|
// ====================================================================
|
|
72
|
-
#region CONSTRUCTION
|
|
92
|
+
#region CONSTRUCTION AND DISPOSAL
|
|
73
93
|
// ====================================================================
|
|
74
94
|
/// <summary>
|
|
75
95
|
/// Creates and returns a new agent using the provided dependencies.
|
|
76
96
|
/// The instance then makes the dependencies work together.
|
|
77
97
|
/// </summary>
|
|
78
98
|
///
|
|
79
|
-
/// <param name="chatroomNetwork">The chatroom network implementation
|
|
99
|
+
/// <param name="chatroomNetwork">The chatroom network implementation
|
|
80
100
|
/// for chatroom access and sending data to peers in a chatroom.
|
|
81
101
|
/// </param>
|
|
82
102
|
///
|
|
@@ -106,7 +126,8 @@ namespace Adrenak.UniVoice {
|
|
|
106
126
|
PeerSettings = new Dictionary<short, ChatroomPeerSettings>();
|
|
107
127
|
PeerOutputs = new Dictionary<short, IAudioOutput>();
|
|
108
128
|
|
|
109
|
-
|
|
129
|
+
Debug.unityLogger.Log(TAG, "Created");
|
|
130
|
+
SetupEventListeners();
|
|
110
131
|
}
|
|
111
132
|
|
|
112
133
|
/// <summary>
|
|
@@ -116,6 +137,7 @@ namespace Adrenak.UniVoice {
|
|
|
116
137
|
/// instances and/or using them outside this instance.
|
|
117
138
|
/// </summary>
|
|
118
139
|
public void Dispose() {
|
|
140
|
+
Debug.unityLogger.Log(TAG, "Disposing");
|
|
119
141
|
AudioInput.Dispose();
|
|
120
142
|
|
|
121
143
|
RemoveAllPeers();
|
|
@@ -123,53 +145,62 @@ namespace Adrenak.UniVoice {
|
|
|
123
145
|
PeerOutputs.Clear();
|
|
124
146
|
|
|
125
147
|
Network.Dispose();
|
|
148
|
+
Debug.unityLogger.Log(TAG, "Disposed");
|
|
126
149
|
}
|
|
127
150
|
#endregion
|
|
128
151
|
|
|
129
152
|
// ====================================================================
|
|
130
153
|
#region INTERNAL
|
|
131
154
|
// ====================================================================
|
|
132
|
-
void
|
|
155
|
+
void SetupEventListeners() {
|
|
156
|
+
Debug.unityLogger.Log(TAG, "Setting up events.");
|
|
157
|
+
|
|
133
158
|
// Network events
|
|
134
|
-
Network.OnCreatedChatroom += () =>
|
|
159
|
+
Network.OnCreatedChatroom += () => {
|
|
160
|
+
Debug.unityLogger.Log(TAG, "Chatroom created.");
|
|
135
161
|
CurrentMode = ChatroomAgentMode.Host;
|
|
162
|
+
};
|
|
136
163
|
Network.OnClosedChatroom += () => {
|
|
137
|
-
|
|
164
|
+
Debug.unityLogger.Log(TAG, "Chatroom closed.");
|
|
138
165
|
RemoveAllPeers();
|
|
166
|
+
CurrentMode = ChatroomAgentMode.Unconnected;
|
|
139
167
|
};
|
|
140
168
|
Network.OnJoinedChatroom += id => {
|
|
169
|
+
Debug.unityLogger.Log(TAG, "Joined chatroom.");
|
|
141
170
|
CurrentMode = ChatroomAgentMode.Guest;
|
|
142
171
|
};
|
|
143
172
|
Network.OnLeftChatroom += () => {
|
|
173
|
+
Debug.unityLogger.Log(TAG, "Left chatroom.");
|
|
144
174
|
RemoveAllPeers();
|
|
145
175
|
CurrentMode = ChatroomAgentMode.Unconnected;
|
|
146
176
|
};
|
|
147
|
-
Network.OnPeerJoinedChatroom += id =>
|
|
177
|
+
Network.OnPeerJoinedChatroom += id => {
|
|
178
|
+
Debug.unityLogger.Log(TAG, "New peer joined: " + id);
|
|
148
179
|
AddPeer(id);
|
|
149
|
-
|
|
180
|
+
};
|
|
181
|
+
Network.OnPeerLeftChatroom += id => {
|
|
182
|
+
Debug.unityLogger.Log(TAG, "Peer left: " + id);
|
|
150
183
|
RemovePeer(id);
|
|
184
|
+
};
|
|
151
185
|
|
|
152
186
|
// Stream the incoming audio data using the right peer output
|
|
153
187
|
Network.OnAudioReceived += (peerID, data) => {
|
|
154
|
-
// if we're muting all,
|
|
188
|
+
// if we're muting all, do nothing.
|
|
155
189
|
if (MuteOthers) return;
|
|
156
190
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
var channels = data.channelCount;
|
|
160
|
-
var samples = data.samples;
|
|
161
|
-
|
|
162
|
-
if (PeerSettings.ContainsKey(peerID) && !PeerSettings[peerID].muteThem)
|
|
163
|
-
PeerOutputs[peerID].Feed(index, frequency, channels, samples);
|
|
191
|
+
if (AllowIncomingAudioFromPeer(peerID))
|
|
192
|
+
PeerOutputs[peerID].Feed(data);
|
|
164
193
|
};
|
|
165
194
|
|
|
166
195
|
AudioInput.OnSegmentReady += (index, samples) => {
|
|
167
|
-
|
|
196
|
+
if (CurrentMode == ChatroomAgentMode.Unconnected) return;
|
|
197
|
+
|
|
198
|
+
// If we're muting ourselves to all, do nothing.
|
|
168
199
|
if (MuteSelf) return;
|
|
169
200
|
|
|
170
201
|
// Get all the recipients we haven't muted ourselves to
|
|
171
202
|
var recipients = Network.PeerIDs
|
|
172
|
-
.Where(
|
|
203
|
+
.Where(id => AllowOutgoingAudioToPeer(id));
|
|
173
204
|
|
|
174
205
|
// Send the audio segment to every deserving recipient
|
|
175
206
|
foreach (var recipient in recipients)
|
|
@@ -180,34 +211,48 @@ namespace Adrenak.UniVoice {
|
|
|
180
211
|
samples = samples
|
|
181
212
|
});
|
|
182
213
|
};
|
|
214
|
+
Debug.unityLogger.Log(TAG, "Event setup completed.");
|
|
183
215
|
}
|
|
184
216
|
|
|
185
217
|
void AddPeer(short id) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
218
|
+
// Ensure no old settings or outputs exist for this ID.
|
|
219
|
+
RemovePeer(id);
|
|
220
|
+
|
|
221
|
+
PeerSettings.Add(id, new ChatroomPeerSettings());
|
|
222
|
+
|
|
223
|
+
var output = AudioOutputFactory.Create(
|
|
224
|
+
AudioInput.Frequency,
|
|
225
|
+
AudioInput.ChannelCount,
|
|
226
|
+
AudioInput.Frequency * AudioInput.ChannelCount / AudioInput.SegmentRate
|
|
227
|
+
);
|
|
228
|
+
output.ID = id.ToString();
|
|
229
|
+
PeerOutputs.Add(id, output);
|
|
230
|
+
Debug.unityLogger.Log(TAG, "Added peer " + id);
|
|
197
231
|
}
|
|
198
232
|
|
|
199
233
|
void RemovePeer(short id) {
|
|
200
|
-
if (PeerSettings.ContainsKey(id))
|
|
234
|
+
if (PeerSettings.ContainsKey(id)) {
|
|
201
235
|
PeerSettings.Remove(id);
|
|
236
|
+
Debug.unityLogger.Log(TAG, "Removed peer settings for ID " + id);
|
|
237
|
+
}
|
|
202
238
|
if (PeerOutputs.ContainsKey(id)) {
|
|
203
239
|
PeerOutputs[id].Dispose();
|
|
204
240
|
PeerOutputs.Remove(id);
|
|
241
|
+
Debug.unityLogger.Log(TAG, "Removed peer output for ID " + id);
|
|
205
242
|
}
|
|
206
243
|
}
|
|
207
244
|
|
|
245
|
+
bool AllowIncomingAudioFromPeer(short id) {
|
|
246
|
+
return PeerSettings.ContainsKey(id) && !PeerSettings[id].muteThem;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
bool AllowOutgoingAudioToPeer(short id) {
|
|
250
|
+
return PeerSettings.ContainsKey(id) && !PeerSettings[id].muteSelf;
|
|
251
|
+
}
|
|
252
|
+
|
|
208
253
|
void RemoveAllPeers() {
|
|
209
|
-
|
|
210
|
-
foreach(var peer in
|
|
254
|
+
Debug.unityLogger.Log(TAG, "Removing all peers");
|
|
255
|
+
foreach(var peer in Network.PeerIDs)
|
|
211
256
|
RemovePeer(peer);
|
|
212
257
|
}
|
|
213
258
|
#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 76706adfc97ef7d44823aa51d618267d
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 76706adfc97ef7d44823aa51d618267d
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: d56c2c84daac5494b93669532bca0b98
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: d56c2c84daac5494b93669532bca0b98
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -5,9 +5,9 @@ namespace Adrenak.UniVoice {
|
|
|
5
5
|
/// Responsible for playing audio that is sent to it.
|
|
6
6
|
/// You'd normally want a <see cref="UnityEngine.AudioSource"/>
|
|
7
7
|
/// based implementation to play the audio in Unity. But this class can
|
|
8
|
-
/// be used in other ways
|
|
8
|
+
/// be used in other ways such as streaming the received audio to a server
|
|
9
9
|
/// or writing it to a local file. It's just an audio output and the
|
|
10
|
-
/// destination
|
|
10
|
+
/// destination depends on your implementation.
|
|
11
11
|
/// </summary>
|
|
12
12
|
public interface IAudioOutput : IDisposable {
|
|
13
13
|
/// <summary>
|
|
@@ -34,10 +34,12 @@ namespace Adrenak.UniVoice {
|
|
|
34
34
|
/// <param name="audioSamples">
|
|
35
35
|
/// The audio samples/segment being fed
|
|
36
36
|
/// </param>
|
|
37
|
-
void Feed(int segmentIndex,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
void Feed(int segmentIndex, int frequency, int channelCount, float[] audioSamples);
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
/// Feeds a <see cref="ChatroomAudioSegment"/> object to the audio output.
|
|
41
|
+
/// </summary>
|
|
42
|
+
/// <param name="segment">The audio data to be sent.</param>
|
|
43
|
+
void Feed(ChatroomAudioSegment segment);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 7d34118811133f44eb7ba1b5c3f6bb77
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 7d34118811133f44eb7ba1b5c3f6bb77
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 095ec1523c98b7f4997c105a06856823
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 095ec1523c98b7f4997c105a06856823
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -46,26 +46,30 @@ namespace Adrenak.UniVoice {
|
|
|
46
46
|
/// <summary>
|
|
47
47
|
/// Fired when a peer joins the chatroom.
|
|
48
48
|
/// Provides the ID of the peer as event data.
|
|
49
|
-
/// This action also MUST be called for all previously
|
|
50
|
-
/// existing peers when
|
|
49
|
+
/// NOTE: This action also MUST be called for all previously
|
|
50
|
+
/// existing peers when a local user connects to a network.
|
|
51
|
+
/// This allows the local user to know about the users that
|
|
52
|
+
/// were in the chatroom before they joined.
|
|
51
53
|
/// </summary>
|
|
52
54
|
event Action<short> OnPeerJoinedChatroom;
|
|
53
55
|
|
|
54
56
|
/// <summary>
|
|
55
57
|
/// Fired when a peer leaves the chatroom.
|
|
56
58
|
/// Provides the ID of the peer as event data.
|
|
57
|
-
/// This also also MUST be called for all peers
|
|
58
|
-
/// when we leave a network.
|
|
59
59
|
/// </summary>
|
|
60
60
|
event Action<short> OnPeerLeftChatroom;
|
|
61
61
|
|
|
62
62
|
/// <summary>
|
|
63
63
|
/// Fired when the network receives audio data from a peer.
|
|
64
|
+
/// The first argument is the ID of the user the audio came from.
|
|
65
|
+
/// The second is the audio segment.
|
|
64
66
|
/// </summary>
|
|
65
67
|
event Action<short, ChatroomAudioSegment> OnAudioReceived;
|
|
66
68
|
|
|
67
69
|
/// <summary>
|
|
68
70
|
/// Fired when the local user sets audio data to a peer.
|
|
71
|
+
/// The first argument is the ID of the user the audio was sent to.
|
|
72
|
+
/// The second is the audio segment.
|
|
69
73
|
/// </summary>
|
|
70
74
|
event Action<short, ChatroomAudioSegment> OnAudioSent;
|
|
71
75
|
#endregion
|
|
@@ -96,19 +100,19 @@ namespace Adrenak.UniVoice {
|
|
|
96
100
|
/// <summary>
|
|
97
101
|
/// Closes a chatroom that the local user is hosting
|
|
98
102
|
/// </summary>
|
|
99
|
-
/// <param name="data">Any arguments for closing the
|
|
103
|
+
/// <param name="data">Any arguments used for closing the chatroom</param>
|
|
100
104
|
void CloseChatroom(object data = null);
|
|
101
105
|
|
|
102
106
|
/// <summary>
|
|
103
107
|
/// Joins a chatroom
|
|
104
108
|
/// </summary>
|
|
105
|
-
/// <param name="data">
|
|
109
|
+
/// <param name="data">Any arguments used to join a chatroom</param>
|
|
106
110
|
void JoinChatroom(object data = null);
|
|
107
111
|
|
|
108
112
|
/// <summary>
|
|
109
113
|
/// Leaves the chatroom the local user is currently in, if any
|
|
110
114
|
/// </summary>
|
|
111
|
-
/// <param name="data">Any arguments
|
|
115
|
+
/// <param name="data">Any arguments used to leave a chatroom</param>
|
|
112
116
|
void LeaveChatroom(object data = null);
|
|
113
117
|
|
|
114
118
|
/// <summary>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 11ba8951ad10dc84a963ca3c32cda48a
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 11ba8951ad10dc84a963ca3c32cda48a
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/Runtime/Interfaces.meta
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: a0b094f3fe5bc624fae2ffb1e18c19a1
|
|
3
|
-
folderAsset: yes
|
|
4
|
-
DefaultImporter:
|
|
5
|
-
externalObjects: {}
|
|
6
|
-
userData:
|
|
7
|
-
assetBundleName:
|
|
8
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: a0b094f3fe5bc624fae2ffb1e18c19a1
|
|
3
|
+
folderAsset: yes
|
|
4
|
+
DefaultImporter:
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
userData:
|
|
7
|
+
assetBundleName:
|
|
8
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 95ab24cb9f03b8c4c8f22f567259def4
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 95ab24cb9f03b8c4c8f22f567259def4
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
namespace Adrenak.UniVoice {
|
|
2
|
-
[System.Serializable]
|
|
3
|
-
/// <summary>
|
|
4
|
-
/// A data structure representing the audio transmitted over the network.
|
|
5
|
-
/// </summary>
|
|
6
|
-
public struct ChatroomAudioSegment {
|
|
7
|
-
/// <summary>
|
|
8
|
-
/// The segment index of the audio samples
|
|
9
|
-
/// </summary>
|
|
10
|
-
public int segmentIndex;
|
|
11
|
-
|
|
12
|
-
/// <summary>
|
|
13
|
-
/// The frequency (or sampling rate) of the audio
|
|
14
|
-
/// </summary>
|
|
15
|
-
public int frequency;
|
|
16
|
-
|
|
17
|
-
/// <summary>
|
|
18
|
-
/// THe number of channels in the audio
|
|
19
|
-
/// </summary>
|
|
20
|
-
public int channelCount;
|
|
21
|
-
|
|
22
|
-
/// <summary>
|
|
23
|
-
/// A float array representing the audio sample data
|
|
24
|
-
/// </summary>
|
|
25
|
-
public float[] samples;
|
|
26
|
-
}
|
|
1
|
+
namespace Adrenak.UniVoice {
|
|
2
|
+
[System.Serializable]
|
|
3
|
+
/// <summary>
|
|
4
|
+
/// A data structure representing the audio transmitted over the network.
|
|
5
|
+
/// </summary>
|
|
6
|
+
public struct ChatroomAudioSegment {
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// The segment index of the audio samples
|
|
9
|
+
/// </summary>
|
|
10
|
+
public int segmentIndex;
|
|
11
|
+
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// The frequency (or sampling rate) of the audio
|
|
14
|
+
/// </summary>
|
|
15
|
+
public int frequency;
|
|
16
|
+
|
|
17
|
+
/// <summary>
|
|
18
|
+
/// THe number of channels in the audio
|
|
19
|
+
/// </summary>
|
|
20
|
+
public int channelCount;
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// A float array representing the audio sample data
|
|
24
|
+
/// </summary>
|
|
25
|
+
public float[] samples;
|
|
26
|
+
}
|
|
27
27
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: e3c9ef93e574acf4094f05ab7346bfd5
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: e3c9ef93e574acf4094f05ab7346bfd5
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 8aa96a7270a41ab42a055ed9a5bcfacd
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 8aa96a7270a41ab42a055ed9a5bcfacd
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/Runtime/Types.meta
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: af3826214be11544e9a38629b9c93566
|
|
3
|
-
folderAsset: yes
|
|
4
|
-
DefaultImporter:
|
|
5
|
-
externalObjects: {}
|
|
6
|
-
userData:
|
|
7
|
-
assetBundleName:
|
|
8
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: af3826214be11544e9a38629b9c93566
|
|
3
|
+
folderAsset: yes
|
|
4
|
+
DefaultImporter:
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
userData:
|
|
7
|
+
assetBundleName:
|
|
8
|
+
assetBundleVariant:
|
package/Runtime.meta
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: e1b2e834bd331324e9157c87f86d1143
|
|
3
|
-
folderAsset: yes
|
|
4
|
-
timeCreated: 1547895114
|
|
5
|
-
licenseType: Free
|
|
6
|
-
DefaultImporter:
|
|
7
|
-
userData:
|
|
8
|
-
assetBundleName:
|
|
9
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: e1b2e834bd331324e9157c87f86d1143
|
|
3
|
+
folderAsset: yes
|
|
4
|
+
timeCreated: 1547895114
|
|
5
|
+
licenseType: Free
|
|
6
|
+
DefaultImporter:
|
|
7
|
+
userData:
|
|
8
|
+
assetBundleName:
|
|
9
|
+
assetBundleVariant:
|
package/package.json
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "com.adrenak.univoice",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"displayName": "Adrenak.UniVoice",
|
|
5
|
+
"description": "Voice chat/VoIP solution for Unity.",
|
|
6
|
+
"unity": "2019.4",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Vatsal Ambastha",
|
|
9
|
+
"email": "ambastha.vatsal@gmail.com",
|
|
10
|
+
"url": "http://www.vatsalambastha.com"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"Peer To Peer",
|
|
15
|
+
"WebRTC",
|
|
16
|
+
"P2P",
|
|
17
|
+
"Networking",
|
|
18
|
+
"Voice Chat",
|
|
19
|
+
"voip",
|
|
20
|
+
"Unity",
|
|
21
|
+
"Unity3d",
|
|
22
|
+
"VR",
|
|
23
|
+
"AR",
|
|
24
|
+
"Metaverse"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"registry": "https://registry.npmjs.org"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/package.json.meta
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 5677af848094d404f835a6468b36f003
|
|
3
|
-
TextScriptImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 5677af848094d404f835a6468b36f003
|
|
3
|
+
TextScriptImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|
package/Runtime/Extensions.cs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
using System.Collections.Generic;
|
|
2
|
-
|
|
3
|
-
using UnityEngine;
|
|
4
|
-
|
|
5
|
-
namespace Adrenak.UniVoice {
|
|
6
|
-
public static class Extensions {
|
|
7
|
-
/// <summary>
|
|
8
|
-
/// Returns the normalized position of the AudioSource on its AudioClip
|
|
9
|
-
/// </summary>
|
|
10
|
-
public static float GetCurrentPosition(this AudioSource source) {
|
|
11
|
-
return (float)source.timeSamples / source.clip.samples;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/// <summary>
|
|
15
|
-
/// Adds the given key to the dictionary with a value if the key
|
|
16
|
-
/// is not present before.
|
|
17
|
-
/// </summary>
|
|
18
|
-
/// <param name="t">The key to check and add</param>
|
|
19
|
-
/// <param name="k">The value if the key is added</param>
|
|
20
|
-
public static void EnsureKey<T, K>
|
|
21
|
-
(this Dictionary<T, K> dict, T t, K k) {
|
|
22
|
-
if (!dict.ContainsKey(t))
|
|
23
|
-
dict.Add(t, k);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/// <summary>
|
|
27
|
-
/// Ensures a key and value pair are in the dictionary
|
|
28
|
-
/// </summary>
|
|
29
|
-
/// <param name="t">The key to ensure</param>
|
|
30
|
-
/// <param name="k">The value associated with the key</param>
|
|
31
|
-
public static void EnsurePair<T, K>
|
|
32
|
-
(this Dictionary<T, K> dict, T t, K k) {
|
|
33
|
-
if (dict.ContainsKey(t))
|
|
34
|
-
dict[t] = k;
|
|
35
|
-
else
|
|
36
|
-
dict.Add(t, k);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 646602ab062d77543b3742e51d16658f
|
|
3
|
-
timeCreated: 1547895114
|
|
4
|
-
licenseType: Free
|
|
5
|
-
MonoImporter:
|
|
6
|
-
serializedVersion: 2
|
|
7
|
-
defaultReferences: []
|
|
8
|
-
executionOrder: 0
|
|
9
|
-
icon: {instanceID: 0}
|
|
10
|
-
userData:
|
|
11
|
-
assetBundleName:
|
|
12
|
-
assetBundleVariant:
|