HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
HephAudio::Native::AndroidAudioSLES Class Referencefinal

uses OpenSL ES More...

#include <AndroidAudioSLES.h>

Inheritance diagram for HephAudio::Native::AndroidAudioSLES:
HephAudio::Native::AndroidAudioBase HephAudio::Native::NativeAudio

Public Member Functions

 AndroidAudioSLES ()
 
 AndroidAudioSLES (const AndroidAudioSLES &)=delete
 
AndroidAudioSLESoperator= (const AndroidAudioSLES &)=delete
 
 ~AndroidAudioSLES ()
 
void SetMasterVolume (double volume) override
 
double GetMasterVolume () const override
 
void InitializeRender (AudioDevice *device, AudioFormatInfo format) override
 
void StopRendering () override
 
void InitializeCapture (AudioDevice *device, AudioFormatInfo format) override
 
void StopCapturing () override
 
void GetNativeParams (NativeAudioParams &nativeParams) const override
 
void SetNativeParams (const NativeAudioParams &nativeParams) override
 
void InitializeRender ()
 
void InitializeRender (AudioChannelLayout channelLayout, uint32_t sampleRate)
 
void InitializeRender (AudioFormatInfo format)
 
void InitializeCapture ()
 
void InitializeCapture (AudioChannelLayout channelLayout, uint32_t sampleRate)
 
void InitializeCapture (AudioFormatInfo format)
 
- Public Member Functions inherited from HephAudio::Native::AndroidAudioBase
 AndroidAudioBase ()
 
 AndroidAudioBase (const AndroidAudioBase &)=delete
 
AndroidAudioBaseoperator= (const AndroidAudioBase &)=delete
 
virtual ~AndroidAudioBase ()
 
- Public Member Functions inherited from HephAudio::Native::NativeAudio
 NativeAudio ()
 
 NativeAudio (const NativeAudio &)=delete
 
NativeAudiooperator= (const NativeAudio &)=delete
 
virtual ~NativeAudio ()=default
 
std::shared_ptr< IAudioDecoderGetAudioDecoder () const
 
void SetAudioDecoder (std::shared_ptr< IAudioDecoder > pNewDecoder)
 
std::shared_ptr< IAudioEncoderGetAudioEncoder () const
 
void SetAudioEncoder (std::shared_ptr< IAudioEncoder > pNewEncoder)
 
AudioObjectPlay (const std::filesystem::path &filePath)
 
AudioObjectPlay (const std::filesystem::path &filePath, uint32_t playCount)
 
AudioObjectPlay (const std::filesystem::path &filePath, uint32_t playCount, bool isPaused)
 
AudioObjectLoad (const std::filesystem::path &filePath)
 
AudioObjectLoad (const std::filesystem::path &filePath, uint32_t playCount)
 
AudioObjectLoad (const std::filesystem::path &filePath, uint32_t playCount, bool isPaused)
 
AudioObjectCreateAudioObject (const std::string &name, size_t bufferFrameCount, AudioChannelLayout channelLayout, uint16_t sampleRate)
 
bool DestroyAudioObject (AudioObject *pAudioObject)
 
bool DestroyAudioObject (const Heph::Guid &audioObjectId)
 
bool AudioObjectExists (AudioObject *pAudioObject) const
 
bool AudioObjectExists (const Heph::Guid &audioObjectId) const
 
AudioObjectGetAudioObject (size_t index)
 
AudioObjectGetAudioObject (const Heph::Guid &audioObjectId)
 
AudioObjectGetAudioObject (const std::string &audioObjectName)
 
size_t GetAudioObjectCount () const
 
void ResumeCapture ()
 
void PauseCapture ()
 
bool IsCapturePaused () const
 
uint32_t GetDeviceEnumerationPeriod () const
 
void SetDeviceEnumerationPeriod (uint32_t deviceEnumerationPeriod_ms)
 
const AudioFormatInfoGetRenderFormat () const
 
const AudioFormatInfoGetCaptureFormat () const
 
void InitializeRender ()
 
void InitializeRender (AudioChannelLayout channelLayout, uint32_t sampleRate)
 
void InitializeRender (AudioFormatInfo format)
 
void InitializeCapture ()
 
void InitializeCapture (AudioChannelLayout channelLayout, uint32_t sampleRate)
 
void InitializeCapture (AudioFormatInfo format)
 
AudioDevice GetAudioDeviceById (const std::string &deviceId) const
 
AudioDevice GetRenderDevice () const
 
AudioDevice GetCaptureDevice () const
 
AudioDevice GetDefaultAudioDevice (AudioDeviceType deviceType) const
 
std::vector< AudioDeviceGetAudioDevices (AudioDeviceType deviceType) const
 

Additional Inherited Members

- Public Attributes inherited from HephAudio::Native::NativeAudio
Heph::Event OnAudioDeviceAdded
 
Heph::Event OnAudioDeviceRemoved
 
Heph::Event OnCapture
 
- Static Public Attributes inherited from HephAudio::Native::AndroidAudioBase
static JavaVM * jvm
 
- Protected Member Functions inherited from HephAudio::Native::AndroidAudioBase
bool EnumerateAudioDevices () override
 
void GetEnv (JNIEnv **pEnv) const
 
std::string JStringToString (JNIEnv *env, jstring jStr) const
 
- Protected Member Functions inherited from HephAudio::Native::NativeAudio
virtual void CheckAudioDevices ()
 
