Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate VexTab to VexFlow 4.0.0. #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/artist.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ class Artist
fingerings = @makeFingering(annotations[i])
if fingerings?
try
(note.addModifier(fingering.num, fingering.modifier) for fingering in fingerings)
(note.addModifier(fingering.modifier, fingering.num) for fingering in fingerings)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible bug fix? Or did an old version of VexFlow have the arguments reversed? Anyways, it was throwing an exception so I switched the two arguments.

catch e
throw new Vex.RERR("ArtistError", "Bad note number in fingering: #{annotations[i]}")

Expand Down
2 changes: 1 addition & 1 deletion src/vextab.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class VexTab
notation_option = option
throw error("'#{option.key}' must be 'true' or 'false'") if option.value not in ["true", "false"]
when "key"
throw error("Invalid key signature '#{option.value}'") unless _.has(Vex.Flow.keySignature.keySpecs, option.value)
throw error("Invalid key signature '#{option.value}'") unless Vex.Flow.hasKeySignature(option.value)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed cleaner to have a method called hasKeySignature(), so I added it to VexFlow.

when "clef"
clefs = ["treble", "bass", "tenor", "alto", "percussion", "none"]
throw error("'clef' must be one of #{clefs.join(', ')}") if option.value not in clefs
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class VexTabTests

# KEY SIGNATURE TESTS

for key of Vex.Flow.keySignature.keySpecs
for key of Vex.Flow.getKeySignatures()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, I added a getter here instead of allowing client code to reach into the internals of VexFlow.

assert.notEqual null, tab.parse("tabstave key=" + key)
assert.notEqual null, tab.parse("tabstave notation=true key=" + key)
assert.notEqual null, tab.parse("tabstave notation=true tablature=true key=" + key)
Expand Down