MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / loadWavFile

Method loadWavFile

examples/TinyAudio/b3SoundEngine.cpp:158–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158int b3SoundEngine::loadWavFile(const char* fileName)
159{
160 int* wavUidPtr = m_data->m_name2wav[fileName];
161 if (wavUidPtr)
162 {
163 return *wavUidPtr;
164 }
165 char resourcePath[1024];
166
167 if (b3ResourcePath::findResourcePath(fileName, resourcePath, 1024, 0))
168 {
169 b3ReadWavFile* wavFile = new b3ReadWavFile();
170 wavFile->getWavInfo(resourcePath);
171 wavFile->resize();
172 wavFile->read(0, true);
173 wavFile->normalize(1);
174 int wavUID = m_data->m_wavFileUidGenerator++;
175 m_data->m_wavFiles.insert(wavUID, wavFile);
176 m_data->m_name2wav.insert(fileName, wavUID);
177 return wavUID;
178 }
179 return 0;
180}
181
182double b3SoundEngine::getSampleRate() const
183{

Callers 2

initPhysicsMethod · 0.80

Calls 5

getWavInfoMethod · 0.80
resizeMethod · 0.45
readMethod · 0.45
normalizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected