orpheus-osmd
Version:
An open source JavaScript engine for displaying MusicXML based on VexFlow.
179 lines (178 loc) • 7.73 kB
TypeScript
import { Fraction } from "../../Common/DataObjects/Fraction";
import { VerticalSourceStaffEntryContainer } from "./VerticalSourceStaffEntryContainer";
import { SourceStaffEntry } from "./SourceStaffEntry";
import { RepetitionInstruction } from "./Instructions/RepetitionInstruction";
import { Staff } from "./Staff";
import { VoiceEntry } from "./VoiceEntry";
import { Voice } from "./Voice";
import { MusicSheet } from "../MusicSheet";
import { MultiExpression } from "./Expressions/MultiExpression";
import { MultiTempoExpression } from "./Expressions/MultiTempoExpression";
import { KeyInstruction } from "./Instructions/KeyInstruction";
import { GraphicalMeasure, SystemLinesEnum } from "../Graphical";
/**
* The Source Measure represents the source data of a unique measure, including all instruments with their staves.
* There exists one source measure per XML measure or per paper sheet measure (e.g. the source measures are not doubled in repetitions)
*/
export declare class SourceMeasure {
/**
* The data entries and data lists will be filled with null values according to the total number of staves,
* so that existing objects can be referred to by staff index.
* @param completeNumberOfStaves
*/
constructor(completeNumberOfStaves: number);
/**
* The unique measure list index starting with 0.
*/
measureListIndex: number;
/**
* The measure number for showing on the music sheet. Typically starts with 1.
*/
endsPiece: boolean;
/**
* The style of the ending bar line.
*/
endingBarStyleXml: string;
endingBarStyleEnum: SystemLinesEnum;
private measureNumber;
private absoluteTimestamp;
private completeNumberOfStaves;
private duration;
private activeTimeSignature;
private staffLinkedExpressions;
private tempoExpressions;
private verticalSourceStaffEntryContainers;
private implicitMeasure;
private breakSystemAfter;
private graphicalMeasureErrors;
private firstInstructionsStaffEntries;
private lastInstructionsStaffEntries;
private firstRepetitionInstructions;
private lastRepetitionInstructions;
private tempoInBPM;
private verticalMeasureList;
get MeasureNumber(): number;
set MeasureNumber(value: number);
get AbsoluteTimestamp(): Fraction;
set AbsoluteTimestamp(value: Fraction);
get CompleteNumberOfStaves(): number;
get Duration(): Fraction;
set Duration(value: Fraction);
get ActiveTimeSignature(): Fraction;
set ActiveTimeSignature(value: Fraction);
get ImplicitMeasure(): boolean;
set ImplicitMeasure(value: boolean);
get BreakSystemAfter(): boolean;
set BreakSystemAfter(value: boolean);
get StaffLinkedExpressions(): MultiExpression[][];
get TempoExpressions(): MultiTempoExpression[];
get VerticalSourceStaffEntryContainers(): VerticalSourceStaffEntryContainer[];
get FirstInstructionsStaffEntries(): SourceStaffEntry[];
get LastInstructionsStaffEntries(): SourceStaffEntry[];
get FirstRepetitionInstructions(): RepetitionInstruction[];
get LastRepetitionInstructions(): RepetitionInstruction[];
getErrorInMeasure(staffIndex: number): boolean;
setErrorInGraphicalMeasure(staffIndex: number, hasError: boolean): void;
getNextMeasure(measures: SourceMeasure[]): SourceMeasure;
getPreviousMeasure(measures: SourceMeasure[]): SourceMeasure;
get VerticalMeasureList(): GraphicalMeasure[];
set VerticalMeasureList(value: GraphicalMeasure[]);
get TempoInBPM(): number;
set TempoInBPM(value: number);
/**
* Check at the given timestamp if a VerticalContainer exists, if not creates a new, timestamp-ordered one,
* and at the given index, if a [[SourceStaffEntry]] exists, and if not, creates a new one.
* @param inMeasureTimestamp
* @param inSourceMeasureStaffIndex
* @param staff
* @returns {{createdNewContainer: boolean, staffEntry: SourceStaffEntry}}
*/
findOrCreateStaffEntry(inMeasureTimestamp: Fraction, inSourceMeasureStaffIndex: number, staff: Staff): {
createdNewContainer: boolean;
staffEntry: SourceStaffEntry;
};
/**
* Check if a VerticalContainer, a staffEntry and a voiceEntry exist at the given timestamp.
* If not, create the necessary entries.
* @param sse
* @param voice
* @returns {{createdVoiceEntry: boolean, voiceEntry: VoiceEntry}}
*/
findOrCreateVoiceEntry(sse: SourceStaffEntry, voice: Voice): {
createdVoiceEntry: boolean;
voiceEntry: VoiceEntry;
};
/**
* Search for a non-null [[SourceStaffEntry]] at the given verticalIndex,
* starting from the given horizontalIndex and moving backwards. If none is found, then return undefined.
* @param verticalIndex
* @param horizontalIndex
* @returns {any}
*/
getPreviousSourceStaffEntryFromIndex(verticalIndex: number, horizontalIndex: number): SourceStaffEntry;
/**
* Return the index of the existing VerticalContainer at the given timestamp.
* @param musicTimestamp
* @returns {number}
*/
getVerticalContainerIndexByTimestamp(musicTimestamp: Fraction): number;
/**
* Return the existing VerticalContainer at the given timestamp.
* @param musicTimestamp
* @returns {any}
*/
getVerticalContainerByTimestamp(musicTimestamp: Fraction): VerticalSourceStaffEntryContainer;
/**
* Check the [[SourceMeasure]] for a possible VerticalContainer with all of its [[StaffEntry]]s undefined,
* and if found, remove the VerticalContainer from the [[SourceMeasure]].
* @param index
*/
checkForEmptyVerticalContainer(index: number): void;
/**
* This method is used for handling a measure with the following error (in the procedure of finding out the Instrument's Duration):
* If the LastStaffEntry is missing (implied restNote or error), then go back the StaffEntries until you find a TiedNote (tie Start),
* which gives the correct MeasureDuration.
* @param musicSheet
* @param maxInstDuration
* @returns {Fraction}
*/
reverseCheck(musicSheet: MusicSheet, maxInstDuration: Fraction): Fraction;
/**
* Calculate all the [[Instrument]]'s NotesDurations for this Measures.
* @param musicSheet
* @param instrumentMaxTieNoteFractions
* @returns {Fraction[]}
*/
calculateInstrumentsDuration(musicSheet: MusicSheet, instrumentMaxTieNoteFractions: Fraction[]): Fraction[];
getEntriesPerStaff(staffIndex: number): SourceStaffEntry[];
/**
*
* @returns {boolean} true iff some measure begin instructions have been found for at least one staff
*/
hasBeginInstructions(): boolean;
beginsWithLineRepetition(): boolean;
/**
* Check if this measure is a Repetition Ending.
* @returns {boolean}
*/
endsWithLineRepetition(): boolean;
/**
* Check if a Repetition starts at the next Measure.
* @returns {boolean}
*/
beginsWithWordRepetition(): boolean;
/**
* Check if this Measure ends a Repetition.
* @returns {boolean}
*/
endsWithWordRepetition(): boolean;
beginsRepetitionEnding(): boolean;
endsRepetitionEnding(): boolean;
getKeyInstruction(staffIndex: number): KeyInstruction;
/**
* Return the first non-null [[SourceStaffEntry]] at the given InstrumentIndex.
* @param instrumentIndex
* @returns {SourceStaffEntry}
*/
private getLastSourceStaffEntryForInstrument;
}