Permalink
Switch branches/tags
develop feat/chordSymbols feature/Articulations feature/Expressions feature/Lyrics feature/Ornaments feature/Repetitions feature/Slurs feature/StemDirection feature/Tabs feature/Theming feature/chordSymbols feature/defaultColorAll feature/metronomeMarkGraphical feature/microtonal feature/pluginInfrastructure feature/staffLineElement fix/SlurPositioning fix/cursorStepping fix/double-rest-elimination-for-multi-voice fix/karma fix/transparentToWhiteBackground fix/zoomFix greenkeeper/cross-env-5.1.4 greenkeeper/cross-env-5.1.5 greenkeeper/cross-env-5.1.6 greenkeeper/cross-env-5.2.0 greenkeeper/cross-env-pin-5.1.3 greenkeeper/eslint-plugin-import-2.10.0 greenkeeper/eslint-plugin-import-2.11.0 greenkeeper/eslint-plugin-import-2.12.0 greenkeeper/eslint-plugin-import-2.13.0 greenkeeper/eslint-plugin-import-pin-2.9.0 greenkeeper/tslint-loader-3.6.0 greenkeeper/tslint-loader-pin-3.5.3 greenkeeper/@types/chai-4.0.7 greenkeeper/@types/chai-4.0.8 greenkeeper/@types/chai-4.0.9 greenkeeper/@types/chai-4.0.10 greenkeeper/@types/chai-4.1.0 greenkeeper/@types/chai-4.1.1 greenkeeper/@types/chai-4.1.2 greenkeeper/@types/chai-4.1.3 greenkeeper/@types/chai-4.1.4 greenkeeper/@types/chai-pin-4.0.6 greenkeeper/@types/loglevel-1.5.0 greenkeeper/@types/loglevel-pin-1.4.30 greenkeeper/typescript-collections-1.2.4 greenkeeper/typescript-collections-1.2.5 greenkeeper/update-to-node-10 greenkeeper/webpack-4.27.1 improvement/Infrastructure improvement/ghostnotes improvement/osmd-debug-release master osmd4node
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
93 lines (89 sloc) 4.75 KB
import { DrawingParametersEnum } from "../MusicalScore/Graphical/DrawingParameters";
/** Possible options for the OpenSheetMusicDisplay constructor, none are mandatory. */
export interface IOSMDOptions {
/** Whether to automatically create beams for notes that don't have beams set in XML. */
autoBeam?: boolean;
/** Options for autoBeaming like whether to beam over rests. See AutoBeamOptions interface. */
autoBeamOptions?: AutoBeamOptions;
/** Automatically resize score with canvas size. Default is true. */
autoResize?: boolean;
/** Render Backend, will be SVG if given undefined, SVG or svg, otherwise Canvas. */
backend?: string;
/** Whether to enable coloring noteheads and stems by their XML color attribute. */
coloringEnabled?: boolean;
/** Default color for a note head (without stem). Default black (undefined). */
defaultColorNotehead?: string;
/** Default color for a note stem. Default black (undefined). */
defaultColorStem?: string;
/** Default color for rests. Default black (undefined). */
defaultColorRest?: string;
/** Default color for Labels like title or lyrics. Default black (undefined). */
defaultColorLabel?: string;
/** Default color for labels in the title. Overrides defaultColorLabel for title labels like composer. Default black (undefined). */
defaultColorTitle?: string;
/** Don't show/load cursor. Will override disableCursor in drawingParameters. */
disableCursor?: boolean;
/** Broad Parameters like compact or preview mode. */
drawingParameters?: string | DrawingParametersEnum;
/** Whether to draw the title of the piece. If false, disables drawing Subtitle as well. */
drawTitle?: boolean;
/** Whether to draw the subtitle of the piece. If true, enables drawing Title as well. */
drawSubtitle?: boolean;
/** Whether to draw credits (title, composer, arranger, copyright etc., see <credit>. Not yet supported. */ // TODO
drawCredits?: boolean;
/** Whether to draw the lyricist's name, if given. */
drawLyricist?: boolean;
/** Whether to draw part (instrument) names. */
drawPartNames?: boolean;
/** Whether to draw fingerings (only left to the note for now). Default true. */
drawFingerings?: boolean;
/** Where to draw fingerings (left, right, above, below, auto).
* Default left. Auto, above, below experimental (potential collisions because bounding box not correct)
*/
fingeringPosition?: string;
/** For above/below fingerings, whether to draw them directly above/below notes (default), or above/below staffline. */
fingeringInsideStafflines?: boolean;
/** Only draw measure 1 to n, where n is the number you specify. */
drawUpToMeasureNumber?: number;
/** Whether to set the wanted stem direction by xml (default) or automatically. */
setWantedStemDirectionByXml?: boolean;
/** Whether tuplets are labeled with ratio (e.g. 5:2 instead of 5 for quintuplets). Default false. */
tupletsRatioed?: boolean;
/** Whether all tuplets should be bracketed (e.g. |--5--| instead of 5). Default false.
* If false, only tuplets given as bracketed in XML (bracket="yes") will be bracketed.
*/
tupletsBracketed?: boolean;
/** Whether all triplets should be bracketed. Overrides tupletsBracketed for triplets.
* If false, only triplets given as bracketed in XML (bracket="yes") will be bracketed.
* (Bracketing all triplets can be cluttering)
*/
tripletsBracketed?: boolean;
/** Whether to draw hidden/invisible notes (print-object="no" in XML). Default false. Not yet supported. */ // TODO
drawHiddenNotes?: boolean;
}
/** Handles [[IOSMDOptions]], e.g. returning default options with OSMDOptionsStandard() */
export class OSMDOptions {
/** Returns the default options for OSMD.
* These are e.g. used if no options are given in the [[OpenSheetMusicDisplay]] constructor.
*/
public static OSMDOptionsStandard(): IOSMDOptions {
return {
autoResize: true,
backend: "svg",
drawingParameters: DrawingParametersEnum.default,
};
}
}
export interface AutoBeamOptions {
/** Whether to extend beams over rests. Default false. */
beam_rests?: boolean;
/** Whether to extend beams only over rests that are in the middle of a potential beam. Default false. */
beam_middle_rests_only?: boolean;
/** Whether to maintain stem direction of autoBeamed notes. Discouraged, reduces beams. Default false. */
maintain_stem_directions?: boolean;
/** Groups of notes (fractions) to beam within a measure.
* List of fractions, each fraction being [nominator, denominator].
* E.g. [[3,4],[1,4]] will beam the first 3 quarters of a measure, then the last quarter.
*/
groups?: [number[]];
}