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

simple event addition : end of score EVENT #51

Open
patikapusula opened this issue Feb 20, 2021 · 1 comment
Open

simple event addition : end of score EVENT #51

patikapusula opened this issue Feb 20, 2021 · 1 comment

Comments

@patikapusula
Copy link

An "end of score" callback, useful for adapting the UI elements.

PlaybackEngine.ts

export enum PlaybackEvent {
  STATE_CHANGE = "state-change",
  ITERATION = "iteration",
  END_OF_SCORE = "end-of-score", // new event
}

// callback
  private endOfScoreCallback(message: string) {
    this.events.emit(PlaybackEvent.END_OF_SCORE, message);
  }

 // check for "end of score" and firing cb
private iterationCallback() {
    if (this.state !== PlaybackState.PLAYING) return;
    if (this.currentIterationStep > 0) this.cursor.next();
    ++this.currentIterationStep;	
// Checking here
if (this.currentIterationStep > this.iterationSteps) {
      this.endOfScoreCallback("End of score");
    }
}
@jimutt
Copy link
Owner

jimutt commented Mar 2, 2021

Hi!
Thanks, yes this could definitely useful. Feel free to open a PR with the change or I can integrate it myself soon.

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