From 33d78a726aaef063c82c7f93588331262b41ca21 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sun, 4 May 2008 19:04:20 -0500 Subject: [PATCH] Rename Region class to Audio_Region --- Timeline/{Region.C => Audio_Region.C} | 50 +++++++++++++-------------- Timeline/{Region.H => Audio_Region.H} | 20 +++++------ Timeline/Audio_Sequence.C | 8 ++--- Timeline/Audio_Sequence.H | 4 +-- Timeline/Loggable.C | 2 +- Timeline/Sequence.C | 2 +- Timeline/TLE.fl | 6 ++-- Timeline/Track.C | 4 +-- Timeline/Track.H | 6 ++-- Timeline/main.C | 4 +-- Timeline/makefile.inc | 2 +- 11 files changed, 54 insertions(+), 54 deletions(-) rename Timeline/{Region.C => Audio_Region.C} (94%) rename Timeline/{Region.H => Audio_Region.H} (93%) diff --git a/Timeline/Region.C b/Timeline/Audio_Region.C similarity index 94% rename from Timeline/Region.C rename to Timeline/Audio_Region.C index 8f9df1a..a769a6c 100644 --- a/Timeline/Region.C +++ b/Timeline/Audio_Region.C @@ -18,7 +18,7 @@ /*******************************************************************************/ #include "Sequence.H" -#include "Region.H" +#include "Audio_Region.H" #include "Timeline.H" #include "Waveform.H" @@ -41,11 +41,11 @@ using namespace std; 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 ) { @@ -83,7 +83,7 @@ map_PRIM ( set ) void -Region::init ( void ) +Audio_Region::init ( void ) { _track = NULL; @@ -103,7 +103,7 @@ Region::init ( void ) } /* copy constructor */ -Region::Region ( const Region & rhs ) +Audio_Region::Audio_Region ( const Audio_Region & rhs ) { *((Sequence_Widget*)this) = (Sequence_Widget &)rhs; @@ -117,13 +117,13 @@ Region::Region ( const Region & rhs ) } 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(); _clip = c; @@ -134,7 +134,7 @@ Region::Region ( Audio_File *c ) /* 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(); _clip = c; @@ -167,7 +167,7 @@ Region::Region ( Audio_File *c, Sequence *t, nframes_t o ) } void -Region::trim ( enum trim_e t, int X ) +Audio_Region::trim ( enum trim_e t, int X ) { X -= _track->x(); @@ -221,7 +221,7 @@ Region::trim ( enum trim_e t, int X ) } int -Region::handle ( int m ) +Audio_Region::handle ( int m ) { static int ox, oy; static enum trim_e trimming; @@ -309,7 +309,7 @@ Region::handle ( int m ) { Loggable::block_start(); - Region *copy = new Region( *this ); + Audio_Region *copy = new Audio_Region( *this ); trim( RIGHT, X ); copy->trim( LEFT, X ); @@ -387,7 +387,7 @@ Region::handle ( int m ) { 0 }, }; - const Fl_Menu_Item *r = menu->popup( X, Y, "Region" ); + const Fl_Menu_Item *r = menu->popup( X, Y, "Audio_Region" ); if ( r ) { @@ -459,7 +459,7 @@ Region::handle ( int m ) { if ( _drag->state == 0 ) { - _track->add( new Region( *this ) ); + _track->add( new Audio_Region( *this ) ); _drag->state = 1; return 1; } @@ -502,7 +502,7 @@ changed: portion of the region covered by this draw, which may or may not cover the fade in question. */ 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 dh = h() - Fl::box_dh( box() ); @@ -565,7 +565,7 @@ damager ( void *v ) } void -Region::draw_box( void ) +Audio_Region::draw_box( void ) { /* 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 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 ); @@ -601,7 +601,7 @@ Region::draw_box( void ) /** Draw (part of) region. X, Y, W and H are the rectangle we're clipped to. */ void -Region::draw ( void ) +Audio_Region::draw ( void ) { /* intersect clip with region */ @@ -739,7 +739,7 @@ Region::draw ( void ) void -Region::normalize ( void ) +Audio_Region::normalize ( void ) { 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 * given buffer, and /start/ may be negative. */ 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 ); @@ -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 again? */ 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; @@ -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 must match the channel layout of the write source! */ nframes_t -Region::write ( nframes_t nframes ) +Audio_Region::write ( nframes_t nframes ) { _range.end += nframes; @@ -938,7 +938,7 @@ Region::write ( nframes_t nframes ) /** prepare for capturing */ void -Region::prepare ( void ) +Audio_Region::prepare ( void ) { log_start(); } @@ -947,7 +947,7 @@ Region::prepare ( void ) /** finalize region capture. Assumes that this *is* a captured region and that no other regions refer to the same source */ bool -Region::finalize ( nframes_t frame ) +Audio_Region::finalize ( nframes_t frame ) { log_end(); diff --git a/Timeline/Region.H b/Timeline/Audio_Region.H similarity index 93% rename from Timeline/Region.H rename to Timeline/Audio_Region.H index 7e64e84..5c31e23 100644 --- a/Timeline/Region.H +++ b/Timeline/Audio_Region.H @@ -22,7 +22,7 @@ #include "Sequence.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 * far too little for our purposes */ @@ -30,7 +30,7 @@ #include "Loggable.H" -class Region : public Sequence_Widget +class Audio_Region : public Sequence_Widget { public: @@ -103,7 +103,7 @@ private: protected: -// const char *class_name ( void ) { return "Region"; } +// const char *class_name ( void ) { return "Audio_Region"; } virtual void get ( Log_Entry &e ) const { @@ -162,7 +162,7 @@ public: void trim ( enum trim_e t, int X ); void init ( void ); - Region ( ) + Audio_Region ( ) { init(); } @@ -174,21 +174,21 @@ public: 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 ); - ~Region ( ) + ~Audio_Region ( ) { 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); } - Region ( const Region & rhs ); - Region ( Audio_File *c ); - Region ( Audio_File *c, Sequence *t, nframes_t o ); + Audio_Region ( const Audio_Region & rhs ); + Audio_Region ( Audio_File *c ); + Audio_Region ( Audio_File *c, Sequence *t, nframes_t o ); int handle ( int m ); void draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool filled, int X, int W ); diff --git a/Timeline/Audio_Sequence.C b/Timeline/Audio_Sequence.C index 510c4f4..08c2920 100644 --- a/Timeline/Audio_Sequence.C +++ b/Timeline/Audio_Sequence.C @@ -146,7 +146,7 @@ Audio_Sequence::handle ( int m ) { const char *text = Fl::event_text(); - if ( ! strcmp( text, "Region" ) ) + if ( ! strcmp( text, "Audio_Region" ) ) return 1; char *file; @@ -176,8 +176,8 @@ Audio_Sequence::handle ( int m ) return 0; } -// Region *r = - new Region( c, this, timeline->xoffset + timeline->x_to_ts( Fl::event_x() - x() ) ); +// Audio_Region *r = + new Audio_Region( c, this, timeline->xoffset + timeline->x_to_ts( Fl::event_x() - x() ) ); redraw(); return 1; @@ -206,7 +206,7 @@ Audio_Sequence::play ( sample_t *buf, nframes_t frame, nframes_t nframes, int ch for ( list ::const_iterator i = _widgets.begin(); i != _widgets.end(); ++i ) { - const Region *r = (Region*)(*i); + const Audio_Region *r = (Audio_Region*)(*i); for ( int i = channels; i--; ) { diff --git a/Timeline/Audio_Sequence.H b/Timeline/Audio_Sequence.H index 68797c3..2ec7901 100644 --- a/Timeline/Audio_Sequence.H +++ b/Timeline/Audio_Sequence.H @@ -20,7 +20,7 @@ #pragma once #include "Sequence.H" -#include "Region.H" +#include "Audio_Region.H" #include "Track.H" #include @@ -107,7 +107,7 @@ public: void dump ( 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 ); diff --git a/Timeline/Loggable.C b/Timeline/Loggable.C index 2f5529a..e005d15 100644 --- a/Timeline/Loggable.C +++ b/Timeline/Loggable.C @@ -182,7 +182,7 @@ void free_sa ( char **sa ) free( sa ); } -/** 'do' a message like "Region 0xF1 set :r 123" */ +/** 'do' a message like "Audio_Region 0xF1 set :r 123" */ bool Loggable::do_this ( const char *s, bool reverse ) { diff --git a/Timeline/Sequence.C b/Timeline/Sequence.C index 233a177..76897e5 100644 --- a/Timeline/Sequence.C +++ b/Timeline/Sequence.C @@ -20,7 +20,7 @@ #include "Sequence.H" #include "Timeline.H" -#include "Region.H" +#include "Audio_Region.H" #include diff --git a/Timeline/TLE.fl b/Timeline/TLE.fl index 1a23539..be7c233 100644 --- a/Timeline/TLE.fl +++ b/Timeline/TLE.fl @@ -25,7 +25,7 @@ decl {\#include "Audio_File.H" // for supported formats} {} 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} {} @@ -357,7 +357,7 @@ timeline->redraw();} } } Submenu {} { - label {&Region} open + label {&Audio_Region} open xywh {0 0 74 25} } { MenuItem {} { @@ -366,7 +366,7 @@ timeline->redraw();} } MenuItem {} { 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();} xywh {40 40 40 25} type Toggle value 1 diff --git a/Timeline/Track.C b/Timeline/Track.C index f5b8eeb..545c609 100644 --- a/Timeline/Track.C +++ b/Timeline/Track.C @@ -728,7 +728,7 @@ Track::seek ( nframes_t frame ) /* FIXME: what about theading issues with this region/audiofile being accessible from the UI thread? Need locking? */ -#include "Region.H" +#include "Audio_Region.H" #include @@ -765,7 +765,7 @@ Track::record ( nframes_t frame ) /* open it again for reading in the GUI thread */ 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(); } diff --git a/Timeline/Track.H b/Timeline/Track.H index 25a33c0..5e0d95f 100644 --- a/Timeline/Track.H +++ b/Timeline/Track.H @@ -45,7 +45,7 @@ class Annotation_Sequence; class Playback_DS; class Record_DS; class Port; -class Region; +class Audio_Region; class Audio_File; class Track : public Fl_Group, public Loggable @@ -76,7 +76,7 @@ private: Sequence *_track; - Region *_capture; /* capture region */ + Audio_Region *_capture; /* capture region */ Audio_File *_capture_af; /* capture write source */ bool configure_outputs ( int n ); @@ -250,7 +250,7 @@ public: int handle ( int m ); - const Region *capture ( void ) const { return _capture; } + const Audio_Region *capture ( void ) const { return _capture; } /* Engine */ nframes_t process ( nframes_t nframes ); diff --git a/Timeline/main.C b/Timeline/main.C index ee3ddc5..eb2d4b6 100644 --- a/Timeline/main.C +++ b/Timeline/main.C @@ -26,7 +26,7 @@ #include #include -#include "Region.H" +#include "Audio_Region.H" #include "Sequence.H" #include "Audio_Sequence.H" #include "Timeline.H" @@ -86,7 +86,7 @@ int main ( int argc, char **argv ) { /* welcome to C++ */ - LOG_REGISTER_CREATE( Region ); + LOG_REGISTER_CREATE( Audio_Region ); LOG_REGISTER_CREATE( Time_Point ); LOG_REGISTER_CREATE( Tempo_Point ); LOG_REGISTER_CREATE( Annotation_Point ); diff --git a/Timeline/makefile.inc b/Timeline/makefile.inc index 093c930..0e616d9 100644 --- a/Timeline/makefile.inc +++ b/Timeline/makefile.inc @@ -15,7 +15,7 @@ Timeline/Peaks.C \ Timeline/Playback_DS.C \ Timeline/Port.C \ Timeline/Record_DS.C \ -Timeline/Region.C \ +Timeline/Audio_Region.C \ Timeline/Sequence.C \ Timeline/Sequence_Point.C \ Timeline/Sequence_Widget.C \