maxl0rd/standingwave3 — Issue #19: Complete Event will not fire for Audio Player
Author: loachman
Created: 2011-11-05 21:22:12+00:00
State: open

I have the following code and the "COMPLETE" event never fires. I have the com folder in the same directory as my .fla, and the awave.swc in my library path.

I am also getting "AUDIO CLIPPING" repeatedly traced out to the output panel. I changed the amplitude to 0.2 and even -5.0 it still plays just as loudly. I assume the amplitude is for the loudness? I thought lowering it would make the "AUDIO CLIPPING" go away and maybe that has something to do with the "COMPLETE EVENT" not firing.

import com.noteflight.standingwave3.elements.*
import com.noteflight.standingwave3.filters.*
import com.noteflight.standingwave3.formats.*
import com.noteflight.standingwave3.generators.*;
import com.noteflight.standingwave3.modulation.*;
import com.noteflight.standingwave3.output.*
import com.noteflight.standingwave3.performance.*;
import com.noteflight.standingwave3.sources.*;
import com.noteflight.standingwave3.utils.*;
import flash.events.Event;

var player:AudioPlayer = new AudioPlayer();
play_btn.addEventListener(MouseEvent.CLICK,playSinewave);

function playSinewave(e:Event):void{
var sinewave:IAudioSource = new SineSource(new AudioDescriptor(),5,440,0.2);
play_btn.enabled = false;
player.addEventListener(Event.COMPLETE,doComplete);
player.play(sinewave);
}

function doComplete(e:Event):void{
trace("COMPLETE")
play_btn.enabled = true;
}