FlowControllerBase
timelines.FlowControllerBase()Abstract base class for computing flow control transformations.
A flow controller is a factory for producing Flows and FlowMaps. It operates as a background processor that computes flow control transformations but is NOT stored on the Timeline itself. Instead, the FlowMaps it produces are attached to Timelines.
Subclasses implement the specific logic for different data sources: - ScoreFlowController: Works with MeasureData (mc, mn, next[], volta, etc.) - Future: AudioFlowController, VideoFlowController for other media types.
Design Decisions: - A flow controller is a factory, NOT stored on Timeline - Sparse sections ARE allowed (atomic sections need not cover entire timeline) - Unit independence: Flows are sequences of TimeIntervals in ANY unit
Public API
- iter_atomic_sections(): Iterate atomic (indivisible) sections
- compute_flow(mode): Compute Flow for the given mode
- create_flow_map(flow): Create FlowMap from computed Flow
Methods
| Name | Description |
|---|---|
| compute_flow | Compute a Flow for the given mode. |
| create_flow_map | Create a FlowMap from a computed Flow. |
| iter_atomic_sections | Iterate over atomic (indivisible) sections. |
compute_flow
timelines.FlowControllerBase.compute_flow(mode=None)Compute a Flow for the given mode.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| mode | FlowMode | None |
The FlowMode to compute. None defaults to ATOMIC. | None |
Returns
| Name | Type | Description |
|---|---|---|
| Flow | The computed Flow. |
create_flow_map
timelines.FlowControllerBase.create_flow_map(flow=None)Create a FlowMap from a computed Flow.
If this controller has MeasureUnit data (i.e. is a ScoreFlowController), the FlowMap is built in quarterbeat space using compute_qb_sections. Otherwise falls back to MC-number space (legacy behaviour).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| flow | Flow | None | The Flow to create a map from. If None, computes DEFAULT flow. | None |
Returns
| Name | Type | Description |
|---|---|---|
| FlowMap | FlowMap for coordinate transformation. |
iter_atomic_sections
timelines.FlowControllerBase.iter_atomic_sections()Iterate over atomic (indivisible) sections.
Each section is a tuple (start, end) representing a contiguous portion that cannot be split by flow control.
Yields
| Name | Type | Description |
|---|---|---|
tuple[Fraction, Fraction] |
Tuples of (start_coordinate, end_coordinate). |