Browse Source

Massive consting.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
63ebacb872
22 changed files with 134 additions and 61 deletions
  1. +2
    -3
      Timeline/Audio_Sequence.H
  2. +4
    -6
      Timeline/Control_Point.H
  3. +1
    -1
      Timeline/Control_Sequence.C
  4. +2
    -2
      Timeline/Control_Sequence.H
  5. +7
    -5
      Timeline/Loggable.C
  6. +18
    -13
      Timeline/Loggable.H
  7. +2
    -3
      Timeline/Region.H
  8. +2
    -3
      Timeline/Ruler_Point.H
  9. +4
    -2
      Timeline/Sequence.H
  10. +1
    -1
      Timeline/Sequence_Point.H
  11. +5
    -3
      Timeline/Sequence_Widget.H
  12. +25
    -2
      Timeline/TLE.fl
  13. +1
    -1
      Timeline/Tempo_Point.C
  14. +2
    -2
      Timeline/Tempo_Point.H
  15. +1
    -1
      Timeline/Time_Point.C
  16. +2
    -2
      Timeline/Time_Point.H
  17. +33
    -0
      Timeline/Timeline.C
  18. +4
    -0
      Timeline/Timeline.H
  19. +0
    -6
      Timeline/Track.C
  20. +3
    -4
      Timeline/Track.H
  21. +7
    -0
      Timeline/Transport.C
  22. +8
    -1
      Timeline/Transport.H

+ 2
- 3
Timeline/Audio_Sequence.H View File

@@ -30,8 +30,7 @@ class Audio_Sequence : public Sequence


protected: protected:


void
get ( Log_Entry &e )
virtual void get ( Log_Entry &e ) const
{ {
Sequence::get( e ); Sequence::get( e );


@@ -100,7 +99,7 @@ public:
return t; return t;
} }


const char *class_name ( void ) { return "Audio_Sequence"; }
// const char *class_name ( void ) { return "Audio_Sequence"; }


int handle ( int m ); int handle ( int m );
void dump ( void ); void dump ( void );


+ 4
- 6
Timeline/Control_Point.H View File

@@ -36,10 +36,9 @@ class Control_Point : public Sequence_Point


protected: protected:


const char *class_name ( void ) { return "Control_Point"; }
// const char *class_name ( void ) { return "Control_Point"; }


void
get ( Log_Entry &e )
virtual void get ( Log_Entry &e ) const
{ {
Sequence_Point::get( e ); Sequence_Point::get( e );


@@ -68,7 +67,7 @@ protected:


Control_Point ( ) Control_Point ( )
{ {
_box_color = FL_WHITE;
} }


public: public:
@@ -87,8 +86,7 @@ public:
_track = t; _track = t;
_y = y; _y = y;
_r->offset = when; _r->offset = when;

// _make_label();
_box_color = FL_WHITE;


log_create(); log_create();
} }


+ 1
- 1
Timeline/Control_Sequence.C View File

@@ -52,7 +52,7 @@ Control_Sequence::init ( void )
} }


void void
Control_Sequence::get ( Log_Entry &e )
Control_Sequence::get ( Log_Entry &e ) const
{ {
Sequence::get( e ); Sequence::get( e );




+ 2
- 2
Timeline/Control_Sequence.H View File

@@ -32,7 +32,7 @@ class Control_Sequence : public Sequence
protected: protected:




void get ( Log_Entry &e );
virtual void get ( Log_Entry &e ) const;
void set ( Log_Entry &e ); void set ( Log_Entry &e );


Control_Sequence ( ) : Sequence( 0, 0, 0, 1 ) Control_Sequence ( ) : Sequence( 0, 0, 0, 1 )
@@ -55,7 +55,7 @@ public:
Control_Sequence ( Track * ); Control_Sequence ( Track * );
~Control_Sequence ( ); ~Control_Sequence ( );


const char *class_name ( void ) { return "Control_Sequence"; }
// const char *class_name ( void ) { return "Control_Sequence"; }


void draw ( void ); void draw ( void );
int handle ( int m ); int handle ( int m );


+ 7
- 5
Timeline/Loggable.C View File

@@ -341,8 +341,10 @@ Loggable::snapshot( FILE *fp )


for ( int i = 0; i < _log_id; ++i ) for ( int i = 0; i < _log_id; ++i )
{ {
if ( _class_map[ string( _loggables[ i ]->class_name() ) ] )
_loggables[ i ]->log_create();
const Loggable * l = _loggables[ i ];

if ( l && _class_map[ string( l->class_name() ) ] )
l->log_create();
} }


_fp = ofp; _fp = ofp;
@@ -428,7 +430,7 @@ Loggable::flush ( void )
} }


