![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <IAudioEncoder.h>
Inheritance diagram for Audio::IAudioEncoder:Public Member Functions | |
| SIGNALPROCESSING_API | IAudioEncoder (uint32 AudioBufferSlack, uint32 DataBufferSlack=4096) |
| virtual SIGNALPROCESSING_API | ~IAudioEncoder () |
| SIGNALPROCESSING_API bool | PushAudio (const float *InBuffer, int32 NumSamples, bool bEncodeIfPossible=true) |
| SIGNALPROCESSING_API int32 | PopData (uint8 *OutData, int32 DataSize) |
| virtual int32 | GetCompressedPacketSize () const =0 |
| SIGNALPROCESSING_API bool | EncodeIfPossible () |
| SIGNALPROCESSING_API int64 | Finalize () |
Protected Member Functions | |
| SIGNALPROCESSING_API void | Init (const FSoundQualityInfo &InQualityInfo) |
| virtual int64 | SamplesRequiredPerEncode () const =0 |
| virtual bool | StartFile (const FSoundQualityInfo &InQualityInfo, TArray< uint8 > &OutFileStart)=0 |
| virtual bool | EncodeChunk (const TArray< float > &InAudio, TArray< uint8 > &OutBytes)=0 |
| virtual bool | EndFile (TArray< uint8 > &OutBytes)=0 |
IAudioEncoder Interface used to implement a runtime audio encoder.
Must be constructed with AudioBufferSlack. Optionally, DataBufferSlack can be called with a different value depending on how often PushAudio, EncodeIfPossible, or PopData will be called.
|
virtual |
|
protectedpure virtual |
Override this to compress InAudio to OutBytes. Returns true on success, false on failure.
Implemented in FOpusEncoder, and FWavEncoder.
| bool Audio::IAudioEncoder::EncodeIfPossible | ( | ) |
If you'd like to run audio encoding on a separate thread, use this call. Otherwise, ensure that bEncodeIfPossible is set to true when you call PushAudio.
Override this to compress InAudio to OutBytes. Returns true on success, false on failure.
Implemented in FOpusEncoder, and FWavEncoder.
| int64 Audio::IAudioEncoder::Finalize | ( | ) |
Call this once you are finished pushing audio. Returns the amount of bytes left to pop if positive, and if negative indicates a failiure.
Used for internet streaming. Should return the amount of bytes required for a self contained packet.
Implemented in FOpusEncoder, and FWavEncoder.
|
protected |
Should be called in the constructor of any implementation of IAudioEncoder. Calls StartFile if necessary.
Pop compressed data. If you are using this encoder for streaming over network, use the size returned by GetCompressedPacketSize(). Returns number of bytes written.
| bool Audio::IAudioEncoder::PushAudio | ( | const float * | InBuffer, |
| int32 | NumSamples, | ||
| bool | bEncodeIfPossible = true |
||
| ) |
Call this function when audio is available. If you would like to handle compression on a separate thread or call, Call this function with bEncodeIfPossible set to false. Returns true if audio was successfully pushed, false, if the internal buffer is full.
How many samples of decoded audio that are required for a single compression operation.
Implemented in FOpusEncoder, and FWavEncoder.
|
protectedpure virtual |
This should be overridden to, give the properties in InQualityInfo, write a header into OutFileStart. returns true on success, or false on failure.
Implemented in FOpusEncoder, and FWavEncoder.