MCPcopy Create free account
hub / github.com/axmolengine/axmol / uncache

Method uncache

core/audio/AudioEngine.cpp:426–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424}
425
426void AudioEngine::uncache(std::string_view filePath)
427{
428 if (!_audioEngineImpl)
429 {
430 return;
431 }
432 auto audioIDsIter = _audioPathIDMap.find(filePath);
433 if (audioIDsIter != _audioPathIDMap.end())
434 {
435 //@Note: For safely iterating elements from the audioID list, we need to copy the list
436 // since 'AudioEngine::remove' may be invoked in '_audioEngineImpl->stop' synchronously.
437 // If this happens, it will break the iteration, and crash will appear on some devices.
438 std::list<AUDIO_ID> copiedIDs(audioIDsIter->second);
439
440 for (AUDIO_ID audioID : copiedIDs)
441 {
442 _audioEngineImpl->stop(audioID);
443
444 auto itInfo = _audioIDInfoMap.find(audioID);
445 if (itInfo != _audioIDInfoMap.end())
446 {
447 if (itInfo->second.profileHelper)
448 {
449 itInfo->second.profileHelper->audioIDs.remove(audioID);
450 }
451 _audioIDInfoMap.erase(audioID);
452 }
453 }
454 _audioPathIDMap.erase(filePath);
455 }
456
457 if (_audioEngineImpl)
458 {
459 _audioEngineImpl->uncache(filePath);
460 }
461}
462
463void AudioEngine::uncacheAll()
464{

Callers

nothing calls this directly

Calls 5

findMethod · 0.45
endMethod · 0.45
stopMethod · 0.45
removeMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected