IStreamedCompressedInfo

Default implementation of a streamed compressed audio format.

Windows
MacOS
Linux

Inheritance Hierarchy

ICompressedAudioInfo

IStreamedCompressedInfo

FOpusAudioInfo

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/AudioDecompress.h

Include

#include "AudioDecompress.h"

Syntax

class IStreamedCompressedInfo : public ICompressedAudioInfo

Remarks

Default implementation of a streamed compressed audio format. Can be subclassed to support streaming of a specific asset format. Handles all the platform independent aspects of file format streaming for you (dealing with UE4 streamed assets)

Variables

Name Description

Protected variable

uint32

 

AudioDataChunkIndex

The chunk index where the actual audio data starts.

Protected variable

uint32

 

AudioDataOffset

Where the actual audio data starts in the current streamed chunk. Accounts for header offset.

Protected variable

bool

 

bIsStreaming

Bool set before ParseHeader. Whether we are streaming a file or not.

Protected variable

bool

 

bPrintChunkFailMessage

Whether or not to print the chunk fail message.

Protected variable

bool

 

bStoringEndOfFile

If we're currently reading the final buffer.

Protected variable

FAudioChunkHand...

 

CurCompressedChunkHandle

Chunk Handle to ensure that this chunk of streamed audio is not deleted while we are using it.

Protected variable

int32

 

CurrentChunkIndex

The current chunk index in the streamed chunks.

Protected variable

uint32

 

CurrentSampleCount

How many samples we've currently read in the source file.

Protected variable

TArray< uint8 >

 

LastDecodedPCM

The decoded PCM byte array from the last decoded frame.

Protected variable

uint32

 

LastPCMByteSize

The amount of PCM data in bytes was decoded last.

Protected variable

uint32

 

LastPCMOffset

The current offset in the last decoded PCM buffer.

Protected variable

uint32

 

MaxFrameSizeSamples

The maximum number of samples per decode frame.

Protected variable

uint8

 

NumChannels

Number of channels (left/right) in the source file.

Protected variable

uint16

 

SampleRate

Sample rate of the source file

Protected variable

uint32

 

SampleStride

The number of bytes per interleaved sample (NumChannels * sizeof(int16)).

Protected variable

const uint8 ...

 

SrcBufferData

Ptr to the current streamed chunk.

Protected variable

uint32

 

SrcBufferDataSize

Size of the current streamed chunk.

Protected variable

uint32

 

SrcBufferOffset

What byte we're currently reading in the streamed chunk.

Protected variable

uint32

 

SrcBufferPadding

Number of bytes of padding used, overridden in some implementations. Defaults to 0.

Protected variable

uint32

 

TrueSampleCount

The total sample count of the source file.

Constructors

Name Description

Public function

IStreamedCompressedInfo()

Destructors

Name Description

Public function Virtual

~IStreamedCompressedInfo()

Functions

Name Description

Public function

bool

 

CreateDecoder()

Create the compression format dependent decoder object.

Public function

FDecodeResul...

 

Decode

(
    const uint8* CompressedData,
    const int32 CompressedDataSize,
    uint8* OutPCMData,
    const int32 OutputPCMDataSize
)

Decode the input compressed frame data into output PCMData buffer.

Protected function

int32

 

DecompressToPCMBuffer

(
    uint16 FrameSize
)

Decompresses a frame of data to PCM buffer

Public function

int32

 

GetFrameSize()

Return the size of the current compression frame

Protected function

const uint8 ...

 

GetLoadedChunk

(
    USoundWave* InSoundWave,
    uint32 ChunkIndex,
    uint32& OutChunkSize
)

Helper function for getting a chunk of compressed audio.

Public function Const

uint32

 

GetMaxFrameSizeSamples()

The size of the decode PCM buffer size.

Protected function

uint32

 

IncrementCurrentSampleCount

(
    uint32 NewSamples
)

Adds to the count of samples that have currently been decoded

Public function

bool

 

ParseHeader

(
    const uint8* InSrcBufferData,
    uint32 InSrcBufferDataSize,
    FSoundQualityInfo* QualityInfo
)

Parse the header information from the input source buffer data.

Public function Virtual

void

 

PrepareToLoop()

Optional method to allow decoder to prepare to loop.

Protected function

uint32

 

Read

(
    void* Outbuffer,
    uint32 DataSize
)

Reads from the internal source audio buffer stream of the given data size.

Protected function

uint32

 

WriteFromDecodedPCM

(
    uint8* Destination,
    uint32 BufferSize
)

Writes data from decoded PCM buffer, taking into account whether some PCM has been written before

Protected function

uint32

 

ZeroBuffer

(
    uint8* Destination,
    uint32 BufferSize
)

Zeroes the contents of a buffer

Overridden from ICompressedAudioInfo

Name Description

Public function Virtual

void

 

EnableHalfRate

(
    bool HalfRate
)

Sets decode to half-rate

Public function Virtual

void

 

ExpandFile

(
    uint8* DstBuffer,
    FSoundQualityInfo* QualityInfo
)

Decompress an entire data file to a TArray

Public function Virtual Const

int32

 

GetCurrentChunkIndex()

Gets the chunk index that was last read from (for Streaming Manager requests)

Public function Virtual Const

int32

 

GetCurrentChunkOffset()

Gets the offset into the chunk that was last read to (for Streaming Manager priority)

Public function Virtual Const

uint32

 

GetSourceBufferSize()

Gets the size of the source buffer originally passed to the info class (bytes)

Public function Virtual Const

int

 

GetStreamBufferSize()

Gets the preferred size for a streaming buffer for this decompression scheme

Public function Virtual

bool

 

ReadCompressedData

(
    uint8* Destination,
    bool bLooping,
    uint32 BufferSize
)

Decompresses data to raw PCM data.

Public function Virtual

bool

 

ReadCompressedInfo

(
    const uint8* InSrcBufferData,
    uint32 InSrcBufferDataSize,
    FSoundQualityInfo* QualityInfo
)

Reads the header information of a compressed format

Public function Virtual

void

 

SeekToTime

(
    const float SeekTime
)

Seeks to time (Some formats might not be seekable)

Public function Virtual

bool

 

StreamCompressedData

(
    uint8* Destination,
    bool bLooping,
    uint32 BufferSize
)

Decompresses streamed data to raw PCM data.

Public function Virtual

bool

 

StreamCompressedInfoInternal

(
    USoundWave* Wave,
    FSoundQualityInfo* QualityInfo
)

Internal override implemented by subclasses.

Public function Virtual Const

bool

 

SupportsStreaming()

Following functions are optional if streaming is supported //.

Public function Virtual Const

bool

 

UsesVorbisChannelOrdering()

Whether the decompressed audio will be arranged using Vorbis' channel ordering See http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9 for details

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss