Ok, I was able to grab a google daydream and cook a map with a looping sound and I was able to repro the pause issue.
I fixed the issue by adding the following code.
In AndroidEventManager.cpp, change the PauseAudio and ResumeAudio functions to:
void FAppEventManager::PauseAudio()
{
bAudioPaused = true;
FAudioDevice* AudioDevice = GEngine->GetMainAudioDevice();
if (AudioDevice)
{
if (AudioDevice->IsAudioMixerEnabled())
{
AudioDevice->SuspendContext();
}
else
{
AudioDevice->Suspend(false);
}
}
}
void FAppEventManager::ResumeAudio()
{
bAudioPaused = false;
FAudioDevice* AudioDevice = GEngine->GetMainAudioDevice();
if (AudioDevice)
{
if (AudioDevice->IsAudioMixerEnabled())
{
AudioDevice->ResumeContext();
}
else
{
AudioDevice->Suspend(true);
}
}
}
Then, in AudioMixerDevice.cpp, make sure the FMixerDevice::ResumeContext() and FMixerDevice::SuspendContext() forwards the command to the platform interface:
void FMixerDevice::ResumeContext()
{
AudioMixerPlatform->ResumeContext();
}
void FMixerDevice::SuspendContext()
{
AudioMixerPlatform->SuspendContext();
}
This forwards to the platform interface (the very thin platform dependent layer in audio mixer). Then, in AudioMixerPlatformAndroid.h/.cpp, implement these functions. There already was a stub implementation in there with a dumb comment. Add the following (or, really move it) up to the //~ Begin IAudioMixerPlatformInterface block.
virtual void SuspendContext() override;
virtual void ResumeContext() override;
Then delete the old stub implementation, and then do the following implementation
static bool bSuspended = false;
void FMixerPlatformAndroid::SuspendContext()
{
if (!bSuspended)
{
bSuspended = true;
// set the player's state to paused
SLresult result = (*SL_PlayerPlayInterface)->SetPlayState(SL_PlayerPlayInterface, SL_PLAYSTATE_PAUSED);
check(SL_RESULT_SUCCESS == result);
}
}
void FMixerPlatformAndroid::ResumeContext()
{
// set the player's state to paused
if (bSuspended)
{
bSuspended = false;
SLresult result = (*SL_PlayerPlayInterface)->SetPlayState(SL_PlayerPlayInterface, SL_PLAYSTATE_PLAYING);
check(SL_RESULT_SUCCESS == result);
}
}
I just tested on google daydream with this change and it appears to have fixed the issue.
Let me know if this fixes it for you, I’ll try and get the change out with the next 4.17 hotfix.