I’m using FMOD Ex for a C# mp3/ogg sequencer
I want to get create peak data for music streams as they are added to the sequencer.
I was loading streams with FMOD_CREATESAMPLE, then locking/unlocking the entire sound and reading the bytes. Then closing that, and reopening with FMOD_CREATESTREAM.
I changed it so it just opened with FMOD_CREATESTREAM and then used seekData(0) and readData(…) because I figured this would be a more efficient way to do it. But in order to read the entire file using readData I need to know the exact number of bytes that stream will decode to, and getting the stream’s length as FMOD_TIMEUNIT_PCMBYTES gives me a value which is always slightly different to the number of bytes actually read by readData(…)
Is there a way to know how many bytes readData(…) will need? Should I just stick to the previous method of locking/unlocking?
- rowanseymour asked 11 years ago
Ensure that you are using time-accurate scanning when the source is opened for streaming. Currently, the flag is FMOD_ACCURATETIME, which has a value of &H4000.
If you are using this flag, the reported data length will match the READ length precisely, 99.5% of the time.
- stdev answered 11 years ago
Please login first to submit.