46 #include "EST_FMatrix.h"
47 #include "EST_types.h"
48 #include "EST_TrackMap.h"
49 #include "EST_ChannelType.h"
50 #include "EST_Featured.h"
57 typedef enum EST_TrackFileType {
78 typedef enum EST_InterpType {
108 void default_channel_names();
112 int interp_value(
float x,
float f);
113 float interp_amp(
float x,
int c,
float f);
114 float estimate_shift(
float x);
118 static const float default_frame_shift;
119 static const int default_sample_rate;
151 void resize(
int num_frames,
int num_channels,
bool preserve = 1);
170 {
resize(EST_CURRENT, n, preserve); }
178 {
resize(n, EST_CURRENT, preserve); }
196 {
return f_String(
"name");}
210 { p_values.
row(fv, n, startf, nf); }
215 { p_values.
column(cv, n, startf, nf); }
235 int start_frame=0,
int nframes=EST_ALL,
236 int start_chan=0,
int nchans=EST_ALL);
251 int start_frame,
int nframes,
268 int start_frame,
int nframes,
286 int start_frame=0,
int nframes=EST_ALL,
287 int start_chan=0,
int nchans=EST_ALL)
const
288 { ((
EST_Track *)
this)->sub_track(st, start_frame, nframes,
289 start_chan, nchans); }
303 int start_frame=0,
int nframes=EST_ALL,
304 int start_chan=0,
int nchans=EST_ALL)
const;
321 const {p_values.
copy_row(n, buf, offset, num); }
325 const {p_values.
copy_row(n, f, offset, num); }
339 const EST_Track &from,
int from_c,
int from_offset=0,
340 int offset=0,
int num=EST_ALL)
341 { p_values.
set_column(c, from.p_values, from_c,
342 from_offset, offset, num); }
347 { p_values.
set_row(n, buf, offset, num); }
352 { p_values.
set_row(n, t, offset, num); }
356 const EST_Track &from,
int from_f,
int from_offset=0,
357 int offset=0,
int num=EST_ALL)
358 { p_values.
set_row(i, from.p_values, from_f, from_offset, offset,
414 float &
a(
int i,
int c=0);
415 float a(
int i,
int c=0)
const;
429 float &
a(
int i,
const char *
name,
int offset=0);
431 float a(
int i,
const char *
name,
int offset=0)
const
432 {
return ((
EST_Track *)
this)->a(i, name, offset); }
434 {
return a(i, (
const char *)name, offset); }
435 float a(
int i,
EST_String name,
int offset=0)
const
436 {
return ((
EST_Track *)
this)->a(i, (
const char *)name, offset); }
449 float &
a(
float t,
int c=0, EST_InterpType interp=it_nearest);
450 float a(
float t,
int c=0, EST_InterpType interp=it_nearest)
const
451 {
return ((
EST_Track *)
this)->a(t, c, interp); }
458 float operator() (
int i,
int c)
const {
return a(i,c); }
465 float operator() (
float t,
int c)
const {
return a(t,c); }
477 float &
t(
int i=0) {
return p_times[i]; }
478 float t(
int i=0)
const {
return p_times(i); }
481 float ms_t(
int i)
const {
return p_times(i) * 1000.0; }
551 EST_Val &aux(
int i,
int c)
const;
553 EST_Val &aux(
int i,
const char *name);
554 EST_Val aux(
int i,
const char *name)
const
555 {
return ((
EST_Track *)
this)->aux(i, name); }
558 {
return aux(i, (
const char *)name); }
561 {
return ((
EST_Track *)
this)->aux(i, (
const char *)name); }
581 EST_read_status
load(
const EST_String name,
float ishift = 0.0,
float startt = 0.0);
607 float ishift = 0.0,
float startt = 0.0 );
615 EST_write_status
save(FILE *fp,
631 int val(
int i)
const;
644 int index(
float t)
const;
661 void add_trailing_breaks();
662 void rm_trailing_breaks();
674 void set_equal_space(
bool t) {p_equal_space =
t;}
675 void set_single_break(
bool t) {p_single_break =
t;}
684 friend ostream& operator << (ostream& s,
const EST_Track &tr);
691 void assign_map(
EST_TrackMap &map) { assign_map(&map); }
695 void create_map(
void) { create_map(EST_default_channel_names); }
704 float &
a(
int i, EST_ChannelType c,
int offset=0);
705 float a(
int i, EST_ChannelType c,
int offset=0)
const
706 {
return ((
EST_Track *)
this)->a(i,c, offset); }
709 float &
a(
float t, EST_ChannelType c, EST_InterpType interp=it_nearest);
710 float a(
float t, EST_ChannelType c, EST_InterpType interp=it_nearest)
const
711 {
return ((
EST_Track *)
this)->a(t, c, interp); }
713 float &
operator() (
int i, EST_ChannelType c) {
return a(i,c); }
714 float operator() (
int i, EST_ChannelType c)
const {
return a(i,c); }
716 float &t_offset() {
return p_t_offset; }
717 float t_offset()
const {
return p_t_offset; }
720 EST_read_status load_channel_names(
const EST_String name);
721 EST_write_status save_channel_names(
const EST_String name);
725 {
return channel_name(channel, EST_default_channel_names, strings_override); }
728 {
return p_aux_names(channel);}
732 EST_TrackFileType file_type()
const {
return (EST_TrackFileType)f_Int(
"file_type",0);}
735 void set_file_type(EST_TrackFileType t) {f_set(
"file_type", (
int)t);}
753 void point_to_first(
IPointer_f &ip)
const { ip.i = 0; }
754 void move_pointer_forwards(IPointer_f &ip)
const { ip.i++; }
755 bool points_to_something(
const IPointer_f &ip)
const {
return ip.i <
num_frames(); }
757 return *(ip.frame); }
INLINE const T & a_no_check(int row, int col) const
const access with no bounds check, care recommend
bool single_break() const
void set_num_frames(int n, bool preserve=1)
void column(EST_TVector< T > &cv, int c, int start_r=0, int len=-1)
Make the vector { cv} a window onto column { c}.
int num_aux_channels() const
return number of auxiliary channels in track
int num_columns() const
return number of columns
void copy_frame_in(int n, const EST_FVector &t, int offset=0, int num=EST_ALL)
void copy_frame_in(int i, const EST_Track &from, int from_f, int from_offset=0, int offset=0, int num=EST_ALL)
void row(EST_TVector< T > &rv, int r, int start_c=0, int len=-1)
Make the vector { rv} a window onto row { r}.
void set_value(int i)
set frame i to be a value
void set_break(int i)
set frame i to be a break
float & t(int i=0)
return time position of frame i
int length() const
return number of frames in track
float & a(int i, int c=0)
int channel_position(EST_String name, int offset=0) const
float end() const
return time of last value in track
float ms_t(int i) const
return time of frame i in milli-seconds.
void copy_frame_out(int n, EST_FVector &f, int offset=0, int num=EST_ALL) const
int next_non_break(int i) const
void set_channel_name(const EST_String &name, int channel)
set the name of the channel.
EST_String name() const
name of track - redundant use access to features
int num_channels() const
return number of channels in track
void copy_column(int c, T *buf, int offset=0, int num=-1) const
float & a_no_check(int i, int c=0)
void set_num_channels(int n, bool preserve=1)
void sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL)
int channel_position(const char *name, int offset=0) const
void fill(const T &v)
fill matrix with value v
EST_read_status load(const EST_String name, float ishift=0.0, float startt=0.0)
int index(float t) const
return the frame index nearest time t
bool equal_space() const
return true if track has equal (i.e. fixed) frame spacing */
float & operator()(int i, int c)
void copy_setup(const EST_Track &a)
copy everything but data
void resize(int num_frames, int num_channels, bool preserve=1)
~EST_Track()
default destructor
void set_name(const EST_String &n)
set name of track - redundant use access to features
void copy_channel_in(int n, const EST_FVector &f, int offset=0, int num=EST_ALL)
void copy_channel_out(int n, EST_FVector &f, int offset=0, int num=EST_ALL) const
EST_write_status save(const EST_String name, const EST_String EST_filetype="")
void copy_channel_out(int n, float *buf, int offset=0, int num=EST_ALL) const
int val(int i) const
return true if frame i is a value
void change_type(float nshift, bool single_break)
REDO.
void resize_aux(EST_StrList &map, bool preserve=1)
bool has_channel(EST_String name) const
void copy_frame_out(int n, float *buf, int offset=0, int num=EST_ALL) const
int index_below(float x) const
return the frame index before time t
EST_Track()
Default constructor.
float start() const
return time of first value in track
void copy_frame_in(int n, const float *buf, int offset=0, int num=EST_ALL)
void copy_channel_in(int n, const float *buf, int offset=0, int num=EST_ALL)
void channel(EST_FVector &cv, int n, int startf=0, int nf=EST_ALL)
int prev_non_break(int i) const
int track_break(int i) const
return true if frame i is a break
void set_aux_channel_name(const EST_String &name, int channel)
set the name of the auxiliary channel.
void copy_row(int r, T *buf, int offset=0, int num=-1) const
int num_frames() const
return number of frames in track
void set_row(int n, const T *buf, int offset=0, int num=-1)
int num_rows() const
return number of rows
int empty() const
returns true if no values are set in the frame
bool has_channel(const char *name) const
void frame(EST_FVector &fv, int n, int startf=0, int nf=EST_ALL)
void fill_time(float t, int start=1)
void copy_channel_in(int c, const EST_Track &from, int from_c, int from_offset=0, int offset=0, int num=EST_ALL)
void copy_sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) const
void set_column(int n, const T *buf, int offset=0, int num=-1)
void sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) const