Class AudioAnalyzerLoopback

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class AudioAnalyzerLoopback : public AudioAnalyzerSource

Audio Analyzer Loopback Source.

This class will be used to capture the audio in real time from a microphone, can playback the captured audio too

Public Functions

AudioAnalyzerLoopback()

Constructor

~AudioAnalyzerLoopback()

Destructor This will unload the audio too

AudioAnalyzerLoopback(AudioAnalyzerLoopback const &x) = delete

Disable copy constructor

Parameters:

x – —

void operator=(AudioAnalyzerLoopback const &x) = delete

Disable copy assignment

Parameters:

x – —

bool initializeAudio(uint16 numChannels, uint32 sampleRate, int bitDepth, uint8 audioFormat, float audioBufferSeconds, uint32 periodSizeInFrames, uint32 periodSizeInMilliseconds, uint32 periods)

Initializes the capturer audio info and opens the audio capture (and player) device

Parameters:
  • numChannels – Number of channels

  • sampleRate – Number of samples per second for the capture (and playback)

  • bitDepth – Bits per sample

  • audioFormat – unsigned, signed, float indicator

  • audioBufferSeconds – Audio buffer size in seconds

  • periodSizeInFrames – Device audio buffer size in frames (power of 2), 0 to use default value

  • periodSizeInMilliseconds – Device audio buffer size in milliseconds, 0 to use default value

  • periods – Device audio buffer size multiplier

Returns:

The audio initilization result

void unloadAudio()

Closes the audio capturer (and player) device

void start(bool captureDataBroadcast)

Starts the audio capturer (and player playback)

Parameters:

captureDataBroadcast – Broadcast the captured data buffer

void stop()

Stops the audio capturer (and player playback)

bool isCapturing() const

Returns if the device is currently capturing audio

Returns:

Device is playing

virtual float getPlaybackProgress(float &bufferPosTime)

Returns the total capture duration and buffer postion time

Parameters:

bufferPosTime[out] Current buffer position (seconds)

Returns:

float Duration in seconds

float getPlaybackProgress()

Returns the total capture duration

Returns:

float Duration in seconds

void setDefaultAudioDevice(const FString &capturerDeviceName)

Set default source audio device

Parameters:

capturerDeviceName – Audio device name

void getDefaultAudioDevice(FString &capturerDeviceName)

Get default source audio device

Parameters:

capturerDeviceName[out] Audio device name

const AudioAnalyzerDeviceInfo &getAudioDeviceInfo() const

Returns the audio device info

Returns:

Audio device info structure

inline virtual bool hasOnlyHeader() const

Returns if only has been loaded the header data

Returns:

Has onkly header data

inline virtual bool needsBufferOffset() const

Returns if the buffer needs to be offset

Returns:

Needs buffer offset

void registerOnCapturedData(std::function<void(TArray<uint8>)> callback)

Registers the called function when the audio capture device has data

Parameters:

callback – Function callback