| 73 | std::mutex g_fileIOMutex; |
| 74 | |
| 75 | std::shared_ptr<AudioBus> MakeBusFromFile(const char * filePath, bool mixToMono) |
| 76 | { |
| 77 | std::lock_guard<std::mutex> lock(g_fileIOMutex); |
| 78 | nqr::AudioData * audioData = new nqr::AudioData(); |
| 79 | try |
| 80 | { |
| 81 | FILE* test = fopen(filePath, "rb"); |
| 82 | if (test) { |
| 83 | fclose(test); |
| 84 | nyquist_io.Load(audioData, std::string(filePath)); |
| 85 | printf("Loaded %s\n", filePath); |
| 86 | } |
| 87 | else { |
| 88 | printf("could not load %s\n", filePath); |
| 89 | return {}; |
| 90 | } |
| 91 | } |
| 92 | catch (...) |
| 93 | { |
| 94 | // use empty pointer as load failure sentinel |
| 95 | /// @TODO report loading error |
| 96 | return {}; |
| 97 | } |
| 98 | |
| 99 | return detail::LoadInternal(audioData, mixToMono); |
| 100 | } |
| 101 | |
| 102 | std::shared_ptr<AudioBus> MakeBusFromFile(const std::string & path, bool mixToMono) |
| 103 | { |
no test coverage detected