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

Method loadFromSamples

src/SFML/Audio/SoundBuffer.cpp:144–167  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

142
143////////////////////////////////////////////////////////////
144bool SoundBuffer::loadFromSamples(const std::int16_t* samples,
145 std::uint64_t sampleCount,
146 unsigned int channelCount,
147 unsigned int sampleRate,
148 const std::vector<SoundChannel>& channelMap)
149{
150 if (samples && sampleCount && channelCount && sampleRate && !channelMap.empty())
151 {
152 // Copy the new audio samples
153 m_samples.assign(samples, samples + sampleCount);
154
155 // Update the internal buffer with the new samples
156 return update(channelCount, sampleRate, channelMap);
157 }
158
159 // Error...
160 err() << "Failed to load sound buffer from samples ("
161 << "array: " << samples << ", "
162 << "count: " << sampleCount << ", "
163 << "channels: " << channelCount << ", "
164 << "samplerate: " << sampleRate << ")" << std::endl;
165
166 return false;
167}
168
169
170////////////////////////////////////////////////////////////

Callers 1

onStopMethod · 0.80

Calls 2

assignMethod · 0.80
updateFunction · 0.50

Tested by

no test coverage detected