Hello, I am quite new to FMOD, and I need a question answered. What is the best method of acquiring the total length of a CD (i.e. the combined length of all tracks). I want to be able to display it’s length in the format “minutes:seconds:milliseconds”.
BTW, FMOD is a great library. It is alot easier to use than DirectAudio, and seems to be more powerful.
- Legalos asked 13 years ago
If you’re using the FSOUND_CD_xxx functions, use FSOUND_CD_GetNumTracks to find out how many tracks there are and then call FSOUND_CD_GetTrackLength for each track.
If you’re using the FSOUND_Stream_xxx functions (i.e. CDDA), use FSOUND_Stream_GetNumSubStreams to find out how many tracks there are and then call FSOUND_Stream_GetLength or FSOUND_Stream_GetLengthMs for each track. See the samples\cdda example if you need further clarification.
The FSOUND_Stream_xxx functions read the CD digitally so the stream can be treated like a normal file stream i.e. you can change the frequency, attach DSP units to it, write it out to file etc. The FSOUND_CD_xxx functions play the CD in analog mode so it takes less CPU time but you can’t access the playing data or change frequency or anything like that.
Is selecting each substream with FSOUND_Stream_SetSubStream and then getting the length the only way? I’ve found that this method takes a tremendous amount of time because you have to poll FSOUND_Stream_GetOpenState and wait for the stream to be ready again before getting the length. Maybe I’m just overlooking something. Any insights on this matter would be greatly appreciated.
Please login first to submit.