# Track

from direct.interval.MetaInterval import Track

## Inheritance:

Track: MetaInterval
MetaInterval: CMetaInterval
CMetaInterval: CInterval
CInterval: TypedReferenceCount
TypedReferenceCount: TypedObject ReferenceCount
TypedObject: MemoryBase
MemoryBase:
ReferenceCount: MemoryBase

## Methods of Track:

applyIvals
validateComponent

## Methods of MetaInterval:

__add__
__delitem__
__delslice__
__doPythonCallbacks
__getitem__
__getslice__
__iadd__
__init__
__len__
__repr__
__setitem__
__setslice__
__str__
__updateIvals
addInterval
addParallel
addParallelEndTogether
addSequence
addTrack
append
applyIvals
clearIntervals
clearToInitial
count
extend
finish
getDuration
getIntervalStartTime
getManager
index
insert
loop
pause
pop
privDoEvent
privPostEvent
remove
resume
resumeUntil
reverse
setIntervalStartTime
setManager
setT
sort
start
timeline
validateComponent
validateComponents

## Methods of CMetaInterval:

CMetaInterval (Constructor)
addCInterval
addExtIndex
clearIntervals
getCInterval
getClassType
getDefType
getEventIndex
getEventT
getEventType
getExtIndex
getIntervalEndTime
getIntervalStartTime
getNumDefs
getPrecision
isEventReady
popEvent
popLevel
pushLevel
setIntervalStartTime
setPrecision
timeline

## Methods of CInterval:

clearToInitial
finish
getAutoFinish
getAutoPause
getClassType
getDoneEvent
getDuration
getManager
getName
getOpenEnded
getPlayRate
getState
getT
getWantsTCallback
isPlaying
isStopped
loop
output
pause
privDoEvent
privFinalize
privInitialize
privInstant
privInterrupt
privReverseFinalize
privReverseInitialize
privReverseInstant
privStep
resume
resumeUntil
setAutoFinish
setAutoPause
setDoneEvent
setManager
setPlayRate
setT
setupPlay
setupResume
setupResumeUntil
setWantsTCallback
start
stepPlay
write

## Methods of TypedReferenceCount:

getClassType

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
testRefCountNonzero
unref

## Constants in CMetaInterval:

RSPreviousEnd | (RelativeStart)
RSPreviousBegin | (RelativeStart)
RSLevelBegin | (RelativeStart)
DTCInterval | (DefType)
DTExtIndex | (DefType)
DTPushLevel | (DefType)
DTPopLevel | (DefType)

## Constants in CInterval:

ETInitialize | (EventType)
ETInstant | (EventType)
ETStep | (EventType)
ETFinalize | (EventType)
ETReverseInitialize | (EventType)
ETReverseInstant | (EventType)
ETReverseFinalize | (EventType)
ETInterrupt | (EventType)
SInitial | (State)
SStarted | (State)
SPaused | (State)
SFinal | (State)

applyIvals def applyIvals(self, meta, relTime, relTo) Undocumented function.

validateComponent def validateComponent(self, tuple) Undocumented function.

__add__ def __add__(self, other) Undocumented function.

__delitem__ def __delitem__(self, index) Undocumented function.

__delslice__ def __delslice__(self, i, j) Undocumented function.

__doPythonCallbacks def __doPythonCallbacks(self) Undocumented function.

__getitem__ def __getitem__(self, index) Undocumented function.

__getslice__ def __getslice__(self, i, j) Undocumented function.

__iadd__ def __iadd__(self, other) Undocumented function.

__init__ def __init__(self, *ivals, **kw) Undocumented function.

__len__ def __len__(self) Undocumented function.

__repr__ def __repr__(self, *args, **kw) Undocumented function.

__setitem__ def __setitem__(self, index, value) Undocumented function.

__setslice__ def __setslice__(self, i, j, s) Undocumented function.

__str__ def __str__(self, *args, **kw) Undocumented function.

__updateIvals def __updateIvals(self) Undocumented function.

addInterval def addInterval(self, ival, relTime, relTo) Undocumented function.

addParallel def addParallel(self, list, name, relTime, relTo, duration) Undocumented function.

