|
sample instance |
Matheus Santos
Member #15,053
April 2013
|
it is possible to play a sample for a given time? using the sample instance for example? |
Trent Gamblin
Member #261
April 2000
|
You can either loop it or set the speed so that it'll stretch to the time you want.
|
André Silva
Member #11,991
May 2010
|
If you want it to play for a shorter amount of time than what it normally lasts for, shouldn't al_init_timeout work? I have to be honest, I don't quite know what timeouts in Allegro are, and a quick read through the manual didn't help much, but I'm guessing that they're a bit like Javascript's setTimeout()?
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
I think the ALLEGRO_TIMEOUT is only used for the event queue when waiting for an event. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
ph03nix
Member #15,028
April 2013
|
Are you using Allegro 5? There's a function called al_set_sample_instance_length. I haven't ever tried it but it seems to do what you want. If that doesn't work you could easily just program an integer to iterate and stop the sound when it reaches a specified value, but this can become desynced if the program stops updating while the sound keeps playing (for example while switching to full screen) |
|