Work on sharing code between engine and timeline.
This commit is contained in:
parent
b846d29c4b
commit
b64034fdf0
6
Makefile
6
Makefile
|
@ -5,6 +5,6 @@ LIBS := -lsndfile `fltk-config --ldflags`
|
||||||
all: all
|
all: all
|
||||||
|
|
||||||
%:
|
%:
|
||||||
@ make -s -C FL CXXFLAGS="$(CXXFLAGS)" LIBS="$(LIBS)" $@
|
@ $(MAKE) -s -C FL CXXFLAGS="$(CXXFLAGS)" LIBS="$(LIBS)" $@
|
||||||
@ make -s -C Timeline CXXFLAGS="$(CXXFLAGS)" LIBS="$(LIBS)" $@
|
@ $(MAKE) -s -C Timeline CXXFLAGS="$(CXXFLAGS)" LIBS="$(LIBS)" $@
|
||||||
@ make -s -C Mixer CXXFLAGS="$(CXXFLAGS)" LIBS="$(LIBS)" $@
|
@ $(MAKE) -s -C Mixer CXXFLAGS="$(CXXFLAGS)" LIBS="$(LIBS)" $@
|
||||||
|
|
|
@ -16,46 +16,32 @@
|
||||||
/* with This program; see the file COPYING. If not,write to the Free Software */
|
/* with This program; see the file COPYING. If not,write to the Free Software */
|
||||||
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// class Track;
|
|
||||||
|
|
||||||
// #include "Waveform.H"
|
|
||||||
|
|
||||||
#include "Audio_File.H"
|
#include "Audio_File.H"
|
||||||
#include "Track.H"
|
#include "Track.H"
|
||||||
#include "Timeline.H"
|
#include "Timeline.H"
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
using namespace std;
|
|
||||||
/* Regions are "virtual" FLTK widgets; this is necessary because the
|
/* 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 */
|
||||||
|
|
||||||
#include "Track_Widget.H"
|
#include "Track_Widget.H"
|
||||||
|
|
||||||
#include "Loggable.H"
|
#include "Loggable.H"
|
||||||
|
|
||||||
/* got I hate C++ */
|
class Region;
|
||||||
#define __CLASS__ "Region"
|
|
||||||
|
|
||||||
class Region : public Track_Widget
|
/* Base for engine. Just to maintain state. Must be free of FLTK
|
||||||
|
* stuff */
|
||||||
|
class Region_Base : public Track_Widget
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
Audio_File *_clip; /* clip this region represents */
|
Audio_File *_clip; /* clip this region represents */
|
||||||
|
|
||||||
float _scale; /* amplitude adjustment */
|
float _scale; /* amplitude adjustment */
|
||||||
|
|
||||||
static Fl_Boxtype _box;
|
|
||||||
static Fl_Color _selection_color;
|
|
||||||
static Fl_Color selection_color ( void ) { return _selection_color; }
|
|
||||||
static void selection_color ( Fl_Color v ) { _selection_color = v; }
|
|
||||||
|
|
||||||
enum trim_e { NO, LEFT, RIGHT };
|
|
||||||
void trim ( enum trim_e t, int X );
|
|
||||||
void init ( void );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
const char *class_name ( void ) { return "Region"; }
|
const char *class_name ( void ) { return "Region"; }
|
||||||
|
@ -130,16 +116,56 @@ protected:
|
||||||
t->add( this );
|
t->add( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
free( s );
|
free( s );
|
||||||
}
|
}
|
||||||
|
|
||||||
free( sa );
|
free( sa );
|
||||||
|
|
||||||
|
#ifndef ENGINE
|
||||||
if ( _track )
|
if ( _track )
|
||||||
_track->redraw();
|
_track->redraw();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Region_Base ( )
|
||||||
|
{
|
||||||
|
_start = _offset = _end = 0;
|
||||||
|
_clip = NULL;
|
||||||
|
_scale = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENGINE
|
||||||
|
/* for loggable */
|
||||||
|
static Loggable *
|
||||||
|
create ( char **sa )
|
||||||
|
{
|
||||||
|
Region_Base *r = new Region_Base;
|
||||||
|
|
||||||
|
r->set( sa );
|
||||||
|
|
||||||
|
return (Loggable *)r;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
friend class Region;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef ENGINE
|
||||||
|
class Region : public Region_Base
|
||||||
|
{
|
||||||
|
|
||||||
|
static Fl_Boxtype _box;
|
||||||
|
static Fl_Color _selection_color;
|
||||||
|
static Fl_Color selection_color ( void ) { return _selection_color; }
|
||||||
|
static void selection_color ( Fl_Color v ) { _selection_color = v; }
|
||||||
|
|
||||||
|
enum trim_e { NO, LEFT, RIGHT };
|
||||||
|
void trim ( enum trim_e t, int X );
|
||||||
|
void init ( void );
|
||||||
|
|
||||||
Region ( )
|
Region ( )
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
@ -149,7 +175,6 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/* for loggable */
|
|
||||||
static Loggable *
|
static Loggable *
|
||||||
create ( char **sa )
|
create ( char **sa )
|
||||||
{
|
{
|
||||||
|
@ -160,7 +185,6 @@ public:
|
||||||
return (Loggable *)r;
|
return (Loggable *)r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
~Region ( )
|
~Region ( )
|
||||||
{
|
{
|
||||||
log_destroy();
|
log_destroy();
|
||||||
|
@ -183,5 +207,4 @@ public:
|
||||||
void dump ( void );
|
void dump ( void );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
#undef __CLASS__
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ bool Waveform::logarithmic = true;
|
||||||
/* TODO: split the variations into separate functions. eg, plain,
|
/* TODO: split the variations into separate functions. eg, plain,
|
||||||
* outlined, filled, polygonal, rectified. */
|
* outlined, filled, polygonal, rectified. */
|
||||||
|
|
||||||
|
/* TODO: this should be made completely independent of /timeline/ so that it can be used for other purposes (file previews) */
|
||||||
|
|
||||||
/** draw a portion of /clip/'s waveform. coordinates are the portion to draw */
|
/** draw a portion of /clip/'s waveform. coordinates are the portion to draw */
|
||||||
void
|
void
|
||||||
Waveform::draw ( int ox, int X, int Y, int W, int H, Audio_File *_clip, int channel, float fpp, nframes_t _start, nframes_t _end, float _scale, Fl_Color color )
|
Waveform::draw ( int ox, int X, int Y, int W, int H, Audio_File *_clip, int channel, float fpp, nframes_t _start, nframes_t _end, float _scale, Fl_Color color )
|
||||||
|
|
Loading…
Reference in New Issue