|
OSSIA
Open Scenario System for Interactive Application
|
The time_interval class. More...
The time_interval class.
time_interval is use to describe temporal structure precising which amount of time (the duration) are between two #time_events.
The duration can be fixed or between a minimal and a maximal duration.
time_interval is a #TimeProcess container.
Public Types | |
| using | exec_callback = std::optional< smallfun::function< void(bool, ossia::time_value), 32 > > |
| to get the interval execution back | |
Public Member Functions | |
| auto | get_date () const noexcept |
| auto | get_offset () const noexcept |
| double | get_internal_speed () const noexcept |
| double | get_speed (time_value date) const noexcept |
| double | speed_override () const noexcept |
| double | local_time_factor (const ossia::token_request &parent_request) const noexcept |
| int64_t | advance_for (ossia::time_value, const ossia::token_request &parent_request) const noexcept |
| int64_t | take_backward_step (ossia::time_value, const ossia::token_request &parent_request) noexcept |
| void | set_offset (ossia::time_value g) noexcept |
| void | set_speed (double g) noexcept |
| void | set_parent_speed (double sp) noexcept |
| tick_transport_info | current_transport_info () const noexcept |
| void | tick_current (ossia::time_value offset, const ossia::token_request &parent_request) |
| void | tick (ossia::time_value, const ossia::token_request &parent_request, double ratio=1.0) |
| Root driver tick: covers the parent request's whole carried sample span. | |
| void | tick_offset (ossia::time_value, ossia::time_value offset, const ossia::token_request &parent_request, int32_t start_sample=-1, int32_t length_sample=-1) |
| void | tick_offset_speed_precomputed (ossia::time_value, ossia::time_value offset, const ossia::token_request &parent_request, int32_t start_sample=-1, int32_t length_sample=-1) |
| time_interval (time_interval::exec_callback, time_event &, time_event &, time_value=Infinite, ossia::time_value=Zero, ossia::time_value=Infinite) | |
| ~time_interval () | |
| destructor | |
| void | start () |
| start time_interval | |
| void | start_and_tick () |
| void | stop () |
| stop time_interval | |
| void | pause () |
| start time_interval | |
| void | resume () |
| stop time_interval | |
| void | offset (ossia::time_value) |
| set time_interval's offset and process a state at offset date | |
| void | transport (ossia::time_value) |
| void | set_callback (exec_callback) |
| sets a new callback for the interval | |
| void | set_callback (smallfun::function< void(bool, ossia::time_value), 32 >) |
| const time_value & | get_nominal_duration () const |
| get the time_interval nominal duration | |
| time_interval & | set_nominal_duration (ossia::time_value) |
| set the time_interval duration | |
| const time_value & | get_min_duration () const |
| get the time_interval minimal duration | |
| time_interval & | set_min_duration (ossia::time_value) |
| set the time_interval minimal duration | |
| const time_value & | get_max_duration () const |
| get the time_interval maximal duration | |
| time_interval & | set_max_duration (ossia::time_value) |
| set the time_interval maximal duration | |
| time_event & | get_start_event () const |
| get the event from where the time_interval starts | |
| time_event & | get_end_event () const |
| get the event from where the time_interval starts | |
| void | add_time_process (std::shared_ptr< time_process >) |
| add a #TimeProcess | |
| void | remove_time_process (time_process *) |
| remove a #TimeProcess | |
| void | reserve_processes (std::size_t sz) |
| const std::vector< std::shared_ptr< time_process > > & | get_time_processes () const |
| get time processes attached to the time_interval | |
| bool | running () const noexcept |
| void | cleanup () |
| void | mute (bool) |
| void | set_time_signature_map (std::optional< time_signature_map > map) |
| void | set_quarter_duration (double tu) |
Static Public Member Functions | |
| static std::shared_ptr< time_interval > | create (time_interval::exec_callback, time_event &, time_event &, time_value=Infinite, ossia::time_value=Zero, ossia::time_value=Infinite) |
| constructor | |
Public Attributes | |
| bool | graphal {} |
| using ossia::time_interval::exec_callback = std::optional<smallfun::function<void(bool, ossia::time_value), 32> > |
to get the interval execution back
| const | #TimeValue position | |
| const | #TimeValue date | |
| std::shared_ptr< | State> |
|
noexcept |
Dimensionless rate multiplier last written into the interval node's Speed inlet, 1. if nothing was ever written there. Only meaningful when the interval has a tempo curve, since that is when the inlet exists.
|
noexcept |
The factor between the parent's model time and ours for this tick: the same one the tick duration is scaled by. A tempo-locked interval runs at its tempo whatever the transport does, hence the parent-speed division.
|
noexcept |
How far a tick of this length would move us, in our own model time, carried fraction included. This is what the tick actually advances by, so anything deciding whether the tick fits must ask this and not recompute.
|
noexcept |
How far back a rewinding scenario moves us, as a positive magnitude, the carried fraction consumed the same way a forward tick consumes it so that going out and back lands on the date we started from.
| void ossia::time_interval::tick_offset | ( | ossia::time_value | date, |
| ossia::time_value | offset, | ||
| const ossia::token_request & | parent_request, | ||
| int32_t | start_sample = -1, |
||
| int32_t | length_sample = -1 |
||
| ) |
The span parameters are the samples of the audio buffer this tick stands for, decided by the caller (the scenario cutting the buffer on interval boundaries, or the root callback handing the whole buffer): they are carried into the tokens verbatim, precisely because they cannot be reconstructed from the flick-quantised model dates. -1 means unknown.
|
static |
constructor
by default a time_interval has an infinite duration with no minimal duration and an infinite maximal duration.
| time_interval::ExecutionCallback | to use to be notified at each step | |
| std::shared_ptr<TimeEvent> | event where the time_interval starts | |
| std::shared_ptr<TimeEvent> | event where the time_interval ends | |
| const | #TimeValue& nominal duration of the time_interval | |
| const | #TimeValue& minimal duration of the time_interval | |
| const | #TimeValue& maximal duration of the time_interval |
| void ossia::time_interval::offset | ( | ossia::time_value | date | ) |
set time_interval's offset and process a state at offset date
the returned #State is made of as many as sub States for each TimeProcess the time_interval manages
don't call offset when the time_interval is running
| const | #TimeValue offset date |
| void ossia::time_interval::set_callback | ( | time_interval::exec_callback | cb | ) |
sets a new callback for the interval
| time_interval::ExecutionCallback | to use to be notified at each step |
| const time_value & ossia::time_interval::get_nominal_duration | ( | ) | const |
get the time_interval nominal duration
| time_interval & ossia::time_interval::set_nominal_duration | ( | ossia::time_value | durationNominal | ) |
set the time_interval duration
| const | #TimeValue& duration |
| const time_value & ossia::time_interval::get_min_duration | ( | ) | const |
get the time_interval minimal duration
| time_interval & ossia::time_interval::set_min_duration | ( | ossia::time_value | durationMin | ) |
set the time_interval minimal duration
| const | #TimeValue& minimal duration |
| const time_value & ossia::time_interval::get_max_duration | ( | ) | const |
get the time_interval maximal duration
| time_interval & ossia::time_interval::set_max_duration | ( | ossia::time_value | durationMax | ) |
set the time_interval maximal duration
| const | #TimeValue& maximal duration |
| time_event & ossia::time_interval::get_start_event | ( | ) | const |
get the event from where the time_interval starts
| time_event & ossia::time_interval::get_end_event | ( | ) | const |
get the event from where the time_interval starts
| void ossia::time_interval::add_time_process | ( | std::shared_ptr< time_process > | timeProcess | ) |
add a #TimeProcess
it also stores the #TimeProcess's start and end #States into the time_interval's start and end #time_events
| std::shared_ptr< | TimeProcess> | to insert |
| void ossia::time_interval::remove_time_process | ( | time_process * | timeProcess | ) |
remove a #TimeProcess
it also removes the #TimeProcess's start and end #States from the time_interval's start and end #time_events
| std::shared_ptr< | TimeProcess> | to insert |
|
inline |
get time processes attached to the time_interval