MCPcopy Create free account
hub / github.com/LabSound/LabSound / MakeBusFromFile

Function MakeBusFromFile

src/extended/AudioFileReader.cpp:75–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73std::mutex g_fileIOMutex;
74
75std::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
102std::shared_ptr<AudioBus> MakeBusFromFile(const std::string & path, bool mixToMono)
103{

Calls 2

LoadInternalFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected