Okay, I wasn't able to find how to do this using only SFML, but I've written the workaround that combines code from the SoundStream tutorial and some libsndfile code. Maybe it'll be useful for someone:
SequentialSoundStreamer.hpp
#include <SFML/Audio.hpp>
#include <sndfile.h>
#include <fftw3.h>
#include <iostream>
namespace sfe
{
class SequentialSoundStreamer : public sf::SoundStream
{
public :
SequentialSoundStreamer(std::size_t BufferSize) :
myBufferSize(BufferSize) {}
bool Open(const char * Filename);
private :
virtual bool OnGetData(sf::SoundStream::Chunk& Data);
std::size_t myBufferSize;
SNDFILE * SoundFile;
SF_INFO SoundFileInfo;
short * SamplesArray;
};
}
SequentialSoundStreamer.cpp
#include "SequentialSoundStreamer.hpp"
namespace sfe
{
bool SequentialSoundStreamer::Open(const char * Filename)
{
SoundFileInfo.format=0;
if (!(SoundFile = sf_open (Filename, SFM_READ, &SoundFileInfo)))
std::cout<<"\nCan't open the file.\n";
Initialize(SoundFileInfo.channels,SoundFileInfo.samplerate);
SamplesArray = (short*) fftw_malloc(sizeof(short) * myBufferSize);
return false;
}
bool SequentialSoundStreamer::OnGetData(sf::SoundStream::Chunk& Data)
{
if (! (Data.NbSamples = sf_readf_short (SoundFile, SamplesArray, myBufferSize / SoundFileInfo.channels) * SoundFileInfo.channels))
{std::cout<<"\nCan't read the file (can be the end of it).\n"; return false;}
Data.Samples = SamplesArray;
return true;
}
}
As sound is being loaded chunk by chunk these chunks (SamplesArray) can be passed whatever they needed to.
malloc can be used instead of fftw_malloc.