x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I make in game voice communication?

I have not been able to find any examples online so I'm trying to use information in the documentation to help develop a means of in game voice chat.

I'm trying to check for voice input from a microphone.

OnlineVoiceImpl and VoiceEngineImp look good places to start but including either of the headers for these classes breaks my build.

Any help will be greatly appreciated.

Product Version: Not Selected
Tags:
more ▼

asked May 28 '14 at 08:24 PM in C++ Programming

avatar image

SpaceComplexity
56 3 5 8

avatar image SpaceComplexity May 28 '14 at 08:42 PM

VoiceInterface.h generates errors on the following line DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnPlayerTalkingStateChanged, TSharedRef, bool);

syntax error : identifier 'OnPlayerTalkingStateChanged' missing type specifier int assumed

avatar image Burnz Oct 26 '17 at 07:44 PM

I know this is an old topic but i recently released my VoiceChat plugin on the marketplace. Source code is included. So in case you want a working solution check out https://www.unrealengine.com/marketplace/ultimate-voicechat-for-blueprints

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Voice support is fully supported on any Steam platform. Additionally I have implemented voice support using the Opus Codec. The codec itself is implemented and integrated for Mac/Linux/Windows, but I have only implemented voice capture support for Windows via DirectSound. The Mac/Linux mic capture would need to be implemented.

  • Voice capture is implemented in the IVoiceCapture interface.
    • this handles all voice capture for a platform

  • Voice codec is implemented via the IVoiceEncoder/IVoiceDecoder interfaces.
    • these are separated out because we need a decoder per player in opus, since it is stateful

  • VoIP is handled via IVoiceEngine and IVoiceInterface
    • the engine handles putting the capture/codec together to provide a packet of data to transmit

    • the interface handles hooking up the game to the engine so that we can provide muting and transmission

Right now OnlineSubsystemSteam and OnlineSubsystemNull both provide voice chat support using their respective interfaces.

  • OnlineSubsystem::Tick
    • Retrieve any local voice data ProcessLocalVoicePackets and add it to an array to be sent out (`FVoiceDataImpl` for example)

  • NetDriver::ProcessLocalClientPackets sends packets to the server

  • NetDriver::ProcessLocalServerPackets sends packets to other clients

  • Clients receive packets in UVoiceChannel::ReceivedBunch
    • Packets are opened and given to the IOnlineVoice for processing
      • IOnlineVoice decompresses the audio and plays it via IVoiceEngine in ProcessRemoteVoicePackets

It should be working in Shootergame, although there may be a few ini settings that need to be verified. Most things should be handled for you, if you use the OnlineSubsystem IOnlineSession. Creating sessions and registering players will set them up to be able to use voice.

DefaultEngine.ini

 [Voice] 
 bEnabled=true
 
 [OnlineSubsystem] 
 bHasVoiceEnabled=true

In DefaultGame.ini

 [/Script/Engine.GameSession]
 bRequiresPushToTalk=false


If you want push to talk, you'll need to implement a key input binding and then call Start/StopNetworkedVoice. Look at ToggleSpeaking, an exec function on PlayerController. I'm not well versed on the Input mapping code, but the entries here call exec functions or bind to keys.

Base/DefaultInput.ini

 [/Script/Engine.PlayerInput]
 +DebugExecBindings=(Key=T,Command="ToggleSpeaking true | OnRelease ToggleSpeaking false")
 
 [/Script/Engine.InputSettings]
 +ActionMappings=(ActionName="PushToTalk", Key=T)


more ▼

answered May 29 '14 at 03:35 PM

avatar image

Crzyhomer STAFF
1.3k 35 26 103

avatar image SpaceComplexity May 31 '14 at 10:59 PM

Should I be able to hear myself if I talk into a microphone with two players registered to one session? I made the changes to the ini settings that you mentioned and hold down the 'T' key in a session with two players but still get no feedback.

avatar image Crzyhomer STAFF Jun 10 '14 at 06:29 PM

