HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CL_Align.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: CL_Align.h ( Clip Library, C++)
7  *
8  * COMMENTS:
9  *
10  * Aligns a collection.
11  */
12 
13 #ifndef __CL_Align__
14 #define __CL_Align__
15 
16 #include "CL_API.h"
17 #include "CL_Clip.h"
18 #include <SYS/SYS_Types.h>
19 
29 
31 {
32 public:
33 
34  CL_Align(fpreal current_time);
35 
36  int getAlignment(CL_TrackListC &toAlign,
37  CL_Alignment align,
38  fpreal &start, fpreal &end);
39 
40  // Sets the start, length and rate on the 'dest' clip, adds all the tracks
41  // in toAlign and aligns them.
42  int align(CL_TrackListC &toAlign,CL_Clip *dest,
43  CL_Alignment align, fpreal rate,
44  fpreal *fstart = 0, fpreal *fend = 0);
45 
46  // This version sets the start, length and rate on the clip, but does not
47  // add tracks.
48  int alignOnly(CL_TrackListC &toAlign, CL_Clip *dest,
49  CL_Alignment align, fpreal rate);
50 
51  // after a call to getAlignment this method will return 1 if
52  // aligning will produce new data, zero otherwise.
53 
54  int needsAlignment(fpreal rate);
55 
56  // this version returns the aligned data of
57  // track "source" in the array "data". Used for extracting data one
58  // track at a time. Always call getAlignment() first.
59 
60  int align(const CL_Track *source,
61  CL_Alignment align,
62  fpreal *dest, fpreal rate);
63 
64  // this version of align does the same as above, but for a short
65  // segment, rather than the full interval. segstart and segend are
66  // in seconds, and are "post-alignment" times
67  int align(const CL_Track *source,
68  CL_Alignment align,
69  fpreal *dest, fpreal rate,
70  fpreal segstart, fpreal segend);
71 
72  // align() or getAlignment must be called first. This returns the number
73  // of samples that the alignment, sample rate and sources would produce.
74  int getNumSamples() const { return myNumSamples; }
75 private:
76 
77  fpreal getClipStartTime(const CL_Clip *c)const;
78  fpreal getClipEndTime(const CL_Clip *c)const;
79  fpreal findEarliestStart() const;
80  fpreal findLatestEnd() const;
81  fpreal findLatestStart() const;
82  fpreal findEarliestEnd() const;
83 
84  const CL_Clip *findLongestClip(fpreal *cliplen=0) const;
85  const CL_Clip *findShortestClip(fpreal *cliplen=0) const;
86 
87  void alignNone(CL_Clip *dest,fpreal start,fpreal end);
88 
89  void alignStart(CL_Clip *dest,fpreal length);
90  void alignEnd(CL_Clip *dest,fpreal length);
91 
92  void alignStretch(CL_Clip *dest);
93 
94 
95  CL_TrackListC *myTracks;
96  int myNumSamples;
97  fpreal myStart;
98  fpreal myEnd;
99  fpreal myCurrentTime;
100 };
101 
102 #endif
GLuint start
Definition: glcorearb.h:475
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
#define CL_API
Definition: CL_API.h:10
CL_Alignment
Definition: CL_Align.h:20
GLuint GLuint end
Definition: glcorearb.h:475
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
int getNumSamples() const
Definition: CL_Align.h:74
fpreal64 fpreal
Definition: SYS_Types.h:277