Currently (Mar 2012) we use the The GstInterpolationControlSource of the gstreamer-controller api, where we have to prebuild queues with control changes. That means that whenever pattern-data changes the respective part of the queue needs to be changed.
One drawback is that when e.g. changing the speed of the song or inserting time-row, we have to recompute all controller queues. This takes some time even on fast computers. Further it is not easy to have tempo changes in a song.
Think of the sequence as a bitmap; y is the ticks, x is the machines with their parameters. That is each machine param has a pixel. Whenever something changes the region gets invalidated. The damage manager needs to check if there was something 'below' and if that was covered by pixels in the changed region to restore it.
The operation can be subdivided into two steps:
- 1 determining the damage
- 2 repairing the damage
determining the damage
What changes can happen?
- pattern events
- A new value is endered in the pattern
- A value changes
- A value get cleared
- A series of values changes (pasting a copy in)
- resolv that into trivial pattern changes?
- sequence events
- A pattern is added to a sequence position
- A pattern is removed from a sequence position
- machine events
- A pattern is deleted (all occurences in the sequence are to be removed)
If a sequence event occurs, the whole area of the pattern is damaged. If the pattern is interrupted by another pattern, then only the part before gets damaged.
If a pattern event occurs this produces a local damage that needs to be converted into a global damage by the sequence. This conversion includes finding all positions the pattern is used and marking the regions as damaged it would play. One need to take into accound here that other pattern can shadow that pattern that signal the change. So for each occurance that damage region can have a different length.
When the calculation of the global damage region is done, patterns that are meant to be removed should be removed before doing the repair step. In-fact they can be removed after we know the positions. Unfortunately we can't remove them, but we can mark them as invalid.
repairing the damage
To repair a damaged region for each tick line we need to determine which pattern play there. Here we need to skip patterns marked for deletion and take into accound that patterns can shadow each other. For each parameter we need to evaluate all tracks that to the machine of the pattern from left-to-right. The rightmost change goes into the controller queue.
We will implement an own GstControlSource. This will generate the control events on the fly. For that each instance will need to know all sequence tracks for the machine. For a given playback position if will need to check the patterns in all tracks and fire the property changes.
Once that works, we can probably have a relative tempo control in the master machine.