-
Notifications
You must be signed in to change notification settings - Fork 202
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
06b4ea0
commit f6088c6
Showing
16 changed files
with
270 additions
and
11 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,19 @@ | ||
/** | ||
* Lists all beat barré types. | ||
*/ | ||
export enum BarreShape { | ||
/** | ||
* No Barré | ||
*/ | ||
None, | ||
|
||
/** | ||
* Full Barré (play all strings) | ||
*/ | ||
Full, | ||
|
||
/** | ||
* 1/2 Barré (play only half the strings) | ||
*/ | ||
Half | ||
} |
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,81 @@ | ||
import { Beat } from '@src/model/Beat'; | ||
import { BarRendererBase } from '@src/rendering/BarRendererBase'; | ||
import { EffectBarGlyphSizing } from '@src/rendering/EffectBarGlyphSizing'; | ||
import { EffectGlyph } from '@src/rendering/glyphs/EffectGlyph'; | ||
import { LineRangedGlyph } from '@src/rendering/glyphs/LineRangedGlyph'; | ||
import { EffectBarRendererInfo } from '@src/rendering/EffectBarRendererInfo'; | ||
import { Settings } from '@src/Settings'; | ||
import { NotationElement } from '@src/NotationSettings'; | ||
import { BarreShape } from '@src/model/BarreShape'; | ||
|
||
export class BeatBarreEffectInfo extends EffectBarRendererInfo { | ||
public get notationElement(): NotationElement { | ||
return NotationElement.EffectLetRing; | ||
} | ||
|
||
public get canShareBand(): boolean { | ||
return false; | ||
} | ||
|
||
public get hideOnMultiTrack(): boolean { | ||
return false; | ||
} | ||
|
||
public shouldCreateGlyph(settings: Settings, beat: Beat): boolean { | ||
return beat.isBarre; | ||
} | ||
|
||
public get sizingMode(): EffectBarGlyphSizing { | ||
return EffectBarGlyphSizing.GroupedOnBeat; | ||
} | ||
|
||
public createNewGlyph(renderer: BarRendererBase, beat: Beat): EffectGlyph { | ||
let barre = ''; | ||
switch (beat.barreShape) { | ||
case BarreShape.None: | ||
case BarreShape.Full: | ||
break; | ||
case BarreShape.Half: | ||
barre += '1/2'; | ||
break; | ||
} | ||
|
||
barre += 'B ' + BeatBarreEffectInfo.toRoman(beat.barreFret); | ||
|
||
return new LineRangedGlyph(barre, false); | ||
} | ||
|
||
private static readonly RomanLetters = new Map<string, number>([ | ||
// ['M', 1000], | ||
// ['CM', 900], | ||
// ['D', 500], | ||
// ['CD', 400], | ||
// ['C', 100], | ||
// ['XC', 90], | ||
['L', 50], | ||
['XL', 40], | ||
['X', 10], | ||
['IX', 9], | ||
['V', 5], | ||
['IV', 4], | ||
['I', 1] | ||
]); | ||
|
||
public static toRoman(num: number): string { | ||
let str = ''; | ||
|
||
if (num > 0) { | ||
for (var [romanLetter, romanNumber] of BeatBarreEffectInfo.RomanLetters) { | ||
const q = Math.floor(num / romanNumber); | ||
num -= q * romanNumber; | ||
str += romanLetter.repeat(q); | ||
} | ||
} | ||
|
||
return str; | ||
} | ||
|
||
public canExpand(from: Beat, to: Beat): boolean { | ||
return from.barreFret === to.barreFret && from.barreShape === to.barreShape; | ||
} | ||
} |
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
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.
Oops, something went wrong.