Catch up with SFML 3 API changes

This commit is contained in:
Chris Thrasher authored and Lukas Dürrenberger committed 2024-05-18 23:35:57 +02:00
1 parent 330b423ee9
commit 5fb7d4a0a1
14 files changed
+265 -147

No files matched your search

+10 -2
View File
@@ -80,11 +80,19 @@ sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* stream)
////////////////////////////////////////////////////////////
sfSoundBuffer* sfSoundBuffer_createFromSamples(const int16_t* samples, uint64_t sampleCount, unsigned int channelCount, unsigned int sampleRate)
sfSoundBuffer* sfSoundBuffer_createFromSamples(const int16_t* samples,
uint64_t sampleCount,
unsigned int channelCount,
unsigned int sampleRate,
sfSoundChannel* channelMapData,
size_t channelMapSize)
{
sfSoundBuffer* buffer = new sfSoundBuffer;
if (!buffer->This.loadFromSamples(samples, sampleCount, channelCount, sampleRate))
std::vector<sf::SoundChannel> channelMap(channelMapSize);
for (std::size_t i = 0; i < channelMap.size(); ++i)
channelMap[i] = static_cast<sf::SoundChannel>(channelMapData[i]);
if (!buffer->This.loadFromSamples(samples, sampleCount, channelCount, sampleRate, channelMap))
{
delete buffer;
buffer = nullptr;