06 July 2014

This week I have worked on a grace and tremolo filter.

Progress on filters

  • Clefs
  • Key Signatures
  • Time Signatures
  • Barlines
  • Dynamics
  • Lyrics
  • Chord Symbols
  • Figured Bass
  • Fret Diagrams
  • Text
  • Slurs
  • Hairpins - filtered with Dynamics
  • Ottava
  • Trills - filtered with Articulations
  • Pedal Lines
  • Other Lines
  • Articulations
  • Arpeggios
  • Glissandi
  • Breaths
  • Fingering
  • Tremolo
  • Breaks
  • Grace Notes

Filters

Unfiltered mime

I have added unfiltered mime xml’s to the selection filter tests. This way we will also check if elements are properly added into the selection, and written into the selection mime xml before applying the filter.

Breaths

I have added a breath filter, which works by removing the breath segment from the cloned segment list.

Other Text

After looking at all the text types, and the filters already implemented, it turned out that the only remaining type is a staff text. All other text elements are marked as system, so we never include them in a selection.

Other Lines

There is a similar situation with the other lines filter. The only line types without a filter are a Note Line and a Volta. I don’t think there is a way to create a Note Line, but just in case the filter applies to both.

Grace notes

There have been a few changes in the master repo concerning spanners, so I didn’t have time to finish this filter. I have added grace notes to the selection, so they are properly highlighted.

Slur change

The recent slur change has complicated the segment clone approach for filtering. To allow slurs to span from and to grace notes, the slurs had to know more than just the ticks of the elements. That is because grace notes are at the same tick as the notes that they attach too.

To do this, inside the Chord::write(Xml) function the score spanner map is checked to see if the start or end element of the spanner is this chord. If so, it writes the slur to the xml.

The previous slur implementation did not need the spanner map when generating chord xml, so cloning segments worked fine. After the change, cloning chords did not create new spanners, but it created new chords with different addresses so no spanners where written to xml. ( the slur.startElement == this check).

To solve this, I had to write a deep clone function that would copy all spanners, and set the startElement and endElement to the newly cloned chords. I did this by creating a map of element->cloned_element, and later replacing the start and end elements for cloned spanners with the new element addresses.

I’ve tested this, at it seems that it is working quite well.

Travis failed on one test. It was the copypaste9, which worked with an ottava. It turned out that cloning an ottava does not copy all fields in the copy constructor. I have fixed the issue, by adding code that also copies the lineStyleStyle of an Ottava. There are probably more things to include as well, but I will wait for input from my mentor on this.

Tremolo

When adding code for the tremolo filter, I have noticed a few bugs with how a 2 note tremolo is pasted. Some of the issues in the tracker:

Tremolo causing corruption Copied tremolo between notes incorrectly pasted

One of the things that need fixing, is the fact that the tremolo should not be copied if not all of the affected notes are included. The other problem to look at is pasting a tremolo that does not fully fit into the measure. It should be split into 2 tremolos.

The segment clone approach will allow any modification of notes without any changes to the real segments. If we copy only a part of a tremolo, we can safely remove the tremolo and proceed with the xml generation for the clipboard mime data. I will continue working on this in the following week.

Tasks in the upcoming week

The goal is to have the tremolo and grace note filters finished by the end of the week. This will include a rebase of the selection-window branch. At the end of the week I will start working on the long awaited voice filters.