mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Handle slurs in Lilypond input
This commit is contained in:
parent
68067be8b2
commit
f0b6bdf907
|
@ -204,6 +204,7 @@ def parseLilypond
|
||||||
tied = false
|
tied = false
|
||||||
repeat = 0
|
repeat = 0
|
||||||
lyricFlags= 0
|
lyricFlags= 0
|
||||||
|
slur = false
|
||||||
|
|
||||||
while tokens.length > 0
|
while tokens.length > 0
|
||||||
token = tokens.shift
|
token = tokens.shift
|
||||||
|
@ -274,11 +275,28 @@ def parseLilypond
|
||||||
lastDur = dur
|
lastDur = dur
|
||||||
d = lyDur(dur)
|
d = lyDur(dur)
|
||||||
|
|
||||||
|
if slur
|
||||||
|
#
|
||||||
|
# We don't support slurs, so we turn them into tied notes at the
|
||||||
|
# final pitch
|
||||||
|
#
|
||||||
|
ix = NOTES.size
|
||||||
|
tie= true
|
||||||
|
while tie do
|
||||||
|
break if ix == 0
|
||||||
|
note = NOTES[ix -= 1]
|
||||||
|
note['pitch'] = pitch;
|
||||||
|
note['tied'] ||= 0
|
||||||
|
note['tied'] |= VL::TiedWithNext
|
||||||
|
tie = (note['tied'] & VL::TiedWithPrev) != 0
|
||||||
|
end
|
||||||
|
tied = true
|
||||||
|
end
|
||||||
note = {'pitch' => pitch, 'durNum'=> d[0], 'durDenom' => d[1]}
|
note = {'pitch' => pitch, 'durNum'=> d[0], 'durDenom' => d[1]}
|
||||||
note['tied'] = VL::TiedWithPrev if tied
|
note['tied'] = VL::TiedWithPrev if tied
|
||||||
p token, note if $DEBUG
|
p token, note if $DEBUG
|
||||||
NOTES.push(note)
|
|
||||||
tied = false
|
tied = false
|
||||||
|
NOTES.push(note)
|
||||||
redo
|
redo
|
||||||
elsif token == '~'
|
elsif token == '~'
|
||||||
if note = NOTES.last
|
if note = NOTES.last
|
||||||
|
@ -286,6 +304,10 @@ def parseLilypond
|
||||||
note['tied'] |= VL::TiedWithNext
|
note['tied'] |= VL::TiedWithNext
|
||||||
end
|
end
|
||||||
tied = true
|
tied = true
|
||||||
|
elsif token == '('
|
||||||
|
slur = true
|
||||||
|
elsif token == ')'
|
||||||
|
slur = false
|
||||||
elsif token == '\repeat' && (tokens[0] == 'volta' || tokens[0] == fold) &&
|
elsif token == '\repeat' && (tokens[0] == 'volta' || tokens[0] == fold) &&
|
||||||
tokens[1] =~ /^\d+$/
|
tokens[1] =~ /^\d+$/
|
||||||
stack.push([block, level, "repeat"])
|
stack.push([block, level, "repeat"])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user