| 279 | } |
| 280 | |
| 281 | void 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 | |
| 307 | void AudioSource::OnAssetUnloaded(Asset* asset, void* caller) |
| 308 | { |
nothing calls this directly
no test coverage detected