Skip to content
This repository has been archived by the owner on Jun 9, 2019. It is now read-only.

[MML] ended event is raised too early #32

Open
revilofr opened this issue Nov 5, 2014 · 2 comments
Open

[MML] ended event is raised too early #32

revilofr opened this issue Nov 5, 2014 · 2 comments

Comments

@revilofr
Copy link
Contributor

revilofr commented Nov 5, 2014

Hi,

Thanks for your work. I'm doing a mml gui of my own and I discovered your library. Great job !

I just noticed that the event 'ended' was raise even if the song is not finished.
So the song continue to play but the event is raised...

Maybe that's not a bug, but I had to ask.

Here is a part of my code to enlight you:

function _play(mmlPartition) {
playBtn.html('Pause');
var player = T("mml", {mml: mmlPartition}, gen);

    //Subscribtions to every events
    gen.on('ended', function () {
        playBtn.html('Play');
        _displayStatus('ended');
        //$('#play_button').html('Play');
        gen.stop();
        gen.reset(T);

        T.stop();
    });

    gen.on('pause', function () {
        _displayStatus('pause');
        playBtn.html('Resume');
    });
    ......
    player.start();
    gen.play(mmlPartition);
}
@revilofr
Copy link
Contributor Author

revilofr commented Nov 5, 2014

Ok I have more info :

it works perfecly with that mml string :
">ed+ed+ec-dc<a8.ceab8.eg+bb+8.e>ed+ed+ec-dc<a8.ceal8.bdal16b>cde8.fed8.edc8.dc<b8.e>e8.eed+ed+ec-dc<a8.ceab8.eg+bb+8.>ed+ed+ec-dc<a8.ceab8.eg+b16a2"

It doesn't work with this one :
"t64r64l16o5>ed+ed+ec-dc<a8.ceab8.eg+bb+8.e>ed+ed+ec-dc<a8.ceal8.bdal16b>cde8.fed8.edc8.dc<b8.e>e8.eed+ed+ec-dc<a8.ceab8.eg+bb+8.>ed+ed+ec-dc<a8.ceab8.eg+b16a2"

The issue is in fact that the first part "t64r64l16o5". It's used by some generators to specify BPM and other settings.

From timbre.js perpective we can notice that the song continue to be played, even if there is some unknown caracters. But the event 'ended' is raised.

is it a normal behaviour?

thanks a lot !

@revilofr
Copy link
Contributor Author

revilofr commented Nov 6, 2014

ok, I made few progresses.
I dug into it and it seems that 2 mml commands cause the raise of an 'ended' event :
'.' and 'r'

I'm continuing to dig into it.

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

No branches or pull requests

1 participant