MCPcopy Create free account
hub / github.com/SFML/SFML / initialize

Method initialize

src/SFML/Audio/SoundBuffer.cpp:245–265  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

243
244////////////////////////////////////////////////////////////
245bool SoundBuffer::initialize(InputSoundFile& file)
246{
247 // Retrieve the sound parameters
248 const std::uint64_t sampleCount = file.getSampleCount();
249
250 // Read the samples from the provided file
251 m_samples.resize(static_cast<std::size_t>(sampleCount));
252 if (file.read(m_samples.data(), sampleCount) == sampleCount)
253 {
254 // Update the internal buffer with the new samples
255 if (!update(file.getChannelCount(), file.getSampleRate(), file.getChannelMap()))
256 {
257 err() << "Failed to initialize sound buffer (internal update failure)" << std::endl;
258 return false;
259 }
260
261 return true;
262 }
263
264 return false;
265}
266
267
268////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 6

updateFunction · 0.50
getSampleCountMethod · 0.45
resizeMethod · 0.45
readMethod · 0.45
getChannelCountMethod · 0.45
getSampleRateMethod · 0.45

Tested by

no test coverage detected