Raul::TimeSlice Class Reference

A duration of time, with conversion between tick time and beat time. More...

#include <TimeSlice.hpp>

List of all members.

Public Member Functions

 TimeSlice (double tick_rate, double bpm)
void set_window (TickTime start, TickCount length)
 Set the start and length of the slice.
void set_start (TickTime time)
void set_length (TickCount length)
bool contains (TickTime time)
double tick_rate ()
double beat_rate ()
double bpm ()
void set_tick_rate (double tick_rate)
void set_bpm (double bpm)
Seconds beats_to_seconds (BeatTime beats) const
TickTime beats_to_ticks (BeatTime beats) const
Seconds ticks_to_seconds (TickTime ticks) const
BeatTime ticks_to_beats (TickTime ticks) const
TickTime start_ticks () const
 Start of current sub-cycle in ticks.
TickCount length_ticks () const
 Length of current sub-cycle in ticks.
BeatTime start_beats () const
 Start of current sub-cycle in beats.
BeatCount length_beats () const
 Length of current sub-cycle in beats.
void set_offset (TickCount offset)
 Set the offset between real-time and timeslice-time.
TickCount offset_ticks () const
 Offset relative to external (e.g Jack) time.


Detailed Description

A duration of time, with conversion between tick time and beat time.

This is a slice along a single timeline (ie t=0 in ticks and t=0 in beats are equal). Relation to an external time base (e.g. Jack frame time) is represented by frame_offset (the idea is that this holds all the information necessary for passing to run() methods so they know the current state of things WRT time).

This class handles conversion between two units of time: musical (beat) time, and real (tick) time. Real time is discrete, the smallest unit of time is the 'tick' (usually audio frames or MIDI ticks). Beat time is stored as a double (to be independent of any rates or timer precision).

This caches as many values as possible to make calls less expensive, pass it around by reference, not value.


Member Function Documentation

void Raul::TimeSlice::set_window ( TickTime  start,
TickCount  length 
) [inline]

Set the start and length of the slice.

Note that external offset is not affected by this, don't forget to reset the offset each cycle!


The documentation for this class was generated from the following file:
Generated on Wed Apr 9 08:14:41 2008 for RAUL by  doxygen 1.5.1