-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a882a6
commit a6d5246
Showing
16 changed files
with
175 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Lists all note ornaments. | ||
*/ | ||
export enum NoteOrnament { | ||
None, | ||
InvertedTurn, | ||
Turn, | ||
UpperMordent, | ||
LowerMordent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Beat } from '@src/model'; | ||
import { NotationElement } from '@src/NotationSettings'; | ||
import { BarRendererBase } from '../BarRendererBase'; | ||
import { EffectBarGlyphSizing } from '../EffectBarGlyphSizing'; | ||
import { EffectBarRendererInfo } from '../EffectBarRendererInfo'; | ||
import { EffectGlyph } from '../glyphs/EffectGlyph'; | ||
import { Settings } from '@src/Settings'; | ||
import { NoteOrnament } from '@src/model/NoteOrnament'; | ||
import { NoteOrnamentGlyph } from '../glyphs/NoteOrnamentGlyph'; | ||
|
||
export class NoteOrnamentEffectInfo extends EffectBarRendererInfo { | ||
public get notationElement(): NotationElement { | ||
return NotationElement.EffectNoteOrnament; | ||
} | ||
|
||
public get hideOnMultiTrack(): boolean { | ||
return false; | ||
} | ||
|
||
public get canShareBand(): boolean { | ||
return true; | ||
} | ||
|
||
public get sizingMode(): EffectBarGlyphSizing { | ||
return EffectBarGlyphSizing.SingleOnBeat; | ||
} | ||
|
||
public shouldCreateGlyph(settings: Settings, beat: Beat): boolean { | ||
return beat.notes.some(n => n.ornament !== NoteOrnament.None); | ||
} | ||
|
||
public createNewGlyph(renderer: BarRendererBase, beat: Beat): EffectGlyph { | ||
return new NoteOrnamentGlyph(beat.notes.find(n=>n.ornament != NoteOrnament.None)!.ornament); | ||
} | ||
|
||
public canExpand(from: Beat, to: Beat): boolean { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { NoteOrnament } from '@src/model/NoteOrnament'; | ||
import { MusicFontGlyph } from './MusicFontGlyph'; | ||
import { MusicFontSymbol } from '@src/model'; | ||
import { ICanvas } from '@src/platform'; | ||
|
||
export class NoteOrnamentGlyph extends MusicFontGlyph { | ||
constructor(ornament: NoteOrnament) { | ||
super(0, 0, 1, NoteOrnamentGlyph.getSymbol(ornament)); | ||
this.center = true; | ||
} | ||
|
||
public override doLayout(): void { | ||
this.width = 26 * this.scale; | ||
this.height = 18 * this.scale; | ||
} | ||
|
||
private static getSymbol(ornament: NoteOrnament): MusicFontSymbol { | ||
switch (ornament) { | ||
case NoteOrnament.InvertedTurn: | ||
return MusicFontSymbol.OrnamentTurnInverted; | ||
case NoteOrnament.Turn: | ||
return MusicFontSymbol.OrnamentTurn; | ||
case NoteOrnament.UpperMordent: | ||
return MusicFontSymbol.OrnamentShortTrill; | ||
case NoteOrnament.LowerMordent: | ||
return MusicFontSymbol.OrnamentMordent; | ||
} | ||
return MusicFontSymbol.None; | ||
} | ||
|
||
public override paint(cx: number, cy: number, canvas: ICanvas): void { | ||
super.paint(cx, cy + this.height - 4 * this.scale, canvas); | ||
} | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters