Voice Interface Sample - C SDK

The Voice C interface sample demonstrates implementation and basically functionality of using Voice.

Preview Only

This Voice Sample demonstrates how to implement a secure voice chat system using a client and server application for the C SDK.

The sample includes the following features:

  • Requesting a token to allow a user to join a room with other users (via Server)

  • Joining a room with friends or other users

  • Leaving a room

  • Muting your own audio

  • Muting other user's audio (via Server and only allowed by the room owner)

  • Kicking another user from the room (via Server and only allowed by the room owner)

  • Showing status updates when a user is speaking or muted

  • Changing audio input and output devices

Voice1.png

Voice Client

Setup for Windows 32/64-bit

This section covers building and running the Voice Client sample app for both 32-bit and 64-bit Windows operating systems.

Building the Voice Client Sample App for Win64/Win32

  1. Unzip EOS-SDK.zip into your location of choice.

  2. Navigate to EOS-SDK > Samples.

  3. Double-click Samples.sln. Visual Studio will open with it in the Solution Explorer.

  4. Set the StartUp Project to Voice.

  5. Open SampleConstants.h and update the ProductId, SandboxId, DeploymentId, ClientCredentialsId, and ClientCredentialsSecret based on the values for your Test App.

  6. Select the solution configuration: Release_DX or Debug_DX.

  7. Select the solution platform: x64 (Win64) or x86 (Win32).

  8. In the Solution Explorer, right-click the Voice project and select Build.

  9. After a successful build, you should have Voice.exe available under \EOS-SDK\Samples\Voice\Client\Bin\Win64\Release_DX\

You can now run the sample application.

Running the Voice Client Sample App (Win64/Win32)

To run the Voice Client sample app:

  1. Navigate to e.g. \EOS-SDK\Samples\Voice\Client\Bin\Win64\Release_DX\

  2. Run Voice.exe

  3. Add -serverport <port> to change the server listen port.

  4. Add -serverurl <url> to change the server URL.

Setup for MacOS or Linux

Setup Prerequisites

To build the Voice Client sample application on MacOS, you will need to install the following dependencies:

Building the Voice Client Sample App for MacOS or Linux

  1. Unzip EOS-SDK.zip into your location of choice.

  2. In Terminal, navigate to /EOS-SDK/Samples/Voice/Client/

  3. Open SampleConstants.h and update ProductId, SandboxId, DeploymentId, ClientCredentialsId, and ClientCredentialsSecret based on the values for your Test App.

  4. Run: ./Build.sh (or you can run Build.command from Finder on Mac).

  5. Once the build successfully completes, you will have newly created files under: /EOS-SDK/Samples/Voice/Client/Build/

You are now ready to run the sample application.

Running the Voice Client Sample App (MacOS or Linux)

To open the sample app:

  1. Navigate to /EOS-SDK/Samples/Voice/Client/

  2. Run: ./Run.sh (or you can run Run.command from Finder on Mac).

  3. Add -serverport <port> to change the server port.

  4. Add -serverurl <url> to change the server URL.

Using the Voice Client Sample App

To log in with the Developer Authentication Tool, select the Dev Auth option and choose Log In. Once you have logged in, the Voice Client sample app includes the following options:

VClient1.png

JOIN

Click on JOIN to start the join room process. A request will be made via the Server application to get a join room token which will then be used to join the room.

Since there are no other players in the current room a new room will be created and you will be added to the room. The room ID will be shown in the "Room:" box and the "ROOM MEMBERS" table will be updated to show you added to the room:

VClient2.png

LEAVE

Use LEAVE room to leave the current room you are currently a member of.

MUTE

MUTE is available only for the local user and it can be used to mute your audio. When your audio is muted you will see the audio status icon change to a red color as shown below:

VClient3.png

OWNER-ONLY

If you are the owner of the room you will have the option of muting another user or kicking them from the current room:

VClient4.png

REMOTE MUTE

Click REMOTE MUTE to mute that user.

KICK

Click KICK to kick that user from the current room, they will not be able to rejoin unless a new room join token is requested and granted.

CHAT

