dsys2

view src/dsys2.h @ 5:94ce16dd20c0

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 02 Sep 2011 01:57:00 +0300
parents 34d90cd9ef9b
children 80f86f0f67ec
line source
1 #ifndef DSYS2_H_
2 #define DSYS2_H_
4 #include <stdio.h>
6 struct dsys_demo;
7 struct dsys_event;
9 typedef float demotime_t;
11 enum dsys_evtype {
12 DSYS_SINGLE,
13 DSYS_PERIODIC
14 };
17 struct dsys_demo *dsys_open(const char *fname);
18 struct dsys_demo *dsys_open_stream(FILE *fp);
19 void dsys_close(struct dsys_demo *demo);
21 void dsys_update(struct dsys_demo *demo, demotime_t tm);
24 void dsys_start(struct dsys_demo *demo);
25 void dsys_stop(struct dsys_demo *demo);
26 int dsys_is_running(struct dsys_demo *demo);
29 demotime_t dsys_duration(struct dsys_demo *demo);
30 demotime_t dsys_time(struct dsys_demo *demo);
31 float dsys_progress(struct dsys_demo *demo);
33 /* seek without continuity */
34 void dsys_seek(struct dsys_demo *demo, demotime_t tm);
35 void dsys_seek_norm(struct dsys_demo *demo, float t);
37 /* seek by accelerating time */
38 void dsys_warp(struct dsys_demo *demo, demotime_t tm);
39 void dsys_warp_norm(struct dsys_demo *demo, float t);
42 /* events */
43 struct dsys_event *dsys_event(struct dsys_demo *demo, const char *name);
45 enum dsys_evtype dsys_event_type(struct dsys_event *ev);
46 float dsys_event_value(struct dsys_event *ev);
48 void dsys_event_callback(struct dsys_event *ev, void (*func)(void*), void *cls);
49 void dsys_event_link(struct dsys_event *ev, float *link);
51 /* event evaluators */
52 float dsys_eval_step(struct dsys_event *ev, demotime_t t);
53 float dsys_eval_lerp(struct dsys_event *ev, demotime_t t);
54 float dsys_eval_sigmoid(struct dsys_event *ev, demotime_t t);
56 /* time conversion */
57 demotime_t dsys_sec_to_dtime(float sec);
58 demotime_t dsys_msec_to_dtime(unsigned long msec);
59 demotime_t dsys_norm_to_dtime(float t);
61 float dsys_dtime_to_sec(demotime_t tm);
62 unsigned long dsys_dtime_to_msec(demotime_t tm);
63 float dsys_dtime_to_norm(demotime_t tm);
66 #endif /* DSYS2_H_ */