37 CInterval(
const std::string &name,
double duration,
bool open_ended);
41 INLINE
const std::string &get_name()
const;
42 INLINE
double get_duration()
const;
43 INLINE
bool get_open_ended()
const;
50 ET_reverse_initialize,
63 INLINE State get_state()
const;
64 INLINE
bool is_stopped()
const;
66 INLINE
void set_done_event(
const std::string &event);
67 INLINE
const std::string &get_done_event()
const;
70 INLINE
double get_t()
const;
72 INLINE
void set_auto_pause(
bool auto_pause);
73 INLINE
bool get_auto_pause()
const;
74 INLINE
void set_auto_finish(
bool auto_finish);
75 INLINE
bool get_auto_finish()
const;
77 INLINE
void set_wants_t_callback(
bool wants_t_callback);
78 INLINE
bool get_wants_t_callback()
const;
83 void start(
double start_t = 0.0,
double end_t = -1.0,
double play_rate = 1.0);
84 void loop(
double start_t = 0.0,
double end_t = -1.0,
double play_rate = 1.0);
87 void resume(
double start_t);
88 void resume_until(
double end_t);
90 void clear_to_initial();
91 bool is_playing()
const;
93 double get_play_rate()
const;
94 void set_play_rate(
double play_rate);
103 void priv_do_event(
double t, EventType event);
104 virtual void priv_initialize(
double t);
105 virtual void priv_instant();
106 virtual void priv_step(
double t);
107 virtual void priv_finalize();
108 virtual void priv_reverse_initialize(
double t);
109 virtual void priv_reverse_instant();
110 virtual void priv_reverse_finalize();
111 virtual void priv_interrupt();
113 virtual void output(std::ostream &out)
const;
114 virtual void write(std::ostream &out,
int indent_level)
const;
116 void setup_play(
double start_time,
double end_time,
double play_rate,
119 void setup_resume_until(
double end_t);
123 MAKE_PROPERTY(name, get_name);
124 MAKE_PROPERTY(duration, get_duration);
125 MAKE_PROPERTY(open_ended, get_open_ended);
126 MAKE_PROPERTY(state, get_state);
127 MAKE_PROPERTY(stopped, is_stopped);
128 MAKE_PROPERTY(done_event, get_done_event, set_done_event);
129 MAKE_PROPERTY(t, get_t, set_t);
130 MAKE_PROPERTY(auto_pause, get_auto_pause, set_auto_pause);
131 MAKE_PROPERTY(auto_finish, get_auto_finish, set_auto_finish);
132 MAKE_PROPERTY(manager, get_manager, set_manager);
133 MAKE_PROPERTY(play_rate, get_play_rate, set_play_rate);
134 MAKE_PROPERTY(playing, is_playing);
138 INLINE
bool check_t_callback();
141 void interval_done();
143 INLINE
void recompute()
const;
144 virtual void do_recompute();
145 INLINE
void check_stopped(
TypeHandle type,
const char *method_name)
const;
146 INLINE
void check_started(
TypeHandle type,
const char *method_name)
const;
152 std::string _done_event;
157 bool _wants_t_callback;
158 double _last_t_callback;
166 bool _start_t_at_start;
188 static void init_type() {
189 TypedReferenceCount::init_type();
191 TypedReferenceCount::get_class_type());
194 return get_class_type();
196 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
204 INLINE std::ostream &operator << (std::ostream &out,
const CInterval &ival);
205 EXPCL_DIRECT_INTERVAL std::ostream &operator << (std::ostream &out, CInterval::State state);