HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Playback.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_Playback.h ( UT Library, C++)
7  *
8  * COMMENTS:
9  *
10  * This class is used to store framebar info for
11  * classes above the SI library.
12  *
13  */
14 
15 #ifndef __UT_Playback__
16 #define __UT_Playback__
17 
18 #include "UT_API.h"
19 #include "UT_ValArray.h"
20 #include <SYS/SYS_StaticInit.h>
21 #include <SYS/SYS_Types.h>
22 
23 #include <iosfwd>
24 #include <utility>
25 
26 class ut_PlayCB;
27 
28 // cbdata, UT_PlaybackMode, oldframe, newframe
29 typedef void (*UT_PlayCallback)(void *, int, fpreal, fpreal);
30 typedef bool (*UT_PlayAdvanceCB)(void *);
31 
33 {
34 public:
35 
36  UT_Playback();
37 
44 
45  FLIPBOOKING
46  };
47 
48  void setPlaybackMode(UT_PlaybackMode mode);
49 
51  { return myPlayback; }
52 
53  int getStopCount() const
54  { return myStopCount; }
55 
56  void setRealtimeMode(bool mode)
57  { myRealtimeMode = mode; }
58 
59  bool getRealtimeMode() const
60  { return myRealtimeMode; }
61 
63  { myStartRange = start; myEndRange = end; }
64 
66  { start = myStartRange; end = myEndRange; }
67 
68  bool isPlaybackReset();
69  bool isPlaying() const { return (myPlayback == FORWARD ||
70  myPlayback == REVERSE); }
71  bool isScrubbing() const { return myPlayback == SCRUB; }
72 
73  void setCurrentFrame(fpreal frame);
74  fpreal getCurrentFrame() { return myCurrentFrame; }
75 
76  void resetAbsoluteFrame();
77  unsigned long getAbsoluteFrame() { return myAbsoluteFrame; }
78 
79  // tells SI_Playback to stop.
80  void stopPlayback();
81  void setStopCallback(void (*cb)(void *), void *data);
82 
83  void setInterceptMode(int mode) { myInterceptMode = mode; }
84  int getInterceptMode() const { return myInterceptMode; }
85 
86  void setEvalStartTime(fpreal eval_start_time) { myEvalStartTime = eval_start_time; }
87  fpreal getEvalStartTime() const { return myEvalStartTime; }
88 
89  // Callbacks are passed the UT_PlaybackMode and 'data'.
90  void addPlayCallback(UT_PlayCallback cb, void *cbdata);
91  void removePlayCallback(UT_PlayCallback cb, void *cbdata);
92 
93  void addPlayAdvanceCB(UT_PlayAdvanceCB, void *cbdata);
94  void removePlayAdvanceCB(UT_PlayAdvanceCB, void *cbdata);
95  bool canAdvancePlay();
96 
97  static UT_Playback *getPlayback();
98 
99 private:
100 
101  using CallbackPair = std::pair<UT_PlayAdvanceCB, void *>;
102 
103  UT_PlaybackMode myPlayback;
104  fpreal myStartRange;
105  fpreal myEndRange;
106  fpreal myCurrentFrame;
107  unsigned long myAbsoluteFrame;
108  bool myRealtimeMode;
109  bool myResetFlag;
110  int myInterceptMode;
111  fpreal myEvalStartTime;
112  UT_ValArray<ut_PlayCB *> myPlayCallbacks;
113  UT_Array<CallbackPair> myPlayAdvanceCBs;
114 
115  int myStopCount;
116 };
117 
118 SYSdeclareStaticObject(UT_API, UTplaybackObject);
119 
120 #endif
121 
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
void setPlaybackRange(fpreal start, fpreal end)
Definition: UT_Playback.h:62
void
Definition: png.h:1083
GLuint start
Definition: glcorearb.h:475
#define UT_API
Definition: UT_API.h:14
void getPlaybackRange(fpreal &start, fpreal &end) const
Definition: UT_Playback.h:65
UT_PlaybackMode getPlaybackMode() const
Definition: UT_Playback.h:50
void(* UT_PlayCallback)(void *, int, fpreal, fpreal)
Definition: UT_Playback.h:29
void setInterceptMode(int mode)
Definition: UT_Playback.h:83
void setRealtimeMode(bool mode)
Definition: UT_Playback.h:56
bool isScrubbing() const
Definition: UT_Playback.h:71
int getInterceptMode() const
Definition: UT_Playback.h:84
GLuint GLuint end
Definition: glcorearb.h:475
bool getRealtimeMode() const
Definition: UT_Playback.h:59
int getStopCount() const
Definition: UT_Playback.h:53
void setEvalStartTime(fpreal eval_start_time)
Definition: UT_Playback.h:86
SYSdeclareStaticObject(UT_API, UTplaybackObject)
fpreal getCurrentFrame()
Definition: UT_Playback.h:74
GLenum mode
Definition: glcorearb.h:99
fpreal64 fpreal
Definition: SYS_Types.h:277
unsigned long getAbsoluteFrame()
Definition: UT_Playback.h:77
bool(* UT_PlayAdvanceCB)(void *)
Definition: UT_Playback.h:30
fpreal getEvalStartTime() const
Definition: UT_Playback.h:87
bool isPlaying() const
Definition: UT_Playback.h:69
Definition: format.h:895