addParallelEndTogether def addParallelEndTogether(self, list, name, relTime, relTo, duration) Undocumented function.

addSequence def addSequence(self, list, name, relTime, relTo, duration) Undocumented function.

addTrack def addTrack(self, list, name, relTime, relTo, duration) Undocumented function.

append def append(self, ival) Undocumented function.

applyIvals def applyIvals(self, meta, relTime, relTo) Undocumented function.

clearIntervals def clearIntervals(self) Undocumented function.

clearToInitial def clearToInitial(self) Undocumented function.

count def count(self, ival) Undocumented function.

extend def extend(self, ivals) Undocumented function.

finish def finish(self) Undocumented function.

getDuration def getDuration(self) Undocumented function.

getIntervalStartTime def getIntervalStartTime(self, *args, **kw) Undocumented function.

getManager def getManager(self) Undocumented function.

index def index(self, ival) Undocumented function.

insert def insert(self, index, ival) Undocumented function.

loop def loop(self, startT=0.0, endT=-1.0, playRate=1.0) Undocumented function.

pause def pause(self) Undocumented function.

pop def pop(self, index=None) Undocumented function.

privDoEvent def privDoEvent(self, t, event) Undocumented function.

privPostEvent def privPostEvent(self) Undocumented function.

remove def remove(self, ival) Undocumented function.

resume def resume(self, startT=None) Undocumented function.

resumeUntil def resumeUntil(self, endT) Undocumented function.

reverse def reverse(self) Undocumented function.

setIntervalStartTime def setIntervalStartTime(self, *args, **kw) Undocumented function.

setManager def setManager(self, manager) Undocumented function.

setT def setT(self, t) Undocumented function.

sort def sort(self, cmpfunc=None) Undocumented function.

start def start(self, startT=0.0, endT=-1.0, playRate=1.0) Undocumented function.

timeline def timeline(self, out=None) Undocumented function.

validateComponent def validateComponent(self, component) Undocumented function.

validateComponents def validateComponents(self, components) Undocumented function.

CMetaInterval CMetaInterval::CMetaInterval(string const &name); Description:

addCInterval int CMetaInterval::add_c_interval(CInterval *c_interval, double rel_time = (0), CMetaInterval::RelativeStart rel_to = (RS_previous_end)); Description: Adds a new CInterval to the list. The interval will be played when the indicated time (relative to the given point) has been reached. The return value is the index of the def entry representing the new interval.

addExtIndex int CMetaInterval::add_ext_index(int ext_index, string const &name, double duration, bool open_ended, double rel_time, CMetaInterval::RelativeStart rel_to); Description: Adds a new external interval to the list. This represents some object in the external scripting language that has properties similar to a CInterval (for instance, a Python Interval object). The CMetaInterval object cannot play this external interval directly, but it records a placeholder for it and will ask the scripting language to play it when it is time, via is_event_ready() and related methods. The ext_index number itself is simply a handle that the scripting language makes up and associates with its interval object somehow. The CMetaInterval object does not attempt to interpret this value. The return value is the index of the def entry representing the new interval.

clearIntervals void CMetaInterval::clear_intervals(void); Description: Resets the list of intervals and prepares for receiving a new list.

getCInterval CInterval *CMetaInterval::get_c_interval(int n) const; Description: Return the CInterval pointer associated with the nth interval definition. It is only valid to call this if get_def_type(n) returns DT_c_interval.

getClassType static TypeHandle CMetaInterval::get_class_type(void); Undocumented function.

getDefType CMetaInterval::DefType CMetaInterval::get_def_type(int n) const; Description: Returns the type of the nth interval definition that has been added.

getEventIndex int CMetaInterval::get_event_index(void) const; Description: If a previous call to is_event_ready() returned true, this returns the index number (added via add_event_index()) of the external interval that needs to be played.

getEventT double CMetaInterval::get_event_t(void) const; Description: If a previous call to is_event_ready() returned true, this returns the t value that should be fed to the given interval.

getEventType CInterval::EventType CMetaInterval::get_event_type(void) const; Description: If a previous call to is_event_ready() returned true, this returns the type of the event (initialize, step, finalize, etc.) for the given interval.

