FSoundWavePCMWriter

[FSoundWavePCMWriter](API\Runtime\Engine\Sound\FSoundWavePCMWriter) This class can be used to save a [TSampleBuffer](API\Runtime\SignalProcessing\TSampleBuffer) to either a wav file or a [USoundWave](API\Runtime\Engine\Sound\USoundWave) using BeginGeneratingSoundWaveFromBuffer, BeginWriteToSoundWave, or BeginWriteToWavFile on the game thread.

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Sound/SampleBufferIO.h

Include

#include "Sound/SampleBufferIO.h"

Syntax

class FSoundWavePCMWriter

Remarks

FSoundWavePCMWriter This class can be used to save a TSampleBuffer to either a wav file or a USoundWave using BeginGeneratingSoundWaveFromBuffer, BeginWriteToSoundWave, or BeginWriteToWavFile on the game thread. This class uses an async task to generate and write the file to disk.

Constructors

Name Description

Public function

FSoundWavePCMWriter

(
    int32 InChunkSize
)

Destructors

Name Description

Public function

~FSoundWavePCMWriter()

Functions

Name Description

Public function

bool

 

BeginGeneratingSoundWaveFromBuffer

(
    const TSampleBuffer<>& InSampleBuf...,
    USoundWave* InSoundWave,
    TFunction< void&#...
)

This kicks off an operation to write InSampleBuffer to SoundWaveToSaveTo.

Public function

bool

 

BeginWriteToSoundWave

(
    const FString& FileName,
    const TSampleBuffer<>& InSampleBuf...,
    FString InPath,
    TFunction< void&#...
)

This kicks off an operation to write InSampleBuffer to a USoundWave asset at the specified file path relative to the project directory.

Public function

bool

 

BeginWriteToWavFile

(
    const TSampleBuffer<>& InSampleBuf...,
    const FString& FileName,
    FString& FilePath,
    TFunction< void()> OnSuccess
)

This writes out the InSampleBuffer as a wav file at the path specified by FilePath and FileName.

Public function

void

 

CancelWrite()

Aborts the current write operation.

Public function

float

 

CheckStatus

(
    ESoundWavePCMWriterState* OutC...
)

Call this on the game thread to continue the write operation.

Public function

USoundWave &...

 

GetFinishedSoundWave()

Used to grab the a handle to the soundwave.

Public function

bool

 

IsDone()

Whether we have finished the write operation, by either succeeding, failing, or being cancelled.

Public function

void

 

Reset()

Clean up all resources used.

Public function

void

 

SaveFinishedSoundWaveToPath

(
    const FString& FileName,
    FString InPath
)

This function can be used after generating a USoundWave by calling BeginGeneratingSoundWaveFromBuffer to save the generated soundwave to an asset.

Public function

USoundWave &...

 

SynchronouslyWriteSoundWave

(
    const TSampleBuffer<>& InSampleBuf...,
    const FString* FileName,
    const FString* FilePath
)

This is a blocking call that will return the SoundWave generated from InSampleBuffer.

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