Beam.ts 995 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {Note} from "./Note";
  2. /**
  3. * A [[Beam]] - the bar grouping multiple consecutive [[Note]]s.
  4. */
  5. export class Beam {
  6. private notes: Note[] = [];
  7. private extendedNoteList: Note[] = [];
  8. public get Notes(): Note[] {
  9. return this.notes;
  10. }
  11. public set Notes(value: Note[]) {
  12. this.notes = value;
  13. }
  14. public get ExtendedNoteList(): Note[] {
  15. return this.extendedNoteList;
  16. }
  17. public set ExtendedNoteList(value: Note[]) {
  18. this.extendedNoteList = value;
  19. }
  20. /**
  21. * Perform all the appropriate actions for adding a singleNote to the Beam.
  22. * @param note
  23. */
  24. public addNoteToBeam(note: Note): void {
  25. if (note !== undefined) {
  26. note.NoteBeam = this;
  27. this.notes.push(note);
  28. this.extendedNoteList.push(note);
  29. }
  30. }
  31. }
  32. export enum BeamEnum {
  33. BeamNone = -1,
  34. BeamBegin = 0,
  35. BeamContinue = 1,
  36. BeamEnd = 2,
  37. BeamForward = 3,
  38. BeamBackward = 4,
  39. }