GraphicalLyricWord.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import {LyricWord} from "../VoiceData/Lyrics/LyricsWord";
  2. import {GraphicalLyricEntry} from "./GraphicalLyricEntry";
  3. /**
  4. * The graphical counterpart of a [[LyricWord]]
  5. */
  6. export class GraphicalLyricWord {
  7. private lyricWord: LyricWord;
  8. private graphicalLyricsEntries: GraphicalLyricEntry[] = [];
  9. constructor(lyricWord: LyricWord) {
  10. this.lyricWord = lyricWord;
  11. this.initialize();
  12. }
  13. public get GetLyricWord(): LyricWord {
  14. return this.lyricWord;
  15. }
  16. public get GraphicalLyricsEntries(): GraphicalLyricEntry[] {
  17. return this.graphicalLyricsEntries;
  18. }
  19. public set GraphicalLyricsEntries(value: GraphicalLyricEntry[]) {
  20. this.graphicalLyricsEntries = value;
  21. }
  22. public isFilled(): boolean {
  23. for (let i: number = 0; i < this.graphicalLyricsEntries.length; i++) {
  24. if (this.graphicalLyricsEntries[i] === undefined) {
  25. return false;
  26. }
  27. }
  28. return true;
  29. }
  30. private initialize(): void {
  31. // FIXME: This is actually not needed in Javascript as we have dynamic memory allication?
  32. for (let i: number = 0; i < this.lyricWord.Syllables.length; i++) {
  33. this.graphicalLyricsEntries.push(undefined);
  34. }
  35. }
  36. }