Rename Region class to Audio_Region

This commit is contained in:
Jonathan Moore Liles 2008-05-04 19:04:20 -05:00
parent 42a1983116
commit 33d78a726a
11 changed files with 54 additions and 54 deletions

View File

@ -18,7 +18,7 @@
/*******************************************************************************/ /*******************************************************************************/
#include "Sequence.H" #include "Sequence.H"
#include "Region.H" #include "Audio_Region.H"
#include "Timeline.H" #include "Timeline.H"
#include "Waveform.H" #include "Waveform.H"
@ -41,11 +41,11 @@ using namespace std;
extern Timeline *timeline; extern Timeline *timeline;
bool Region::inherit_track_color = true; bool Audio_Region::inherit_track_color = true;
Fl_Boxtype Region::_box = FL_UP_BOX; Fl_Boxtype Audio_Region::_box = FL_UP_BOX;
Fl_Color Region::_selection_color = FL_MAGENTA; Fl_Color Audio_Region::_selection_color = FL_MAGENTA;
static Fl_Color fl_invert_color ( Fl_Color c ) static Fl_Color fl_invert_color ( Fl_Color c )
{ {
@ -83,7 +83,7 @@ map_PRIM ( set )
void void
Region::init ( void ) Audio_Region::init ( void )
{ {
_track = NULL; _track = NULL;
@ -103,7 +103,7 @@ Region::init ( void )
} }
/* copy constructor */ /* copy constructor */
Region::Region ( const Region & rhs ) Audio_Region::Audio_Region ( const Audio_Region & rhs )
{ {
*((Sequence_Widget*)this) = (Sequence_Widget &)rhs; *((Sequence_Widget*)this) = (Sequence_Widget &)rhs;
@ -117,13 +117,13 @@ Region::Region ( const Region & rhs )
} }
Sequence_Widget * Sequence_Widget *
Region::clone ( const Sequence_Widget *r ) Audio_Region::clone ( const Sequence_Widget *r )
{ {
return new Region( *(Region*)r ); return new Audio_Region( *(Audio_Region*)r );
} }
/* */ /* */
Region::Region ( Audio_File *c ) Audio_Region::Audio_Region ( Audio_File *c )
{ {
init(); init();
_clip = c; _clip = c;
@ -134,7 +134,7 @@ Region::Region ( Audio_File *c )
/* used when DND importing */ /* used when DND importing */
Region::Region ( Audio_File *c, Sequence *t, nframes_t o ) Audio_Region::Audio_Region ( Audio_File *c, Sequence *t, nframes_t o )
{ {
init(); init();
_clip = c; _clip = c;
@ -167,7 +167,7 @@ Region::Region ( Audio_File *c, Sequence *t, nframes_t o )
} }
void void
Region::trim ( enum trim_e t, int X ) Audio_Region::trim ( enum trim_e t, int X )
{ {
X -= _track->x(); X -= _track->x();
@ -221,7 +221,7 @@ Region::trim ( enum trim_e t, int X )
} }
int int
Region::handle ( int m ) Audio_Region::handle ( int m )
{ {
static int ox, oy; static int ox, oy;
static enum trim_e trimming; static enum trim_e trimming;
@ -309,7 +309,7 @@ Region::handle ( int m )
{ {
Loggable::block_start(); Loggable::block_start();
Region *copy = new Region( *this ); Audio_Region *copy = new Audio_Region( *this );
trim( RIGHT, X ); trim( RIGHT, X );
copy->trim( LEFT, X ); copy->trim( LEFT, X );
@ -387,7 +387,7 @@ Region::handle ( int m )
{ 0 }, { 0 },
}; };
const Fl_Menu_Item *r = menu->popup( X, Y, "Region" ); const Fl_Menu_Item *r = menu->popup( X, Y, "Audio_Region" );
if ( r ) if ( r )
{ {
@ -459,7 +459,7 @@ Region::handle ( int m )
{ {
if ( _drag->state == 0 ) if ( _drag->state == 0 )
{ {
_track->add( new Region( *this ) ); _track->add( new Audio_Region( *this ) );
_drag->state = 1; _drag->state = 1;
return 1; return 1;
} }
@ -502,7 +502,7 @@ changed:
portion of the region covered by this draw, which may or may not portion of the region covered by this draw, which may or may not
cover the fade in question. */ cover the fade in question. */
void void
Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int X, int W ) Audio_Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int X, int W )
{ {
const int dy = y() + Fl::box_dy( box() ); const int dy = y() + Fl::box_dy( box() );
const int dh = h() - Fl::box_dh( box() ); const int dh = h() - Fl::box_dh( box() );
@ -565,7 +565,7 @@ damager ( void *v )
} }
void void
Region::draw_box( void ) Audio_Region::draw_box( void )
{ {
/* dirty hack to keep the box from flipping to vertical at small sizes */ /* dirty hack to keep the box from flipping to vertical at small sizes */
@ -573,7 +573,7 @@ Region::draw_box( void )
Fl_Color selection_color = _selection_color; Fl_Color selection_color = _selection_color;
Fl_Color color = Region::inherit_track_color ? track()->track()->color() : _box_color; Fl_Color color = Audio_Region::inherit_track_color ? track()->track()->color() : _box_color;
color = fl_color_average( color, track()->color(), 0.75f ); color = fl_color_average( color, track()->color(), 0.75f );
@ -601,7 +601,7 @@ Region::draw_box( void )
/** Draw (part of) region. X, Y, W and H are the rectangle we're clipped to. */ /** Draw (part of) region. X, Y, W and H are the rectangle we're clipped to. */
void void
Region::draw ( void ) Audio_Region::draw ( void )
{ {
/* intersect clip with region */ /* intersect clip with region */
@ -739,7 +739,7 @@ Region::draw ( void )
void void
Region::normalize ( void ) Audio_Region::normalize ( void )
{ {
printf( "normalize: start=%lu end=%lu\n", _r->start, _r->end ); printf( "normalize: start=%lu end=%lu\n", _r->start, _r->end );
@ -765,7 +765,7 @@ Region::normalize ( void )
* buffer size of /nframes/. /start/ and /end/ are relative to the * buffer size of /nframes/. /start/ and /end/ are relative to the
* given buffer, and /start/ may be negative. */ * given buffer, and /start/ may be negative. */
void void
Region::Fade::apply ( sample_t *buf, Region::Fade::fade_dir_e dir, long start, nframes_t end, nframes_t nframes ) const Audio_Region::Fade::apply ( sample_t *buf, Audio_Region::Fade::fade_dir_e dir, long start, nframes_t end, nframes_t nframes ) const
{ {
// printf( "apply fade %s: start=%ld end=%lu\n", dir == Fade::Out ? "out" : "in", start, end ); // printf( "apply fade %s: start=%ld end=%lu\n", dir == Fade::Out ? "out" : "in", start, end );
@ -811,7 +811,7 @@ Region::Fade::apply ( sample_t *buf, Region::Fade::fade_dir_e dir, long start, n
for different channels at the same position avoid hitting the disk for different channels at the same position avoid hitting the disk
again? */ again? */
nframes_t nframes_t
Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const Audio_Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) const
{ {
const Range r = _range; const Range r = _range;
@ -906,7 +906,7 @@ Region::read ( sample_t *buf, nframes_t pos, nframes_t nframes, int channel ) co
/** write /nframes/ from /buf/ to source. /buf/ is interleaved and /** write /nframes/ from /buf/ to source. /buf/ is interleaved and
must match the channel layout of the write source! */ must match the channel layout of the write source! */
nframes_t nframes_t
Region::write ( nframes_t nframes ) Audio_Region::write ( nframes_t nframes )
{ {
_range.end += nframes; _range.end += nframes;
@ -938,7 +938,7 @@ Region::write ( nframes_t nframes )
/** prepare for capturing */ /** prepare for capturing */
void void
Region::prepare ( void ) Audio_Region::prepare ( void )
{ {
log_start(); log_start();
} }
@ -947,7 +947,7 @@ Region::prepare ( void )
/** finalize region capture. Assumes that this *is* a captured region /** finalize region capture. Assumes that this *is* a captured region
and that no other regions refer to the same source */ and that no other regions refer to the same source */
bool bool
Region::finalize ( nframes_t frame ) Audio_Region::finalize ( nframes_t frame )
{ {
log_end(); log_end();

View File

@ -22,7 +22,7 @@
#include "Sequence.H" #include "Sequence.H"
#include "Timeline.H" #include "Timeline.H"
/* Regions are "virtual" FLTK widgets; this is necessary because the /* Audio_Regions are "virtual" FLTK widgets; this is necessary because the
* dimensions of real FLTK widgets are limited to 16-bits, which is * dimensions of real FLTK widgets are limited to 16-bits, which is
* far too little for our purposes */ * far too little for our purposes */
@ -30,7 +30,7 @@
#include "Loggable.H" #include "Loggable.H"
class Region : public Sequence_Widget class Audio_Region : public Sequence_Widget
{ {
public: public:
@ -103,7 +103,7 @@ private:
protected: protected:
// const char *class_name ( void ) { return "Region"; } // const char *class_name ( void ) { return "Audio_Region"; }
virtual void get ( Log_Entry &e ) const virtual void get ( Log_Entry &e ) const
{ {
@ -162,7 +162,7 @@ public:
void trim ( enum trim_e t, int X ); void trim ( enum trim_e t, int X );
void init ( void ); void init ( void );
Region ( ) Audio_Region ( )
{ {
init(); init();
} }
@ -174,21 +174,21 @@ public:
const char *source_name ( void ) const { return _clip->name(); } const char *source_name ( void ) const { return _clip->name(); }
LOG_CREATE_FUNC( Region ); LOG_CREATE_FUNC( Audio_Region );
Sequence_Widget *clone ( const Sequence_Widget *r ); Sequence_Widget *clone ( const Sequence_Widget *r );
~Region ( ) ~Audio_Region ( )
{ {
log_destroy(); log_destroy();
} }
Fl_Boxtype box ( void ) const { return Region::_box; } Fl_Boxtype box ( void ) const { return Audio_Region::_box; }
Fl_Align align ( void ) const { return (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE); } Fl_Align align ( void ) const { return (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE); }
Region ( const Region & rhs ); Audio_Region ( const Audio_Region & rhs );
Region ( Audio_File *c ); Audio_Region ( Audio_File *c );
Region ( Audio_File *c, Sequence *t, nframes_t o ); Audio_Region ( Audio_File *c, Sequence *t, nframes_t o );
int handle ( int m ); int handle ( int m );
void draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool filled, int X, int W ); void draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool filled, int X, int W );

View File

@ -146,7 +146,7 @@ Audio_Sequence::handle ( int m )
{ {
const char *text = Fl::event_text(); const char *text = Fl::event_text();
if ( ! strcmp( text, "Region" ) ) if ( ! strcmp( text, "Audio_Region" ) )
return 1; return 1;
char *file; char *file;
@ -176,8 +176,8 @@ Audio_Sequence::handle ( int m )
return 0; return 0;
} }
// Region *r = // Audio_Region *r =
new Region( c, this, timeline->xoffset + timeline->x_to_ts( Fl::event_x() - x() ) ); new Audio_Region( c, this, timeline->xoffset + timeline->x_to_ts( Fl::event_x() - x() ) );
redraw(); redraw();
return 1; return 1;
@ -206,7 +206,7 @@ Audio_Sequence::play ( sample_t *buf, nframes_t frame, nframes_t nframes, int ch
for ( list <Sequence_Widget *>::const_iterator i = _widgets.begin(); for ( list <Sequence_Widget *>::const_iterator i = _widgets.begin();
i != _widgets.end(); ++i ) i != _widgets.end(); ++i )
{ {
const Region *r = (Region*)(*i); const Audio_Region *r = (Audio_Region*)(*i);
for ( int i = channels; i--; ) for ( int i = channels; i--; )
{ {

View File

@ -20,7 +20,7 @@
#pragma once #pragma once
#include "Sequence.H" #include "Sequence.H"
#include "Region.H" #include "Audio_Region.H"
#include "Track.H" #include "Track.H"
#include <FL/Fl_Input.H> #include <FL/Fl_Input.H>
@ -107,7 +107,7 @@ public:
void dump ( void ); void dump ( void );
void remove_selected ( void ); void remove_selected ( void );
const Region *capture ( void ) const { return track()->capture(); } const Audio_Region *capture ( void ) const { return track()->capture(); }
nframes_t play ( sample_t *buf, nframes_t frame, nframes_t nframes, int channels ); nframes_t play ( sample_t *buf, nframes_t frame, nframes_t nframes, int channels );

View File

@ -182,7 +182,7 @@ void free_sa ( char **sa )
free( sa ); free( sa );
} }
/** 'do' a message like "Region 0xF1 set :r 123" */ /** 'do' a message like "Audio_Region 0xF1 set :r 123" */
bool bool
Loggable::do_this ( const char *s, bool reverse ) Loggable::do_this ( const char *s, bool reverse )
{ {

View File

@ -20,7 +20,7 @@
#include "Sequence.H" #include "Sequence.H"
#include "Timeline.H" #include "Timeline.H"
#include "Region.H" #include "Audio_Region.H"
#include <FL/fl_draw.H> #include <FL/fl_draw.H>

View File

@ -25,7 +25,7 @@ decl {\#include "Audio_File.H" // for supported formats} {}
decl {\#include "Waveform.H" // for options} {} decl {\#include "Waveform.H" // for options} {}
decl {\#include "Region.H" // for options} {} decl {\#include "Audio_Region.H" // for options} {}
decl {\#include "Control_Sequence.H" // for options} {} decl {\#include "Control_Sequence.H" // for options} {}
@ -357,7 +357,7 @@ timeline->redraw();}
} }
} }
Submenu {} { Submenu {} {
label {&Region} open label {&Audio_Region} open
xywh {0 0 74 25} xywh {0 0 74 25}
} { } {
MenuItem {} { MenuItem {} {
@ -366,7 +366,7 @@ timeline->redraw();}
} }
MenuItem {} { MenuItem {} {
label {Inherit track color} label {Inherit track color}
callback {Region::inherit_track_color = menu_picked_value( o ); callback {Audio_Region::inherit_track_color = menu_picked_value( o );
timeline->redraw();} timeline->redraw();}
xywh {40 40 40 25} type Toggle value 1 xywh {40 40 40 25} type Toggle value 1

View File

@ -728,7 +728,7 @@ Track::seek ( nframes_t frame )
/* FIXME: what about theading issues with this region/audiofile being /* FIXME: what about theading issues with this region/audiofile being
accessible from the UI thread? Need locking? */ accessible from the UI thread? Need locking? */
#include "Region.H" #include "Audio_Region.H"
#include <time.h> #include <time.h>
@ -765,7 +765,7 @@ Track::record ( nframes_t frame )
/* open it again for reading in the GUI thread */ /* open it again for reading in the GUI thread */
Audio_File *af = Audio_File::from_file( _capture_af->name() ); Audio_File *af = Audio_File::from_file( _capture_af->name() );
_capture = new Region( af, track(), frame ); _capture = new Audio_Region( af, track(), frame );
_capture->prepare(); _capture->prepare();
} }

View File

@ -45,7 +45,7 @@ class Annotation_Sequence;
class Playback_DS; class Playback_DS;
class Record_DS; class Record_DS;
class Port; class Port;
class Region; class Audio_Region;
class Audio_File; class Audio_File;
class Track : public Fl_Group, public Loggable class Track : public Fl_Group, public Loggable
@ -76,7 +76,7 @@ private:
Sequence *_track; Sequence *_track;
Region *_capture; /* capture region */ Audio_Region *_capture; /* capture region */
Audio_File *_capture_af; /* capture write source */ Audio_File *_capture_af; /* capture write source */
bool configure_outputs ( int n ); bool configure_outputs ( int n );
@ -250,7 +250,7 @@ public:
int handle ( int m ); int handle ( int m );
const Region *capture ( void ) const { return _capture; } const Audio_Region *capture ( void ) const { return _capture; }
/* Engine */ /* Engine */
nframes_t process ( nframes_t nframes ); nframes_t process ( nframes_t nframes );

View File

@ -26,7 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "Region.H" #include "Audio_Region.H"
#include "Sequence.H" #include "Sequence.H"
#include "Audio_Sequence.H" #include "Audio_Sequence.H"
#include "Timeline.H" #include "Timeline.H"
@ -86,7 +86,7 @@ int
main ( int argc, char **argv ) main ( int argc, char **argv )
{ {
/* welcome to C++ */ /* welcome to C++ */
LOG_REGISTER_CREATE( Region ); LOG_REGISTER_CREATE( Audio_Region );
LOG_REGISTER_CREATE( Time_Point ); LOG_REGISTER_CREATE( Time_Point );
LOG_REGISTER_CREATE( Tempo_Point ); LOG_REGISTER_CREATE( Tempo_Point );
LOG_REGISTER_CREATE( Annotation_Point ); LOG_REGISTER_CREATE( Annotation_Point );

View File

@ -15,7 +15,7 @@ Timeline/Peaks.C \
Timeline/Playback_DS.C \ Timeline/Playback_DS.C \
Timeline/Port.C \ Timeline/Port.C \
Timeline/Record_DS.C \ Timeline/Record_DS.C \
Timeline/Region.C \ Timeline/Audio_Region.C \
Timeline/Sequence.C \ Timeline/Sequence.C \
Timeline/Sequence_Point.C \ Timeline/Sequence_Point.C \
Timeline/Sequence_Widget.C \ Timeline/Sequence_Widget.C \