I want to use FMOD to open a stream and play/listen to it, which is pretty easy to do with FMOD. I would also like at the same time to write the stream I am playing to disk as an MP3 file. I can parse the SHOUTCAST headers and open a TCP/IP connection and write the stream on my own but I’d like to do it using FMOD if possible, any suggestions on how to do this?
- arnoldmm asked 14 years ago
Are you trying to save a SHOUTcast stream to disk as an mp3 or are you trying to rebroadcast it?
If you’re trying to rebroadcast it then you can’t do it directly with FMOD – we do playback only, not broadcasting, so you’ll have to do all the SHOUTcast/network broadcasting stuff yourself.
If you’re just trying to save it to disk then have a look at the cddarip example and modify it to pass chunks of data to BladeEnc.dll or lame_enc.dll rather than just using fwrite.
I only want to write the stream to disk while playing it. I couldn’t find cddarip example until I realized I didn’t have the newest version of fmodapi. I downloaded it and looked at cddarip and I checked out bladeenc.dll and lame_enc.dll too. Looks like a good solution for me… thanks.
After looking at cddarip, netstream and the lame_enc, bladeenc examples I can now play and save a SHOUTCAST stream. When I play it back with Realplay there is a 2-3 second lag before it starts playing, how can I fix this?
BTW FMOD is amazing it was really easy to do.
I looked at a hexdump of the MP3 file I wrote and it had a lot of empty blocks before the data started. I figured that because of my firewall kicking in each time, it was delaying the stream while the DSP callback was still being called and calling lame_enc. I re-configured the firewall and it was still delaying about a second and writing about 70 empty frames. Anway I just moved the code for creating the DSP callback and there is no delay at all.
Please login first to submit.