Rebuffer when an audio region is moved.

This commit is contained in:
Jonathan Moore Liles 2008-05-22 15:34:21 -05:00
parent 6c9e2c8c07
commit c79d48c663
6 changed files with 25 additions and 4 deletions

View File

@ -25,7 +25,6 @@
#include <FL/Fl_Menu_Item.H> #include <FL/Fl_Menu_Item.H>
#include <stdio.h> #include <stdio.h>
#include "Sequence.H" #include "Sequence.H"
#include "Audio_Region.H" #include "Audio_Region.H"
#include "Timeline.H" #include "Timeline.H"
@ -210,7 +209,7 @@ Audio_Region::handle ( int m )
int ret; int ret;
if ( Sequence_Region::handle( m ) ) if ( m != FL_RELEASE && Sequence_Region::handle( m ) )
return 1; return 1;
Logger _log( this ); Logger _log( this );
@ -361,6 +360,8 @@ Audio_Region::handle ( int m )
copied = false; copied = false;
sequence()->handle_widget_change( _r->start, _r->length );
return 1; return 1;
} }
case FL_DRAG: case FL_DRAG:

View File

@ -25,6 +25,7 @@
#include "Track.H" #include "Track.H"
#include "Engine/Audio_File.H" // for ::from_file() #include "Engine/Audio_File.H" // for ::from_file()
#include "Transport.H" // for locate()
Audio_Sequence::Audio_Sequence ( Track *track ) : Sequence( track ) Audio_Sequence::Audio_Sequence ( Track *track ) : Sequence( track )
{ {
@ -116,6 +117,18 @@ deurlify ( char *url )
} }
void
Audio_Sequence::handle_widget_change ( nframes_t start, nframes_t length )
{
/* a region has changed. we may need to rebuffer... */
/* trigger rebuffer */
/* FIXME: we really only need to rebuffer *this* sequence! */
/* FIXME: how does this fit into the selection? */
if ( start > transport->frame || start + length > transport->frame )
transport->locate( transport->frame );
}
void void
Audio_Sequence::draw ( void ) Audio_Sequence::draw ( void )
{ {

View File

@ -39,6 +39,8 @@ protected:
} }
void handle_widget_change ( nframes_t start, nframes_t length );
public: public:
LOG_CREATE_FUNC( Audio_Sequence ); LOG_CREATE_FUNC( Audio_Sequence );

View File

@ -231,6 +231,7 @@ protected:
void log_start ( void ); void log_start ( void );
void log_end ( void ); void log_end ( void );
void log_create ( void ) const; void log_create ( void ) const;
void log_destroy ( void ) const; void log_destroy ( void ) const;

View File

@ -60,8 +60,14 @@ protected:
std::list <Sequence_Widget *> _widgets; std::list <Sequence_Widget *> _widgets;
Sequence_Widget *event_widget ( void ); Sequence_Widget *event_widget ( void );
public: public:
/* child classes should implement this if they need to take
special action when a widget is changed/moved/resized. /start/
and /length/ define the affected region */
virtual void handle_widget_change ( nframes_t start, nframes_t length ) { (void)(start + length); }
/* welcome to C++ */ /* welcome to C++ */
LOG_NAME_FUNC( Sequence ); LOG_NAME_FUNC( Sequence );

View File

@ -95,8 +95,6 @@ Sequence_Widget::end_drag ( void )
timeline->unlock(); timeline->unlock();
/* TODO: perhaps trigger rebuffer here? */
delete _r; delete _r;
_r = &_range; _r = &_range;