getExtIndex int CMetaInterval::get_ext_index(int n) const; Description: Return the external interval index number associated with the nth interval definition. It is only valid to call this if get_def_type(n) returns DT_ext_index.

getIntervalEndTime double CMetaInterval::get_interval_end_time(string const &name) const; Description: Returns the actual end time, relative to the beginning of the interval, of the child interval with the given name, if found, or -1 if the interval is not found.

getIntervalStartTime double CMetaInterval::get_interval_start_time(string const &name) const; Description: Returns the actual start time, relative to the beginning of the interval, of the child interval with the given name, if found, or -1 if the interval is not found.

getNumDefs int CMetaInterval::get_num_defs(void) const; Description: Returns the number of interval and push/pop definitions that have been added to the meta interval.

getPrecision double CMetaInterval::get_precision(void) const; Description: Returns the precision with which time measurements are compared. See set_precision().

isEventReady bool CMetaInterval::is_event_ready(void); Description: Returns true if a recent call to priv_initialize(), priv_step(), or priv_finalize() has left some external intervals ready to play. If this returns true, call get_event_index(), get_event_t(), and pop_event() to retrieve the relevant information.

popEvent void CMetaInterval::pop_event(void); Description: Acknowledges that the external interval on the top of the queue has been extracted, and is about to be serviced by the scripting language. This prepares the interval so the next call to is_event_ready() will return information about the next external interval on the queue, if any.

popLevel int CMetaInterval::pop_level(double duration = (-1)); Description: Finishes a level marked by a previous call to push_level(), and returns to the previous level. If the duration is not negative, it represents a phony duration to assign to the level, for the purposes of sequencing later intervals. Otherwise, the level's duration is computed based on the intervals within the level.

pushLevel int CMetaInterval::push_level(string const &name, double rel_time, CMetaInterval::RelativeStart rel_to); Description: Marks the beginning of a nested level of child intervals. Within the nested level, a RelativeStart time of RS_level_begin refers to the start of the level, and the first interval added within the level is always relative to the start of the level. The return value is the index of the def entry created by this push.

setIntervalStartTime bool CMetaInterval::set_interval_start_time(string const &name, double rel_time, CMetaInterval::RelativeStart rel_to = (RS_level_begin)); Description: Adjusts the start time of the child interval with the given name, if found. This may be either a C++ interval added via add_c_interval(), or an external interval added via add_ext_index(); the name must match exactly. If the interval is found, its start time is adjusted, and all subsequent intervals are adjusting accordingly, and true is returned. If a matching interval is not found, nothing is changed and false is returned.

setPrecision void CMetaInterval::set_precision(double precision); Description: Indicates the precision with which time measurements are compared. For numerical accuracy, all floating-point time values are converted to integer values internally by scaling by the precision factor. The larger the number given here, the smaller the delta of time that can be differentiated; the limit is the maximum integer that can be represented in the system.

timeline void CMetaInterval::timeline(ostream &out) const; Description: Outputs a list of all events in the order in which they occur.

clearToInitial void CInterval::clear_to_initial(void); Description: Pauses the interval, if it is playing, and resets its state to its initial state, abandoning any state changes already in progress in the middle of the interval. Calling this is like pausing the interval and discarding it, creating a new one in its place.

finish void CInterval::finish(void); Description: Stops the interval from playing and sets it to its final state.

getAutoFinish bool CInterval::get_auto_finish(void) const; Description: Returns the state of the 'auto_finish' flag. See set_auto_finish().

getAutoPause bool CInterval::get_auto_pause(void) const; Description: Returns the state of the 'auto_pause' flag. See set_auto_pause().

getClassType static TypeHandle CInterval::get_class_type(void); Undocumented function.

getDoneEvent string const &CInterval::get_done_event(void) const; Description: Returns the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own.

getDuration double CInterval::get_duration(void) const; Description: Returns the duration of the interval in seconds.

