mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +00:00
Fixed and verified round trip
This commit is contained in:
parent
83cfbaa037
commit
8d3e5f6801
|
@ -211,7 +211,9 @@ void VLPlistVisitor::VisitChord(VLChord & c)
|
|||
|
||||
- (void)readMelody:(NSArray *)melody inMeasure:(size_t)measNo
|
||||
{
|
||||
VLFraction at(0);
|
||||
VLFraction at(0);
|
||||
VLFraction tiedStart(0);
|
||||
VLLyricsNote tiedNote;
|
||||
|
||||
for (NSEnumerator * ne = [melody objectEnumerator];
|
||||
NSDictionary * ndict = [ne nextObject];
|
||||
|
@ -220,23 +222,44 @@ void VLPlistVisitor::VisitChord(VLChord & c)
|
|||
note.fDuration.fNum = [[ndict objectForKey:@"durNum"] intValue];
|
||||
note.fDuration.fDenom = [[ndict objectForKey:@"durDenom"] intValue];
|
||||
note.fPitch = [[ndict objectForKey:@"pitch"] intValue];
|
||||
note.fTied = [[ndict objectForKey:@"tied"] intValue];
|
||||
note.fTied = 0;
|
||||
|
||||
for (NSEnumerator * le = [[ndict objectForKey:@"lyrics"] objectEnumerator];
|
||||
NSDictionary * ldict = [le nextObject];
|
||||
) {
|
||||
VLSyllable syll;
|
||||
if ([[ndict objectForKey:@"tied"] intValue] & VLNote::kTiedWithPrev) {
|
||||
if (at != 0) {
|
||||
//
|
||||
// Extend preceding note
|
||||
//
|
||||
tiedNote.fDuration += note.fDuration;
|
||||
song->DelNote(measNo, tiedStart);
|
||||
song->AddNote(tiedNote, measNo, tiedStart);
|
||||
|
||||
if (NSString * t = [ldict objectForKey:@"text"])
|
||||
syll.fText = [t UTF8String];
|
||||
goto advanceAt;
|
||||
} else {
|
||||
//
|
||||
// Extend previous measure
|
||||
//
|
||||
note.fTied |= VLNote::kTiedWithPrev;
|
||||
}
|
||||
} else {
|
||||
for (NSEnumerator * le = [[ndict objectForKey:@"lyrics"] objectEnumerator];
|
||||
NSDictionary * ldict = [le nextObject];
|
||||
) {
|
||||
VLSyllable syll;
|
||||
|
||||
syll.fKind = [[ldict objectForKey:@"kind"] intValue];
|
||||
if (NSString * t = [ldict objectForKey:@"text"])
|
||||
syll.fText = [t UTF8String];
|
||||
|
||||
note.fLyrics.push_back(syll);
|
||||
syll.fKind = [[ldict objectForKey:@"kind"] intValue];
|
||||
|
||||
note.fLyrics.push_back(syll);
|
||||
}
|
||||
}
|
||||
|
||||
song->AddNote(note, measNo, at);
|
||||
tiedStart = at;
|
||||
tiedNote = note;
|
||||
|
||||
song->AddNote(note, measNo, at);
|
||||
advanceAt:
|
||||
at += note.fDuration;
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +297,7 @@ void VLPlistVisitor::VisitChord(VLChord & c)
|
|||
measNo = static_cast<size_t>([mNo intValue]);
|
||||
|
||||
[self readMelody:[mdict objectForKey:@"melody"] inMeasure:measNo];
|
||||
[self readChords:[mdict objectForKey:@"melody"] inMeasure:measNo];
|
||||
[self readChords:[mdict objectForKey:@"chords"] inMeasure:measNo];
|
||||
|
||||
if ([[mdict objectForKey:@"tocoda"] boolValue])
|
||||
song->fGoToCoda = measNo;
|
||||
|
@ -327,6 +350,7 @@ void VLPlistVisitor::VisitChord(VLChord & c)
|
|||
|
||||
- (void)readPropertiesFromPlist:(NSArray *)properties
|
||||
{
|
||||
song->fProperties.clear();
|
||||
for (NSEnumerator * pe = [properties objectEnumerator];
|
||||
NSDictionary * pdict = [pe nextObject];
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user