Lua Api: add general pattern index change notifier

Currently, as far as I see, there is only one possibility to get notified when the pattern index changes:

renoise.song().selected_pattern_index_observable:add_notifier(pattern_index_changed)  

The problem:
the function is not called (while playing), when in the Renoise GUI the function “follow player position in the pattern while playing” is disabled (this is the button next to the metronome button).
The observer fires only an notifier if it is enabled.
As this notifier reflects the selected_pattern this behaviour might be correct;

but there should be a possibility to get notified if the currently played pattern in the song sequence changes.
Otherwise tools which rely on the above pattern index change notifier will not work properly, if the “follow player position…” function is disabled.

That would then need to be a notifier for the current playing sequence index.
You can get the current playing position using renoise.song().transport.playback_pos (sequence and line position) but its not time accurate (considering you can use the idle notifier once every 10msecs to poll this value)
You can also force the follow play mode on by simply taking care that “renoise.song().transport.follow_player” is always set to true before your particular function is being executed.
(save the current state to a temporary variable so that the original setting is restored if the user stops using the function)

Thank you, vv :)

This would be great.

This may also be not that reliable if there are very fast playing (short) patterns, so the controlled pattern playing positions to determine a pattern change (say positions 1-10) may not be handled by the idle notifier within the given time.
There could also be other calculations within the idle notifier regarding the pattern playing position which may compete with the pattern change detection.

In my case the tool is Live Dive, in which actions are required on every sequence index change, and the sequence index changes regularly and often. If a user wants to disable the “follow player position” option in order to edit a pattern directly (while playing), this approach may not be usable; because everytime the sequence index changes, the option is switched on and off which would be quite annoying for the user (as he looses focus at his actual editing position).