void void
Loggable::log_print( char **o, char **n )
Loggable::log_print( char **o, char **n ) const
{ {
if ( n ) if ( n )
for ( ; *n; n++ ) for ( ; *n; n++ )
@@ -533,7 +535,7 @@ Loggable::log_end ( void )
} }


void void
Loggable::log_create ( void )
Loggable::log_create ( void ) const
{ {
// indent(); // indent();
log( "%s 0x%X create ", class_name(), _id ); log( "%s 0x%X create ", class_name(), _id );
@@ -559,7 +561,7 @@ Loggable::log_create ( void )
} }


void void
Loggable::log_destroy ( void )
Loggable::log_destroy ( void ) const
{ {
// indent(); // indent();
log( "%s 0x%X destroy (nothing) << ", class_name(), _id ); log( "%s 0x%X destroy (nothing) << ", class_name(), _id );


+ 18
- 13
Timeline/Loggable.H View File

@@ -42,14 +42,18 @@ typedef Loggable *(create_func)(Log_Entry &);
#define LOG_REGISTER_CREATE( class ) \ #define LOG_REGISTER_CREATE( class ) \
Loggable::register_create( #class, & class ::create ); Loggable::register_create( #class, & class ::create );


#define LOG_CREATE_FUNC( class ) \
static Loggable * \
create ( Log_Entry &e ) \
{ \
class *r = new class; \
r->set( e ); \
return (Loggable *)r; \
} \
#define LOG_NAME_FUNC( class ) \
virtual const char *class_name ( void ) const { return #class ; }

#define LOG_CREATE_FUNC( class ) \
static Loggable * \
create ( Log_Entry &e ) \
{ \
class *r = new class; \
r->set( e ); \
return (Loggable *)r; \
} \
LOG_NAME_FUNC( class ); \




class Logger; class Logger;
@@ -76,7 +80,7 @@ private:


int _nest; int _nest;


void log_print( char **o, char **n );
void log_print( char **o, char **n ) const;
static void log ( const char *fmt, ... ); static void log ( const char *fmt, ... );


static void flush ( void ); static void flush ( void );
@@ -171,8 +175,7 @@ public:
} }


/* log messages for journal */ /* log messages for journal */
virtual const char *class_name ( void ) = 0;
virtual void get ( Log_Entry &e ) = 0;
virtual void get ( Log_Entry &e ) const = 0;
virtual void set ( Log_Entry &e ) = 0; virtual void set ( Log_Entry &e ) = 0;


static bool do_this ( const char *s, bool reverse ); static bool do_this ( const char *s, bool reverse );
@@ -181,11 +184,13 @@ protected:


void log_start ( void ); void log_start ( void );
void log_end ( void ); void log_end ( void );
void log_create ( void );
void log_destroy ( void );
void log_create ( void ) const;
void log_destroy ( void ) const;


public: public:


virtual const char *class_name ( void ) const = 0;

int id ( void ) { return _id; } int id ( void ) { return _id; }






+ 2
- 3
Timeline/Region.H View File

@@ -102,10 +102,9 @@ private:


protected: protected:


const char *class_name ( void ) { return "Region"; }
// const char *class_name ( void ) { return "Region"; }


void
get ( Log_Entry &e )
virtual void get ( Log_Entry &e ) const
{ {
e.add( ":source", _clip ? _clip->name() : "" ); e.add( ":source", _clip ? _clip->name() : "" );
e.add( ":gain", _scale ); e.add( ":gain", _scale );


+ 2
- 3
Timeline/Ruler_Point.H View File

@@ -37,10 +37,9 @@ public:


protected: protected:


const char *class_name ( void ) { return "Ruler_Point"; }
// const char *class_name ( void ) { return "Ruler_Point"; }


void
get ( Log_Entry &e )
virtual void get ( Log_Entry &e ) const
{ {
Sequence_Point::get( e ); Sequence_Point::get( e );




+ 4
- 2
Timeline/Sequence.H View File

@@ -54,7 +54,7 @@ protected:
std::list <Sequence_Widget *> _widgets; std::list <Sequence_Widget *> _widgets;
Sequence_Widget *event_widget ( void ); Sequence_Widget *event_widget ( void );


virtual const char *class_name ( void ) { return "Sequence"; }
// virtual const char *class_name ( void ) { return "Sequence"; }




virtual void set ( Log_Entry &e ) virtual void set ( Log_Entry &e )
@@ -72,7 +72,7 @@ protected:
} }
} }


virtual void get ( Log_Entry &e )
virtual void get ( Log_Entry &e ) const
{ {
e.add( ":n", name() ); e.add( ":n", name() );
// e.add( ":t", _track ); // e.add( ":t", _track );
@@ -91,6 +91,8 @@ protected:


public: public:


LOG_NAME_FUNC( Sequence );

Sequence ( int X, int Y, int W, int H, Track *track=0 ); Sequence ( int X, int Y, int W, int H, Track *track=0 );


virtual ~Sequence ( ); virtual ~Sequence ( );


+ 1
- 1
Timeline/Sequence_Point.H View File

@@ -28,7 +28,7 @@ protected:


char *_label; char *_label;


virtual void get ( Log_Entry &e )
virtual void get ( Log_Entry &e ) const
{ {
e.add( ":x", _r->offset ); e.add( ":x", _r->offset );
e.add( ":t", _track ); e.add( ":t", _track );


+ 5
- 3
Timeline/Sequence_Widget.H View File

@@ -77,8 +77,7 @@ protected:
Drag *_drag; Drag *_drag;




virtual void
get ( Log_Entry &e )
virtual void get ( Log_Entry &e ) const
{ {
e.add( ":x", _r->offset ); e.add( ":x", _r->offset );
e.add( ":l", _r->start ); e.add( ":l", _r->start );
@@ -139,6 +138,9 @@ public:
_r->offset = _r->start = _r->end = 0; _r->offset = _r->start = _r->end = 0;


_drag = NULL; _drag = NULL;

_box_color = FL_BACKGROUND_COLOR;
_color = FL_FOREGROUND_COLOR;
} }


virtual ~Sequence_Widget ( ) virtual ~Sequence_Widget ( )
@@ -173,7 +175,7 @@ public:


virtual Sequence_Widget *clone ( const Sequence_Widget *r ) = 0; virtual Sequence_Widget *clone ( const Sequence_Widget *r ) = 0;


bool selected ( void )
bool selected ( void ) const
{ {
return ::find( _selection.begin(), _selection.end(), this ) != _selection.end(); return ::find( _selection.begin(), _selection.end(), this ) != _selection.end();
} }


+ 25
- 2
Timeline/TLE.fl View File

@@ -120,6 +120,7 @@ exit( 0 );}
} }
MenuItem {} { MenuItem {} {
label Undo label Undo
callback {Loggable::undo();} selected
xywh {0 0 40 25} shortcut 0x4007a xywh {0 0 40 25} shortcut 0x4007a
} }
} }
@@ -191,8 +192,30 @@ exit( 0 );}
} }
} }
} }
Submenu timeline_menu {
label {&Timeline} open
xywh {0 0 74 25}
} {
Submenu {} {
label {&Snap} open
xywh {0 0 74 25}
} {
MenuItem {} {
label Bars
xywh {0 0 40 25} type Radio value 1
}
MenuItem {} {
label Beats
xywh {10 10 40 25} type Radio
}
MenuItem {} {
label Off
xywh {20 20 40 25} type Radio
}
}
}
Submenu options_menu { Submenu options_menu {
label {&Options} open
label {&Options}
xywh {0 0 74 25} divider xywh {0 0 74 25} divider
} { } {
Submenu {} { Submenu {} {
@@ -350,7 +373,7 @@ Fl::scheme( Fl::scheme() );}
class Clock class Clock
} }
Fl_Box {} { Fl_Box {} {
label PLAYHEAD selected
label PLAYHEAD
xywh {325 29 142 40} box BORDER_BOX color 46 xywh {325 29 142 40} box BORDER_BOX color 46
code0 {o->type( Clock::BBT );} code0 {o->type( Clock::BBT );}
code1 {o->run( &transport->frame );} code1 {o->run( &transport->frame );}


+ 1
- 1
Timeline/Tempo_Point.C View File

@@ -23,7 +23,7 @@
#include "Timeline.H" // for timeline->tempo_track #include "Timeline.H" // for timeline->tempo_track


void void
Tempo_Point::get ( Log_Entry &e )
Tempo_Point::get ( Log_Entry &e ) const
{ {
e.add( ":x", _r->offset ); e.add( ":x", _r->offset );
e.add( ":tempo", _tempo ); e.add( ":tempo", _tempo );


+ 2
- 2
Timeline/Tempo_Point.H View File

@@ -37,9 +37,9 @@ class Tempo_Point : public Sequence_Point


protected: protected:


const char *class_name ( void ) { return "Tempo_Point"; }
// const char *class_name ( void ) { return "Tempo_Point"; }


void get ( Log_Entry &e );
virtual void get ( Log_Entry &e ) const;
void set ( Log_Entry &e ); void set ( Log_Entry &e );


Tempo_Point ( ) Tempo_Point ( )


+ 1
- 1
Timeline/Time_Point.C View File

@@ -22,7 +22,7 @@
#include "Timeline.H" // for timeline->time_track #include "Timeline.H" // for timeline->time_track


void void
Time_Point::get ( Log_Entry &e )
Time_Point::get ( Log_Entry &e ) const
{ {
e.add( ":x", _r->offset ); e.add( ":x", _r->offset );
e.add( ":beats_per_bar", _time.beats_per_bar ); e.add( ":beats_per_bar", _time.beats_per_bar );


+ 2
- 2
Timeline/Time_Point.H View File

@@ -63,9 +63,9 @@ class Time_Point : public Sequence_Point


protected: protected:


const char *class_name ( void ) { return "Time_Point"; }
// const char *class_name ( void ) { return "Time_Point"; }


void get ( Log_Entry &e );
virtual void get ( Log_Entry &e ) const;
void set ( Log_Entry &e ); void set ( Log_Entry &e );






+ 33
- 0
Timeline/Timeline.C View File

@@ -929,6 +929,39 @@ Timeline::remove_track ( Track *track )
redraw(); redraw();
} }


/** Initiate recording for all armed tracks */
bool
Timeline::record ( void )
{
for ( int i = tracks->children(); i-- ; )
{
Track *t = (Track*)tracks->child( i );

if ( t->armed() && t->record_ds )
t->record_ds->start( transport->frame );
}

deactivate();

return true;
}

/** stop recording for all armed tracks */
void
Timeline::stop ( void )
{
for ( int i = tracks->children(); i-- ; )
{
Track *t = (Track*)tracks->child( i );

if ( t->armed() && t->record_ds )
t->record_ds->stop( transport->frame );
}

activate();
}


/**********/ /**********/
/* Engine */ /* Engine */
/**********/ /**********/


+ 4
- 0
Timeline/Timeline.H View File

@@ -160,6 +160,10 @@ public:
int total_input_buffer_percent ( void ); int total_input_buffer_percent ( void );
int total_output_buffer_percent ( void ); int total_output_buffer_percent ( void );



bool record ( void );
void stop ( void );

void zoom ( float secs ); void zoom ( float secs );
void zoom_in ( void ); void zoom_in ( void );
void zoom_out ( void ); void zoom_out ( void );


+ 0
- 6
Timeline/Track.C View File

@@ -62,12 +62,6 @@ Track::cb_button ( Fl_Widget *w )
if ( w == record_button ) if ( w == record_button )
{ {


/* /\* FIXME: wrong place for this! *\/ */
/* if ( record_button->value() ) */
/* record_ds->start( transport->frame ); */
/* else */
/* record_ds->stop( transport->frame ); */

} }
if ( w == mute_button ) if ( w == mute_button )
{ {


+ 3
- 4
Timeline/Track.H View File

@@ -109,7 +109,7 @@ public:
Playback_DS *playback_ds; Playback_DS *playback_ds;
Record_DS *record_ds; Record_DS *record_ds;


const char *class_name ( void ) { return "Track"; }
// const char *class_name ( void ) { return "Track"; }


void void
set ( Log_Entry &e ) set ( Log_Entry &e )
@@ -160,8 +160,7 @@ public:
} }




void
get ( Log_Entry &e )
virtual void get ( Log_Entry &e ) const
{ {
e.add( ":n", _name ); e.add( ":n", _name );
e.add( ":t", track() ); e.add( ":t", track() );
@@ -225,7 +224,7 @@ public:
static int width ( void ) { return 150; } static int width ( void ) { return 150; }


void track( Sequence * t ); void track( Sequence * t );
Sequence * track ( void ) { return _track; }
Sequence * track ( void ) const { return _track; }


void draw ( void ); void draw ( void );
int handle ( int m ); int handle ( int m );


+ 7
- 0
Timeline/Transport.C View File

@@ -46,6 +46,10 @@ Transport::start ( void )
{ {
// MESSAGE( "Starting transport" ); // MESSAGE( "Starting transport" );
jack_transport_start( client ); jack_transport_start( client );

if ( _record_button->value() )
timeline->record();

} }


void void
@@ -53,6 +57,9 @@ Transport::stop ( void )
{ {
// MESSAGE( "Stopping transport" ); // MESSAGE( "Stopping transport" );
jack_transport_stop( client ); jack_transport_stop( client );

if ( _record_button->value() )
timeline->stop();
} }


void void


+ 8
- 1
Timeline/Transport.H View File

@@ -56,7 +56,13 @@ private:
else if ( w == _play_button ) else if ( w == _play_button )
toggle(); toggle();
else if ( w == _record_button ) else if ( w == _record_button )
printf( "FIXME: record now\n" );
{
if ( rolling )
if ( _record_button->value() )
timeline->record();
else
timeline->stop();
}
} }


public: public:
@@ -88,6 +94,7 @@ public:
o->box( FL_UP_BOX ); o->box( FL_UP_BOX );


_record_button = o = new Fl_Button( 0, 0, bw, 0, "@circle" ); _record_button = o = new Fl_Button( 0, 0, bw, 0, "@circle" );
o->type( FL_TOGGLE_BUTTON );
o->labeltype( FL_EMBOSSED_LABEL ); o->labeltype( FL_EMBOSSED_LABEL );
o->labelcolor( FL_RED ); o->labelcolor( FL_RED );
o->shortcut( 'R' ); o->shortcut( 'R' );


Loading…
Cancel
Save