HephAudio v3.1.0
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 | |
Audio () | |
Audio (AudioAPI api) | |
std::shared_ptr< 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 * | Load (const std::filesystem::path &filePath) |
AudioObject * | Load (const std::filesystem::path &filePath, uint32_t playCount) |
AudioObject * | CreateAudioObject (const std::string &name, size_t bufferFrameCount, AudioChannelLayout channelLayout, uint32_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 (const AudioChannelLayout &channelLayout, uint32_t sampleRate) |
void | InitializeRender (AudioFormatInfo format) |
void | InitializeRender (AudioDevice *device, const AudioChannelLayout &channelLayout, uint32_t sampleRate) |
void | InitializeRender (AudioDevice *device, AudioFormatInfo format) |
void | StopRendering () |
void | InitializeCapture () |
void | InitializeCapture (const AudioChannelLayout &channelLayout, uint32_t sampleRate) |
void | InitializeCapture (AudioFormatInfo format) |
void | InitializeCapture (AudioDevice *device, const AudioChannelLayout &channelLayout, uint32_t sampleRate) |
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 |
Public Attributes | |
Heph::Event & | OnAudioDeviceAdded |
Heph::Event & | OnAudioDeviceRemoved |
Heph::Event & | OnCapture |
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. |
std::shared_ptr< Native::NativeAudio > HephAudio::Audio::GetNativeAudio | ( | ) | const |
gets the shared 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::Load | ( | const std::filesystem::path & | filePath | ) |
reads the file 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 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::CreateAudioObject | ( | const std::string & | name, |
size_t | bufferFrameCount, | ||
AudioChannelLayout | channelLayout, | ||
uint32_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 | ( | const 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, |
const AudioChannelLayout & | channelLayout, | ||
uint32_t | sampleRate ) |
initializes rendering with the provided device and the provided format.
device | pointer to the audio render device. |
channelLayout | channel layout of the render format. |
sampleRate | sample rate of the 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 | ( | const 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, |
const AudioChannelLayout & | channelLayout, | ||
uint32_t | sampleRate ) |
initializes capturing with the provided device and the provided format.
device | pointer to the audio capture device. |
channelLayout | channel layout of the capture format. |
sampleRate | sample rate of the 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. |
Heph::Event& HephAudio::Audio::OnAudioDeviceAdded |
raised when an audio device is connected to the device or activated.
Heph::Event& HephAudio::Audio::OnAudioDeviceRemoved |
raised when an audio device is disconnected from the device or deactivated.
Heph::Event& HephAudio::Audio::OnCapture |
raised when sufficient amount of audio data is captured.