| @@ -30,8 +30,7 @@ class Audio_Sequence : public Sequence | |||
| protected: | |||
| void | |||
| get ( Log_Entry &e ) | |||
| virtual void get ( Log_Entry &e ) const | |||
| { | |||
| Sequence::get( e ); | |||
| @@ -100,7 +99,7 @@ public: | |||
| return t; | |||
| } | |||
| const char *class_name ( void ) { return "Audio_Sequence"; } | |||
| // const char *class_name ( void ) { return "Audio_Sequence"; } | |||
| int handle ( int m ); | |||
| void dump ( void ); | |||
| @@ -36,10 +36,9 @@ class Control_Point : public Sequence_Point | |||
| 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 ); | |||
| @@ -68,7 +67,7 @@ protected: | |||
| Control_Point ( ) | |||
| { | |||
| _box_color = FL_WHITE; | |||
| } | |||
| public: | |||
| @@ -87,8 +86,7 @@ public: | |||
| _track = t; | |||
| _y = y; | |||
| _r->offset = when; | |||
| // _make_label(); | |||
| _box_color = FL_WHITE; | |||
| log_create(); | |||
| } | |||
| @@ -52,7 +52,7 @@ Control_Sequence::init ( void ) | |||
| } | |||
| void | |||
| Control_Sequence::get ( Log_Entry &e ) | |||
| Control_Sequence::get ( Log_Entry &e ) const | |||
| { | |||
| Sequence::get( e ); | |||
| @@ -32,7 +32,7 @@ class Control_Sequence : public Sequence | |||
| protected: | |||
| void get ( Log_Entry &e ); | |||
| virtual void get ( Log_Entry &e ) const; | |||
| void set ( Log_Entry &e ); | |||
| Control_Sequence ( ) : Sequence( 0, 0, 0, 1 ) | |||
| @@ -55,7 +55,7 @@ public: | |||
| Control_Sequence ( Track * ); | |||
| ~Control_Sequence ( ); | |||
| const char *class_name ( void ) { return "Control_Sequence"; } | |||
| // const char *class_name ( void ) { return "Control_Sequence"; } | |||
| void draw ( void ); | |||
| int handle ( int m ); | |||
| @@ -341,8 +341,10 @@ Loggable::snapshot( FILE *fp ) | |||
| 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; | |||
| @@ -428,7 +430,7 @@ Loggable::flush ( void ) | |||
| } | |||
| void | |||
| Loggable::log_print( char **o, char **n ) | |||
| Loggable::log_print( char **o, char **n ) const | |||
| { | |||
| if ( n ) | |||
| for ( ; *n; n++ ) | |||
| @@ -533,7 +535,7 @@ Loggable::log_end ( void ) | |||
| } | |||
| void | |||
| Loggable::log_create ( void ) | |||
| Loggable::log_create ( void ) const | |||
| { | |||
| // indent(); | |||
| log( "%s 0x%X create ", class_name(), _id ); | |||
| @@ -559,7 +561,7 @@ Loggable::log_create ( void ) | |||
| } | |||
| void | |||
| Loggable::log_destroy ( void ) | |||
| Loggable::log_destroy ( void ) const | |||
| { | |||
| // indent(); | |||
| log( "%s 0x%X destroy (nothing) << ", class_name(), _id ); | |||
| @@ -42,14 +42,18 @@ typedef Loggable *(create_func)(Log_Entry &); | |||
| #define LOG_REGISTER_CREATE( class ) \ | |||
| 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; | |||
| @@ -76,7 +80,7 @@ private: | |||
| 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 flush ( void ); | |||
| @@ -171,8 +175,7 @@ public: | |||
| } | |||
| /* 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; | |||
| static bool do_this ( const char *s, bool reverse ); | |||
| @@ -181,11 +184,13 @@ protected: | |||
| void log_start ( void ); | |||
| void log_end ( void ); | |||
| void log_create ( void ); | |||
| void log_destroy ( void ); | |||
| void log_create ( void ) const; | |||
| void log_destroy ( void ) const; | |||
| public: | |||
| virtual const char *class_name ( void ) const = 0; | |||
| int id ( void ) { return _id; } | |||
| @@ -102,10 +102,9 @@ private: | |||
| 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( ":gain", _scale ); | |||
| @@ -37,10 +37,9 @@ public: | |||
| 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 ); | |||
| @@ -54,7 +54,7 @@ protected: | |||
| std::list <Sequence_Widget *> _widgets; | |||
| 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 ) | |||
| @@ -72,7 +72,7 @@ protected: | |||
| } | |||
| } | |||
| virtual void get ( Log_Entry &e ) | |||
| virtual void get ( Log_Entry &e ) const | |||
| { | |||
| e.add( ":n", name() ); | |||
| // e.add( ":t", _track ); | |||
| @@ -91,6 +91,8 @@ protected: | |||
| public: | |||
| LOG_NAME_FUNC( Sequence ); | |||
| Sequence ( int X, int Y, int W, int H, Track *track=0 ); | |||
| virtual ~Sequence ( ); | |||
| @@ -28,7 +28,7 @@ protected: | |||
| char *_label; | |||
| virtual void get ( Log_Entry &e ) | |||
| virtual void get ( Log_Entry &e ) const | |||
| { | |||
| e.add( ":x", _r->offset ); | |||
| e.add( ":t", _track ); | |||
| @@ -77,8 +77,7 @@ protected: | |||
| Drag *_drag; | |||
| virtual void | |||
| get ( Log_Entry &e ) | |||
| virtual void get ( Log_Entry &e ) const | |||
| { | |||
| e.add( ":x", _r->offset ); | |||
| e.add( ":l", _r->start ); | |||
| @@ -139,6 +138,9 @@ public: | |||
| _r->offset = _r->start = _r->end = 0; | |||
| _drag = NULL; | |||
| _box_color = FL_BACKGROUND_COLOR; | |||
| _color = FL_FOREGROUND_COLOR; | |||
| } | |||
| virtual ~Sequence_Widget ( ) | |||
| @@ -173,7 +175,7 @@ public: | |||
| 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(); | |||
| } | |||
| @@ -120,6 +120,7 @@ exit( 0 );} | |||
| } | |||
| MenuItem {} { | |||
| label Undo | |||
| callback {Loggable::undo();} selected | |||
| 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 { | |||
| label {&Options} open | |||
| label {&Options} | |||
| xywh {0 0 74 25} divider | |||
| } { | |||
| Submenu {} { | |||
| @@ -350,7 +373,7 @@ Fl::scheme( Fl::scheme() );} | |||
| class Clock | |||
| } | |||
| Fl_Box {} { | |||
| label PLAYHEAD selected | |||
| label PLAYHEAD | |||
| xywh {325 29 142 40} box BORDER_BOX color 46 | |||
| code0 {o->type( Clock::BBT );} | |||
| code1 {o->run( &transport->frame );} | |||
| @@ -23,7 +23,7 @@ | |||
| #include "Timeline.H" // for timeline->tempo_track | |||
| void | |||
| Tempo_Point::get ( Log_Entry &e ) | |||
| Tempo_Point::get ( Log_Entry &e ) const | |||
| { | |||
| e.add( ":x", _r->offset ); | |||
| e.add( ":tempo", _tempo ); | |||
| @@ -37,9 +37,9 @@ class Tempo_Point : public Sequence_Point | |||
| 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 ); | |||
| Tempo_Point ( ) | |||
| @@ -22,7 +22,7 @@ | |||
| #include "Timeline.H" // for timeline->time_track | |||
| void | |||
| Time_Point::get ( Log_Entry &e ) | |||
| Time_Point::get ( Log_Entry &e ) const | |||
| { | |||
| e.add( ":x", _r->offset ); | |||
| e.add( ":beats_per_bar", _time.beats_per_bar ); | |||
| @@ -63,9 +63,9 @@ class Time_Point : public Sequence_Point | |||
| 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 ); | |||
| @@ -929,6 +929,39 @@ Timeline::remove_track ( Track *track ) | |||
| 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 */ | |||
| /**********/ | |||
| @@ -160,6 +160,10 @@ public: | |||
| int total_input_buffer_percent ( void ); | |||
| int total_output_buffer_percent ( void ); | |||
| bool record ( void ); | |||
| void stop ( void ); | |||
| void zoom ( float secs ); | |||
| void zoom_in ( void ); | |||
| void zoom_out ( void ); | |||
| @@ -62,12 +62,6 @@ Track::cb_button ( Fl_Widget *w ) | |||
| 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 ) | |||
| { | |||
| @@ -109,7 +109,7 @@ public: | |||
| Playback_DS *playback_ds; | |||
| Record_DS *record_ds; | |||
| const char *class_name ( void ) { return "Track"; } | |||
| // const char *class_name ( void ) { return "Track"; } | |||
| void | |||
| 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( ":t", track() ); | |||
| @@ -225,7 +224,7 @@ public: | |||
| static int width ( void ) { return 150; } | |||
| void track( Sequence * t ); | |||
| Sequence * track ( void ) { return _track; } | |||
| Sequence * track ( void ) const { return _track; } | |||
| void draw ( void ); | |||
| int handle ( int m ); | |||
| @@ -46,6 +46,10 @@ Transport::start ( void ) | |||
| { | |||
| // MESSAGE( "Starting transport" ); | |||
| jack_transport_start( client ); | |||
| if ( _record_button->value() ) | |||
| timeline->record(); | |||
| } | |||
| void | |||
| @@ -53,6 +57,9 @@ Transport::stop ( void ) | |||
| { | |||
| // MESSAGE( "Stopping transport" ); | |||
| jack_transport_stop( client ); | |||
| if ( _record_button->value() ) | |||
| timeline->stop(); | |||
| } | |||
| void | |||
| @@ -56,7 +56,13 @@ private: | |||
| else if ( w == _play_button ) | |||
| toggle(); | |||
| else if ( w == _record_button ) | |||
| printf( "FIXME: record now\n" ); | |||
| { | |||
| if ( rolling ) | |||
| if ( _record_button->value() ) | |||
| timeline->record(); | |||
| else | |||
| timeline->stop(); | |||
| } | |||
| } | |||
| public: | |||
| @@ -88,6 +94,7 @@ public: | |||
| o->box( FL_UP_BOX ); | |||
| _record_button = o = new Fl_Button( 0, 0, bw, 0, "@circle" ); | |||
| o->type( FL_TOGGLE_BUTTON ); | |||
| o->labeltype( FL_EMBOSSED_LABEL ); | |||
| o->labelcolor( FL_RED ); | |||
| o->shortcut( 'R' ); | |||