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::AndroidAudioBase Class Reference

base class for classes that interact with the Android audio APIs. More...

#include <AndroidAudioBase.h>

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

Public Member Functions

 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)
 
virtual void SetMasterVolume (double volume)=0
 
virtual double GetMasterVolume () const =0
 
const AudioFormatInfoGetRenderFormat () const
 
const AudioFormatInfoGetCaptureFormat () const
 
void InitializeRender ()
 
void InitializeRender (AudioChannelLayout channelLayout, uint32_t sampleRate)
 
void InitializeRender (AudioFormatInfo format)
 
virtual void InitializeRender (AudioDevice *device, AudioFormatInfo format)=0
 
virtual void StopRendering ()=0
 
void InitializeCapture ()
 
void InitializeCapture (AudioChannelLayout channelLayout, uint32_t sampleRate)
 
void InitializeCapture (AudioFormatInfo format)
 
virtual void InitializeCapture (AudioDevice *device, AudioFormatInfo format)=0
 
virtual void StopCapturing ()=0
 
virtual void GetNativeParams (NativeAudioParams &nativeParams) const =0
 
virtual void SetNativeParams (const NativeAudioParams &nativeParams)=0
 
AudioDevice GetAudioDeviceById (const std::string &deviceId) const
 
AudioDevice GetRenderDevice () const
 
AudioDevice GetCaptureDevice () const
 
AudioDevice GetDefaultAudioDevice (AudioDeviceType deviceType) const
 
std::vector< AudioDeviceGetAudioDevices (AudioDeviceType deviceType) const
 

Static Public Attributes

static JavaVM * jvm
 

Protected Member Functions

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

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
 

Additional Inherited Members

- Public Attributes inherited from HephAudio::Native::NativeAudio
Heph::Event OnAudioDeviceAdded
 
Heph::Event OnAudioDeviceRemoved
 
Heph::Event OnCapture
 
- Static Protected Attributes inherited from HephAudio::Native::NativeAudio
static constexpr bool DEVICE_ENUMERATION_FAIL = false
 
static constexpr bool DEVICE_ENUMERATION_SUCCESS = true
 

Detailed Description

base class for classes that interact with the Android audio APIs.

Constructor & Destructor Documentation

◆ AndroidAudioBase()

HephAudio::Native::AndroidAudioBase::AndroidAudioBase ( )

creates a new instance and initializes it with default values.

◆ ~AndroidAudioBase()

virtual HephAudio::Native::AndroidAudioBase::~AndroidAudioBase ( )
virtual

releases the resources and destroys the instance.

Member Function Documentation

◆ EnumerateAudioDevices()

bool HephAudio::Native::AndroidAudioBase::EnumerateAudioDevices ( )
overrideprotectedvirtual

enumerates the audio devices.

Returns
DEVICE_ENUMERATION_SUCCESS if succeded, otherwise DEVICE_ENUMERATION_FAIL.

Implements HephAudio::Native::NativeAudio.

Member Data Documentation

◆ deviceApiLevel

uint32_t HephAudio::Native::AndroidAudioBase::deviceApiLevel
protected

API level of the current device.

◆ jvm

JavaVM* HephAudio::Native::AndroidAudioBase::jvm
static

pointer to the Java virtual machine.