getManager CIntervalManager *CInterval::get_manager(void) const; Description: Returns the CIntervalManager object which will be responsible for playing this interval. Note that this can only return a C++ object; if the particular CIntervalManager object has been extended in the scripting language, this will return the encapsulated C++ object, not the full extended object.

getName string const &CInterval::get_name(void) const; Description: Returns the interval's name.

getOpenEnded bool CInterval::get_open_ended(void) const; Description: Returns the state of the "open_ended" flag. This is primarily intended for instantaneous intervals like FunctionIntervals; it indicates true if the interval has some lasting effect that should be applied even if the interval doesn't get started until after its finish time, or false if the interval is a transitive thing that doesn't need to be called late.

getPlayRate double CInterval::get_play_rate(void) const; Description: Returns the play rate as set by the last call to start(), loop(), or set_play_rate().

getState CInterval::State CInterval::get_state(void) const; Description: Indicates the state the interval believes it is in: whether it has been started, is currently in the middle, or has been finalized.

getT double CInterval::get_t(void) const; Description: Returns the current time of the interval: the last value of t passed to priv_initialize(), priv_step(), or priv_finalize().

getWantsTCallback bool CInterval::get_wants_t_callback(void) const; Description: Returns the state of the 'wants_t_callback' flag. See set_wants_t_callback().

isPlaying bool CInterval::is_playing(void) const; Description: Returns true if the interval is currently playing, false otherwise.

isStopped bool CInterval::is_stopped(void) const; Description: Returns true if the interval is in either its initial or final states (but not in a running or paused state).

loop void CInterval::loop(double start_t = (0), double end_t = (-1), double play_rate = (1)); Description: Starts the interval playing by registering it with the current CIntervalManager. The interval will play until it is interrupted with finish() or pause(), looping back to start_t when it reaches end_t. If end_t is less than zero, it indicates the end of the interval.

output virtual void CInterval::output(ostream &out) const; Description:

pause double CInterval::pause(void); Description: Stops the interval from playing but leaves it in its current state. It may later be resumed from this point by calling resume().

privDoEvent void CInterval::priv_do_event(double t, CInterval::EventType event); These functions control the actual playback of the interval. Don't call them directly; they're intended to be called from a supervising object, e.g. the Python start() .. finish() interface. These cannot be declared private because they must be accessible to Python, but the method names are prefixed with priv_ to remind you that you probably don't want to be using them directly. Description: Calls the appropriate event function indicated by the EventType.

privFinalize virtual void CInterval::priv_finalize(void); Description: This is called to stop an interval, forcing it to whatever state it would be after it played all the way through. It's generally invoked by set_final_t().

privInitialize virtual void CInterval::priv_initialize(double t); These functions control the actual playback of the interval. Don't call them directly; they're intended to be called from a supervising object, e.g. the Python start() .. finish() interface. These cannot be declared private because they must be accessible to Python, but the method names are prefixed with priv_ to remind you that you probably don't want to be using them directly. Description: This replaces the first call to priv_step(), and indicates that the interval has just begun. This may be overridden by derived classes that need to do some explicit initialization on the first call.

privInstant virtual void CInterval::priv_instant(void); Description: This is called in lieu of priv_initialize() .. priv_step() .. priv_finalize(), when everything is to happen within one frame. The interval should initialize itself, then leave itself in the final state.

privInterrupt virtual void CInterval::priv_interrupt(void); Description: This is called while the interval is playing to indicate that it is about to be interrupted; that is, priv_step() will not be called for a length of time. But the interval should remain in its current state in anticipation of being eventually restarted when the calls to priv_step() eventually resume. The purpose of this function is to allow self-running intervals like sound intervals to stop the actual sound playback during the pause.

privReverseFinalize virtual void CInterval::priv_reverse_finalize(void); Description: Called generally following a priv_reverse_initialize(), this indicates the interval should set itself to the initial state.

privReverseInitialize virtual void CInterval::priv_reverse_initialize(double t); Description: Similar to priv_initialize(), but this is called when the interval is being played backwards; it indicates that the interval should start at the finishing state and undo any intervening intervals.

privReverseInstant virtual void CInterval::priv_reverse_instant(void); Description: This is called in lieu of priv_reverse_initialize() .. priv_step() .. priv_reverse_finalize(), when everything is to happen within one frame. The interval should initialize itself, then leave itself in the initial state.

