Trying to receive Icecast Stream, URL callback


#1

Hi I'm new to JUCE, have done a bit of cpp in the past though.

 

I want to receive an icecast stream directly and output the audio by a vst, I've been experimenting for a week but I'm now stuck!

I was looking at the URL class and readEntireBinaryStream. The problem is that the vst freezes when I call readEntireBinaryStream, I believe it is because the url is constently sending audio stream data so the call never ends.

I've tried implementing the OpenStreamProgressCallback callback in createinputstream but can't seem to understand how to declare this function. Would you have an example for the syntax?

I think what I'm looking for is an asynchronous url request, whereas URL seems to implement a synchronus request. Should I use a thread for this?


#2

You would certainly need to use a thread for it.

I've no idea how icecast works, but would suspect that you'd maybe need to use some kind of customised socket to use it - the URL classes expect to read a finite amount of data, not a stream.


#3

Thanks, I'm now looking into boost for a custom socket, I've got boost working with juce and will be playing around with their http request and sockets.

 


#4

I finaly got the http stream working using libcurl and parts of this example: http://curl.haxx.se/libcurl/c/getinmemory.html

I'm now getting the raw data of a vorbis stream into an array, how would I go about decoding this with Juce?

 

Looking at OggVorbisAudioFormat I'm trying to figure out how to get my data in there, would the method createReaderFor be apropriate for what I want?

In that case OggVorbisAudioFormat.createReaderFor needs a source stream InputStream but I couldn't find any method to manually write my array of data to the InputStream.

 

Any tips?

 


#5

I think that by using boost sockets etc. you are complicating things. If you use JUCE's URL class (which can use curl internally) you can directly create an InputStream (see here for more info).