I'm not sure Shootergame has push to talk implemented, so you would want to set the bRequiresPushToTalk=false to leave the voice on all the time.

There is a cheat command call DumpVoiceMutingState that will print out a bunch of information when the two players are connected. If you could run that and paste it here it would be helpful.

avatar image birdfreeyahoo Jul 26 '14 at 02:41 PM

Hey, can I catch the reception of the voice packets? Because I want to apply a filter on them AND play them in a certain position in world.

avatar image Crzyhomer STAFF Jul 28 '14 at 01:37 PM

There is no support for this out of the box right now. The voice packets are handled internally and either routed to the platform APIs (LIVE/Steam) or to our AudioComponent system (NULL) for playback.

You could modify code in the following place to intercept the voice packets.

 UVoiceChannel::ReceivedBunch(FInBunch& Bunch)

This serializes the network voice packet and adds it to the VoiceData.RemotePackets variable on most platforms. If you take the packet yourself you'd have to put it back on that array or make sure to play the data somehow.

avatar image devel.bmad Feb 04 '15 at 10:58 PM

Does this mean that a client on mac should be able to play voice chat from remote client but not to capture and send voice?

avatar image Crzyhomer STAFF Mar 12 '15 at 05:27 AM

So sorry for the delay here, it totally slipped the cracks.

Yes, as it currently stands Opus is compiled for Mac and the code should be cross platform. If you received an Opus voice packet it should be decompressed and routed to our AudioComponent which would play on Mac.

That being said, I haven't tested and in fact think that the factory method for the voice codec interface is probably not enabled on Mac. Could/should be doable.

Implementing Mic capture on Mac hasn't been prioritized.

avatar image Muzaheed Mar 26 '15 at 09:13 AM

dont know what wrong happening on my side. not OnlineSubsystemSteam . i am trying it through lan. do i supposed to do anything for OnlineSubsystemNull ?

avatar image Crzyhomer STAFF Apr 01 '15 at 01:38 AM

Not sure exactly what the problem you are having is. Are you trying to get Steam and instead getting NULL? Do you want NULL and its not working?

Both Steam and NULL interfaces have voice support, but they do require you use the Session APIs to create/join a multiplayer session so UniqueIds for each player are involved. That will allow you to mute players and do other game logic.

There is a thread on the forums where I try to answer this in great detail here.

avatar image IrishMTS Apr 01 '16 at 09:33 PM

Hey, just want to make it clear to others something that I've only really determined now. The voice module itself is essentially implicit. The only things to implement the basic model is to just make the required changes to the .ini files, and then set up a multiplayer session. There's no need to delve into the source code yourself.

avatar image IronTaxi Feb 09 '17 at 09:22 PM

Setting up a voice audio class in the project settings is also important. not assigned by default.

this will allow you to control the volume of voice independently.

avatar image JJGG117 Aug 13 '17 at 06:14 PM

How can I assign non-PushToTalk voice its own sound class without C++?

avatar image Jason Chou Jun 15 '17 at 04:14 AM

Hi, I used "OnlineSubsystemNull" to creat/join sessions and followed the setting with Josh. Client could send and receive voice when I tested in editor ,but Server was no voice. When I packaged to two computers and tested each other, there weren't voice, What 's going wrong? any one can help me,please?

avatar image Jason Chou Jun 15 '17 at 06:34 AM

hey guys, that's my fault, two computer all need microphones.

avatar image JJGG117 Aug 13 '17 at 06:14 PM

How can I switch between PushToTalk and Non-PushToTalk in Blueprints? Basically re-write the .ini file every time I change a bool?

avatar image ANonSmartMan Jul 30 '18 at 05:01 PM

Thanks for posting this. Very helpful. What I'm wondering is how can I set up multiple voice channels so that my teams don't hear each other? It doesn't seem clear from the example in Shooter Game. I'm looking at that code and I keep searching for some voice channel code or something. How is this handled in the team deathmatch game mode? Certainly the players aren't listening to the opponents' voices during a match.

Any help would be greatly appreciated.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question