All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
FPSEGPT Class Reference

#include <pitsync1.h>

Inheritance diagram for FPSEGPT:
ELIST_LINK

Public Member Functions

 FPSEGPT ()
 
 FPSEGPT (inT16 x)
 
 FPSEGPT (inT16 x, BOOL8 faking, inT16 offset, inT16 region_index, inT16 pitch, inT16 pitch_error, FPSEGPT_LIST *prev_list)
 
 FPSEGPT (FPCUTPT *cutpt)
 
inT32 position ()
 
double cost_function ()
 
double squares ()
 
double sum ()
 
FPSEGPTprevious ()
 
inT16 cheap_cuts () const
 
- Public Member Functions inherited from ELIST_LINK
 ELIST_LINK ()
 
 ELIST_LINK (const ELIST_LINK &)
 
void operator= (const ELIST_LINK &)
 

Public Attributes

BOOL8 faked
 
BOOL8 terminal
 
inT16 fake_count
 

Detailed Description

Definition at line 32 of file pitsync1.h.

Constructor & Destructor Documentation

FPSEGPT::FPSEGPT ( )
inline

Definition at line 35 of file pitsync1.h.

35  { //empty
36  }
FPSEGPT::FPSEGPT ( inT16  x)

Definition at line 68 of file pitsync1.cpp.

70  :xpos (x) {
71  pred = NULL;
72  mean_sum = 0;
73  sq_sum = 0;
74  cost = 0;
75  faked = FALSE;
76  terminal = FALSE;
77  fake_count = 0;
78  mid_cuts = 0;
79 }
inT16 fake_count
Definition: pitsync1.h:71
BOOL8 faked
Definition: pitsync1.h:69
BOOL8 terminal
Definition: pitsync1.h:70
#define FALSE
Definition: capi.h:29
#define NULL
Definition: host.h:144
FPSEGPT::FPSEGPT ( inT16  x,
BOOL8  faking,
inT16  offset,
inT16  region_index,
inT16  pitch,
inT16  pitch_error,
FPSEGPT_LIST *  prev_list 
)

Definition at line 88 of file pitsync1.cpp.

96  :xpos (x) {
97  inT16 best_fake; //on previous
98  FPSEGPT *segpt; //segment point
99  inT32 dist; //from prev segment
100  double sq_dist; //squared distance
101  double mean; //mean pitch
102  double total; //total dists
103  double factor; //cost function
104  FPSEGPT_IT pred_it = prev_list;//for previuos segment
105 
106  cost = MAX_FLOAT32;
107  pred = NULL;
108  faked = faking;
109  terminal = FALSE;
110  best_fake = MAX_INT16;
111  mid_cuts = 0;
112  for (pred_it.mark_cycle_pt (); !pred_it.cycled_list (); pred_it.forward ()) {
113  segpt = pred_it.data ();
114  if (segpt->fake_count < best_fake)
115  best_fake = segpt->fake_count;
116  dist = x - segpt->xpos;
117  if (dist >= pitch - pitch_error && dist <= pitch + pitch_error
118  && !segpt->terminal) {
119  total = segpt->mean_sum + dist;
120  sq_dist = dist * dist + segpt->sq_sum + offset * offset;
121  //sum of squarees
122  mean = total / region_index;
123  factor = mean - pitch;
124  factor *= factor;
125  factor += sq_dist / (region_index) - mean * mean;
126  if (factor < cost) {
127  cost = factor; //find least cost
128  pred = segpt; //save path
129  mean_sum = total;
130  sq_sum = sq_dist;
131  fake_count = segpt->fake_count + faked;
132  }
133  }
134  }
135  if (fake_count > best_fake + 1)
136  pred = NULL; //fail it
137 }
inT16 fake_count
Definition: pitsync1.h:71
BOOL8 faked
Definition: pitsync1.h:69
BOOL8 terminal
Definition: pitsync1.h:70
#define FALSE
Definition: capi.h:29
#define MAX_INT16
Definition: host.h:119
#define MAX_FLOAT32
Definition: host.h:124
#define NULL
Definition: host.h:144
short inT16
Definition: host.h:100
int inT32
Definition: host.h:102
FPSEGPT::FPSEGPT ( FPCUTPT cutpt)

Definition at line 47 of file pitsync1.cpp.

49  {
50  pred = NULL;
51  mean_sum = cutpt->sum ();
52  sq_sum = cutpt->squares ();
53  cost = cutpt->cost_function ();
54  faked = cutpt->faked;
55  terminal = cutpt->terminal;
56  fake_count = cutpt->fake_count;
57  xpos = cutpt->position ();
58  mid_cuts = cutpt->cheap_cuts ();
59 }
inT16 cheap_cuts() const
Definition: pithsync.h:84
double squares()
Definition: pithsync.h:75
double sum()
Definition: pithsync.h:78
inT16 fake_count
Definition: pitsync1.h:71
BOOL8 faked
Definition: pitsync1.h:69
inT32 position()
Definition: pithsync.h:69
BOOL8 terminal
Definition: pitsync1.h:70
BOOL8 faked
Definition: pithsync.h:91
inT16 fake_count
Definition: pithsync.h:93
double cost_function()
Definition: pithsync.h:72
BOOL8 terminal
Definition: pithsync.h:92
#define NULL
Definition: host.h:144

Member Function Documentation

inT16 FPSEGPT::cheap_cuts ( ) const
inline

Definition at line 64 of file pitsync1.h.

64  { //no of cheap cuts
65  return mid_cuts;
66  }
double FPSEGPT::cost_function ( )
inline

Definition at line 52 of file pitsync1.h.

52  {
53  return cost;
54  }
inT32 FPSEGPT::position ( )
inline

Definition at line 49 of file pitsync1.h.

49  { //acces func
50  return xpos;
51  }
FPSEGPT* FPSEGPT::previous ( )
inline

Definition at line 61 of file pitsync1.h.

61  {
62  return pred;
63  }
double FPSEGPT::squares ( )
inline

Definition at line 55 of file pitsync1.h.

55  {
56  return sq_sum;
57  }
double FPSEGPT::sum ( )
inline

Definition at line 58 of file pitsync1.h.

58  {
59  return mean_sum;
60  }

Member Data Documentation

inT16 FPSEGPT::fake_count

Definition at line 71 of file pitsync1.h.

BOOL8 FPSEGPT::faked

Definition at line 69 of file pitsync1.h.

BOOL8 FPSEGPT::terminal

Definition at line 70 of file pitsync1.h.


The documentation for this class was generated from the following files: