I cannot get LoadFromSamples to work.
I get samples in the form of a const sf::Int16 *. Since I can't change a const pointer directly, I copy all of the data to a buffer. I modify it, and then I try to load the buffer back to the sf::SoundBuffer.
const sf::Int16 * pSample = Buffer.GetSamples();
int max = Buffer.GetSamplesCount()-1;
int channels = Buffer.GetChannelsCount();
int sampleRate = Buffer.GetSampleRate();
sf::Int16 * myBuffer = new sf::Int16[max];
for( int i = 0; i < max; i++ )
{
myBuffer[i] = pSample[i];
}
//Modify myBuffer
Buffer.LoadFromSamples( myBuffer, max, channels, sampleRate );
I get the following error:
error C2662: 'sf::SoundBuffer::LoadFromSamples' : cannot convert 'this' pointer from 'const sf::SoundBuffer' to 'sf::SoundBuffer &' Conversion loses qualifiers
I declare Buffer as:
const sf::SoundBuffer& Buffer = Recorder.GetBuffer();
Maybe I'm doing something wrong with references?