| 211 | } |
| 212 | |
| 213 | std::shared_ptr<AudioData const> AudioCache::LoadFromFileAsync(const std::filesystem::path & path, ThreadPool& threadPool) |
| 214 | { |
| 215 | std::shared_ptr<AudioData const> audio; |
| 216 | |
| 217 | if (findInCache(path, audio)) |
| 218 | return audio; |
| 219 | |
| 220 | threadPool.AddTask([this, &audio, path]() |
| 221 | { |
| 222 | if ((audio = loadAudioFile(path))) |
| 223 | { |
| 224 | sendAudioLoadedMessage(audio, path.generic_string().c_str()); |
| 225 | } |
| 226 | }); |
| 227 | return audio; |
| 228 | } |
| 229 | |
| 230 | } // namespace donut::engine::audio |