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

With Multiple sounds, not looping #4

Open
ghost opened this issue Jul 24, 2014 · 2 comments
Open

With Multiple sounds, not looping #4

ghost opened this issue Jul 24, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 24, 2014

When I use the following code example, the 1st sound is not looping.
var loop = new SeamlessLoop();

        loop.addUri('Loading_tune.mp3', 6*1000, 'Loading_tune');
        loop.addUri('background_sound.mp3', 144*1000, 'background_sound');

        loop.callback(function()
        {
            loop.start('Loading_tune');
            loop.start('background_sound');

// After 10s stop only background (Loading_tune should still loop)

            setTimeout(function()
            {
                loop.stop('background_sound');
            }, 10*1000);
        });
@brantome
Copy link

Same problem here. Any ideas on how to play multiple loops at the same time ?
Thanks

@roganoalien
Copy link

roganoalien commented Mar 12, 2019

Create one seamlessloop object for each sound. Load every sound and call the callback to validate each sound is loaded and then start every sound.

loop1.addUri('/Content/sounds/song2/drums-new.mp3', 20000, "drums");
loop2.addUri('/Content/sounds/song2/bass.mp3', 20000, "bass");
loop3.addUri('/Content/sounds/song2/fxs.mp3', 20000, "fxs");
loop4.addUri('/Content/sounds/song2/guitars.mp3', 20000, "guitars");
loop5.addUri('/Content/sounds/song2/synth.mp3', 20000, "synth");

loop1.callback(function(){
    validator++;
    canPlay(validator);
});
....

canPlay(validator){
    if(validator === 5){
        loop1.start();
        loop2.start();
        loop3.start();
        loop4.start();
        loop4.start();
}

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