Files
UnrealEngineUWP/Engine/Source/Runtime/Android/AudioMixerAndroid/Private/AudioMixerPlatformAndroid.h
aaron mcleran 8db0b74958 Cleaning up codec definitions on soundwaves.
- Adding new enumeration to select PCM, ADPCM, Bink, and "platform specific"
- Updated platform codecs and various APIs to select correctly which codec to use
- Changed "is seekable streaming" semantics to "Is Seekable" since that is more correct in a post-stream-caching world
- Tried to clean up platform backends. Unable to move Bink decoder to multiplatform code because of module dependencies, will require a future refactor of our decoder module setup.

#rb Phil.Popp, Jimmy.Smith
#jira UE-140860
#preflight 61f97ad7f02e20f45add6d45

#ROBOMERGE-AUTHOR: aaron.mcleran
#ROBOMERGE-SOURCE: CL 18813332 in //UE5/Release-5.0/... via CL 18813341 via CL 18822758
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18824290 by aaron mcleran in ue5-main branch]
2022-02-02 07:35:13 -05:00

78 lines
2.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "AudioMixer.h"
#include "DSP/Dsp.h"
#include <SLES/OpenSLES.h>
#include "SLES/OpenSLES_Android.h"
// Any platform defines
namespace Audio
{
class FMixerPlatformAndroid : public IAudioMixerPlatformInterface
{
public:
FMixerPlatformAndroid();
~FMixerPlatformAndroid();
//~ Begin IAudioMixerPlatformInterface
virtual EAudioMixerPlatformApi::Type GetPlatformApi() const override { return EAudioMixerPlatformApi::OpenSLES; }
virtual bool InitializeHardware() override;
virtual bool TeardownHardware() override;
virtual bool IsInitialized() const override;
virtual bool GetNumOutputDevices(uint32& OutNumOutputDevices) override;
virtual bool GetOutputDeviceInfo(const uint32 InDeviceIndex, FAudioPlatformDeviceInfo& OutInfo) override;
virtual bool GetDefaultOutputDeviceIndex(uint32& OutDefaultDeviceIndex) const override;
virtual bool OpenAudioStream(const FAudioMixerOpenStreamParams& Params) override;
virtual bool CloseAudioStream() override;
virtual bool StartAudioStream() override;
virtual bool StopAudioStream() override;
virtual FAudioPlatformDeviceInfo GetPlatformDeviceInfo() const override;
virtual void SubmitBuffer(const uint8* Buffer) override;
virtual FName GetRuntimeFormat(const USoundWave* InSoundWave) const override;
virtual ICompressedAudioInfo* CreateCompressedAudioInfo(const FName& InRuntimeFormat) const override;
virtual FString GetDefaultDeviceName() override;
virtual FAudioPlatformSettings GetPlatformSettings() const override;
virtual void SuspendContext() override;
virtual void ResumeContext() override;
//~ End IAudioMixerPlatformInterface
private:
const TCHAR* GetErrorString(SLresult Result);
int32 GetDeviceBufferSize(int32 RenderCallbackSize) const;
SLObjectItf SL_EngineObject;
SLEngineItf SL_EngineEngine;
SLObjectItf SL_OutputMixObject;
SLObjectItf SL_PlayerObject;
SLPlayItf SL_PlayerPlayInterface;
SLAndroidSimpleBufferQueueItf SL_PlayerBufferQueue;
FCriticalSection SuspendedCriticalSection;
bool bSuspended;
bool bInitialized;
bool bInCallback;
// This buffer is pushed to and popped from in the SubmitBuffer callback.
// This is required for devices that require frame counts per callback that are not powers of two.
Audio::TCircularAudioBuffer<int16> CircularOutputBuffer;
// This is the buffer we pop CircularOutputBuffer into in SubmitBuffer.
TArray<int16> DeviceBuffer;
int32 NumSamplesPerRenderCallback;
int32 NumSamplesPerDeviceCallback;
static void OpenSLBufferQueueCallback( SLAndroidSimpleBufferQueueItf InQueueInterface, void* pContext );
};
}