Combining the UE4 Plugin and low level system

Hi again!

I’m having a lot of trouble figuring out what the FMOD Studio plugin for UE4 does on my behalf. I’m using the low-level system to create and play sounds, but some things don’t seem to work:

Calling FMOD::Studio::set3DSettings doesn’t seem to actually have an effect. Does the plugin override this? Do I just need to convert my units manually when setting sound origins in code?

I had a lot of trouble trying to position the listener. I think I need to do it using UE’s APlayerController::GetAudioListenerPosition. Is that right? Can I assume FMOD is already adapted to UE’s coordinate system?

To test, I’m printing:

FMOD_3D_ATTRIBUTES ListenerAttributes;
StudioSystem->getListenerAttributes(0, &ListenerAttributes);

printf(ListenerAttributes.position.x, ListenerAttributes.position.y, ListenerAttributes.position.z);

and

PlaybackSoundChannel->set3DAttributes(&Pos, &Vel);
printf(Pos.x, Pos.y, Pos.z);

These values correspond with what I’m seeying in my world when I’m moving my listener and sound source (The coordinates are in FMOD units though). However, I cannot get them to sound right in my headphones. I can walk around my sound source and I notice a difference, but it’s just not as natural sounding as the FMOD examples. Notably, my left earphone/speaker never seems to get a ‘fair amount’ of audio.

Our UE4 integation does indeed call APlayerController::GetAudioListenerPosition, and then converts the units before calling into FMOD. If you look at FMODUtils.h you will see that it converts unreal units of 1 unit = 1cm into units of 1 unit = 1 metre.

It sets the listener position into Studio, which automatically updates the low level listener orientation, so there is nothing more you should need to do there.

You should be able to set positions using the channel set3DAttributes function, as well as customize the falloff with set3DMinMaxDistance - first convert it to metres using the same conversion code as FMODUtils.