I’m using a custom DSP to implement volume envelopes. It’s within the context of a sequencer where audio is scheduled using Channel::setDelay (FMOD_DELAYTYPE delaytype, unsigned int delayhi, unsigned int delaylo) in order to achieve accurate timing.
The issue I’m having is with identifying the exact beginning of the sound data. I’m having difficulty – for example – beginning a fade at sample 0 of a sound because the DSP callback is called regardless of whether the scheduled channel is playing back yet. The DSP clock is also not accurate enough to use for measuring since it increments with coarse granularity.
I could test for the first non-zero value detected, but if an audio file begins with silence the timing will be thrown off. Any advice would be appreciated. Thank you!
- graham.mcd asked 5 years ago
You should be able to get the clock value from the dsp callback with System::getDSPClock. When the 1024 sample block comes along, the clock sholud be a multiple of 1024. Just count into the block with youroffset%blocksize to get the sample offset inside the mix block.
Thanks Brett – that API you mentioned for FMOD studio sounds promising. We’re on iOS though which I don’t see listed under the supported platforms. Are you planning on releasing it for iOS?
I’ll also check out your suggestion regarding sample counting. Thanks!
- graham.mcd answered 5 years ago
Please login first to submit.