privStep virtual void CInterval::priv_step(double t); Description: Advances the time on the interval. The time may either increase (the normal case) or decrease (e.g. if the interval is being played by a slider).

resume void CInterval::resume(void); Description: Restarts the interval from its current point after a previous call to pause(). Description: Restarts the interval from the indicated point after a previous call to pause().

resumeUntil void CInterval::resume_until(double end_t); Description: Restarts the interval from the current point after a previous call to pause() (or a previous play-to-point-and-stop), to play until the indicated point and then stop.

setAutoFinish void CInterval::set_auto_finish(bool auto_finish); Description: Changes the state of the 'auto_finish' flag. If this is true, the interval may be arbitrarily finished when the system needs to reset due to some external event by calling CIntervalManager::interrupt(). If this is false (the default), the interval must always be explicitly finished or paused.

setAutoPause void CInterval::set_auto_pause(bool auto_pause); Description: Changes the state of the 'auto_pause' flag. If this is true, the interval may be arbitrarily interrupted when the system needs to reset due to some external event by calling CIntervalManager::interrupt(). If this is false (the default), the interval must always be explicitly finished or paused.

setDoneEvent void CInterval::set_done_event(string const &event); Description: Sets the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own.

setManager void CInterval::set_manager(CIntervalManager *manager); Description: Indicates the CIntervalManager object which will be responsible for playing this interval. This defaults to the global CIntervalManager; you should need to change this only if you have special requirements for playing this interval.

setPlayRate void CInterval::set_play_rate(double play_rate); Description: Changes the play rate of the interval. If the interval is already started, this changes its speed on-the-fly. Note that since play_rate is a parameter to start() and loop(), the next call to start() or loop() will reset this parameter.

setT void CInterval::set_t(double t); Description: Explicitly sets the time within the interval. Normally, you would use start() .. finish() to let the time play normally, but this may be used to set the time to some particular value.

setupPlay void CInterval::setup_play(double start_time, double end_time, double play_rate, bool do_loop); Description: Called to prepare the interval for automatic timed playback, e.g. via a Python task. The interval will be played from start_t to end_t, at a time factor specified by play_rate. start_t must always be less than end_t (except for the exception for end_t == -1, below), but if play_rate is negative the interval will be played backwards. Specify end_t of -1 to play the entire interval from start_t. Call step_play() repeatedly to execute the interval.

setupResume void CInterval::setup_resume(void); Description: Called to prepare the interval for restarting at the current point within the interval after an interruption.

setupResumeUntil void CInterval::setup_resume_until(double end_t); Description: Called to prepare the interval for restarting from the current point after a previous call to pause() (or a previous play-to-point-and-stop), to play until the indicated point and then stop.

setWantsTCallback void CInterval::set_wants_t_callback(bool wants_t_callback); Description: Changes the state of the 'wants_t_callback' flag. If this is true, the interval will be returned by CIntervalManager::get_event() each time the interval's time value has been changed, regardless of whether it has any external events.

start void CInterval::start(double start_t = (0), double end_t = (-1), double play_rate = (1)); Description: Starts the interval playing by registering it with the current CIntervalManager. The interval will play to the end and stop. If end_t is less than zero, it indicates the end of the interval.

stepPlay bool CInterval::step_play(void); Description: Should be called once per frame to execute the automatic timed playback begun with setup_play(). Returns true if the interval should continue, false if it is done and should stop.

write virtual void CInterval::write(ostream &out, int indent_level) const; Description:

getClassType static TypeHandle TypedReferenceCount::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.

getClassType static TypeHandle ReferenceCount::get_class_type(void); Undocumented function.

getRefCount int ReferenceCount::get_ref_count(void) const; Description: Returns the current reference count.

ref void ReferenceCount::ref(void) const; Description: Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

testRefCountIntegrity bool ReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero bool ReferenceCount::test_ref_count_nonzero(void) const; Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref bool ReferenceCount::unref(void) const; Description: Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is true if the new reference count is nonzero, false if it is zero.