Skip to content

Commit

Permalink
Merge pull request #895 from rvilarl/migration/voicegroup
Browse files Browse the repository at this point in the history
Migration/voicegroup
  • Loading branch information
0xfe authored Apr 11, 2021
2 parents 99651b1 + 4894ded commit 04b6f22
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/voicegroup.js → src/voicegroup.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
// [VexFlow](http://vexflow.com) - Copyright (c) Mohit Muthanna 2010.

import type { ModifierContext } from './modifiercontext';
import { Vex } from './vex';
import { Voice } from './voice';

/** @constructor */
export class VoiceGroup {
protected voices: Voice[];
protected modifierContexts: ModifierContext[];

constructor() {
this.voices = [];
this.modifierContexts = [];
}

// Every tickable must be associated with a voiceGroup. This allows formatters
// and preformatters to associate them with the right modifierContexts.
getVoices() {
/**
* Every tickable must be associated with a voiceGroup. This allows formatters
* and preformatters to associate them with the right modifierContexts.
*/
getVoices(): Voice[] {
return this.voices;
}
getModifierContexts() {

getModifierContexts(): ModifierContext[] {
return this.modifierContexts;
}

addVoice(voice) {
addVoice(voice: Voice): void {
if (!voice) throw new Vex.RERR('BadArguments', 'Voice cannot be null.');
this.voices.push(voice);
voice.setVoiceGroup(this);
Expand Down

0 comments on commit 04b6f22

Please sign in to comment.