void JoinRenderThread ()
 
void JoinCaptureThread ()
 
void JoinDeviceThread ()
 
EncodedAudioBuffer Mix (uint32_t frameCount)
 
size_t GetAOCountToMix () const
 
virtual double GetFinalAOVolume (AudioObject *pAudioObject) const
 
- Protected Attributes inherited from HephAudio::Native::AndroidAudioBase
uint32_t deviceApiLevel
 
- Protected Attributes inherited from HephAudio::Native::NativeAudio
std::shared_ptr< IAudioDecoderpAudioDecoder
 
std::shared_ptr< IAudioEncoderpAudioEncoder
 
std::vector< AudioObjectaudioObjects
 
std::vector< AudioDeviceaudioDevices
 
std::thread::id mainThreadId
 
std::thread renderThread
 
std::thread captureThread
 
std::thread deviceThread
 
std::string renderDeviceId
 
std::string captureDeviceId
 
AudioFormatInfo renderFormat
 
AudioFormatInfo captureFormat
 
bool disposing
 
bool isRenderInitialized
 
bool isCaptureInitialized
 
bool isCapturePaused
 
uint32_t deviceEnumerationPeriod_ms
 
std::mutex audioDevicesMutex
 
std::recursive_mutex audioObjectsMutex
 
- Static Protected Attributes inherited from HephAudio::Native::NativeAudio
static constexpr bool DEVICE_ENUMERATION_FAIL = false
 
static constexpr bool DEVICE_ENUMERATION_SUCCESS = true
 

Detailed Description

uses OpenSL ES

Constructor & Destructor Documentation

◆ AndroidAudioSLES()

HephAudio::Native::AndroidAudioSLES::AndroidAudioSLES ( )

creates a new instance and initializes it with default values.

◆ ~AndroidAudioSLES()

HephAudio::Native::AndroidAudioSLES::~AndroidAudioSLES ( )

releases the resources and destroys the instance.

Member Function Documentation

◆ SetMasterVolume()

void HephAudio::Native::AndroidAudioSLES::SetMasterVolume ( double volume)
overridevirtual

sets the master volume.

Parameters
volumenew master volume.
Important
values above 1 may cause distortion.

Implements HephAudio::Native::NativeAudio.

◆ GetMasterVolume()

double HephAudio::Native::AndroidAudioSLES::GetMasterVolume ( ) const
overridevirtual

gets the master volume.

Implements HephAudio::Native::NativeAudio.

◆ InitializeRender() [1/4]

void HephAudio::Native::AndroidAudioSLES::InitializeRender ( AudioDevice * device,
AudioFormatInfo format )
overridevirtual

initializes rendering with the provided device and the provided format.

Parameters
devicepointer to the audio render device.
formatrender format.

Implements HephAudio::Native::NativeAudio.

◆ StopRendering()

void HephAudio::Native::AndroidAudioSLES::StopRendering ( )
overridevirtual

stops rendering and releases the resources allocated for it.

Implements HephAudio::Native::NativeAudio.

◆ InitializeCapture() [1/4]

void HephAudio::Native::AndroidAudioSLES::InitializeCapture ( AudioDevice * device,
AudioFormatInfo format )
overridevirtual

initializes capturing with the provided device and the provided format.

Parameters
devicepointer to the audio capture device.
formatcapture format.

Implements HephAudio::Native::NativeAudio.

◆ StopCapturing()

void HephAudio::Native::AndroidAudioSLES::StopCapturing ( )
overridevirtual

stops capturing and releases the resources allocated for it.

Implements HephAudio::Native::NativeAudio.

◆ GetNativeParams()

void HephAudio::Native::AndroidAudioSLES::GetNativeParams ( NativeAudioParams & nativeParams) const
overridevirtual

gets the native API specific parameters.

Implements HephAudio::Native::NativeAudio.

◆ SetNativeParams()

void HephAudio::Native::AndroidAudioSLES::SetNativeParams ( const NativeAudioParams & nativeParams)
overridevirtual

sets the native API specific parameters.

Implements HephAudio::Native::NativeAudio.

◆ InitializeRender() [2/4]

void HephAudio::Native::NativeAudio::InitializeRender ( )

initializes rendering with the default device and default format.

◆ InitializeRender() [3/4]

void HephAudio::Native::NativeAudio::InitializeRender ( AudioChannelLayout channelLayout,
uint32_t sampleRate )

initializes rendering with the default device and the provided format.

Parameters
channelLayoutchannel layout of the render format.
sampleRatesample rate of the render format.

◆ InitializeRender() [4/4]

void HephAudio::Native::NativeAudio::InitializeRender ( AudioFormatInfo format)

initializes rendering with the default device and the provided format.

Parameters
formatrender format.

◆ InitializeCapture() [2/4]

void HephAudio::Native::NativeAudio::InitializeCapture ( )

initializes capturing with the default device and default format.

◆ InitializeCapture() [3/4]

void HephAudio::Native::NativeAudio::InitializeCapture ( AudioChannelLayout channelLayout,
uint32_t sampleRate )

initializes capturing with the default device and the provided format.

Parameters
channelLayoutchannel layout of the capture format.
sampleRatesample rate of the capture format.

◆ InitializeCapture() [4/4]

void HephAudio::Native::NativeAudio::InitializeCapture ( AudioFormatInfo format)

initializes capturing with the default device and the provided format.

Parameters
formatcapture format.