Skip to content

Commit

Permalink
Fixing PAE bug with empty beams
Browse files Browse the repository at this point in the history
  • Loading branch information
lpugin committed Feb 4, 2019
1 parent 533442f commit b9aaa5f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/iopae.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ void PaeInput::parsePlainAndEasy(std::istream &infile)

// beaming ends
else if (incipit[i] == '}' && in_beam > 0) {
current_measure.notes[current_measure.notes.size() - 1].beam = BEAM_TERMINAL;
if (!current_measure.notes.empty()) {
current_measure.notes.at(current_measure.notes.size() - 1).beam = BEAM_TERMINAL;
}
current_note.beam = 0;
in_beam--;
}
Expand Down Expand Up @@ -1068,7 +1070,7 @@ int PaeInput::getAbbreviation(const char *incipit, pae::Measure *measure, int in
while ((i + 1 < length) && (incipit[i + 1] == 'f')) {
i++;
for (j = measure->abbreviation_offset; j < abbreviation_stop; ++j) {
measure->notes.push_back(measure->notes[j]);
measure->notes.push_back(measure->notes.at(j));
}
}
measure->abbreviation_offset = -1;
Expand Down Expand Up @@ -1145,8 +1147,8 @@ int PaeInput::getNote(const char *incipit, pae::Note *note, pae::Measure *measur
LogWarning("Plaine & Easie import: found note before duration was specified");
}
else {
note->duration = measure->durations[measure->durations_offset];
note->dots = measure->dots[measure->durations_offset];
note->duration = measure->durations.at(measure->durations_offset);
note->dots = measure->dots.at(measure->durations_offset);
}
}
note->pitch = getPitch(incipit[i]);
Expand Down Expand Up @@ -1243,7 +1245,7 @@ void PaeInput::convertMeasure(pae::Measure *measure)
m_nested_objects.clear();

for (unsigned int i = 0; i < measure->notes.size(); ++i) {
pae::Note *note = &measure->notes[i];
pae::Note *note = &measure->notes.at(i);
parseNote(note);
}

Expand Down

0 comments on commit b9aaa5f

Please sign in to comment.