Skip to content

Commit

Permalink
Merge pull request #39 from adrenak/v4
Browse files Browse the repository at this point in the history
V4
  • Loading branch information
adrenak authored Dec 29, 2024
2 parents 2e86a35 + 6760fb0 commit 974d589
Show file tree
Hide file tree
Showing 90 changed files with 12,437 additions and 857 deletions.
40 changes: 22 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,34 @@ on:
- master
jobs:
release:
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: Release
runs-on: ubuntu-latest
env:
PKG_ROOT: "Assets/Adrenak.UniVoice"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v3
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/npm
@semantic-release/git
branch: master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Check if README.md has changed
id: readme_check
run: |
if git diff --name-only HEAD~1 HEAD | grep -q "README.md"; then
echo "README_CHANGED=true" >> $GITHUB_ENV
else
echo "README_CHANGED=false" >> $GITHUB_ENV
fi
- name: Create/Update upm branch
- name: Update package README
if: env.README_CHANGED == 'true'
run: |
cp README.md "$PKG_ROOT/README.md"
git config --global user.name 'github-bot'
git config --global user.email '[email protected]'
git commit -am "Updated package README from root README"
git push -f -u origin master
- name: Create UPM branch
run: |
git branch -d upm &> /dev/null || echo upm branch not found
git subtree split -P "$PKG_ROOT" -b upm
Expand All @@ -38,6 +44,4 @@ jobs:
git config --global user.email '[email protected]'
git commit -am "fix: Samples => Samples~"
fi
git push -f -u origin upm
env:
PKG_ROOT: "Assets/Adrenak.UniVoice"
git push -f -u origin upm
39 changes: 12 additions & 27 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,28 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
# with:
# submodules: true
with:
fetch-depth: 0 # Ensure full history is fetched for the reset to work next

- name: Hard Reset
run: |
git reset --hard HEAD
git clean -fdx # Remove untracked files and directories
- name: Install DocFX
run: choco install -y docfx

- name: Use README.md as index.md
run: cp README.md Documentation/index.md

- name: Build
- name: Build DocFX
run: docfx Documentation/docfx.json

# Upload the generated documentation
- name: Upload site artifact
uses: actions/upload-artifact@v1
with:
name: _site
path: _site # Must equals the 'build.dest' value on your docfx.json

# Deploy the generated documentation to the gh-pages branch
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# with:
# submodules: true

# Download the generated documentation
- name: Download site artifact
uses: actions/download-artifact@v1
with:
name: _site
- name: List generated site files
run: dir _site

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
- name: Deploy site
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
Expand Down
20 changes: 0 additions & 20 deletions .releaserc.json

This file was deleted.

67 changes: 0 additions & 67 deletions Assets/Adrenak.UniVoice/CHANGELOG.md

This file was deleted.

85 changes: 30 additions & 55 deletions Assets/Adrenak.UniVoice/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Note: Inbuilt implementations and samples have been removed from this repository. They'll be added to separate repositories soon.

# UniVoice
UniVoice is a voice chat/VoIP solution for Unity.

Expand All @@ -9,73 +7,50 @@ Some features of UniVoice:
- ⚙ Peer specific settings. Don't want to listen to a peer? Mute them. Don't want someone listening to you? Mute yourself against them.

- 🎨 Customize your audio input, output and networking layer.
* 🎤 __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.
* 🎤 __Configurable Audio Input__: UniVoice is audio input agnostic. It supports mic audio input out of the box and you can change the source of outgoing audio by implementing the `IAudioInput` interrace.

* 🔊 __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.
* 🔊 __Configurable Audio Output__: UniVoice is audio output agnostic. Out of the box is supports playing peer audio using Unity AudioSource. You can divert incoming audio to anywhere you want by implementing the `IAudioOutput` interface.

* 🌐 __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.

# Docs
Manuals and sample projects are not available yet. For the API reference, please visit http://www.vatsalambastha.com/univoice

# Usage
## Creating a chatroom agent
- To be able to host and join voice chatrooms, you need a `ChatroomAgent` instance.
* 🌐 __Configurable Network__: UniVoice is network agnostic and supports Mirror out of the box. You can implement the `IAudioClient` and `IAudioServer` interfaces using the networking plugin of your choice to make it compatible with it.

