46#include "EST_FMatrix.h"
48#include "EST_TrackMap.h"
49#include "EST_ChannelType.h"
50#include "EST_Featured.h"
57typedef enum EST_TrackFileType {
78typedef 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;
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
434 {
return a(i, (
const char *)
name, offset); }
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); }
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;
558 {
return aux(i, (
const char *)
name); }
607 float ishift = 0.0,
float startt = 0.0 );
615 EST_write_status
save(FILE *fp,
631 int val(
int i)
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; }
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); }
void copy_row(int r, T *buf, int offset=0, int num=-1) const
int num_columns() const
return number of columns
void fill(const T &v)
fill matrix with value v
INLINE const T & a_no_check(int row, int col) const
const access with no bounds check, care recommend
void set_row(int n, const T *buf, int offset=0, int num=-1)
int num_rows() const
return number of rows
void row(EST_TVector< T > &rv, int r, int start_c=0, int len=-1)
Make the vector {\tt rv} a window onto row {\tt r}.
void set_column(int n, const T *buf, int offset=0, int num=-1)
void column(EST_TVector< T > &cv, int c, int start_r=0, int len=-1)
Make the vector {\tt cv} a window onto column {\tt c}.
void copy_column(int c, T *buf, int offset=0, int num=-1) const
void copy_channel_out(int n, float *buf, int offset=0, int num=EST_ALL) const
float & operator()(int i, int c)
void copy_frame_in(int n, const float *buf, int offset=0, int num=EST_ALL)
bool has_channel(EST_String name) const
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_num_frames(int n, bool preserve=1)
int channel_position(const char *name, int offset=0) const
void set_channel_name(const EST_String &name, int channel)
set the name of the channel.
void copy_channel_in(int n, const float *buf, int offset=0, int num=EST_ALL)
EST_read_status load(const EST_String name, float ishift=0.0, float startt=0.0)
int track_break(int i) const
return true if frame i is a break
float & t(int i=0)
return time position of frame i
void sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) const
int val(int i) const
return true if frame i is a value
EST_write_status save(const EST_String name, const EST_String EST_filetype="")
float & a(int i, int c=0)
void copy_channel_in(int n, const EST_FVector &f, int offset=0, int num=EST_ALL)
int num_aux_channels() const
return number of auxiliary channels in track
int next_non_break(int i) const
void copy_setup(const EST_Track &a)
copy everything but data
~EST_Track()
default destructor
void set_name(const EST_String &n)
set name of track - redundant use access to features
int index_below(float x) const
return the frame index before time t
void sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL)
bool has_channel(const char *name) const
EST_Track()
Default constructor.
EST_Track(int num_frames, EST_StrList &map)
resizing constructor
int empty() const
returns true if no values are set in the frame
int length() const
return number of frames in track
void set_num_channels(int n, bool preserve=1)
int channel_position(EST_String name, int offset=0) const
bool equal_space() const
return true if track has equal (i.e. fixed) frame spacing */
float start() const
return time of first value in track
void set_value(int i)
set frame i to be a value
void copy_frame_in(int n, const EST_FVector &t, int offset=0, int num=EST_ALL)
void resize_aux(EST_StrList &map, bool preserve=1)
float ms_t(int i) const
return time of frame i in milli-seconds.
int num_channels() const
return number of channels in track
int num_frames() const
return number of frames in track
void copy_frame_in(int i, const EST_Track &from, int from_f, int from_offset=0, int offset=0, int num=EST_ALL)
float end() const
return time of last value in track
int index(float t) const
return the frame index nearest time t
float & a_no_check(int i, int c=0)
void channel(EST_FVector &cv, int n, int startf=0, int nf=EST_ALL)
void change_type(float nshift, bool single_break)
REDO.
void resize(int num_frames, int num_channels, bool preserve=1)
void copy_channel_out(int n, EST_FVector &f, int offset=0, int num=EST_ALL) const
EST_String name() const
name of track - redundant use access to features
void fill_time(float t, int start=1)
void set_aux_channel_name(const EST_String &name, int channel)
set the name of the auxiliary channel.
int prev_non_break(int i) const
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_frame_out(int n, EST_FVector &f, int offset=0, int num=EST_ALL) const
void frame(EST_FVector &fv, int n, int startf=0, int nf=EST_ALL)
void copy_frame_out(int n, float *buf, int offset=0, int num=EST_ALL) const
void set_break(int i)
set frame i to be a break
bool single_break() const