Class AudioAnalyzerCapturer

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class AudioAnalyzerCapturer : public AudioAnalyzerSource

Audio Analyzer Capturer Source.

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

Public Functions

AudioAnalyzerCapturer()

Constructor

~AudioAnalyzerCapturer()

Destructor This will unload the audio too

AudioAnalyzerCapturer(AudioAnalyzerCapturer const &x) = delete

Disable copy constructor

Parameters:

x – —

void operator=(AudioAnalyzerCapturer const &x) = delete

Disable copy assignment

Parameters:

x – —

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

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

Parameters:
  • 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

  • initPlaybackDevice – Intializes a playback device

  • 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 playback, bool enableCapturedDataBroadcast)

Starts the audio capturer (and player playback)

Parameters:
  • playback – Indicates if we want to playback the captured audio too

  • enableCapturedDataBroadcast – Indicates if we want to broadcast the audio capture data

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 setDefaultAudioDevices(const FString &capturerDeviceName, const FString &playerDeviceName)

Set default capturer and player device

Parameters:
  • capturerDeviceName – New default capturer audio device name

  • playerDeviceName – New default player audio device name

void getDefaultAudioDevices(FString &capturerDeviceName, FString &playerDeviceName)

Get default capturer and player device

Parameters:
  • capturerDeviceName[out] Default audio capturer device name

  • playerDeviceName[out] Default audio player device name

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

const AudioAnalyzerDeviceInfo &getAudioCapturerDeviceInfo() const

(Const) Returns the capturer audio device info

Returns:

audio device info structure

const AudioAnalyzerDeviceInfo &getAudioPlayerDeviceInfo() const

(Const) Returns the player audio device info

Returns:

audio device info structure

float getCaptureVolume()

Returns the volume of the captured audio

Returns:

volume in range 0.0-1.0

void setCaptureVolume(float volume)

Sets the volume of the captured audio

Parameters:

volume – New volume in range 0.0-1.0

float getPlaybackVolume()

Returns the volume of the playback of the captured audio

Returns:

volume in range 0.0-1.0

void setPlaybackVolume(float volume)

Sets the volume of the playback of captured audio

Parameters:

volume – New volume in range 0.0-1.0

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

Registers the called function when the audio capture device has data

Parameters:

callback – Function callback

Public Static Functions

static void getInputAudioDeviceNames(TArray<FString> &audioDeviceNames)

Get input audio device names list

Parameters:

audioDeviceNames[out] Device names list availables for input