offset start end -> start offset length

pull/3/head
Jonathan Moore Liles 2008-05-07 13:43:56 -05:00
parent 8a048e6ef2
commit 6bb4a1d066
14 changed files with 225 additions and 242 deletions

View File

@ -69,7 +69,7 @@ public:
{
_sequence = sequence;
_r->offset = when;
_r->start = when;
_label = strdup( name );
@ -78,7 +78,7 @@ public:
Annotation_Point ( const Annotation_Point &rhs )
{
_r->offset = rhs._r->offset;
_r->start = rhs._r->start;
_label = strdup( rhs._label );
}

View File

@ -52,10 +52,10 @@ Annotation_Region::Annotation_Region ( Sequence *sequence, nframes_t when, const
{
_sequence = sequence;
_r->offset = when;
_r->start = when;
/* FIXME: hack */
_r->end = 400;
_r->length = 400;
_label = strdup( name );
@ -64,7 +64,9 @@ Annotation_Region::Annotation_Region ( Sequence *sequence, nframes_t when, const
Annotation_Region::Annotation_Region ( const Annotation_Region &rhs )
{
_r->offset = rhs._r->offset;
_r->start = rhs._r->start;
_r->length = rhs._r->length;
_label = strdup( rhs._label );
}

View File

@ -58,39 +58,62 @@ static Fl_Color fl_invert_color ( Fl_Color c )
}
#if 0
/* perhaps use map? */
map_PRIM ( set )
void
Audio_Region::get ( Log_Entry &e ) const
{
/* if ( narg % 2 != 0 ) */
/* printf( "invalid number of arguments\n" ); */
e.add( ":source", _clip ? _clip->name() : "" );
e.add( ":gain", _scale );
e.add( ":fade-in-type", _fade_in.type );
e.add( ":fade-in-duration", _fade_in.length );
e.add( ":fade-out-type", _fade_out.type );
e.add( ":fade-out-duration", _fade_out.length );
e.add( ":color", (int)_box_color );
int id = atoi( arg );
Sequence_Region::get( e );
map_ARG_NEXT( arg, end );
Logable *l = Loggable::find( id );
char **sa = malloc( sizeof( char * ) * narg + 1 );
for ( int i = 0; i < narg; ++i )
sa[ i ] = strdup( map_ARG_NEXT( arg, end ) );
l->set( sa );
map_RESULT( "" );
e.add( ":offset", _r->offset );
}
void
Audio_Region::set ( Log_Entry &e )
{
for ( int i = 0; i < e.size(); ++i )
{
const char *s, *v;
e.get( i, &s, &v );
if ( ! strcmp( s, ":gain" ) )
_scale = atof( v );
else if ( ! strcmp( s, ":color" ) )
_box_color = (Fl_Color)atoi( v );
else if ( ! strcmp( s, ":fade-in-type" ) )
_fade_in.type = (Fade::fade_type_e)atoi( v );
else if ( ! strcmp( s, ":fade-in-duration" ) )
_fade_in.length = atoll( v );
else if ( ! strcmp( s, ":fade-out-type" ) )
_fade_out.type = (Fade::fade_type_e)atoi( v );
else if ( ! strcmp( s, ":fade-out-duration" ) )
_fade_out.length = atoll( v );
else if ( ! strcmp( s, ":offset" ) )
_r->offset = atoll( v );
else if ( ! strcmp( s, ":source" ) )
{
if ( ! ( _clip = Audio_File::from_file( v ) ) )
{
printf( "Grave error: could not open source \"%s\"\n", v );
}
}
}
Sequence_Region::set( e );
}
#endif
void
Audio_Region::init ( void )
{
_sequence = NULL;
_r->offset = 0;
_r->start = 0;
_r->end = 0;
_scale = 1.0f;
_clip = NULL;
@ -128,7 +151,7 @@ Audio_Region::Audio_Region ( Audio_File *c )
{
init();
_clip = c;
_r->end = _clip->length();
_r->length = _clip->length();
log_create();
}
@ -139,9 +162,10 @@ Audio_Region::Audio_Region ( Audio_File *c, Sequence *t, nframes_t o )
{
init();
_clip = c;
_r->end = _clip->length();
_sequence = t;
_r->offset = o;
_r->offset = 0;
_r->start = o;
_r->length = _clip->length();
sequence()->add( this );
@ -172,7 +196,6 @@ int
Audio_Region::handle ( int m )
{
static int ox, oy;
static enum trim_e trimming;
static bool copied = false;
static nframes_t os;
@ -266,7 +289,7 @@ Audio_Region::handle ( int m )
ox = x() - X;
oy = y() - Y;
/* for panning */
os = _r->start;
os = _r->offset;
/* normalization and selection */
if ( Fl::event_button2() )
@ -360,14 +383,10 @@ Audio_Region::handle ( int m )
int d = (ox + X) - x();
long td = timeline->x_to_ts( d );
nframes_t W = _r->end - _r->start;
if ( td > 0 && os < td )
_r->start = 0;
_r->offset = 0;
else
_r->start = os - td;
_r->end = _r->start + W;
_r->offset = os - td;
sequence()->redraw();
return 1;
@ -390,6 +409,8 @@ Audio_Region::handle ( int m )
return Sequence_Widget::handle( m );
break;
}
return 0;
}
@ -513,15 +534,14 @@ Audio_Region::draw ( void )
W += 4;
int OX = scroll_x();
int ox = timeline->ts_to_x( _r->offset );
int ox = timeline->ts_to_x( _r->start );
if ( ox > OX + sequence()->w() ||
ox < OX && ox + abs_w() < OX )
/* not in viewport */
return;
int rw = timeline->ts_to_x( _r->end - _r->start );
// nframes_t end = _r->offset + ( _r->end - _r->start );
int rw = timeline->ts_to_x( _r->length );
/* calculate waveform offset due to scrolling */
nframes_t offset = 0;
@ -545,7 +565,8 @@ Audio_Region::draw ( void )
// const nframes_t start = _r->start + offset + timeline->x_to_ts( X - rx );
nframes_t start = _r->start + offset;
// nframes_t start = _r->start + offset;
nframes_t start = _r->offset + offset;
/* compensate for ??? */
if ( X - rx > 0 )
@ -636,14 +657,10 @@ Audio_Region::draw ( void )
void
Audio_Region::normalize ( void )
{
printf( "normalize: start=%lu end=%lu\n", _r->start, _r->end );
/* FIXME: figure out a way to do this via the peak server */
int peaks, channels;
Peak *pbuf;
if ( _clip->read_peaks( length(), _r->start, _r->end, &peaks, &pbuf, &channels ) &&
if ( _clip->read_peaks( length(), offset(), offset() + length(), &peaks, &pbuf, &channels ) &&
peaks )
_scale = pbuf->normalization_factor();
}
@ -710,10 +727,8 @@ Audio_Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channe
{
const Range r = _range;
const nframes_t length = r.end - r.start;
/* do nothing if we aren't covered by this frame range */
if ( pos > r.offset + length || pos + nframes < r.offset )
if ( pos > r.start + r.length || pos + nframes < r.start )
return 0;
/* calculate offsets into file and sample buffer */
@ -722,23 +737,23 @@ Audio_Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channe
cnt = nframes;
if ( pos < r.offset )
if ( pos < r.start )
{
sofs = 0;
ofs = r.offset - pos;
ofs = r.start - pos;
cnt -= ofs;
}
else
{
ofs = 0;
sofs = pos - r.offset;
sofs = pos - r.start;
}
if ( ofs >= nframes )
return 0;
// const nframes_t start = ofs + r.start + sofs;
const nframes_t start = r.start + sofs;
const nframes_t start = r.offset + sofs;
const nframes_t len = min( cnt, nframes - ofs );
const nframes_t end = start + len;
@ -782,9 +797,9 @@ Audio_Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channe
/* do fade out if necessary */
// if ( start + cnt + fade.length > r.end )
if ( start + fade.length > r.end )
if ( start + fade.length > ( r.offset + r.length ) )
{
const nframes_t d = r.end - start;
const nframes_t d = ( r.offset + r.length ) - start;
assert( cnt <= nframes );
@ -803,12 +818,12 @@ Audio_Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channe
nframes_t
Audio_Region::write ( nframes_t nframes )
{
_range.end += nframes;
_range.length += nframes;
/* FIXME: too much? */
// _track->damage( FL_DAMAGE_EXPOSE, x() + w(), y(), 10/* FIXME: guess */, h() );
if ( 0 == ( timeline->ts_to_x( _range.end ) % 20 ) )
if ( 0 == ( timeline->ts_to_x( _range.length ) % 20 ) )
{
nframes_t oldl = _clip->length();
@ -851,7 +866,7 @@ Audio_Region::finalize ( nframes_t frame )
/* FIXME: should we attempt to truncate the file? */
_range.end = frame - _range.offset;
_range.length = frame - _range.start - _range.offset;
redraw();

View File

@ -102,53 +102,8 @@ private:
protected:
// const char *class_name ( void ) { return "Audio_Region"; }
virtual void get ( Log_Entry &e ) const
{
e.add( ":source", _clip ? _clip->name() : "" );
e.add( ":gain", _scale );
e.add( ":fade-in-type", _fade_in.type );
e.add( ":fade-in-duration", _fade_in.length );
e.add( ":fade-out-type", _fade_out.type );
e.add( ":fade-out-duration", _fade_out.length );
e.add( ":color", (int)_box_color );
Sequence_Widget::get( e );
}
void
set ( Log_Entry &e )
{
for ( int i = 0; i < e.size(); ++i )
{
const char *s, *v;
e.get( i, &s, &v );
if ( ! strcmp( s, ":gain" ) )
_scale = atof( v );
else if ( ! strcmp( s, ":color" ) )
_box_color = (Fl_Color)atoi( v );
else if ( ! strcmp( s, ":fade-in-type" ) )
_fade_in.type = (Fade::fade_type_e)atoi( v );
else if ( ! strcmp( s, ":fade-in-duration" ) )
_fade_in.length = atoll( v );
else if ( ! strcmp( s, ":fade-out-type" ) )
_fade_out.type = (Fade::fade_type_e)atoi( v );
else if ( ! strcmp( s, ":fade-out-duration" ) )
_fade_out.length = atoll( v );
else if ( ! strcmp( s, ":source" ) )
{
if ( ! ( _clip = Audio_File::from_file( v ) ) )
{
printf( "Grave error: could not open source \"%s\"\n", v );
}
}
}
Sequence_Widget::set( e );
}
virtual void get ( Log_Entry &e ) const;
virtual void set ( Log_Entry &e );
public:

View File

@ -23,7 +23,7 @@ Control_Point::Control_Point ( Sequence *t, nframes_t when, float y )
{
_sequence = t;
_y = y;
_r->offset = when;
_r->start = when;
_box_color = FL_WHITE;
log_create();
@ -31,7 +31,7 @@ Control_Point::Control_Point ( Sequence *t, nframes_t when, float y )
Control_Point::Control_Point ( const Control_Point &rhs )
{
_r->offset = rhs._r->offset;
_r->start = rhs._r->start;
_y = rhs._y;
}

View File

@ -97,7 +97,7 @@ Sequence::overlaps ( Sequence_Widget *r )
for ( list <Sequence_Widget *>::const_iterator i = _widgets.begin(); i != _widgets.end(); i++ )
{
if ( *i == r ) continue;
if ( ! ( (*i)->offset() > r->offset() + r->length() || (*i)->offset() + (*i)->length() < r->offset() ) )
if ( ! ( (*i)->start() > r->start() + r->length() || (*i)->start() + (*i)->length() < r->start() ) )
return *i;
}
@ -176,7 +176,7 @@ Sequence::event_widget ( void )
{
nframes_t ets = timeline->xoffset + timeline->x_to_ts( Fl::event_x() - x() );
for ( list <Sequence_Widget *>::const_reverse_iterator r = _widgets.rbegin(); r != _widgets.rend(); r++ )
if ( ets > (*r)->offset() && ets < (*r)->offset() + (*r)->length() )
if ( ets > (*r)->start() && ets < (*r)->start() + (*r)->length() )
return (*r);
return NULL;
@ -189,7 +189,7 @@ Sequence::select_range ( int X, int W )
nframes_t ets = sts + timeline->x_to_ts( W );
for ( list <Sequence_Widget *>::const_reverse_iterator r = _widgets.rbegin(); r != _widgets.rend(); r++ )
if ( ! ( (*r)->offset() > ets || (*r)->offset() + (*r)->length() < sts ) )
if ( ! ( (*r)->start() > ets || (*r)->start() + (*r)->length() < sts ) )
(*r)->select();
}
@ -236,14 +236,14 @@ Sequence::snap ( Sequence_Widget *r )
if ( abs( rx1 - wx2 ) < snap_pixels )
{
r->offset( w->offset() + w->length() + 1 );
r->start( w->start() + w->length() + 1 );
return;
}
if ( abs( rx2 - wx1 ) < snap_pixels )
{
r->offset( ( w->offset() - r->length() ) - 1 );
r->start( ( w->start() - r->length() ) - 1 );
return;
}
@ -252,10 +252,10 @@ Sequence::snap ( Sequence_Widget *r )
nframes_t f;
if ( timeline->nearest_line( r->offset(), &f ) )
if ( timeline->nearest_line( r->start(), &f ) )
{
// printf( "snap frame is %lu\n", f );
r->offset( f );
r->start( f );
}
}

View File

@ -22,8 +22,7 @@
void
Sequence_Point::get ( Log_Entry &e ) const
{
e.add( ":x", _r->offset );
e.add( ":sequence", _sequence );
Sequence_Widget::get( e );
}
void
@ -37,7 +36,7 @@ Sequence_Point::set ( Log_Entry &e )
e.get( i, &s, &v );
if ( ! strcmp( ":x", s ) )
if ( ! strcmp( ":start", s ) )
{
sequence()->sort();
}

View File

@ -56,8 +56,6 @@ public:
return sequence()->x() + sequence()->w() + abs_w();
else
return x;
}
nframes_t length ( void ) const { return timeline->x_to_ts( abs_w() ); }

View File

@ -20,6 +20,35 @@
#include "Sequence_Region.H"
#include "Track.H"
void
Sequence_Region::get ( Log_Entry &e ) const
{
e.add( ":color", (int)_box_color );
e.add( ":length", _r->length );
Sequence_Widget::get( e );
}
void
Sequence_Region::set ( Log_Entry &e )
{
for ( int i = 0; i < e.size(); ++i )
{
const char *s, *v;
e.get( i, &s, &v );
if ( ! strcmp( s, ":color" ) )
_box_color = (Fl_Color)atoll( v );
else if ( ! strcmp( s, ":length" ) )
_r->length = atoll( v );
}
Sequence_Widget::set( e );
}
void
Sequence_Region::draw_box ( void )
@ -53,14 +82,17 @@ Sequence_Region::trim ( enum trim_e t, int X )
long td = timeline->x_to_ts( d );
if ( td < 0 && _r->start < 0 - td )
td = 0 - _r->start;
if ( td < 0 && _r->offset < 0 - td )
td = 0 - _r->offset;
if ( _r->start + td >= _r->end )
td = (_r->end - _r->start) - timeline->x_to_ts( 1 );
if ( td > 0 && td >= _r->length )
td = _r->length - timeline->x_to_ts( 1 );
// td = _r->length - timeline->x_to_ts( 1 );
_r->start += td;
_r->offset += td;
_r->start += td;
_r->length -= td;
break;
}
case RIGHT:
@ -71,12 +103,12 @@ Sequence_Region::trim ( enum trim_e t, int X )
long td = timeline->x_to_ts( d );
// printf( "%li %li\n", td, _r->end - _r->start );
// printf( "%li %li\n", td, _r->length - _r->offset );
if ( td >= 0 && _r->end - _r->start < td )
_r->end = _r->start + timeline->x_to_ts( 1 );
if ( td >= 0 && _r->length < td )
_r->length = timeline->x_to_ts( 1 );
else
_r->end -= td;
_r->length -= td;
break;
}
@ -105,7 +137,7 @@ Sequence_Region::handle ( int m )
int ret;
Logger _log( this );
//log_r->start();
//log_r->offset();
switch ( m )
{

View File

@ -23,36 +23,15 @@
#include "Sequence_Widget.H"
/* Base class representing a /region/ of time on a /sequence/, with
controls for the start and end points. */
controls for the offset and length points. */
class Sequence_Region : public Sequence_Widget
{
protected:
virtual void get ( Log_Entry &e ) const
{
e.add( ":color", (int)_box_color );
Sequence_Widget::get( e );
}
void
virtual set ( Log_Entry &e )
{
for ( int i = 0; i < e.size(); ++i )
{
const char *s, *v;
e.get( i, &s, &v );
if ( ! strcmp( s, ":color" ) )
_box_color = (Fl_Color)atoll( v );
}
Sequence_Widget::set( e );
}
virtual void get ( Log_Entry &e ) const;
virtual void set ( Log_Entry &e );
Sequence_Region ( )
{

View File

@ -33,6 +33,58 @@ Sequence_Widget * Sequence_Widget::_pushed = NULL;
Sequence_Widget * Sequence_Widget::_belowmouse = NULL;
Fl_Color Sequence_Widget::_selection_color = FL_MAGENTA;
void
Sequence_Widget::get ( Log_Entry &e ) const
{
e.add( ":start", _r->start );
// e.add( ":offset", _r->offset );
// e.add( ":length", _r->length );
e.add( ":sequence", _sequence );
e.add( ":selected", selected() );
}
void
Sequence_Widget::set ( Log_Entry &e )
{
for ( int i = 0; i < e.size(); ++i )
{
const char *s, *v;
e.get( i, &s, &v );
if ( ! strcmp( s, ":start" ) )
_r->start = atoll( v );
// else if ( ! strcmp( s, ":offset" ) )
// _r->offset = atoll( v );
// else if ( ! strcmp( s, ":length" ) )
// _r->length = atoll( v );
else if ( ! strcmp( s, ":selected" ) )
{
if ( atoi( v ) )
select();
else
deselect();
}
else if ( ! strcmp( s, ":sequence" ) )
{
int i;
sscanf( v, "%X", &i );
Sequence *t = (Sequence*)Loggable::find( i );
assert( t );
t->add( this );
}
// else
// e.erase( i );
}
if ( _sequence )
_sequence->redraw();
}
void
Sequence_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color )
{
@ -172,7 +224,7 @@ Sequence_Widget::handle ( int m )
case FL_RELEASE:
if ( _drag )
{
end_drag();
length_drag();
_log.release();
}
@ -194,15 +246,15 @@ Sequence_Widget::handle ( int m )
{
const nframes_t of = timeline->x_to_offset( X );
if ( of >= _drag->offset )
if ( of >= _drag->start )
{
_r->offset = of - _drag->offset;
_r->start = of - _drag->start;
if ( Sequence_Widget::_current == this )
sequence()->snap( this );
}
else
_r->offset = 0;
_r->start = 0;
}

View File

@ -30,21 +30,21 @@ class Sequence_Widget;
struct Drag
{
/* mouse coords at start of drag */
/* mouse coords at offset of drag */
int x;
int y;
int state;
nframes_t offset;
nframes_t start;
Drag( int X, int Y, nframes_t offset=0 ) : x( X ), y( Y ), offset( offset ) { state = 0; }
Drag( int X, int Y, nframes_t start=0 ) : x( X ), y( Y ), start( start ) { state = 0; }
};
struct Range
{
nframes_t offset; /* where on the timeline */
nframes_t start; /* first sample from clip */
nframes_t end; /* last sample from clip */
nframes_t start; /* where on the timeline */
nframes_t offset; /* first sample from clip */
nframes_t length; /* total number of samples */
};
/* Base class for virtual widget on a track */
@ -79,56 +79,8 @@ protected:
Drag *_drag;
virtual void get ( Log_Entry &e ) const
{
e.add( ":x", _r->offset );
e.add( ":l", _r->start );
e.add( ":r", _r->end );
e.add( ":sequence", _sequence );
e.add( ":selected", selected() );
}
virtual void
set ( Log_Entry &e )
{
for ( int i = 0; i < e.size(); ++i )
{
const char *s, *v;
e.get( i, &s, &v );
if ( ! strcmp( s, ":x" ) )
_r->offset = atoll( v );
else if ( ! strcmp( s, ":l" ) )
_r->start = atoll( v );
else if ( ! strcmp( s, ":r" ) )
_r->end = atoll( v );
else if ( ! strcmp( s, ":selected" ) )
{
if ( atoi( v ) )
select();
else
deselect();
}
else if ( ! strcmp( s, ":sequence" ) )
{
int i;
sscanf( v, "%X", &i );
Sequence *t = (Sequence*)Loggable::find( i );
assert( t );
t->add( this );
}
// else
// e.erase( i );
}
if ( _sequence )
_sequence->redraw();
}
virtual void get ( Log_Entry &e ) const;
virtual void set ( Log_Entry &e );
public:
@ -138,7 +90,7 @@ public:
_r = &_range;
_r->offset = _r->start = _r->end = 0;
_r->start = _r->offset = _r->length = 0;
_drag = NULL;
@ -234,7 +186,7 @@ public:
_r = new Range( _range );
}
void end_drag ( void )
void length_drag ( void )
{
_range = *_r;
delete _r;
@ -245,26 +197,26 @@ public:
}
void
offset ( nframes_t where )
start ( nframes_t where )
{
if ( ! selected() )
{
redraw();
_r->offset = where;
_r->start = where;
}
else
{
long d = where - _r->offset;
long d = where - _r->start;
for ( list <Sequence_Widget *>::iterator i = _selection.begin(); i != _selection.end(); i++ )
{
(*i)->redraw();
if ( d < 0 )
(*i)->_r->offset -= 0 - d;
(*i)->_r->start -= 0 - d;
else
(*i)->_r->offset += d;
(*i)->_r->start += d;
}
}
@ -284,18 +236,18 @@ public:
/* used by regions */
virtual int x ( void ) const
{
return _r->offset < timeline->xoffset ? _sequence->x() : min( _sequence->x() + _sequence->w(), _sequence->x() + timeline->ts_to_x( _r->offset - timeline->xoffset ) );
return _r->start < timeline->xoffset ? _sequence->x() : min( _sequence->x() + _sequence->w(), _sequence->x() + timeline->ts_to_x( _r->start - timeline->xoffset ) );
}
/* use this as x() when you need to draw lines between widgets */
int line_x ( void ) const
{
return _r->offset < timeline->xoffset ? max( -32768, _sequence->x() - timeline->ts_to_x( timeline->xoffset - _r->offset )) : min( 32767, _sequence->x() + timeline->ts_to_x( _r->offset - timeline->xoffset ) );
return _r->start < timeline->xoffset ? max( -32768, _sequence->x() - timeline->ts_to_x( timeline->xoffset - _r->start )) : min( 32767, _sequence->x() + timeline->ts_to_x( _r->start - timeline->xoffset ) );
}
virtual int w ( void ) const
{
int tx = timeline->ts_to_x( _r->offset );
int tx = timeline->ts_to_x( _r->start );
int rw;
if ( tx < scroll_x() )
@ -306,8 +258,8 @@ public:
return min( rw, _sequence->w() );
}
int abs_x ( void ) const { return timeline->ts_to_x( _r->offset ); }
virtual int abs_w ( void ) const { return timeline->ts_to_x( _r->end - _r->start ); }
int abs_x ( void ) const { return timeline->ts_to_x( _r->start ); }
virtual int abs_w ( void ) const { return timeline->ts_to_x( _r->length ); }
Fl_Color color ( void ) const { return _color; }
void color ( Fl_Color v ) { _color = v; }
@ -318,22 +270,21 @@ public:
Sequence * sequence ( void ) const { return _sequence; }
void sequence ( Sequence *t ) { _sequence = t; }
nframes_t offset ( void ) const { return _r->offset; }
// void offset ( nframes_t o ) { _r->offset = o; }
void end ( nframes_t v ) { _r->end = v; }
nframes_t end ( void ) const { return _r->end; }
void start ( nframes_t v ) { _r->start = v; }
nframes_t start ( void ) const { return _r->start; }
// void start ( nframes_t o ) { _r->start = o; }
/** convert a screen x coord into an offset into the region */
void length ( nframes_t v ) { _r->length = v; }
virtual nframes_t length ( void ) const { return _r->length; }
void offset ( nframes_t v ) { _r->offset = v; }
nframes_t offset ( void ) const { return _r->offset; }
/** convert a screen x coord into an start into the region */
nframes_t x_to_offset ( int X )
{
return timeline->x_to_ts( scroll_x() + ( X - _sequence->x() ) ) - _r->offset;
return timeline->x_to_ts( scroll_x() + ( X - _sequence->x() ) ) - _r->start;
}
int active_r ( void ) const { return _sequence->active_r(); }
virtual nframes_t length ( void ) const { return _r->end - _r->start; }
virtual Fl_Boxtype box ( void ) const { return FL_UP_BOX; }
virtual Fl_Align align ( void ) const { return (Fl_Align)0; }
@ -366,13 +317,13 @@ public:
bool
operator< ( const Sequence_Widget & rhs )
{
return _r->offset < rhs._r->offset;
return _r->start < rhs._r->start;
}
bool
operator<=( const Sequence_Widget & rhs )
{
return _r->offset <= rhs._r->offset;
return _r->start <= rhs._r->start;
}
virtual void draw_label ( const char *label, Fl_Align align, Fl_Color color=(Fl_Color)0 );

View File

@ -25,7 +25,7 @@
void
Tempo_Point::get ( Log_Entry &e ) const
{
e.add( ":x", _r->offset );
e.add( ":start", _r->offset );
e.add( ":tempo", _tempo );
}
@ -38,7 +38,7 @@ Tempo_Point::set ( Log_Entry &e )
e.get( i, &s, &v );
if ( ! strcmp( s, ":x" ) )
if ( ! strcmp( s, ":start" ) )
_r->offset = atol( v );
else if ( ! strcmp( s, ":tempo" ) )
_tempo = atof( v );

View File

@ -24,7 +24,7 @@
void
Time_Point::get ( Log_Entry &e ) const
{
e.add( ":x", _r->offset );
e.add( ":start", _r->offset );
e.add( ":beats_per_bar", _time.beats_per_bar );
e.add( ":beat_type", _time.beat_type );
}
@ -38,7 +38,7 @@ Time_Point::set ( Log_Entry &e )
e.get( i, &s, &v );
if ( ! strcmp( s, ":x" ) )
if ( ! strcmp( s, ":start" ) )
_r->offset = atol( v );
else if ( ! strcmp( s, ":beats_per_bar" ) )
_time.beats_per_bar = atoi( v );