HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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();
35  ~CL_Align();
36 
37 
38  int getAlignment(CL_TrackListC &toAlign,
39  CL_Alignment align,
40  fpreal &start, fpreal &end);
41 
42  // Sets the start, length and rate on the 'dest' clip, adds all the tracks
43  // in toAlign and aligns them.
44  int align(CL_TrackListC &toAlign,CL_Clip *dest,
45  CL_Alignment align, fpreal rate,
46  fpreal *fstart = 0, fpreal *fend = 0);
47 
48  // This version sets the start, length and rate on the clip, but does not
49  // add tracks.
50  int alignOnly(CL_TrackListC &toAlign, CL_Clip *dest,
51  CL_Alignment align, fpreal rate);
52 
53  // after a call to getAlignment this method will return 1 if
54  // aligning will produce new data, zero otherwise.
55 
56  int needsAlignment(fpreal rate);
57 
58  // this version returns the aligned data of
59  // track "source" in the array "data". Used for extracting data one
60  // track at a time. Always call getAlignment() first.
61 
62  int align(const CL_Track *source,
63  CL_Alignment align,
64  fpreal *dest, fpreal rate);
65 
66  // this version of align does the same as above, but for a short
67  // segment, rather than the full interval. segstart and segend are
68  // in seconds, and are "post-alignment" times
69  int align(const CL_Track *source,
70  CL_Alignment align,
71  fpreal *dest, fpreal rate,
72  fpreal segstart, fpreal segend);
73 
74  // align() or getAlignment must be called first. This returns the number
75  // of samples that the alignment, sample rate and sources would produce.
76  int getNumSamples() const { return myNumSamples; }
77 private:
78 
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 };
100 
101 #endif
GLuint start
Definition: glcorearb.h:474
#define CL_API
Definition: CL_API.h:10
CL_Alignment
Definition: CL_Align.h:20
GLuint GLuint end
Definition: glcorearb.h:474
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
int getNumSamples() const
Definition: CL_Align.h:76
double fpreal
Definition: SYS_Types.h:263
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:794