HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
|
manages the native audio classes. More...
#include <Audio.h>
Public Member Functions | |
void | SetOnAudioDeviceAddedHandler (Heph::EventHandler handler) |
void | AddOnAudioDeviceAddedHandler (Heph::EventHandler handler) |
void | SetOnAudioDeviceRemovedHandler (Heph::EventHandler handler) |
void | AddOnAudioDeviceRemovedHandler (Heph::EventHandler handler) |
void | SetOnCaptureHandler (Heph::EventHandler handler) |
void | AddOnCaptureHandler (Heph::EventHandler handler) |
Audio () | |
Audio (AudioAPI api) | |
Audio (const Audio &)=delete | |
Audio & | operator= (const Audio &)=delete |
~Audio () | |
Native::NativeAudio * | GetNativeAudio () const |
std::shared_ptr< IAudioDecoder > | GetAudioDecoder () const |
void | SetAudioDecoder (std::shared_ptr< IAudioDecoder > pNewDecoder) |
std::shared_ptr< IAudioEncoder > | GetAudioEncoder () const |
void | SetAudioEncoder (std::shared_ptr< IAudioEncoder > pNewEncoder) |
AudioObject * | Play (const std::filesystem::path &filePath) |
AudioObject * | Play (const std::filesystem::path &filePath, uint32_t playCount) |
AudioObject * | Play (const std::filesystem::path &filePath, uint32_t playCount, bool isPaused) |
AudioObject * | Load (const std::filesystem::path &filePath) |
AudioObject * | Load (const std::filesystem::path &filePath, uint32_t playCount) |
AudioObject * | Load (const std::filesystem::path &filePath, uint32_t playCount, bool isPaused) |
AudioObject * | CreateAudioObject (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 |
AudioObject * | GetAudioObject (size_t index) const |
AudioObject * | GetAudioObject (const Heph::Guid &audioObjectId) |
AudioObject * | GetAudioObject (const std::string &audioObjectName) const |
size_t | GetAudioObjectCount () const |
void | ResumeCapture () |
void | PauseCapture () |
bool | IsCapturePaused () const |
uint32_t | GetDeviceEnumerationPeriod () const |
void | SetDeviceEnumerationPeriod (uint32_t deviceEnumerationPeriod_ms) |
void | SetMasterVolume (double volume) |
double | GetMasterVolume () const |
const AudioFormatInfo & | GetRenderFormat () const |
const AudioFormatInfo & | GetCaptureFormat () const |
void | InitializeRender () |
void | InitializeRender (AudioChannelLayout channelLayout, uint32_t sampleRate) |
void | InitializeRender (AudioFormatInfo format) |
void | InitializeRender (AudioDevice *device, AudioFormatInfo format) |
void | StopRendering () |
void | InitializeCapture () |
void | InitializeCapture (AudioChannelLayout channelLayout, uint32_t sampleRate) |
void | InitializeCapture (AudioFormatInfo format) |
void | InitializeCapture (AudioDevice *device, AudioFormatInfo format) |
void | StopCapturing () |
void | GetNativeParams (Native::NativeAudioParams &nativeParams) const |
void | SetNativeParams (const Native::NativeAudioParams &nativeParams) |
AudioDevice | GetAudioDeviceById (const std::string &deviceId) const |
AudioDevice | GetRenderDevice () const |
AudioDevice | GetCaptureDevice () const |
AudioDevice | GetDefaultAudioDevice (AudioDeviceType deviceType) const |
std::vector< AudioDevice > | GetAudioDevices (AudioDeviceType deviceType) const |
manages the native audio classes.
HephAudio::Audio::Audio | ( | ) |
creates a new instance and initializes it with default values.
HephAudio::Audio::Audio | ( | AudioAPI | api | ) |
creates a new instance and initializes it with the provided values.
api | the native audio API that will be used. |
HephAudio::Audio::~Audio | ( | ) |
releases the resources and destroys the instance.
Native::NativeAudio * HephAudio::Audio::GetNativeAudio | ( | ) | const |
gets the pointer to the native audio instance that's internally used.
std::shared_ptr< IAudioDecoder > HephAudio::Audio::GetAudioDecoder | ( | ) | const |
gets the shared pointer to the audio decoder instance.
void HephAudio::Audio::SetAudioDecoder | ( | std::shared_ptr< IAudioDecoder > | pNewDecoder | ) |
sets the decoder.
pNewDecoder | shared pointer to the new decoder. |
std::shared_ptr< IAudioEncoder > HephAudio::Audio::GetAudioEncoder | ( | ) | const |
gets the shared pointer to the audio encoder instance.
void HephAudio::Audio::SetAudioEncoder | ( | std::shared_ptr< IAudioEncoder > | pNewEncoder | ) |
sets the encoder.
pNewEncoder | shared pointer to the new encoder. |
AudioObject * HephAudio::Audio::Play | ( | const std::filesystem::path & | filePath | ) |
reads the file, then starts playing it.
filePath | path of the file which will be played. |
AudioObject * HephAudio::Audio::Play | ( | const std::filesystem::path & | filePath, |
uint32_t | playCount ) |
reads the file, then starts playing it.
filePath | path of the file which will be played. |
playCount | number of times the file will be played. |
AudioObject * HephAudio::Audio::Play | ( | const std::filesystem::path & | filePath, |
uint32_t | playCount, | ||
bool | isPaused ) |
reads the file, then starts playing it.
filePath | path of the file which will be played. |
playCount | number of times the file will be played. |
isPaused | indicates whether to start playing the audio data after reading it to memory. |
AudioObject * HephAudio::Audio::Load | ( | const std::filesystem::path & | filePath | ) |
reads the file and converts the audio data to the render format but does not start playing it.
filePath | path of the file which will be loaded. |
AudioObject * HephAudio::Audio::Load | ( | const std::filesystem::path & | filePath, |
uint32_t | playCount ) |
reads the file and converts the audio data to the render format but does not start playing it.
filePath | path of the file which will be loaded. |
playCount | number of times the file will be played. |
AudioObject * HephAudio::Audio::Load | ( | const std::filesystem::path & | filePath, |
uint32_t | playCount, | ||
bool | isPaused ) |
reads the file and converts the audio data to the render format but does not start playing it.
filePath | path of the file which will be loaded. |
playCount | number of times the file will be played. |
isPaused | indicates whether to start playing the audio data after loading it. |
AudioObject * HephAudio::Audio::CreateAudioObject | ( | const std::string & | name, |
size_t | bufferFrameCount, | ||
AudioChannelLayout | channelLayout, | ||
uint16_t | sampleRate ) |
creates an audio object with the provided buffer info.
name | name for the audio object. |
bufferFrameCount | number of frames the buffer will have. |
channelLayout | channel layout of the buffer. |
sampleRate | sample rate of the buffer. |
bool HephAudio::Audio::DestroyAudioObject | ( | AudioObject * | pAudioObject | ) |
destroys the audio object.
pAudioObject | pointer to the object which will be destroyed. |
bool HephAudio::Audio::DestroyAudioObject | ( | const Heph::Guid & | audioObjectId | ) |
destroys the audio object.
audioObjectId | unique identifier of the object which will be destroyed. |
bool HephAudio::Audio::AudioObjectExists | ( | AudioObject * | pAudioObject | ) | const |
bool HephAudio::Audio::AudioObjectExists | ( | const Heph::Guid & | audioObjectId | ) | const |
AudioObject * HephAudio::Audio::GetAudioObject | ( | size_t | index | ) | const |
gets the audio object.
index | index of the audio object. |
AudioObject * HephAudio::Audio::GetAudioObject | ( | const Heph::Guid & | audioObjectId | ) |
gets the audio object.
audioObjectId | unique identifier of the audio object. |
AudioObject * HephAudio::Audio::GetAudioObject | ( | const std::string & | audioObjectName | ) | const |
gets the first audio object with the provided name.
audioObjectName | name of the audio object. |
size_t HephAudio::Audio::GetAudioObjectCount | ( | ) | const |
gets the number of audio objects currently present.
void HephAudio::Audio::ResumeCapture | ( | ) |
resumes capturing.
void HephAudio::Audio::PauseCapture | ( | ) |
pauses capturing.
bool HephAudio::Audio::IsCapturePaused | ( | ) | const |
checks whether the capturing is paused.
uint32_t HephAudio::Audio::GetDeviceEnumerationPeriod | ( | ) | const |
void HephAudio::Audio::SetDeviceEnumerationPeriod | ( | uint32_t | deviceEnumerationPeriod_ms | ) |
void HephAudio::Audio::SetMasterVolume | ( | double | volume | ) |
sets the master volume.
volume | new master volume. |
double HephAudio::Audio::GetMasterVolume | ( | ) | const |
gets the master volume.
const AudioFormatInfo & HephAudio::Audio::GetRenderFormat | ( | ) | const |
gets the audio format used for rendering.
const AudioFormatInfo & HephAudio::Audio::GetCaptureFormat | ( | ) | const |
gets the audio format used for capturing.
void HephAudio::Audio::InitializeRender | ( | ) |
initializes rendering with the default device and default format.
void HephAudio::Audio::InitializeRender | ( | AudioChannelLayout | channelLayout, |
uint32_t | sampleRate ) |
initializes rendering with the default device and the provided format.
channelLayout | channel layout of the render format. |
sampleRate | sample rate of the render format. |
void HephAudio::Audio::InitializeRender | ( | AudioFormatInfo | format | ) |
initializes rendering with the default device and the provided format.
format | render format. |
void HephAudio::Audio::InitializeRender | ( | AudioDevice * | device, |
AudioFormatInfo | format ) |
initializes rendering with the provided device and the provided format.
device | pointer to the audio render device. |
format | render format. |
void HephAudio::Audio::StopRendering | ( | ) |
stops rendering and releases the resources allocated for it.
void HephAudio::Audio::InitializeCapture | ( | ) |
initializes capturing with the default device and default format.
void HephAudio::Audio::InitializeCapture | ( | AudioChannelLayout | channelLayout, |
uint32_t | sampleRate ) |
initializes capturing with the default device and the provided format.
channelLayout | channel layout of the capture format. |
sampleRate | sample rate of the capture format. |
void HephAudio::Audio::InitializeCapture | ( | AudioFormatInfo | format | ) |
initializes capturing with the default device and the provided format.
format | capture format. |
void HephAudio::Audio::InitializeCapture | ( | AudioDevice * | device, |
AudioFormatInfo | format ) |
initializes capturing with the provided device and the provided format.
device | pointer to the audio capture device. |
format | capture format. |
void HephAudio::Audio::StopCapturing | ( | ) |
stops capturing and releases the resources allocated for it.
void HephAudio::Audio::GetNativeParams | ( | Native::NativeAudioParams & | nativeParams | ) | const |
gets the native API specific parameters.
void HephAudio::Audio::SetNativeParams | ( | const Native::NativeAudioParams & | nativeParams | ) |
sets the native API specific parameters.
AudioDevice HephAudio::Audio::GetAudioDeviceById | ( | const std::string & | deviceId | ) | const |
gets audio device by id.
AudioDevice HephAudio::Audio::GetRenderDevice | ( | ) | const |
gets the audio device that's currently being used for rendering.
AudioDevice HephAudio::Audio::GetCaptureDevice | ( | ) | const |
gets the audio device that's currently being used for capturing.
AudioDevice HephAudio::Audio::GetDefaultAudioDevice | ( | AudioDeviceType | deviceType | ) | const |
gets the system default render/capture device.
deviceType | type of the device. Must be either AudioDeviceType::Render or AudioDeviceType::Capture . |
std::vector< AudioDevice > HephAudio::Audio::GetAudioDevices | ( | AudioDeviceType | deviceType | ) | const |
gets the available audio devices of the requested type.
deviceType | type of the audio devices. |