Playing sound on speaker in PS4 controller using event bank


(Yuk Yat Cheng) #1

Hello

I am now developing a PS4 game and try to output sounds from the speaker in PS4 controller. I have found an example in low level API, but since I would like to use FMOD Studio to create events for the sounds, I would like to ask if I can play the sounds by using the events I have defined in FMOD Studio instead of directly loading the audio file (just like the method used in the low level API example).

Thank you.

Regards
Sunny Cheng


(Nicholas Wilcox) #2

If you use the functions Bus::getChannelGroup or EventInstance::getChannelGroup you can play events through the controller speaker using the code from the low level example.


(Yuk Yat Cheng) #3

I have successfully get the channel group using EventInstance::getChannelGroup, but in the code from the low level example, a FMOD::Sound pointer is also needed when calling FMOD::System::playSound() to output sound to the speaker in PS4 controller. In the sample code, it creates the FMOD::Sound object by directly loading the audio file. Are there any methods which I can create the FMOD::Sound object by using the event name defined in FMOD Studio?
Also, I have tried to add a self-created controller channel group, which is similar to the ‘controllerPort’ object in the low level sample code, to the retrieved channel group as a child, but it does not work. Is this a proper way to output sound to the speaker in PS4 controller?
If possible, may I have some sample code for this issue other than the low level example?
Thank you.


(Nicholas Wilcox) #4

You’re overthinking things. Just take the channel group from the event or bus and call attachChannelGroupToPort() with it. That is all.


(Yuk Yat Cheng) #5

Thanks Nicholas. It works when I attach the channel group retrieved from the event instance to controller port through low level system.