Hi All,
I'm trying to write my own sf::SoundStream but the application crashes with a floating point exception after onGetData is called 3 times.
I'm initializing the sound stream to 2 chanels at 22050 Hz, and filling the data chunk with 735 samples of silence. The rationale is:
22050 / 60 = 367.5 frames
367.5 * 2 channels = 735 samples
However, I'm receiving warnings and then the application crashes:
An internal OpenAL call failed in SoundStream.cpp (327) : AL_INVALID_VALUE, a numeric argument is out of range
An internal OpenAL call failed in SoundStream.cpp (327) : AL_INVALID_VALUE, a numeric argument is out of range
An internal OpenAL call failed in SoundStream.cpp (327) : AL_INVALID_VALUE, a numeric argument is out of range
Floating point exception
My methods are:
void initialize( unsigned sample_rate )
{
SoundStream::initialize( 2, sample_rate );
}
bool onGetData( Chunk& data )
{
static int16_t buffer[ 735 ] = { 0 };
data.samples = buffer;
data.sampleCount = sizeof( buffer ) / sizeof( buffer[ 0 ] );
return true;
}
I'm not sure my numbers are correct. In fact, I find it odd that there are 735 samples in a chunk since the number of channels is 2, so I think the number of samples should be even...
Any thoughts? What size the buffer array should be? In SFML terminology, on a stereo stream, a sample is really just one sample, or it's two samples?
My SFML version is 2.1.
Thanks,
Andre