Streaming from Internet

Started by Crack-Hat,

Crack-Hat

First of i did the right thing when changing fron xaudio to BASS.DLL

well off to my question how can i Display the Prebuffer progress of a Internet strem with BASS_StreamCreateURL()??
or display the return values if there are any?

thanks in advance

Ian @ un4seen

buffered=BASS_StreamGetFilePosition(handle,1)-BASS_StreamGetFilePosition(handle,0);That'll do it.

Irrational86

Ian, using this method you just mentioned, how do you know the maximun buffer size that it will allocate from an internet stream?

Ian @ un4seen

If you're streaming a file (not in blocks), then the max size is the file length - BASS_StreamGetFilePosition(handle,2) - otherwise, you can just let the buffer fill to get it's size :D

If you know the stream bitrate (see ICY tags if it's a Shoutcast stream), you can calculate the buffer size (in bytes) from the buffer length (in seconds) as set with BASS_SetNetConfig.

Irrational86

Using the second method you mentioned, streaming from shoutcast, knowing the bitrate and the netbuffer size...how would you do it??

Olego

#6
I wonder if this would work:

seconds = bufferSize * 8.0 / bitRate;
Or would you divide that by 2 if it's Stereo?

~Olego~

Ian @ un4seen

Yep, that's correct (the equation, not the stereo bit ;D), except the ICY tag gives the bitrate in kbps (eg. 128, not 128000)...
bufferSize = bitRate_kbps * 125 * seconds;

Irrational86

#8
Awesome, thanks a lot Ian, it works 100% perfect....but..

What does the 125 represent? Is it always going to be 125, or change according to freq, resolution (8 or 16 bits), mono/stereo??