Class AudioAnalyzerExtractor

Inheritance Relationships

Base Type

Class Documentation

class AudioAnalyzerExtractor : public AudioAnalyzerSource

Audio Analyzer Extractor.

This class will be used to load audio from a disk file and do offline analysis

Public Functions

AudioAnalyzerExtractor()

Constructor

~AudioAnalyzerExtractor()

Destructor This will unload the loaded audio too

AudioAnalyzerExtractor(AudioAnalyzerExtractor const &x) = delete

Disable copy constructor

Parameters

x

void operator=(AudioAnalyzerExtractor const &x) = delete

Disable copy assignment

Parameters

x

bool initializeAudio(const FString &filePath, bool onlyHeader)

Decodes the PCM audio data and opens the audio extractor device

Parameters
  • filePath – Path to the audio file

  • onlyHeader – Load only header info, audio data will not be uncompressed

Returns

Audio initilization execution result

bool asyncInitializeAudio(const FString &filePath, bool onlyHeader)

Decodes the PCM audio data and opens the audio extractor device

Parameters
  • filePath – Path to the audio file

  • onlyHeader – Load only header info, audio data will not be uncompressed

Returns

Audio initilization scheduled

bool initializeSoundWave(UAudioAnalyzerSoundWave *soundWave, const FString &filePath)

Decodes the PCM audio data and constructs a sound wave object

Parameters
  • soundWave[out] SoundWave pointer

  • filePath – Path to the audio file

Returns

SoundWave initialization result

bool asyncInitializeSoundWave(UAudioAnalyzerSoundWave *soundWave, const FString &filePath)

Decodes the PCM audio data and constructs a sound wave object

Parameters
  • soundWave[out] SoundWave pointer

  • filePath – Path to the audio file

Returns

SoundWave initilization scheduled

void unloadAudio()

Closes audio player device

virtual float getPlaybackProgress(float &bufferPosTime)

Returns the playback progress and buffer postion time

Parameters

bufferPosTime[out] Buffer position (same as below value)

Returns

float Progress in seconds

float getTotalDuration() const

Returns the total audio duration

Returns

Duration in seconds

void setEnableMetadataLoad(bool enableMetadataLoad)

Enables or disables metadata load

Parameters

enableMetadataLoad – Enable metadata load

void getMetadata(FString &Filename, FString &Extension, FString &MetaType, FString &Title, FString &Artist, FString &Album, FString &Year, FString &Genre)

Get file metadata

Parameters
  • Filename[out] Filename of the audio file

  • Extension[out] Extension of the audio file

  • MetaType[out] ID3_V1 | ID3_V2.3 | ID3_V2.4

  • Title[out] Title of the song

  • Artist[out] Artist

  • Album[out] Album

  • Year[out] Year

  • Genre[out] Genre

void getMetadataArt(const FString &Prefix, const FString &Folder, int32 &NumberOfPictures)

Extract the AlbumArt pictures into the selected folder. Prefix1.png, Prefix2.png,…

Parameters
  • Prefix – Prefix used to name the pictures.

  • Folder – Destination folder

  • NumberOfPictures[out] Number of stored pictures

inline const AudioAnalyzerDecoder::AudioFileType getAudioFileFormat() const

Get audio format

Returns

AudioAnalyzerDecoder::AudioFileType

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 registerOnInitAudioEnd(std::function<void(bool)> callback)

Registers the called function when the init audio ends

Parameters

callback – Function callback

void registerOnConstructSoundWaveEnd(std::function<void(bool)> callback)

Registers the called function when the init audio ends

Parameters

callback – Function callback

inline bool isAsyncInitRunning() const

Returns if the async initialization thread is running

Returns

bool Async Initialization is running

void setAudioComponent(UAudioComponent *audioComponent)

Link an audio component to the analyzer

Parameters

audioComponent – Audio Component pointer

void registerOnAudioComponentPlaybackEnd(std::function<void()> callback)

Registers the called function when the audio playback reaches its end

Parameters

callback – Function callback

void registerOnAudioComponentPlaybackLoopEnd(std::function<void()> callback)

Registers the called function when one loop of the audio playback reaches its end

Parameters

callback – Function callback

void registerOnAudioComponentStopFinished(std::function<void()> callback)

Registers the called function when one loop of the audio playback reaches its end

Parameters

callback – Function callback

inline UAudioComponent *getAudioComponent() const

Returns the audio component pointer

Returns

Audio Component pointer

void playAudioComponent(int32 loops, float startTime)

Starts the audio component playback

Parameters
  • loops – Number of loops

  • startTime – Starting position seconds

void asyncStopAudioComponent()

Stops audio playback

void pauseAudioComponent(bool forcePause = true)

Pauses audio component playback if the device is in playing state UnPauses audio component playback if the device has been paused previously

Parameters

forcePause – Set the pause to this state

bool isAudioComponentPlaying() const

Returns if the device is currently playing audio

Returns

Device is playing

bool isAudioComponentPaused() const

Returns if the audio component device is currently paused

Returns

Device is paused

float getAudioComponentPlaybackProgress(float &bufferPosTime)

Returns the audio component progress and buffer postion time

Parameters

bufferPosTime[out] Buffer position (same as below value)

Returns

float Progress in seconds

float getAudioComponentPlaybackProgress()

Returns the audio component playback progress

Returns

float Progress in seconds

void setAudioComponentPlaybackProgress(float time)

Sets the audio component playback progress

Parameters

time – New playback position in seconds

float getAudioComponentTotalDuration() const

Returns the total audio duration

Returns

Duration in seconds

const int getAudioComponentRemainingLoops() const

Get remaining loops of the Audio Component

Returns

remainingLoops

Public Members

std::function<void()> onAudioComponentPlaybackFinished

Reference to the audio component onPlaybackEnd function callback

std::function<void()> onAudioComponentPlaybackLoopFinished

Reference to the audio component onPlaybackLoopEnd function callback

std::function<void()> onAudioComponentStopFinished

Reference to the audio component onStopFinished function callback