UAudioComponent::PlayQuantized
#include "Components/AudioComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallablevirtual
Description
Starts this component's sound aligned to a Quartz clock's quantization boundary, such as the next bar or beat, instead of playing immediately.
Caveats & Gotchas
- • Requires an already-created UQuartzClockHandle from the Quartz clock subsystem — an invalid or expired handle causes the command to silently fail to schedule rather than falling back to immediate playback.
- • Marked UnsafeDuringActorConstruction — calling this from a constructor or very early in actor initialization can fail to schedule correctly; call it from BeginPlay or later instead.
Signature
virtual void PlayQuantized(const UObject* WorldContextObject, UPARAM(ref) UQuartzClockHandle*& InClockHandle, UPARAM(ref) FQuartzQuantizationBoundary& InQuantizationBoundary, const FOnQuartzCommandEventBP& InDelegate, float InStartTime = 0.f, float InFadeInDuration = 0.f, float InFadeVolumeLevel = 1.f, EAudioFaderCurve InFadeCurve = EAudioFaderCurve::Linear) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | const UObject* | World context used to resolve the Quartz subsystem. | — |
| InClockHandle | UQuartzClockHandle*& | Handle to the Quartz clock to quantize playback against. | — |
| InQuantizationBoundary | FQuartzQuantizationBoundary& | The musical boundary (e.g. next bar or beat) to align playback to. | — |
| InDelegate | const FOnQuartzCommandEventBP& | Delegate invoked as the quantized command passes through its lifecycle stages. | — |
| InStartTime | float | Offset, in seconds, to begin reading the sound at. | 0.f |
| InFadeInDuration | float | Duration of the volume fade-in once playback starts. | 0.f |
| InFadeVolumeLevel | float | Target volume level to fade in to. | 1.f |
| InFadeCurve | EAudioFaderCurve | Curve shape used for the fade-in. | EAudioFaderCurve::Linear |
Return Type
void Example
Play a sound on the next bar C++
FQuartzQuantizationBoundary Boundary;
Boundary.Quantization = EQuartzCommandQuantization::Bar;
FOnQuartzCommandEventBP Unused;
AudioComp->PlayQuantized(this, ClockHandle, Boundary, Unused); See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?