MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / OnAssetLoaded

Method OnAssetLoaded

Source/Engine/Audio/AudioSource.cpp:281–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281void AudioSource::OnAssetLoaded(Asset* asset, void* caller)
282{
283 if (!SourceID)
284 return;
285
286 // Reset spatial and playback
287 AudioBackend::Source::IsLoopingChanged(SourceID, _loop && !UseStreaming());
288 AudioBackend::Source::SpatialSetupChanged(SourceID, Is3D(), _attenuation, _minDistance, _dopplerFactor);
289
290 // Start playing if source was waiting for the clip to load
291 if (_state == States::Playing && !_isActuallyPlayingSth)
292 {
293 if (Clip->IsStreamable())
294 {
295 // Request faster streaming update
296 Clip->RequestStreamingUpdate();
297 }
298 else
299 {
300 // Play it right away
301 AudioBackend::Source::SetNonStreamingBuffer(SourceID, Clip->Buffers[0]);
302 PlayInternal();
303 }
304 }
305}
306
307void AudioSource::OnAssetUnloaded(Asset* asset, void* caller)
308{

Callers

nothing calls this directly

Calls 2

Is3DFunction · 0.85

Tested by

no test coverage detected