com.adrenak.univoice 1.1.2 → 1.2.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 +41 -27
- package/CHANGELOG.md.meta +7 -7
- package/LICENSE +21 -21
- package/LICENSE.meta +7 -7
- package/README.md +24 -52
- 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 +38 -32
- package/Runtime/ChatroomAgent.cs.meta +11 -11
- package/Runtime/Extensions.cs.meta +12 -12
- package/Runtime/Interfaces/IAudioInput.cs +3 -3
- package/Runtime/Interfaces/IAudioInput.cs.meta +11 -11
- package/Runtime/Interfaces/IAudioOutput.cs +2 -2
- package/Runtime/Interfaces/IAudioOutput.cs.meta +11 -11
- package/Runtime/Interfaces/IAudioOutputFactory.cs +1 -1
- package/Runtime/Interfaces/IChatroomNetwork.cs +17 -20
- package/Runtime/Interfaces/IChatroomNetwork.cs.meta +11 -11
- package/Runtime/Interfaces.meta +8 -8
- package/Runtime/Types/ChatroomAgentMode.cs +1 -1
- package/Runtime/Types/ChatroomAgentMode.cs.meta +11 -11
- package/Runtime/Types/{ChatroomAudioDTO.cs → ChatroomAudioSegment.cs} +5 -5
- package/{InbuiltImpl/InbuiltChatroomAgentFactory.cs.meta → Runtime/Types/ChatroomAudioSegment.cs.meta} +1 -1
- package/Runtime/Types/ChatroomPeerSettings.cs +10 -10
- package/Runtime/Types/ChatroomPeerSettings.cs.meta +11 -11
- package/Runtime/Types.meta +8 -8
- package/Runtime.meta +9 -9
- package/package.json +18 -44
- package/package.json.meta +7 -7
- package/InbuiltImpl/Adrenak.UniVoice.InbuiltImpl.asmdef +0 -16
- package/InbuiltImpl/Adrenak.UniVoice.InbuiltImpl.asmdef.meta +0 -7
- package/InbuiltImpl/AirPeerUniVoiceNetwork.cs +0 -140
- package/InbuiltImpl/AirPeerUniVoiceNetwork.cs.meta +0 -11
- package/InbuiltImpl/InbuiltAudioOutput.cs +0 -288
- package/InbuiltImpl/InbuiltAudioOutput.cs.meta +0 -12
- package/InbuiltImpl/InbuiltChatroomAgentFactory.cs +0 -24
- package/InbuiltImpl/UniMicAudioInput.cs +0 -35
- package/InbuiltImpl/UniMicAudioInput.cs.meta +0 -11
- package/InbuiltImpl.meta +0 -8
- package/Runtime/Interfaces/IChatroomAgentFactory.cs +0 -5
- package/Runtime/Interfaces/IChatroomAgentFactory.cs.meta +0 -11
- package/Runtime/Types/ChatroomAudioDTO.cs.meta +0 -11
- package/Samples/Adrenak.UniVoice.Samples.asmdef +0 -15
- package/Samples/Adrenak.UniVoice.Samples.asmdef.meta +0 -7
- package/Samples/Plugins/Android/AndroidPermissionsManager.cs +0 -68
- package/Samples/Plugins/Android/AndroidPermissionsManager.cs.meta +0 -12
- package/Samples/Plugins/Android/unityandroidpermissions.aar +0 -0
- package/Samples/Plugins/Android/unityandroidpermissions.aar.meta +0 -33
- package/Samples/Plugins/Android.meta +0 -9
- package/Samples/Plugins.meta +0 -9
- package/Samples/Prefabs/Peer View.prefab +0 -1017
- package/Samples/Prefabs/Peer View.prefab.meta +0 -7
- package/Samples/Prefabs.meta +0 -8
- package/Samples/Scenes/GroupVoiceCallSample.unity +0 -2348
- package/Samples/Scenes/GroupVoiceCallSample.unity.meta +0 -7
- package/Samples/Scenes.meta +0 -8
- package/Samples/Scripts/GroupVoiceCallSample.cs +0 -182
- package/Samples/Scripts/GroupVoiceCallSample.cs.meta +0 -11
- package/Samples/Scripts/PeerView.cs +0 -74
- package/Samples/Scripts/PeerView.cs.meta +0 -11
- package/Samples/Scripts.meta +0 -8
- package/Samples/Sprites/mic.png +0 -0
- package/Samples/Sprites/mic.png.meta +0 -88
- package/Samples/Sprites/off.png +0 -0
- package/Samples/Sprites/off.png.meta +0 -88
- package/Samples/Sprites/on.png +0 -0
- package/Samples/Sprites/on.png.meta +0 -88
- package/Samples/Sprites/speaker.png +0 -0
- package/Samples/Sprites/speaker.png.meta +0 -88
- package/Samples/Sprites.meta +0 -8
- package/Samples.meta +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,27 +1,41 @@
|
|
|
1
|
-
## [1.1.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* README
|
|
7
|
-
|
|
8
|
-
## [1.1.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Bug Fixes
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
###
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
###
|
|
26
|
-
|
|
27
|
-
*
|
|
1
|
+
## [1.1.4](https://github.com/adrenak/univoice/compare/v1.1.3...v1.1.4) (2021-08-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Spell-fix in README ([fcbc7c6](https://github.com/adrenak/univoice/commit/fcbc7c6c28c84415a50050d7014ecdfc39347309))
|
|
7
|
+
|
|
8
|
+
## [1.1.3](https://github.com/adrenak/univoice/compare/v1.1.2...v1.1.3) (2021-06-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Add missing mute others toggle in sample scene. ([cff9574](https://github.com/adrenak/univoice/commit/cff9574bdd4b769de519f451e489b9dcdb76f649))
|
|
14
|
+
|
|
15
|
+
## [1.1.2](https://github.com/adrenak/univoice/compare/v1.1.1...v1.1.2) (2021-06-02)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* README fix ([d03db44](https://github.com/adrenak/univoice/commit/d03db449e1fe2557a57df75ccfc8fe4a310f308f))
|
|
21
|
+
|
|
22
|
+
## [1.1.1](https://github.com/adrenak/univoice/compare/v1.1.0...v1.1.1) (2021-06-02)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* Prevent sample app screen from sleeping. ([545d96f](https://github.com/adrenak/univoice/commit/545d96f16b858ba1dbdb01de5298ba62c06c2725))
|
|
28
|
+
|
|
29
|
+
# [1.1.0](https://github.com/adrenak/univoice/compare/v1.0.0...v1.1.0) (2021-06-02)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* InbuiltAudioOutput now also accepts minimum segment count and ([294bfef](https://github.com/adrenak/univoice/commit/294bfef5677d49cd941b513c421980cf6a5e393f))
|
|
35
|
+
|
|
36
|
+
# 1.0.0 (2021-06-02)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* 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
CHANGED
|
@@ -1,72 +1,55 @@
|
|
|
1
|
+
Note: Inbuilt implementations and samples have been removed from this repository. They'll be added to separate repositories soon.
|
|
2
|
+
|
|
1
3
|
# UniVoice
|
|
2
4
|
UniVoice is a voice chat/VoIP solution for Unity.
|
|
3
5
|
|
|
4
|
-
It comes with ready-to-use P2P (peer to peer) conenctivity which allows devices to communicate nearly free of cost*. For the underlying P2P solution, please visit [AirPeer](https://www.github.com/adrenak/airpeer)
|
|
5
|
-
|
|
6
6
|
Some features of UniVoice:
|
|
7
7
|
- 👥 Group voice chat. Multiple peers can join a chatroom and exchange audio.
|
|
8
8
|
|
|
9
9
|
- ⚙ Peer specific settings. Don't want to listen to a peer? Mute them. Don't want someone listening to you? Mute yourself against them.
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
- 🎨 Customise your audio input, output and networking layer.
|
|
10
|
+
|
|
11
|
+
- 🎨 Customize your audio input, output and networking layer.
|
|
14
12
|
* 🎤 __Configurable Audio Input__: Decide what the input of your outgoing audio is. Let it be from [Unity's Microphone](https://docs.unity3d.com/ScriptReference/Microphone.html) class, or a live streaming audio, or an MP4 file on the disk.
|
|
15
13
|
|
|
16
14
|
* 🔊 __Configurable Audio Output__: Decide where the incoming peer audio goes. Let the output of incoming audio be [Unity AudioSource](https://docs.unity3d.com/ScriptReference/AudioSource.html) to play the audio in-game, or write it into an MP4 on the disk, or stream it to an online service.
|
|
17
15
|
|
|
18
16
|
* 🌐 __Configurable Network__: Want to use UniVoice in a WLAN project using [Telepathy?](https://github.com/vis2k/Telepathy) Just adapt its API for UniVoice with a simple the `IChatroomNetwork` interface. Using your own backend for multiplayer? Create and expose your audio API and write a UniVoice implementation, again with the same interface.
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* 🔊 __Audio Output__: source that plays incoming peer audio on [Unity AudioSource](https://docs.unity3d.com/ScriptReference/AudioSource.html)
|
|
24
|
-
|
|
25
|
-
* 🌐 __P2P network__: implementation based on [AirPeer](https://www.github.com/adrenak/airpeer) which uses WebRTC for free-of-cost networking between peers.
|
|
26
|
-
|
|
27
|
-
Plus, to get started you don't need to worry about hosting your own WebRTC signalling server as a server that's good enough for testing is already available. (See the project samples for more details)
|
|
28
|
-
|
|
29
|
-
_*signalling server costs still apply, but they are minimal and sometimes free on platforms such as Heroku_
|
|
30
|
-
|
|
31
|
-
# Documentation
|
|
32
|
-
For the API documentation, please visit http://www.vatsalambastha.com/univoice
|
|
33
|
-
|
|
34
|
-
Manuals, Wiki, Tutorials, etc. are not available yet.
|
|
18
|
+
# Docs
|
|
19
|
+
Manuals and sample projects are not available yet. For the API reference, please visit http://www.vatsalambastha.com/univoice
|
|
35
20
|
|
|
36
21
|
# Usage
|
|
37
22
|
## Creating a chatroom agent
|
|
38
|
-
- To be able to host and join voice chatrooms, you need a `ChatroomAgent` instance.
|
|
23
|
+
- To be able to host and join voice chatrooms, you need a `ChatroomAgent` instance.
|
|
39
24
|
|
|
40
25
|
```
|
|
41
|
-
var agent = new
|
|
42
|
-
// Don't worry, a signalling server URL is available inside the repositories samples code.
|
|
26
|
+
var agent = new ChatroomAgent(IChatroomNetwork network, IAudioInput audioInput, IAudioOutput audioOutput);
|
|
43
27
|
```
|
|
44
28
|
|
|
45
29
|
## Hosting and joining chatrooms
|
|
30
|
+
|
|
46
31
|
Every peer in the chatroom is assigned an ID by the host. And every peer has a peer list, representing the other peers in the chatroom.
|
|
47
|
-
|
|
32
|
+
|
|
48
33
|
- To get your ID
|
|
49
|
-
`agent.
|
|
50
|
-
|
|
51
|
-
`ChatroomAgent` exposes `Network`, an implementation of `IChatroomNetwork`
|
|
34
|
+
`agent.Network.OwnID;`
|
|
52
35
|
|
|
53
36
|
- To get a list of the other peers in the chatroom, use this:
|
|
54
|
-
`agent.Network.
|
|
37
|
+
`agent.Network.PeersIDs`
|
|
55
38
|
|
|
56
39
|
`agent.Network` also provides methods to host or join a chatroom. Here is how you use them:
|
|
57
40
|
|
|
58
41
|
```
|
|
59
42
|
// Host a chatroom using a name
|
|
60
|
-
agent.Network.HostChatroom(
|
|
43
|
+
agent.Network.HostChatroom(optional_data);
|
|
61
44
|
|
|
62
45
|
// Join an existing chatroom using a name
|
|
63
|
-
agent.Network.JoinChatroom(
|
|
46
|
+
agent.Network.JoinChatroom(optional_data);
|
|
64
47
|
|
|
65
48
|
// Leave the chatroom, if connected to one
|
|
66
|
-
agent.Network.LeaveChatroom();
|
|
49
|
+
agent.Network.LeaveChatroom(optional_data);
|
|
67
50
|
|
|
68
|
-
// Closes a chatroom, if
|
|
69
|
-
agent.Network.CloseChatroom();
|
|
51
|
+
// Closes a chatroom, if is hosting one
|
|
52
|
+
agent.Network.CloseChatroom(optional_data);
|
|
70
53
|
|
|
71
54
|
```
|
|
72
55
|
## Muting Audio
|
|
@@ -76,30 +59,19 @@ To mute yourself use `agent.MuteSelf = true;` or set it to `false` to unmute you
|
|
|
76
59
|
|
|
77
60
|
For muting a specific peer, first get the peers settings object using this:
|
|
78
61
|
```
|
|
79
|
-
|
|
80
|
-
settings.muteThem = true;
|
|
62
|
+
agent.PeerSettings[id].muteThem = true; // where id belongs to the peer in question
|
|
81
63
|
```
|
|
82
64
|
|
|
83
65
|
If you want to mute yourself towards a specific peer, use this:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
settings.muteSelf = true;
|
|
87
|
-
```
|
|
88
|
-
|
|
66
|
+
`agent.PeerSettings[id].muteSelf = true; // where id belongs to the peer in question`
|
|
67
|
+
|
|
89
68
|
## Events
|
|
90
|
-
`agent.Network` provides several network related events. Refer to the API reference for them.
|
|
91
|
-
|
|
92
|
-
# Known Issues
|
|
93
|
-
UniVoice is based on [AirPeer](https://www.github.com/adrenak/airpeer) which currently has an issue where peers on different networks are often unable to connect.
|
|
94
|
-
|
|
95
|
-
Eg. two mobile phone in different geographical locations are trying to have a voice chat. Both are connected to their respective WiFi. One hosts and waits for the other. The one trying to join may fail and only succeed when the connection is changed from its Wifi to cellular data.
|
|
96
|
-
|
|
97
|
-
This issue will be addressed inside AirPeer itself. For more see the 'Connectivity issues' section at the [AirPeer Homepage](http://www.vatsalambastha.com/airpeer)
|
|
69
|
+
`agent.Network` provides several network related events. Refer to the [API reference](http://www.vatsalambastha.com/univoice/api/Adrenak.UniVoice.ChatroomAgent.html) for them.
|
|
98
70
|
|
|
99
71
|
# License and Support
|
|
100
|
-
This project under the [MIT license](https://github.com/adrenak/univoice/blob/master/LICENSE).
|
|
72
|
+
This project is under the [MIT license](https://github.com/adrenak/univoice/blob/master/LICENSE).
|
|
101
73
|
|
|
102
|
-
Updates and maintenance are not
|
|
74
|
+
Updates and maintenance are not guaranteed and the project is maintained by the original developer in his free time. Community contributions are welcome.
|
|
103
75
|
|
|
104
76
|
__Commercial consultation and development can be arranged__ but is subject to schedule and availability.
|
|
105
77
|
|
|
@@ -109,4 +81,4 @@ The developer can be reached at the following links:
|
|
|
109
81
|
[Website](http://www.vatsalambastha.com)
|
|
110
82
|
[LinkedIn](https://www.linkedin.com/in/vatsalAmbastha)
|
|
111
83
|
[GitHub](https://www.github.com/adrenak)
|
|
112
|
-
[Twitter](https://www.twitter.com/vatsalAmbastha)
|
|
84
|
+
[Twitter](https://www.twitter.com/vatsalAmbastha)
|
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,68 +1,70 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using System.Linq;
|
|
1
|
+
using System;
|
|
2
|
+
using System.Linq;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
namespace Adrenak.UniVoice {
|
|
6
6
|
/// <summary>
|
|
7
7
|
/// Provides the means to host or connect to a chatroom.
|
|
8
8
|
/// </summary>
|
|
9
|
-
public class ChatroomAgent : IDisposable {
|
|
10
|
-
// ====================================================================
|
|
11
|
-
#region PROPERTIES
|
|
12
|
-
// ====================================================================
|
|
9
|
+
public class ChatroomAgent : IDisposable {
|
|
10
|
+
// ====================================================================
|
|
11
|
+
#region PROPERTIES
|
|
12
|
+
// ====================================================================
|
|
13
13
|
/// <summary>
|
|
14
14
|
/// The underlying network which the agent uses to host or connect to
|
|
15
15
|
/// chatrooms, and send and receive data to and from peers
|
|
16
16
|
/// </summary>
|
|
17
|
-
public IChatroomNetwork Network { get; private set; }
|
|
17
|
+
public IChatroomNetwork Network { get; private set; }
|
|
18
18
|
|
|
19
19
|
/// <summary>
|
|
20
20
|
/// Source of outgoing audio that can be
|
|
21
21
|
/// transmitted over the network to peers
|
|
22
|
-
/// </summary>
|
|
23
|
-
public IAudioInput AudioInput { get; private set; }
|
|
22
|
+
/// </summary>
|
|
23
|
+
public IAudioInput AudioInput { get; private set; }
|
|
24
24
|
|
|
25
25
|
/// <summary>
|
|
26
26
|
/// A factory that returns an <see cref="IAudioOutput"/>
|
|
27
27
|
/// instance. Used every time a Peer connects for that peer to get
|
|
28
28
|
/// an output for that peer.
|
|
29
29
|
/// </summary>
|
|
30
|
-
public IAudioOutputFactory AudioOutputFactory { get; private set; }
|
|
31
|
-
|
|
30
|
+
public IAudioOutputFactory AudioOutputFactory { get; private set; }
|
|
31
|
+
|
|
32
32
|
/// <summary>
|
|
33
33
|
/// There is a <see cref="IAudioOutput"/> for each peer that gets
|
|
34
34
|
/// created using the provided <see cref="AudioOutputFactory"/>
|
|
35
35
|
/// The <see cref="IAudioOutput"/> instance corresponding to a peer is
|
|
36
36
|
/// responsible for playing the audio that we receive that peer.
|
|
37
|
-
/// </summary>
|
|
37
|
+
/// </summary>
|
|
38
38
|
public Dictionary<short, IAudioOutput> PeerOutputs;
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
/// <summary>
|
|
41
41
|
/// The current <see cref="ChatroomAgentMode"/> of this agent
|
|
42
|
-
/// </summary>
|
|
43
|
-
public ChatroomAgentMode CurrentMode { get; private set; }
|
|
44
|
-
|
|
42
|
+
/// </summary>
|
|
43
|
+
public ChatroomAgentMode CurrentMode { get; private set; }
|
|
44
|
+
|
|
45
45
|
/// <summary>
|
|
46
46
|
/// Mutes all the peers. If set to true, no incoming audio from other
|
|
47
47
|
/// peers will be played. If you want to selectively mute a peer, use
|
|
48
48
|
/// the <see cref="ChatroomPeerSettings.muteThem"/> flag in the
|
|
49
49
|
/// <see cref="PeerSettings"/> instance for that peer.
|
|
50
|
-
///
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
/// Note that setting this will not change <see cref="PeerSettings"/>
|
|
51
|
+
/// </summary>
|
|
52
|
+
public bool MuteOthers { get; set; }
|
|
53
|
+
|
|
53
54
|
/// <summary>
|
|
54
55
|
/// Whether this agent is muted or not. If set to true, voice data will
|
|
55
56
|
/// not be sent to ANY peer. If you want to selectively mute yourself
|
|
56
57
|
/// to a peer, use the <see cref="ChatroomPeerSettings.muteSelf"/>
|
|
57
58
|
/// flag in the <see cref="PeerSettings"/> instance for that peer.
|
|
58
|
-
///
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
/// Note that setting this will not change <see cref="PeerSettings"/>
|
|
60
|
+
/// </summary>
|
|
61
|
+
public bool MuteSelf { get; set; }
|
|
62
|
+
|
|
61
63
|
/// <summary>
|
|
62
64
|
/// <see cref="ChatroomPeerSettings"/> for each peer which allows you
|
|
63
65
|
/// to read or change the settings for a specific peer. Use [id] to get
|
|
64
66
|
/// settings for a peer with ID id;
|
|
65
|
-
/// </summary>
|
|
67
|
+
/// </summary>
|
|
66
68
|
public Dictionary<short, ChatroomPeerSettings> PeerSettings;
|
|
67
69
|
#endregion
|
|
68
70
|
|
|
@@ -82,7 +84,7 @@ namespace Adrenak.UniVoice {
|
|
|
82
84
|
/// <param name="audioOutputFactory">
|
|
83
85
|
/// The factory used for creating <see cref="IAudioOutput"/> instances
|
|
84
86
|
/// for peers so that incoming audio from peers can be played.
|
|
85
|
-
/// </param>
|
|
87
|
+
/// </param>
|
|
86
88
|
public ChatroomAgent(
|
|
87
89
|
IChatroomNetwork chatroomNetwork,
|
|
88
90
|
IAudioInput audioInput,
|
|
@@ -130,7 +132,7 @@ namespace Adrenak.UniVoice {
|
|
|
130
132
|
// Node server events
|
|
131
133
|
Network.OnCreatedChatroom += () =>
|
|
132
134
|
CurrentMode = ChatroomAgentMode.Host;
|
|
133
|
-
Network.
|
|
135
|
+
Network.OnClosedChatroom += () => {
|
|
134
136
|
CurrentMode = ChatroomAgentMode.Unconnected;
|
|
135
137
|
RemoveAllPeers();
|
|
136
138
|
};
|
|
@@ -177,7 +179,7 @@ namespace Adrenak.UniVoice {
|
|
|
177
179
|
|
|
178
180
|
// Send the audio segment to every deserving recipient
|
|
179
181
|
foreach (var recipient in recipients)
|
|
180
|
-
Network.SendAudioSegment(new
|
|
182
|
+
Network.SendAudioSegment(new ChatroomAudioSegment {
|
|
181
183
|
id = recipient,
|
|
182
184
|
segmentIndex = index,
|
|
183
185
|
frequency = AudioInput.Frequency,
|
|
@@ -185,8 +187,8 @@ namespace Adrenak.UniVoice {
|
|
|
185
187
|
samples = samples
|
|
186
188
|
});
|
|
187
189
|
};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
+
}
|
|
191
|
+
|
|
190
192
|
void RemovePeer(short id) {
|
|
191
193
|
if (PeerSettings.ContainsKey(id))
|
|
192
194
|
PeerSettings.Remove(id);
|
|
@@ -205,8 +207,12 @@ namespace Adrenak.UniVoice {
|
|
|
205
207
|
|
|
206
208
|
bool HasSettingsForPeer(short id) => PeerSettings.ContainsKey(id);
|
|
207
209
|
|
|
208
|
-
void EnsurePeerStreamer
|
|
209
|
-
|
|
210
|
+
void EnsurePeerStreamer(
|
|
211
|
+
short id,
|
|
212
|
+
int frequency,
|
|
213
|
+
int channels,
|
|
214
|
+
int segmentLength
|
|
215
|
+
) {
|
|
210
216
|
if (!PeerOutputs.ContainsKey(id) && PeerSettings.ContainsKey(id)) {
|
|
211
217
|
var output = AudioOutputFactory.Create(
|
|
212
218
|
frequency,
|
|
@@ -219,4 +225,4 @@ namespace Adrenak.UniVoice {
|
|
|
219
225
|
}
|
|
220
226
|
#endregion
|
|
221
227
|
}
|
|
222
|
-
}
|
|
228
|
+
}
|
|
@@ -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,12 +1,12 @@
|
|
|
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:
|
|
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:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
|
|
1
|
+
using System;
|
|
2
|
+
|
|
3
3
|
namespace Adrenak.UniVoice {
|
|
4
4
|
/// <summary>
|
|
5
5
|
/// Source of user voice input. This would usually be implemented
|
|
@@ -31,4 +31,4 @@ namespace Adrenak.UniVoice {
|
|
|
31
31
|
/// </summary>
|
|
32
32
|
int SegmentRate { get; }
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
}
|
|
@@ -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:
|
|
@@ -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:
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/// </summary>
|
|
6
6
|
public interface IAudioOutputFactory {
|
|
7
7
|
/// <summary>
|
|
8
|
-
/// Creates an
|
|
8
|
+
/// Creates an instance of a concrete <see cref="IAudioOutput"/> class
|
|
9
9
|
/// </summary>
|
|
10
10
|
/// <param name="peerID">The ID of the peer for which </param>
|
|
11
11
|
/// <param name="frequency">Frequency/sample rate of the audio </param>
|