(options: RecorderAppOptions = {})
| 78 | private subscriptions: (() => void)[] = []; |
| 79 | |
| 80 | constructor(options: RecorderAppOptions = {}) { |
| 81 | this.rhythm = options.rhythm ?? RHYTHM_4_4_STRAIGHT; |
| 82 | this.slotDuration = pickSlotDuration(this.rhythm.subdivisionsPerBeat); |
| 83 | this.slotTicks = MIDI_QUARTER_TIME / this.rhythm.subdivisionsPerBeat; |
| 84 | |
| 85 | this.root = parseHtml(html` |
| 86 | <div class="at-wrap at-wrap-recorder"> |
| 87 | <div class="cmp-overlay"></div> |
| 88 | <div class="at-content"> |
| 89 | <div class="cmp-sidebar"></div> |
| 90 | <div class="at-viewport"> |
| 91 | <div class="at-canvas"></div> |
| 92 | </div> |
| 93 | </div> |
| 94 | <div class="cmp-footer"></div> |
| 95 | </div> |
| 96 | `); |
| 97 | |
| 98 | const viewport = this.root.querySelector<HTMLElement>('.at-viewport')!; |
| 99 | const canvas = this.root.querySelector<HTMLElement>('.at-canvas')!; |
| 100 | |
| 101 | const settings = new alphaTab.Settings(); |
| 102 | settings.fillFromJson({ |
| 103 | core: { |
| 104 | fontDirectory: options.fontDirectory ?? Paths.fontDirectory |
| 105 | }, |
| 106 | player: { |
| 107 | playerMode: alphaTab.PlayerMode.EnabledAutomatic, |
| 108 | soundFont: options.soundFont ?? Paths.soundFont, |
| 109 | scrollOffsetX: -10, |
| 110 | scrollOffsetY: -20, |
| 111 | scrollElement: viewport |
| 112 | }, |
| 113 | display: { |
| 114 | layoutMode: alphaTab.LayoutMode.Parchment, |
| 115 | justifyLastSystem: true |
| 116 | } |
| 117 | } satisfies alphaTab.json.SettingsJson); |
| 118 | |
| 119 | this.api = new alphaTab.AlphaTabApi(canvas, settings); |
| 120 | this.subscriptions.push(this.api.error.on(e => console.error('alphaTab error', e))); |
| 121 | |
| 122 | // build the empty percussion score |
| 123 | this.score = new alphaTab.model.Score(); |
| 124 | this.track = new alphaTab.model.Track(); |
| 125 | this.track.name = 'Drums'; |
| 126 | this.track.shortName = 'Drums'; |
| 127 | this.track.ensureStaveCount(1); |
| 128 | this.track.playbackInfo.primaryChannel = 9; |
| 129 | this.track.playbackInfo.secondaryChannel = 9; |
| 130 | this.staff = this.track.staves[0]; |
| 131 | this.staff.isPercussion = true; |
| 132 | this.staff.showTablature = false; |
| 133 | this.staff.showStandardNotation = true; |
| 134 | this.score.addTrack(this.track); |
| 135 | this.score.defaultSystemsLayout = 5; |
| 136 | this.track.defaultSystemsLayout = 5; |
| 137 |
nothing calls this directly
no test coverage detected