## Installation
⚠️ [OpenUPM](https://openupm.com/packages/com.adrenak.univoice/?subPage=versions) may not have up to date releases. Install using NPM registry instead 👇

Ensure you have the NPM registry in the `packages.json` file of your Unity project with the following scopes:
```
var agent = new ChatroomAgent(IChatroomNetwork network, IAudioInput audioInput, IAudioOutput audioOutput);
"scopedRegistries": [
{
"name": "npmjs",
"url": "https://registry.npmjs.org",
"scopes": [
"com.npmjs",
"com.adrenak.unimic",
"com.adrenak.brw",
"com.adrenak.unimic",
"com.adrenak.unityopus"
]
}
}
```

## Hosting and joining chatrooms

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.

- To get your ID
`agent.Network.OwnID;`
## Docs and getting started
This repository contains a sample scene for the Mirror network, which is the best place to see how UniVoice can be integrated into your project.

- To get a list of the other peers in the chatroom, use this:
`agent.Network.PeersIDs`

`agent.Network` also provides methods to host or join a chatroom. Here is how you use them:
For the API reference, please visit http://www.vatsalambastha.com/univoice

```
// Host a chatroom using a name
agent.Network.HostChatroom(optional_data);
// Join an existing chatroom using a name
agent.Network.JoinChatroom(optional_data);
## Dependencies
[com.adrenak.brw](https://www.github.com/adrenak/brw)`@1.0.1` for reading and writing messages for communication. See `MirrorServer.cs` and `MirrorClient.cs` where they're used.

// Leave the chatroom, if connected to one
agent.Network.LeaveChatroom(optional_data);
[com.adrenak.unimic](https://www.github.com/adrenak/unimic)`@3.2.1` for easily capturing audio from any connected mic devices. See `UniMicInput.cs` for usage.

// Closes a chatroom, if is hosting one
agent.Network.CloseChatroom(optional_data);
[com.adrenak.unityopus](https://www.github.com/adrenak/unityopus)`@1.0.0` for Opus encoding and decoding. See `OpusFilter.cs` for usage

```
## Muting Audio
To mute everyone in the chatroom, use `agent.MuteOthers = true;` or set it to `false` to unmute them all.

To mute yourself use `agent.MuteSelf = true;` or set it to `false` to unmute yourself. This will stop sending your audio to all the peers in the chatroom.

For muting a specific peer, first get the peers settings object using this:
```
agent.PeerSettings[id].muteThem = true; // where id belongs to the peer in question
```

If you want to mute yourself towards a specific peer, use this:
`agent.PeerSettings[id].muteSelf = true; // where id belongs to the peer in question`

## Events
`agent.Network` provides several network related events. Refer to the [API reference](http://www.vatsalambastha.com/univoice/api/Adrenak.UniVoice.ChatroomAgent.html) for them.

# License and Support
## License and Support
This project is under the [MIT license](https://github.com/adrenak/univoice/blob/master/LICENSE).

Updates and maintenance are not guaranteed and the project is maintained by the original developer in his free time. Community contributions are welcome.

__Commercial consultation and development can be arranged__ but is subject to schedule and availability.
Community contributions are welcome.

# Contact
## Contact
The developer can be reached at the following links:

[Website](http://www.vatsalambastha.com)
Expand Down
22 changes: 19 additions & 3 deletions Assets/Adrenak.UniVoice/Runtime/Adrenak.UniVoice.Runtime.asmdef
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
{
"name": "Adrenak.UniVoice.Runtime"
}
{
"name": "Adrenak.UniVoice.Runtime",
"references": [
"GUID:f87ecb857e752164ab814a3de8eb0262",
"GUID:1f776cd02c03a7b4280b6b649d7758e2",
"GUID:30817c1a0e6d646d99c048fc403f5979",
"GUID:725ee7191c021de4dbf9269590ded755",
"GUID:34d15e3fb5fa4b541b5a93a6dc182cc5"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
Loading

0 comments on commit 974d589

Please sign in to comment.