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

Problems with Performances and SoundSource #24

Open
seultwo opened this issue May 2, 2012 · 0 comments
Open

Problems with Performances and SoundSource #24

seultwo opened this issue May 2, 2012 · 0 comments

Comments

@seultwo
Copy link

seultwo commented May 2, 2012

Hello,
I have a problems with Performances and SoundSource. I tried your exemple for SoundSource but it doesn't work . It works good with sineSource and embed file but not with urlrequest. Can you help me? Ask me if you want precisions.

My code:

package
{

import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.media.Sound;
import flash.media.SoundLoaderContext;
import flash.net.URLRequest;
import com.noteflight.standingwave3.performance.AudioPerformer;
import com.noteflight.standingwave3.elements.IAudioSource;
import com.noteflight.standingwave3.performance.IPerformance;
import com.noteflight.standingwave3.elements.AudioDescriptor;
import com.noteflight.standingwave3.output.AudioPlayer;
import com.noteflight.standingwave3.sources.SineSource;
import com.noteflight.standingwave3.sources.SoundSource;
import com.noteflight.standingwave3.performance.ListPerformance;
/**
 * ...
 * @author Vincent
 */
public class Main extends Sprite 
{

    public function Main():void 
    {


        var player:AudioPlayer = new AudioPlayer(4096);
        var url_base:String = "sounds/base_1.mp3";
        var url_ambiance:String = "sounds/ambiance_1.mp3";
        var url_instru:String = "sounds/instru_1.mp3";
        var audio_desc:AudioDescriptor = new AudioDescriptor(44100,2);
        //var source:IAudioSource = new SineSource(new AudioDescriptor(), 5, 440);
        var source_base_0:IAudioSource;
        var source_ambiance_0:IAudioSource;
        var source_instru_0:IAudioSource;
        var sequence:ListPerformance = new ListPerformance();

        function handleSoundComplete(e:Event):void
        {
            trace(e.target.bytesLoaded);
            trace("ok2");
            source_base_0 = new SoundSource(e.target as Sound);
            sequence.addSourceAt(1, source_base_0, 0, 0);
        }
            var sound2:Sound = new Sound(new URLRequest("sounds/ambiance_1.mp3"));
            sound2.addEventListener(Event.COMPLETE, handleSoundComplete_2);


        function handleSoundComplete_2(e2:Event):void
        {
            trace(e2.target.bytesLoaded);
            trace("ok2 - ambiance");

            source_ambiance_0 = new SoundSource(e2.target as Sound);
            sequence.addSourceAt(1, source_ambiance_0, 0, 0)
        }

        var AP_seq:IAudioSource =  new AudioPerformer(sequence, audio_desc);
        //AP_seq.mixGain = -12;
        player.play(AP_seq);
    }
}

}

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

1 participant