MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / renderScore

Method renderScore

packages/alphatab/src/AlphaTabApiBase.ts:669–693  ·  view source on GitHub ↗

* Initiates a rendering of the given score. * @param score The score containing the tracks to be rendered. * @param trackIndexes The indexes of the tracks from the song that should be rendered. If not provided, the first track of the * song will be shown. * @param renderHints Add

(score: Score, trackIndexes?: number[], renderHints?: RenderHints)

Source from the content-addressed store, hash-verified

667 * ```
668 */
669 public renderScore(score: Score, trackIndexes?: number[], renderHints?: RenderHints): void {
670 const tracks: Track[] = [];
671 if (!trackIndexes) {
672 if (score.tracks.length > 0) {
673 tracks.push(score.tracks[0]);
674 }
675 } else {
676 if (trackIndexes.length === 0) {
677 if (score.tracks.length > 0) {
678 tracks.push(score.tracks[0]);
679 }
680 } else if (trackIndexes.length === 1 && trackIndexes[0] === -1) {
681 for (const track of score.tracks) {
682 tracks.push(track);
683 }
684 } else {
685 for (const index of trackIndexes) {
686 if (index >= 0 && index <= score.tracks.length) {
687 tracks.push(score.tracks[index]);
688 }
689 }
690 }
691 }
692 this._internalRenderTracks(score, tracks, renderHints);
693 }
694
695 /**
696 * Renders the given list of tracks.

Callers 3

runVisualTestFullMethod · 0.95
loadMethod · 0.95
texMethod · 0.95

Calls 2

_internalRenderTracksMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected