maxl0rd / standingwave3

Flash ActionScript3 dynamic audio library

Home Page:http://www.noteflight.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Looping a Listperformance

Thunder-Dan opened this issue · comments

Hey maxl0rd,

I tried creating a Listperformance and looping it. See my code for details:
I expected the loop to be played back steadily and without gaps.
Why is there a pause after every 4 beeps? Did I make a stupid mistake?
Is there maybe an easier way to achieve this?
Thanks in advance - the library is awesome!

var sequence:ListPerformance = new ListPerformance();
for (var i:int = 0;i<4;i++) {
  sequence.addSourceAt( i/2  , new SineSource(new AudioDescriptor(), 0.1, 440));
}

// Play it back.
var source:IAudioSource = new AudioPerformer(sequence, new AudioDescriptor(44100,2));

var mySample:Sample = source.getSample(source.frameCount)
var myLoop:LoopSource = new LoopSource(source.descriptor, mySample);
myLoop.firstFrame = 0;
myLoop.startFrame = 0;
myLoop.endFrame = source.frameCount;

var player:AudioPlayer = new AudioPlayer();
player.play(myLoop);

I also am having this issue with LoopSource. Can't seem to find out why there is a pause on every loop even when the duration is set.