| 277 | } |
| 278 | |
| 279 | Task* 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 | |
| 313 | void AudioClip::CancelStreamingTasks() |
| 314 | { |
no test coverage detected