A procedural sound wave that allows streaming raw audio data at runtime. More...
#include <ST_AudioSoundWaveProcedural.h>
Public Member Functions | |
UST_AudioSoundWaveProcedural (const FObjectInitializer &ObjectInitializer) | |
Constructor for initializing the procedural sound wave. | |
~UST_AudioSoundWaveProcedural () | |
Destructor for cleanup. | |
virtual TUniquePtr< Audio::IProxyData > | CreateNewProxyData (const Audio::FProxyDataInitParams &InitParams) override |
Creates a new proxy data object for this sound wave. | |
virtual int32 | OnGeneratePCMAudio (TArray< uint8 > &OutAudio, int32 NumSamples) |
Called by the audio engine to generate raw PCM audio data. | |
void | QueueAudioBuffer (const uint8 *AudioData, const int32 BufferSize) |
Queues raw PCM audio data for playback. | |
void | Initialise (FFFTIOData FFTIOData, bool bUsedByMixerOnly, EST_SampleFormat NewSampleFormat) |
Setups up sound wave with relevant IO data. | |
virtual Audio::EAudioMixerStreamDataFormat::Type | GetGeneratedPCMDataFormat () const override |
Return the format of the generated PCM data type. | |
virtual bool | RegisterToIO (EAudioIOType NewAudioIOType) |
virtual void | DeregisterFromIO (EAudioIOType CurrAudioIOType) |
virtual void | OnAudioIOStatusChanged_Implementation (bool bIsActive, FIntPoint IOId) override |
const FThreadSafeBool & | GetInitialisedFlag () const |
Public Member Functions inherited from IST_AudioProcessingInterface | |
void | OnAudioIOStatusChanged (bool bIsActive, FIntPoint IOId) |
Event triggered when the status of an audio I/O device changes. | |
void | OnRawMagnitudesReady (const TArray< float > &RawMagnitudes, FIntPoint IOId) |
Event triggered when raw magnitude data is ready for an audio I/O device. | |
void | OnFrequencyBandsReady (const TArray< float > &FrequencyBands, int32 NumFrequencyBands, FIntPoint IOId) |
Event triggered when frequency band data is ready for an audio I/O device. | |
void | OnAmplitudesReady (const TArray< float > &Amplitudes, FIntPoint IOId) |
Event triggered when amplitude data is ready for an audio I/O device. | |
void | OnPitchesReady (const TArray< float > &Pitches, FIntPoint IOId) |
Event triggered when pitch data is ready for an audio I/O device. | |
void | OnBeatDetected (const TArray< float > &Beats, const TArray< bool > &BeatDetectedForChannel, FIntPoint IOId) |
Event triggered when a beat is detected in the audio data for an I/O device. |
Public Attributes | |
EAudioIOType | Registered_AudioIOType = EAudioIOType::None |
A procedural sound wave that allows streaming raw audio data at runtime.
UST_AudioSoundWaveProcedural enables the feeding of audio samples dynamically via QueueAudioBuffer.
UST_AudioSoundWaveProcedural::UST_AudioSoundWaveProcedural | ( | const FObjectInitializer & | ObjectInitializer | ) |
Constructor for initializing the procedural sound wave.
ObjectInitializer | The initializer used to construct this object. |
|
overridevirtual |
Creates a new proxy data object for this sound wave.
Used by the audio engine for optimized audio rendering and playback.
InitParams | Parameters used to initialize the proxy data. |
|
virtual |
Deregisters the actor from an audio input/output type.
|
overridevirtual |
Return the format of the generated PCM data type.
Used in audio mixer to allow generating float buffers and avoid unnecessary format conversions. This feature is only supported in audio mixer. If your procedural sound wave needs to be used in both audio mixer and old audio engine, it's best to generate int16 data as old audio engine only supports int16 formats. Or check at runtime if the audio mixer is enabled. Audio mixer will convert from int16 to float internally.
void UST_AudioSoundWaveProcedural::Initialise | ( | FFFTIOData | FFTIOData, |
bool | bUsedByMixerOnly, | ||
EST_SampleFormat | NewSampleFormat ) |
Setups up sound wave with relevant IO data.
Extracts FFTIOData from the Audio IO and sets channel and samples data. This should be called before sampler registration.
FFFTIOData | FFTIOData from the ST Audio IO. |
bUsedByMixerOnly | when true means it used by mixer only and the PCM Data can support float formats. When false we only support int16 formats. |
NewSampleFormat | is the format used by the IO device. |
|
overridevirtual |
Called when the audio I/O status changes.
bIsActive | Indicates if the audio I/O is active. |
IOId | The identifier of the I/O operation whose status has changed. |
|
virtual |
Called by the audio engine to generate raw PCM audio data.
Override this to provide audio samples to the playback engine.
OutAudio | The array to fill with PCM audio data (int16). |
NumSamples | The number of samples requested by the engine. |
void UST_AudioSoundWaveProcedural::QueueAudioBuffer | ( | const uint8 * | AudioData, |
const int32 | BufferSize ) |
Queues raw PCM audio data for playback.
Accepts 16-bit signed PCM data (interleaved for stereo) and appends it to the internal buffer. This should be called continuously with new audio data during playback.
AudioData | Pointer to the PCM data buffer (must be in int16 format). |
BufferSize | Size of the buffer in bytes. |
|
virtual |
Registers the actor to an audio input/output type.
EAudioIOType UST_AudioSoundWaveProcedural::Registered_AudioIOType = EAudioIOType::None |
Registered audio input/output types for the visualisation actor.