My problem occurs in trying to play a net-stream (MP3 format)
I download it 256k each time and keep appending data in my external python source,
when the data updates, I stop it and create the sound/channel again with OPEN-MEMORY and setPosition to the previous pos, but this method meet little ‘cut off’ problem
I have read the example code usercreatedsound, but pcmreadcallback only useful for PCM data 😥
how can I process the MP3 stream fluently?
- swordmage asked 7 years ago
[quote="mathew":26oefo0z]The could not seek error happens when the target MP3 has a lot of tag information. You could try using the FMOD_IGNORETAGS flag and setting suggested sound type to MP3 in createsoundexinfo.[/quote:26oefo0z]
I did so, the problem remains…
I think the problem possibly occur in network part, not the file part, for if I download the special mp3 through my own method, and play it with OPEN_MEMORY, FMOD works.
And I wonder a solution which can play fluently with my own download method :
I download it by chunks, play the chunk with OPEN_MEMORY after the first chunk downloaded, and each time the new chunk comes I combine the chunks and save the current pos, stop and re-createSound, play again, setPosition to the previous pos…
the switch cause a obvious ‘cut off’ 😥
Is there any good way to avoid the unfriendly switch ?
If you want to manage the reading of the netstream yourself you could override the open, close, seek and read callbacks for the sound via FMOD_CREATESOUNDEXINFO. Then you just need to feed FMOD the data you download when it requests it.
You will have to do buffering and what not to keep the response times low but you should be able to achieve your chunk idea better this way.
yes, I have considered FMOD’s createStream, and use it as first choice,
but I have to use my download scheme for 2 reasons :
1. for some net-stream, FMOD can not fetch and returns FMOD_ERR_FILE_COULDNOTSEEK error, but stream really exist there…
I catch this err in FMOD’s update function and notice my python code to use the 2nd download scheme,
then python gets it successful by chunks, and send to FMOD using OPEN_MEMORY, and this occur the ‘cut off’ problem every time I refresh the data, I mentioned before
2. the stream may be play several times, so after downloaded, I cache it to avoid re-downloading which result in delay
waiting for a solution 😳
[quote="peter":3fnj0ax0]Have you tried just loading the netstream through FMOD?[/quote:3fnj0ax0]
and I wonder why some mp3-stream can’t fetch by FMOD’s createStream.
(return FMOD_ERR_FILE_COULDNOTSEEK error)
but if I download through my method, and play it by FMOD with OPEN_MEMORY, it works…
Please login first to submit.