Browse Source

Rename Region class to Audio_Region

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
33d78a726a
11 changed files with 54 additions and 54 deletions
  1. +25
    -25
      Timeline/Audio_Region.C
  2. +10
    -10
      Timeline/Audio_Region.H
  3. +4
    -4
      Timeline/Audio_Sequence.C
  4. +2
    -2
      Timeline/Audio_Sequence.H
  5. +1
    -1
      Timeline/Loggable.C
  6. +1
    -1
      Timeline/Sequence.C
  7. +3
    -3
      Timeline/TLE.fl
  8. +2
    -2
      Timeline/Track.C
  9. +3
    -3
      Timeline/Track.H
  10. +2
    -2
      Timeline/main.C
  11. +1
    -1
      Timeline/makefile.inc

Timeline/Region.C → Timeline/Audio_Region.C View File

@@ -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();


Timeline/Region.H → Timeline/Audio_Region.H View File

@@ -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 );

+ 4
- 4
Timeline/Audio_Sequence.C View File

@@ -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 <Sequence_Widget *>::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--; )
{


+ 2
- 2
Timeline/Audio_Sequence.H View File

@@ -20,7 +20,7 @@
#pragma once

#include "Sequence.H"
#include "Region.H"
#include "Audio_Region.H"
#include "Track.H"

#include <FL/Fl_Input.H>
@@ -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 );



+ 1
- 1
Timeline/Loggable.C View File

@@ -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 )
{


+ 1
- 1
Timeline/Sequence.C View File

@@ -20,7 +20,7 @@
#include "Sequence.H"
#include "Timeline.H"

#include "Region.H"
#include "Audio_Region.H"

#include <FL/fl_draw.H>



+ 3
- 3
Timeline/TLE.fl View File

@@ -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


+ 2
- 2
Timeline/Track.C View File

@@ -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 <time.h>
@@ -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();
}


+ 3
- 3
Timeline/Track.H View File

@@ -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 );


+ 2
- 2
Timeline/main.C View File

@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <string.h>

#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 );


+ 1
- 1
Timeline/makefile.inc View File

@@ -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 \


Loading…
Cancel
Save