I have music audio that I'd like to play portions of, during different times of the game.
For example, play the first 20 seconds of the music then stop.
Later I'll have it start at minute 1:00 of the music and play for 30 seconds.
The only condition for stopping the music is the length of time it's been playing. The manual mentions using Wait(int).
Code: ags
This isn't ideal because Wait will block (from what I understand), Also, Wait() doesn't use seconds but frame/loops (?) so there is some conversion there and I don't know how accurate it will be for every machine.
I also tried using a while loop and checking the channel song position (PositionMS) until a given PositionMS number, but it kept crashing because it said I was stuck in a long running loop.
Is there another way I could go about this?
I rather not create a ton of music clips, but that might be the answer.
For example, play the first 20 seconds of the music then stop.
Later I'll have it start at minute 1:00 of the music and play for 30 seconds.
The only condition for stopping the music is the length of time it's been playing. The manual mentions using Wait(int).
aSong.PlayFrom(1000);
Wait(40);
aSong.Stop();
This isn't ideal because Wait will block (from what I understand), Also, Wait() doesn't use seconds but frame/loops (?) so there is some conversion there and I don't know how accurate it will be for every machine.
I also tried using a while loop and checking the channel song position (PositionMS) until a given PositionMS number, but it kept crashing because it said I was stuck in a long running loop.
Is there another way I could go about this?
I rather not create a ton of music clips, but that might be the answer.