Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete Event will not fire for Audio Player #19

Open
jamestyner opened this issue Nov 5, 2011 · 1 comment
Open

Complete Event will not fire for Audio Player #19

jamestyner opened this issue Nov 5, 2011 · 1 comment

Comments

@jamestyner
Copy link

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;
}

@Jobbies
Copy link

Jobbies commented Feb 9, 2012

In the AudioPlayer constructor it adds a listener for SOUND_COMPETE and in the handler dispatches that same event so I'm guessing you should probably listen for that.

public function AudioPlayer(framesPerCallback:Number = 4096)
        {
            _sampleHandler = new AudioSampleHandler(framesPerCallback); 
            _sampleHandler.addEventListener(Event.SOUND_COMPLETE, handleComplete);
            _progressTimer.addEventListener(TimerEvent.TIMER, handleProgressTimer);
        }

private function handleComplete(e:Event):void
        {
            dispatchEvent(e);
            _progressTimer.stop();
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants