Audio: Is it possible to change the RepeatStyle property for a sound playing?

Started by puddlesofun, Thu 22/11/2012 01:53:10

Previous topic - Next topic

puddlesofun

Currently I am using the Play command to play a short loop of music in each room of my game, but I am finding it really jarring that the loop is stopped halfway through when the player enters a new room. Ideally, I would like the previous audio file to continue playing to its end before the next one starts.

Substituting PlayQueued doesn't seem to work for this: it either doesn't play or just interrupts like normal, depending on the priority I assign.

I'm new at this, so I am assuming there is a simple scripting solution that I am too stupid to see. I'm very grateful in advance to anyone who can help.

Here is what my useless code currently looks like:

EDIT:
So I kept banging my head against this and I have kinda sorta solved it, but it's a bit messy. What I have now in each room is something like this:
Quotefunction room_RepExec()
{
if (musicchannel == null || !musicchannel.IsPlaying) musicchannel = tuneforthisroom.Play(eAudioPriorityNormal, eOnce);
}
(wherein tuneforthisroom is the music file that needs to be played for this particular room)

The problem with this method is that there is an audible gap between the end of the file and it repeating, which is not the case when eRepeat is used.

What would be ideal would be if there was a way to change the RepeatStyle on an audio file that is playing without retriggering it. Then I wouldn't have to faff around with repeatedly executing stuff. Does anyone know how to do that?

SMF spam blocked by CleanTalk