Hey guys,

I'm doing a sound controller class, and one of the things i want to do is pausing and looping. separately, they work fine, but when combined, problems occur.

Ok, first off, when pausing (a bit pseudo code):
Code:
private var pos:int;
public function Pause( pause:True ):void
{
   if( pause)
   {
      pos = soundChannel.position;
      soundChannel.stop();
   }
   else
   {
      soundChannel = sound.play( pos );
   }
}
that all works fine. My problem is when I combine it with looping. Normally, if you want to loop something, you do this:
Code:
soundChannel = sound.play( 0, numLoops );
which will loop it fine. However, if you change the starting position - like coming back from a pause - like this:
Code:
soundChannel = sound.play( pos, numLoops );
what'll happen is that it will actually loop *from the position that you set* and not "play the rest of the sound, then loop from 0".

I'm assuming this is default behaviour, which is fine, but does anyone know a way around this?

The only event you get from the SoundChannel class is SOUND_COMPLETE, which only triggers on looping sounds when the required number of loops have been played.

I've tried making my own looping system, which works except that there's a noticeable pause between the end of the loop and the start of the next one (taken up by removing listeners, setting parameters, calling play()).

Any solution?
Thanks,
Damian