OSSIA
Open Scenario System for Interactive Application
ossia::time_interval Class Reference

The time_interval class. More...

Detailed Description

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 More...
 

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
 
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)
 
void tick_offset (ossia::time_value, ossia::time_value offset, const ossia::token_request &parent_request)
 
void tick_offset_speed_precomputed (ossia::time_value, ossia::time_value offset, const ossia::token_request &parent_request)
 
 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 More...
 
void transport (ossia::time_value)
 
void set_callback (exec_callback)
 sets a new callback for the interval More...
 
void set_callback (smallfun::function< void(bool, ossia::time_value), 32 >)
 
const time_valueget_nominal_duration () const
 get the #time_interval nominal duration More...
 
time_intervalset_nominal_duration (ossia::time_value)
 set the #time_interval duration More...
 
const time_valueget_min_duration () const
 get the #time_interval minimal duration More...
 
time_intervalset_min_duration (ossia::time_value)
 set the #time_interval minimal duration More...
 
const time_valueget_max_duration () const
 get the #time_interval maximal duration More...
 
time_intervalset_max_duration (ossia::time_value)
 set the #time_interval maximal duration More...
 
time_eventget_start_event () const
 get the event from where the #time_interval starts More...
 
time_eventget_end_event () const
 get the event from where the #time_interval starts More...
 
void add_time_process (std::shared_ptr< time_process >)
 add a #TimeProcess More...
 
void remove_time_process (time_process *)
 remove a #TimeProcess More...
 
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 More...
 
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_intervalcreate (time_interval::exec_callback, time_event &, time_event &, time_value=Infinite, ossia::time_value=Zero, ossia::time_value=Infinite)
 constructor More...
 

Public Attributes

bool graphal {}
 

Member Typedef Documentation

◆ exec_callback

using ossia::time_interval::exec_callback = std::optional<smallfun::function<void(bool, ossia::time_value), 32> >

to get the interval execution back

Parameters
const#TimeValue position
const#TimeValue date
std::shared_ptr<State>

Member Function Documentation

◆ create()

std::shared_ptr< time_interval > ossia::time_interval::create ( time_interval::exec_callback  callback,
time_event startEvent,
time_event endEvent,
ossia::time_value  nominal = Infinite,
ossia::time_value  min = Zero,
ossia::time_value  max = Infinite 
)
static

constructor

by default a #time_interval has an infinite duration with no minimal duration and an infinite maximal duration.

Parameters
time_interval::ExecutionCallbackto 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
Returns
std::shared_ptr<#time_interval>

◆ offset()

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

Parameters
const#TimeValue offset date
Returns
std::shared_ptr<#State>

◆ set_callback()

void ossia::time_interval::set_callback ( time_interval::exec_callback  cb)

sets a new callback for the interval

Parameters
time_interval::ExecutionCallbackto use to be notified at each step

◆ get_nominal_duration()

const time_value & ossia::time_interval::get_nominal_duration ( ) const

get the #time_interval nominal duration

Returns
const #TimeValue& nominal duration

◆ set_nominal_duration()

time_interval & ossia::time_interval::set_nominal_duration ( ossia::time_value  durationNominal)

set the #time_interval duration

Parameters
const#TimeValue& duration
Returns
#time_interval the interval

◆ get_min_duration()

const time_value & ossia::time_interval::get_min_duration ( ) const

get the #time_interval minimal duration

Returns
const #TimeValue& minimal duration

◆ set_min_duration()

time_interval & ossia::time_interval::set_min_duration ( ossia::time_value  durationMin)

set the #time_interval minimal duration

Parameters
const#TimeValue& minimal duration
Returns
#time_interval the interval

◆ get_max_duration()

const time_value & ossia::time_interval::get_max_duration ( ) const

get the #time_interval maximal duration

Returns
const #TimeValue& maximal duration

◆ set_max_duration()

time_interval & ossia::time_interval::set_max_duration ( ossia::time_value  durationMax)

set the #time_interval maximal duration

Parameters
const#TimeValue& maximal duration
Returns
#time_interval the interval

◆ get_start_event()

time_event & ossia::time_interval::get_start_event ( ) const

get the event from where the #time_interval starts

Returns
std::shared_ptr<#time_event> start event

◆ get_end_event()

time_event & ossia::time_interval::get_end_event ( ) const

get the event from where the #time_interval starts

Returns
std::shared_ptr<#time_event> start event

◆ add_time_process()

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

Parameters
std::shared_ptr<TimeProcess>to insert

◆ remove_time_process()

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

Parameters
std::shared_ptr<TimeProcess>to insert

◆ get_time_processes()

const std::vector<std::shared_ptr<time_process> >& ossia::time_interval::get_time_processes ( ) const
inline

get time processes attached to the #time_interval

Returns
#Container<#TimeProcess>