0
0

Hello,

I use the stream-functions to play mp3-files. some of them are vbr, some are not. I need to play every file (vbr or not) immediately, without scanning it before (it taktes about 3 seconds on my machine, with 10mb large files). But I also need to have exact time-accuracy for getlengthms, setposition and so on.
Since it is no problem to show the time data a little bit delayed, is it somehow possible to play the stream immediately, but scan it while it’s playing?

Thanks
tommie-lie

  • You must to post comments
0
0

[quote="brett":h1ypzvr1]the rest of this thread already talked about seeking, maybe you didnt read all of it. id3 will not do anything for seeking . nothing. FSOUND_MPEGACCURATE will prescan the whole mp3 (headers only) when FSOUND_Stream_Open is called, which builds an offset table, so when it seeks it is accurate.[/quote:h1ypzvr1]

i read it as well…. my question is: when i open the stream WITHOUT FSOUND_MPEGACCURATE , how is the seek then done… the file is not scanned and i call the fsound_stream_settime() function… is it accurate or not…? and yes.. id3 is no solution for that problem. even if 80% would have this information inside… 20% would still not!

  • You must to post comments
0
0

no, that’s not my problem.
My problem is, that when the user skips some tracks, the new track needs a long time to start, because the file has to be scanned at first. I want to play it immediately (that’s possible if I don’t use the MPEGACCURATE flag), but I still need to seek the file by time, not by byte or something else.
So I need to make FMOD scan the file while it plays. If you’d call so, I need a two-task-method: The one thread plays it, the other one scans it. After scanning, all the seeking-methods must work.

  • You must to post comments
0
0

then there is no way to play the file immediately and scan it while playing?

  • You must to post comments
0
0

Built into FMOD doesn’t exist.
A partial solution would be scan some frames (I suggest 10 or 20 frames at the beginning) of the mp3 file BEFORE loading it. If those frames have different bitrates, then the mp3 file is VBR so you must load it with MPEG_ACCURATE flag, else it can be directly loaded. Doing so, at least CBR mp3 files should be loaded almost instantly.

  • You must to post comments
0
0

The only thing I have in mind is setup fmod to play the file while scanning the whole file “manually” from your software. I have no other ideas, now…

  • You must to post comments
0
0

You could disregard MPEG_ACCURATE and get all of the info you need from an ID3 function, like ID3Lib, which gives MPEG info fast.

  • You must to post comments
0
0

and how do I do that?

  • You must to post comments
0
0

Yes, I know. It is the TLEN-frame I think.
But not all players set this frame, so it may be zero or may not exist at all.
In addition, that doesn’t solve my problem with SetTimeMS…

  • You must to post comments
0
0

What the anonymous poster suggested is not easy, so unless you got a clue how to do it, don’t try.

  • You must to post comments
0
0

I know, it wont work very well, but I have seen many MP3s with the correct mpeg data stored inside, so its not impossible for all mp3’s.

  • You must to post comments
0
0

ohh :(

Any other suggestions?
I really need it! I thought of two streams, one playing immediately and the other for getting the length, but of course I can’t copy the timedata from the ‘informationstream’ to the playing ‘real’ one.
Isn’t there any way to play the file and get the information later?
Perhaps a suggestion for the next version ๐Ÿ˜‰

  • You must to post comments
0
0

Oh I see, I hadnt noticed that in my original post.

  • You must to post comments
0
0

anonymous poster was me, damn’d cookies!

You just have to know how many frames there are in a mp3 file.
The see how many frames there are in the file, just seek for every sequence of sync headers. You find a sync header when you find 11 (eleven) set bits. Then you have to multiply the number of frames by the number of milliseconds took by a frame. I think you may find useful informations on the Net about this. However it is not so hard as you may think. IF you need some sourcecode, ask me privately.

  • You must to post comments
0
0

[quote="Paranoid_Android":3ismi2d6]You could disregard MPEG_ACCURATE and get all of the info you need from an ID3 function, like ID3Lib, which gives MPEG info fast.[/quote:3ismi2d6]

but what is when open without MPEG_ACCURATE , (because i did my analsysis before) when i want top open a stream and right after it, before playing, i do a FSOUND_Stream_SetTime() call… will this Seek be accurate? then this would be ok for me…. and if the seek is always accurate.. how is it handled internally? does it a real frame scan to the required position?!

have anybody here tried out the accuracy of the seeking mechanism into fmod?

  • You must to post comments
0
0

Is there no easier way? Something that is already a bit automated in FMOD?

But even if I do it manually, then I still have to seek manually. How will FMOD (esp. the function Stream_SetTime) know the timedata of the file? So I have to jump to the frames by myself and I think that’s not the way someone should use FMOD. Then, I could also use another mp3-decoder an play the decoded sound via the API…

  • You must to post comments
0
0

mdd: i tried to use the Xing (LAME uses it too) header with FMOD. It Is possble but i can’t get it very accurate timing functions.
But it is acceptable for playback :)

if you want the code mail me: christanaskoski@hotmail.com

  • You must to post comments
0
0

That’s also true.
I don’t really know how you may solve this problem.
Sometime ago I heard about some undocumented functions. They seem to be related to mp3 decoding, maybe there is a setposition that uses frames instead of ms.
At last a suggestion: why you don’t use ogg vorbis? Is mp3 support really need?

  • You must to post comments
0
0

[quote="brett":2chsupy3][quote="Chris":2chsupy3]mdd: i tried to use the Xing (LAME uses it too) header with FMOD. It Is possble but i can’t get it very accurate timing functions.
But it is acceptable for playback :)

if you want the code mail me: christanaskoski@hotmail.com[/quote:2chsupy3]

looks like the xing header provides only 100 points to reference inside the file, which is going to be the cause of the innacuracy. FMOD does a similar thing, but has as many points as there are frames so it gets the exact millisecond offset for each mpeg frame. I found some of the info here http://www.multiweb.cz/twoinches/MP3inside.htm which if you wrote the code, then you already know about :). But others might find it interesting.[/quote:2chsupy3]

thanks!
i did wrote the code myself but maybe i can improve it a bit now ๐Ÿ˜€

  • You must to post comments
0
0

Well, I need both of them. It should be a MediaPlayer and so I need MP3s and Oggs.
As far as I know, Ogg supports VBR, too, so it would also be neccessary to prescan the Ogg-files.

  • You must to post comments
Showing 19 results
Your Answer

Please first to submit.