Skip to content

Commit

Permalink
more multi-measure rest fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronDavidNewman committed Jan 25, 2024
1 parent 898aef3 commit d2590a8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
9 changes: 0 additions & 9 deletions src/smo/data/partInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ export interface SmoMidiInstrument {
* and contains the notes from the score. It can be comprised of 1 or 2 adjacent staves.
* Usually you will call
* {@link SmoPartInfo.defaults}, and modify the parameters you need to change.
* @param partName
* @param partAbbreviation
* @param stavesAfter for multi-stave parts (e.g. piano), indicates the relative position in the full score.
* @param stavesBefore
* @param layoutManager page/layout settings for the part
* @param measureFormatting a map of measure format to measures for the part
* @param textGroups if preserveTextGroups is true, the part has its own text.
* @param preseverTextGroups if false, we use the full score text
* @param cueInScore indicates tiny notes, like for piano accompaniment
* @category SmoParameters
*/
export interface SmoPartInfoParams {
Expand Down
17 changes: 14 additions & 3 deletions src/smo/data/systemStaff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,21 @@ export class SmoSystemStaff implements SmoObjectParams {
isRest(index: number) {
return this.measures[index].isRest();
}
/**
* for the purposes of breaking up multimeasure rests, isRepeat is true if
* the next bar has a start repeat, or the current bar has an end repeat.
* @param index
* @returns
*/
isRepeat(index: number) {
const specialBar = !(this.measures[index].getEndBarline().barline === SmoBarline.barlines.singleBar &&
(this.measures[index].getStartBarline().barline === SmoBarline.barlines.singleBar ||
this.measures[index].getStartBarline().barline === SmoBarline.barlines.noBar));
if (index < this.measures.length - 1) {
if (this.measures[index + 1].getStartBarline().barline !== SmoBarline.barlines.singleBar &&
this.measures[index + 1].getStartBarline().barline !== SmoBarline.barlines.noBar) {
return true;
}
}
const specialBar = this.measures[index].getEndBarline().barline !== SmoBarline.barlines.singleBar &&
this.measures[index].getStartBarline().barline !== SmoBarline.barlines.noBar;
return specialBar || this.measures[index].repeatSymbol;
}
isRepeatSymbol(index: number) {
Expand Down

0 comments on commit d2590a8

Please sign in to comment.