mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +00:00
More MusicXML bug fixes
This commit is contained in:
parent
103204fce4
commit
8d78730f5e
|
@ -119,7 +119,7 @@ class MusicXMLListener
|
||||||
when 'composer'
|
when 'composer'
|
||||||
@kind = 'textProp'
|
@kind = 'textProp'
|
||||||
@key = 'composer'
|
@key = 'composer'
|
||||||
when 'poet'
|
when 'poet', 'lyricist'
|
||||||
@kind = 'textProp'
|
@kind = 'textProp'
|
||||||
@key = 'lyricist'
|
@key = 'lyricist'
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,7 +32,7 @@ def _identification
|
||||||
composer.add_attribute('type', 'composer')
|
composer.add_attribute('type', 'composer')
|
||||||
ident.add_element(composer)
|
ident.add_element(composer)
|
||||||
poet = newTextElement('creator', INPUT['lyricist'])
|
poet = newTextElement('creator', INPUT['lyricist'])
|
||||||
poet.add_attribute('type', 'poet')
|
poet.add_attribute('type', 'lyricist')
|
||||||
ident.add_element(poet)
|
ident.add_element(poet)
|
||||||
encoding = REXML::Element.new('encoding')
|
encoding = REXML::Element.new('encoding')
|
||||||
if INPUT['saved']
|
if INPUT['saved']
|
||||||
|
@ -109,7 +109,9 @@ def _pitch(name, pitch, prefix="")
|
||||||
return pitch
|
return pitch
|
||||||
end
|
end
|
||||||
|
|
||||||
def _note(pitch, dur, tied=0)
|
TYPE = %w[whole half quarter eighth 16th 32nd]
|
||||||
|
|
||||||
|
def _note(pitch, dur, visual, tied)
|
||||||
note = REXML::Element.new('note')
|
note = REXML::Element.new('note')
|
||||||
if pitch == VL::NoPitch
|
if pitch == VL::NoPitch
|
||||||
note.add_element(REXML::Element.new('rest'))
|
note.add_element(REXML::Element.new('rest'))
|
||||||
|
@ -127,6 +129,7 @@ def _note(pitch, dur, tied=0)
|
||||||
note.add_element 'tie', {'type' => 'start' }
|
note.add_element 'tie', {'type' => 'start' }
|
||||||
end
|
end
|
||||||
note.add_element newTextElement('voice', 1)
|
note.add_element newTextElement('voice', 1)
|
||||||
|
note.add_element newTextElement('type', TYPE[visual & 7])
|
||||||
|
|
||||||
return note
|
return note
|
||||||
end
|
end
|
||||||
|
@ -221,12 +224,17 @@ def _chord(pitch, steps, root)
|
||||||
best = 0
|
best = 0
|
||||||
kind = 'none'
|
kind = 'none'
|
||||||
CHORD.each do |k,mask|
|
CHORD.each do |k,mask|
|
||||||
|
extra = mask & ~steps
|
||||||
mask &= steps
|
mask &= steps
|
||||||
score = 0
|
score = 0
|
||||||
while mask > 0
|
while mask > 0
|
||||||
score += 1
|
score += 10
|
||||||
mask &= mask-1
|
mask &= mask-1
|
||||||
end
|
end
|
||||||
|
while extra > 0
|
||||||
|
score -= 1
|
||||||
|
extra &= extra-1
|
||||||
|
end
|
||||||
if score > best
|
if score > best
|
||||||
kind = k
|
kind = k
|
||||||
best = score
|
best = score
|
||||||
|
@ -357,7 +365,7 @@ def _melody
|
||||||
m.add_element(bk)
|
m.add_element(bk)
|
||||||
tempAt = noteAt
|
tempAt = noteAt
|
||||||
end
|
end
|
||||||
n = _note(note['pitch'], dur, note['tied'] || 0)
|
n = _note(note['pitch'], dur, note['visual'], note['tied'] || 0)
|
||||||
stanza = 1
|
stanza = 1
|
||||||
note['lyrics'].each do |syll|
|
note['lyrics'].each do |syll|
|
||||||
if syll['text']
|
if syll['text']
|
||||||
|
|
|
@ -47,9 +47,11 @@
|
||||||
<string>TEXT</string>
|
<string>TEXT</string>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleTypeRole</key>
|
<key>CFBundleTypeRole</key>
|
||||||
<string>None</string>
|
<string>Viewer</string>
|
||||||
<key>LSTypeIsPackage</key>
|
<key>LSTypeIsPackage</key>
|
||||||
<false/>
|
<false/>
|
||||||
|
<key>NSDocumentClass</key>
|
||||||
|
<string>VLDocument</string>
|
||||||
<key>NSPersistentStoreTypeKey</key>
|
<key>NSPersistentStoreTypeKey</key>
|
||||||
<string>Binary</string>
|
<string>Binary</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
@ -65,7 +67,7 @@
|
||||||
<key>CFBundleTypeName</key>
|
<key>CFBundleTypeName</key>
|
||||||
<string>VLMusicXMLType</string>
|
<string>VLMusicXMLType</string>
|
||||||
<key>CFBundleTypeRole</key>
|
<key>CFBundleTypeRole</key>
|
||||||
<string>Editor</string>
|
<string>Viewer</string>
|
||||||
<key>LSTypeIsPackage</key>
|
<key>LSTypeIsPackage</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>NSDocumentClass</key>
|
<key>NSDocumentClass</key>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user