Geri Borbás
Geri Borbás

Reputation: 16598

Play just a part of the sound (both in and out) with OpenAL (iOS)?

I have a recording that has some unuseful voices at the beginning, and at the end. How can I play just the middle part of the sound?

I have AL_SEC_OFFSET, that is suitable for the entry point, I already use it, but what about the endpoint?

Is there any smart OpenAL settings for this? Hopeso.

Thanks.

Upvotes: 2

Views: 318

Answers (2)

Karl
Karl

Reputation: 14974

OpenAL doesn't have built-in support for stopping playback at a specific sample point. A timer is your best bet in this case, even though it will be somewhat inaccurate.

If you want sample-perfect stopping, you could just load the middle part of the audio file into an ALBuffer rather than the entire thing. I have some code which does that here:

https://github.com/kstenerud/ObjectAL-for-iPhone/blob/master/ObjectAL/ObjectAL/Support/OALAudioFile.m#L188

Upvotes: 0

Geri Borbás
Geri Borbás

Reputation: 16598

There could be a workaround that fires a timer that stops playing before end. Any simplier?

Upvotes: 1

Related Questions