Skip to content

Commit

Permalink
v0.7.4
Browse files Browse the repository at this point in the history
- Enhancement in method `meico.mei.Mei.processMeasure()`. If a measure does not comply with the underlying time signature meico needs to add another `timeSignature` element in the `timeSignatureMap`. However, the subsequent measure may comply with the original time signature. Hence, at the end of the non-compliant measure meico should switch back to the original time signature. This is what it does now.
- Minor stability fix in method `meico.mei.Mei.addDynamicsToMpm()`.
  • Loading branch information
axelberndt committed Jan 17, 2020
1 parent b8ac342 commit 91d4ff4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions history.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
### Version History


#### v0.7.4
- Enhancement in method `meico.mei.Mei.processMeasure()`. If a measure does not comply with the underlying time signature meico needs to add another `timeSignature` element in the `timeSignatureMap`. However, the subsequent measure may comply with the original time signature. Hence, at the end of the non-compliant measure meico should switch back to the original time signature. This is what it does now.
- Minor stability fix in method `meico.mei.Mei.addDynamicsToMpm()`.


#### v0.7.3
- MPM attributes `startStyle` and `defaultArticulation` have been removed from all `...-Map` elements. Initial styles are indicated by style switches (e.g. `<style date="0.0" name.ref="my initial style"/>` and for articulation maps `<style date="0.0" name.ref="my initial style" defaultArticulation="nonlegato"/>`) at the beginning of of the map. The corresponding code changes are in classes `meico.mei.Mei`, `meico.mpm.maps.ArticulationMap`, `DynamicsMap`, `GenericMap`, `MetricalAccentuationMap`, `RubatoMap`, `TempoMap`.
- In class `meico.mpm.Mpm` element `referenceMusic` is renamed to `relatedResources` and element `reference` has been renamed to `resource`.
Expand Down
13 changes: 9 additions & 4 deletions src/meico/mei/Mei.java
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ else if (this.helper.currentMsmMovement.getFirstChildElement("global").getFirstC
durNotTimeSig = true;
}

// the measure length does not confirm the time signature, hence we need a new time signature entry at the measure's startDate
// the measure length does not confirm the time signature, hence we need a new time signature entry at the measure's startDate and another one ate the end so the next measure has the official time signature again
if (durNotTimeSig) {
double[] numDenom = this.helper.getCurrentTimeSignature(); // get the current time signature numerator and denominator
double num = (dur2 * numDenom[1]) / (this.helper.ppq * 4.0); // from the actual duration of the measure and the denominator of the time signature compute the new numerator
Expand All @@ -1490,10 +1490,12 @@ else if (this.helper.currentMsmMovement.getFirstChildElement("global").getFirstC
}

tsMap.appendChild(ts); // add the new timeSignature element to the global timeSignatureMap
Element tsBack = Msm.makeTimeSignature(endDate, numDenom[0], (int)numDenom[1], null); // generate a timeSignature element to switch back to the official time signature at the end of the measure
tsMap.appendChild(tsBack); // add it to the map
}

// go through all msm parts and set the currentDate attribute to endDate
Elements parts = this.helper.currentMsmMovement.getChildElements("part"); // get all parts
Elements parts = this.helper.currentMsmMovement.getChildElements("part"); // get all parts
for (int i=0; i < parts.size(); ++i) // go through all the parts
parts.get(i).getAttribute("currentDate").setValue(Double.toString(endDate)); // set their currentDate attribute

Expand Down Expand Up @@ -2137,7 +2139,6 @@ else if (form.getValue().equals("dim"))
if ((dd.xmlId != null) && multiIDs)
ddd.xmlId = dd.xmlId + "_meico_" + UUID.randomUUID().toString();


this.addDynamicsToMpm(ddd, dynamicsMap, endid, tstamp2);

multiIDs = true;
Expand Down Expand Up @@ -2176,11 +2177,15 @@ private int addDynamicsToMpm(DynamicsData dynamicsData, DynamicsMap dynamicsMap,
}
break; // done, no need to search for further previous dynamics instructions
}
if (dynamicsData.volumeString == null) // no volume found
dynamicsData.volumeString = "?"; // set placeholder volume

int index = dynamicsMap.addDynamics(dynamicsData); // add it to the map
if (index < 0)
return index;
Element dynamics = dynamicsMap.getElement(index); // get the element just created
if (dynamicsData.endDate != null) {
dynamics.addAttribute(new Attribute("date.end", dynamicsData.endDate.toString())); // add the date.end attribute to the element (will be resolved during mpmPostprocessing())
dynamics.addAttribute(new Attribute("date.end", dynamicsData.endDate.toString())); // add the date.end attribute to the element (will be resolved during mpmPostprocessing())
} else if (tstamp2 != null) { // if this element must be terminated in another measure via a tstamp2.ges or tstamp2 attribute
dynamics.addAttribute(new Attribute("tstamp2", tstamp2.getValue())); // add the tstamp2 attribute to the element (must be deleted later!)
this.helper.tstamp2s.add(dynamics); // add the element to the helper's tstamp2s list
Expand Down
2 changes: 1 addition & 1 deletion src/meico/mpm/elements/maps/GenericMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public ArrayList<KeyValue<Double, Element>> getAllElementsAt(double date) {
* @return
*/
public Element getElement(int index) {
if (index >= this.elements.size())
if ((index >= this.elements.size()) || (index < 0))
return null;

return this.elements.get(index).getValue();
Expand Down

0 comments on commit 91d4ff4

Please sign in to comment.