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

Method CreateStreamingTask

Source/Engine/Audio/AudioClip.cpp:279–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279Task* AudioClip::CreateStreamingTask(int32 residency)
280{
281 ScopeLock lock(Locker);
282
283 ASSERT(_totalChunks != 0 && Math::IsInRange(residency, 0, _totalChunks) && _streamingTask == nullptr);
284 Task* result = nullptr;
285
286 // Requests assets chunks data
287 for (int32 i = 0; i < StreamingQueue.Count(); i++)
288 {
289 const int32 idx = StreamingQueue[i];
290 if (Buffers[idx] == 0)
291 {
292 const auto task = (Task*)RequestChunkDataAsync(idx);
293 if (task)
294 {
295 if (result)
296 result->ContinueWith(task);
297 else
298 result = task;
299 }
300 }
301 }
302
303 // Add streaming task
304 _streamingTask = New<StreamingTask>(this);
305 if (result)
306 result->ContinueWith(_streamingTask);
307 else
308 result = _streamingTask;
309
310 return result;
311}
312
313void AudioClip::CancelStreamingTasks()
314{

Callers 1

UpdateResourceFunction · 0.45

Calls 3

IsInRangeFunction · 0.85
ContinueWithMethod · 0.80
CountMethod · 0.45

Tested by

no test coverage detected