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  ~UT_Playback();
38 
45 
46  FLIPBOOKING
47  };
48 
49  void setPlaybackMode(UT_PlaybackMode mode);
50 
52  { return myPlayback; }
53 
54  int getStopCount() const
55  { return myStopCount; }
56 
57  void setRealtimeMode(bool mode)
58  { myRealtimeMode = mode; }
59 
60  bool getRealtimeMode() const
61  { return myRealtimeMode; }
62 
64  { myStartRange = start; myEndRange = end; }
65 
67  { start = myStartRange; end = myEndRange; }
68 
69  bool isPlaybackReset();
70  bool isPlaying() const { return (myPlayback == FORWARD ||
71  myPlayback == REVERSE); }
72  bool isScrubbing() const { return myPlayback == SCRUB; }
73 
74  void setCurrentFrame(fpreal frame);
75  fpreal getCurrentFrame() { return myCurrentFrame; }
76 
77  void resetAbsoluteFrame();
78  unsigned long getAbsoluteFrame() { return myAbsoluteFrame; }
79 
80  // tells SI_Playback to stop.
81  void stopPlayback();
82  void setStopCallback(void (*cb)(void *), void *data);
83 
84  void setInterceptMode(int mode) { myInterceptMode = mode; }
85  int getInterceptMode() const { return myInterceptMode; }
86 
87  // Callbacks are passed the UT_PlaybackMode and 'data'.
88  void addPlayCallback(UT_PlayCallback cb, void *cbdata);
89  void removePlayCallback(UT_PlayCallback cb, void *cbdata);
90 
91  void addPlayAdvanceCB(UT_PlayAdvanceCB, void *cbdata);
92  void removePlayAdvanceCB(UT_PlayAdvanceCB, void *cbdata);
93  bool canAdvancePlay();
94 
95  static UT_Playback *getPlayback();
96 
97 private:
98 
99  using CallbackPair = std::pair<UT_PlayAdvanceCB, void *>;
100 
101  UT_PlaybackMode myPlayback;
102  fpreal myStartRange;
103  fpreal myEndRange;
104  fpreal myCurrentFrame;
105  unsigned long myAbsoluteFrame;
106  bool myRealtimeMode;
107  bool myResetFlag;
108  int myInterceptMode;
109  UT_ValArray<ut_PlayCB *> myPlayCallbacks;
110  UT_Array<CallbackPair> myPlayAdvanceCBs;
111 
112  int myStopCount;
113 };
114 
115 SYSdeclareStaticObject(UT_API, UTplaybackObject);
116 
117 #endif
118 
void setPlaybackRange(fpreal start, fpreal end)
Definition: UT_Playback.h:63
void
Definition: png.h:1083
GLuint start
Definition: glcorearb.h:474
#define UT_API
Definition: UT_API.h:14
void getPlaybackRange(fpreal &start, fpreal &end) const
Definition: UT_Playback.h:66
UT_PlaybackMode getPlaybackMode() const
Definition: UT_Playback.h:51
void(* UT_PlayCallback)(void *, int, fpreal, fpreal)
Definition: UT_Playback.h:29
void setInterceptMode(int mode)
Definition: UT_Playback.h:84
void setRealtimeMode(bool mode)
Definition: UT_Playback.h:57
bool isScrubbing() const
Definition: UT_Playback.h:72
int getInterceptMode() const
Definition: UT_Playback.h:85
GLuint GLuint end
Definition: glcorearb.h:474
bool getRealtimeMode() const
Definition: UT_Playback.h:60
int getStopCount() const
Definition: UT_Playback.h:54
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
SYSdeclareStaticObject(UT_API, UTplaybackObject)
fpreal getCurrentFrame()
Definition: UT_Playback.h:75
GLenum mode
Definition: glcorearb.h:98
GLboolean * data
Definition: glcorearb.h:130
fpreal64 fpreal
Definition: SYS_Types.h:277
unsigned long getAbsoluteFrame()
Definition: UT_Playback.h:78
bool(* UT_PlayAdvanceCB)(void *)
Definition: UT_Playback.h:30
bool isPlaying() const
Definition: UT_Playback.h:70