Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Reversed audio

This thread is locked; no one can reply to it. rss feed Print
Reversed audio
Aldrik
Member #16,925
December 2018
avatar

Is there any example available for playing a sample and audio stream in reverse?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

No, and that's kind of questionable whether it can be done currently.

You might have luck with ALLEGRO_PLAYMODE_BIDIR and al_set_sample_instance_position but I don't know if seeking to the second half of the bidirectional position is possible.

Somebody else might know more on #allegro on IRC on freenode.

Not really my subject of expertise.

Aldrik
Member #16,925
December 2018
avatar

I managed to get something to work by setting the sample instance speed to -1.0f and setting the position to the end of the sample but it has some weird side effects.

I will try what Edgar Reynaldo said and see if that has better results.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

roger levy
Member #2,513
July 2002

I'd like to know what works. I guess if there's no way to do it right now you could create a reverse version of the sample ...

Aldrik
Member #16,925
December 2018
avatar

In my game I am implementing rewind, I am storing the position of the sample instance every tick and set the position every tick when rewinding (60 FPS). I also set the sample instance speed to -1.0f. It doesn't work flawlessly but I think I can work around it.

I attached a video displaying the results.

Go to: