[Openal] Play sound back with OpenAl ?

Chris Robinson chris.kcat at gmail.com
Thu May 22 02:58:54 PDT 2008


On Thursday 22 May 2008 02:34:23 am you wrote:
> You do not understand me.
> I go to perform a multimedia application that will allow me to manipulate
> the sounds (play pause, fast backward, fast forward ..)
> I have not been able to make fast backward and listen at the same time the
> sounds that go back.
> How to do this ? (fast backward and listen at the same time the sounds that
> go back).

Ah, you want to play the sound backward. Unfortuantely, OpenAL doesn't really 
allow that. If you simply want to skip backwards, you could just continuously 
set the play position back, eg:

ALfloat curpos = 0.0f;
alGetSourcef(sourceID, AL_SEC_OFFSET, &curpos);

curpos -= 0.125f;
while(curpos > 0.0f) {
    alSourcef(sourceID, AL_SEC_OFFSET, curpos);
    curpos -= 0.125f;
}
curpos = 0.0f;
alSourceStop(sourceID);

but if you wanted it to play smoothly, you'd have to modify the actual data 
that you'd pass to alBufferData again (of course, this means stopping the 
sound first).


More information about the Openal mailing list