Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Sample-precise audio control

This thread is locked; no one can reply to it. rss feed Print
Sample-precise audio control
roger levy
Member #2,513
July 2002

Hi everyone,
My goal is to take a TV-turning-on sound I found, which includes a pulsing "hum" section that I've seemlessly looped in Audacity, and in my game play the "turn on" sound and then immediately start playing the "hum" sound with looping the moment the turn-on sound ends, for a seamless transition.
Is there any provision in Allegro to do this, besides having to write my own sound mixing code?
I know of the concept of loop points - don't know how to set them in Audacity yet (if possible) or if Allegro even supports them, but I would still like to know how to go about timing sounds (or doing anything) at the sample level of time resolution.

Eric Johnson
Member #14,841
January 2013
avatar

So you basically just want to loop the an audio sample, or am I misunderstanding you?

You can loop audio using ALLEGRO_SAMPLE_INSTANCE and ALLEGRO_PLAYMODE_LOOP. But as for "loop points", I don't think Allegro has any built-in functionality for that.

Polybios
Member #12,293
October 2010

You can set loop points, but only on audio streams currently. They are passed as seconds with double precision.

Go to: