Incrementing bar numbers in volta repeats

There are different ideas of bar numbering: counting bars as written or as played/heard. In other words: volta repeats might be counted only once or as often as they are played. Only the former is officially supported, but the latter is used by respectable publications such as the Neue Bach-Ausgabe. This has also been reported in ensemble music where some parts are printed with volta repeats whereas others (as well as the conductor) are printed as unfolded.

Here is a hack that increments the currentBarNumber property whenever volta repeats occur. It also offers basic (though limited) support for alternatives.