mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +00:00
Fix reading of documents with multiple time values
This commit is contained in:
parent
f9f2946bb8
commit
b8dac8dd63
|
@ -558,12 +558,32 @@ void VLSong::AddMeasure()
|
|||
VLChord rchord(dur);
|
||||
VLMeasure meas;
|
||||
|
||||
meas.fPropIdx = fProperties.size()-1;
|
||||
meas.fChords.push_back(rchord);
|
||||
meas.fMelody.push_back(rest);
|
||||
|
||||
fMeasures.push_back(meas);
|
||||
}
|
||||
|
||||
void VLSong::SetProperties(size_t measure, int propIdx)
|
||||
{
|
||||
VLFraction dur = fProperties[propIdx].fTime;
|
||||
dur.Normalize();
|
||||
VLLyricsNote rest(dur);
|
||||
VLChord rchord(dur);
|
||||
VLMeasure meas;
|
||||
|
||||
meas.fPropIdx = propIdx;
|
||||
meas.fChords.push_back(rchord);
|
||||
meas.fMelody.push_back(rest);
|
||||
|
||||
if (measure < fMeasures.size())
|
||||
fMeasures[measure] = meas;
|
||||
else
|
||||
while (fMeasures.size() <= measure)
|
||||
fMeasures.push_back(meas);
|
||||
}
|
||||
|
||||
void VLSong::swap(VLSong & other)
|
||||
{
|
||||
fProperties.swap(other.fProperties);
|
||||
|
|
|
@ -377,6 +377,7 @@ public:
|
|||
const VLProperties & Properties(size_t measure) const {
|
||||
return fProperties[fMeasures[measure].fPropIdx];
|
||||
}
|
||||
void SetProperties(size_t measure, int propIdx);
|
||||
|
||||
bool DoesBeginSection(size_t measure) const;
|
||||
void AddSection(size_t measure);
|
||||
|
|
|
@ -310,6 +310,8 @@ advanceAt:
|
|||
) {
|
||||
if (NSNumber * mNo = [mdict objectForKey:@"measure"])
|
||||
measNo = static_cast<size_t>([mNo intValue]);
|
||||
if (NSNumber * mPx = [mdict objectForKey:@"properties"])
|
||||
song->SetProperties(measNo, [mPx intValue]);
|
||||
|
||||
[self readMelody:[mdict objectForKey:@"melody"] inMeasure:measNo onsets:onsets];
|
||||
[self readChords:[mdict objectForKey:@"chords"] inMeasure:measNo];
|
||||
|
@ -322,9 +324,6 @@ advanceAt:
|
|||
song->fMeasures[measNo].fBreak |= VLMeasure::kNewSystem;
|
||||
if ([[mdict objectForKey:@"new-page"] boolValue])
|
||||
song->fMeasures[measNo].fBreak |= VLMeasure::kNewPage;
|
||||
if (NSNumber * mPx = [mdict objectForKey:@"properties"])
|
||||
song->fMeasures[measNo].fPropIdx=
|
||||
static_cast<size_t>([mPx intValue]);
|
||||
|
||||
if (NSDictionary * beginRep = [mdict objectForKey:@"begin-repeat"]) {
|
||||
VLRepeat rep;
|
||||
|
|
Loading…
Reference in New Issue
Block a user