1
Audio / Trouble with feeding audio stream
« on: July 11, 2009, 05:38:33 pm »
It works now. I had to divide the number of NbSamples by the size of sf::Int16. Now it looks like that
Thanks for your help!
Code: [Select]
bool player::OnGetData(sf::SoundStream::Chunk& ck)
{
for (unsigned got = 0; got < in_size; ++got)
{
char* temp = in + got; // inkrement the pointer
*temp = data_stream->recieve_byte(); // get a byte of the audio stream
}
size_t decoded_bytes;
mpg123_decode (mpg, (unsigned char* ) in, in_size, reinterpret_cast<unsigned char*> (out), out_size*4, &decoded_bytes);
ck.Samples = out;
ck.NbSamples = decoded_bytes/sizeof(sf::Int16);
return true;
}
Thanks for your help!