Piano "Half Sustain Pedal" Indications

When playing the piano, there a quite a few songs that require you to only press the sustain pedal half way (or even a quarter of the way in some cases).
There is currently not a way to show these indications on the generated music in an intuitive way. This snippet provides functions that allow you to easily do this.
The implementation is quite complicated, but basically there are two music functions that get defined, sustainHalfOn and sustainHalfOff. You can use these just like you would normally use sustainOn and sustainOff. You can use any of the sustain pedal styles, and everything will work as expected. You do need to add an explicit call to sustainHalfOff when you want the half pedal to end. Calling sustainOn does not automatically turn off sustainHalfOn.

Under the covers, this works by representing sustain half on/half off as Una Corda pedal events. The logic temporarily changes the rendering of Una Corda pedals when you call sustainHalfOn, and changes it back when you call sustainHalfOff. We also temporarily change the value of Staff.unaCordaPedalStyle to match the value of Staff.sustainPedalStyle for the duration of the half sustain event so that the intended sustain pedal style will be used.