VClient5.png

Click CHAT next to a friend's name in the friends list and you will be added to their room to allow you to chat with them.

You can also join the same room as another player who is not your friend using the JOIN console command.

AUDIO DEVICES

You can change the output and input audio devices using the dropdowns in the SETUP dialog:

VClient6.png

SPEAKING STATUS

When a user is speaking the audio status icon will change to a green color and a full speaker:

VClient7.png

Console Commands

JOIN

  • Usage: "JOIN ROOM_NAME".

  • Starts the join room process for the local user.

  • If ROOM_NAME is supplied that room will be joined if allowed.

  • If ROOM_NAME is not supplied a new room will be created and joined.

LEAVE

  • Usage: "LEAVE"

  • The local user will leave the current room.

KICK

  • Usage: "KICK USER_ID".

  • Kicks a user from the current room.

  • Will do nothing if you are not the room owner.

  • USER_ID is a ProductUserId.

REMOTEMUTE

  • Usage: "REMOTEMUTE USER_ID MUTE".

  • Sets remote mute state for a user.

  • Will do nothing if you are not the room owner.

  • USER_ID is a ProductUserId.

  • MUTE is 1 to mute and 0 to unmute.

Voice Server

VServer1.png

Setup for Windows 32/64-bit

This section covers building and running the Voice Server sample app for both 32-bit and 64-bit Windows operating systems.

Building the Voice Server Sample App for Win64/Win32

  1. Unzip EOS-SDK.zip into your location of choice.

  2. Navigate to \EOS-SDK\Samples\.

  3. Double-click Samples.sln. Visual Studio will open with it in the Solution Explorer.

  4. Set the StartUp Project to VoiceServer.

  5. Open SampleConstants.h and update ProductId, SandboxId, DeploymentId, ClientCredentialsId, and ClientCredentialsSecret based on the values for your Test App.

  6. Select the solution configuration. Use either Release or Debug.

  7. Select the solution platform: x64 (Win64) or x86 (Win32).

  8. In the Solution Explorer, right-click the VoiceServer project and select Build.

  9. After a successful build, you should have VoiceServer.exe available under \EOS-SDK\Samples\Voice\Server\Bin\Win64\Release\

You can now run the sample application.

Running the Voice Server Sample App (Win64/Win32)

To run the Voice Server sample app:

  1. Navigate to e.g. \EOS-SDK\Samples\Voice\Server\Bin\Win64\Release\

  2. Run VoiceServer.exe

  3. Add -voiceserverport <port> to change the server listen port.

  4. Add -voiceserverurl <url> to change the server URL.

Setup for MacOS or Linux

Setup Prerequisites

To build the Voice Server sample application on MacOS, you will need to install the following dependencies:

  • cmake

  • gcc (through Command Line Tools for Xcode for Mac)

Building the Voice Client Sample App for MacOS or Linux

  1. Unzip EOS-SDK.zip into your location of choice.

  2. In Terminal, navigate to /EOS-SDK/Samples/Voice/Server/

  3. Open SampleConstants.h and update ProductId, SandboxId, DeploymentId, ClientCredentialsId, and ClientCredentialsSecret based on the values for your Test App.

  4. Run: ./Build.sh (or you can run Build.command from Finder on Mac).

  5. Once the build successfully completes, you will have newly created files under: /EOS-SDK/Samples/Voice/Server/Build/

You are now ready to run the sample application.

Running the Voice Server Sample App (MacOS)

To open the sample app:

  1. Navigate to /EOS-SDK/Samples/Voice/Server/

  2. Run: ./Run.sh (or you can run Run.command from Finder on Mac).

  3. Add -voiceserverport <port> to change the server listen port.

  4. Add -voiceserverurl <url> to change the server URL.

Using the Voice Server Sample App

The Voice Server is a console-based application so there are no GUI elements, debug text will be printed to the console and to the debug log file (default: DebugOutput.log). Errors will be printed out as red text and warnings as yellow text.

Once the Voice Server application has been started it can be left running and will process requests from multiple clients.

Use Ctrl+C to stop the Server application.