Timeline: Add basic punch in/out support (may require latency compensation).
This commit is contained in:
parent
e968d8190f
commit
a27d0b1718
|
@ -40,6 +40,9 @@ Timeline::record ( void )
|
|||
|
||||
nframes_t frame = transport->frame;
|
||||
|
||||
if ( transport->punch_enabled() && frame < range_start() )
|
||||
frame = range_start();
|
||||
|
||||
DMESSAGE( "Going to record starting at frame %lu", (unsigned long)frame );
|
||||
|
||||
for ( int i = tracks->children(); i-- ; )
|
||||
|
@ -61,6 +64,9 @@ Timeline::stop ( void )
|
|||
{
|
||||
nframes_t frame = transport->frame;
|
||||
|
||||
if ( transport->punch_enabled() && frame > range_end() )
|
||||
frame = range_end();
|
||||
|
||||
for ( int i = tracks->children(); i-- ; )
|
||||
{
|
||||
Track *t = (Track*)tracks->child( i );
|
||||
|
|
|
@ -202,7 +202,7 @@ Track::process_output ( nframes_t nframes )
|
|||
}
|
||||
|
||||
/* FIXME: should we blank the control output here or leave it floating? */
|
||||
for ( int i = control->children(); i--; )
|
||||
for ( int i = 0; i < control->children(); i++ )
|
||||
((Control_Sequence*)control->child( i ))->process( nframes );
|
||||
|
||||
if ( playback_ds )
|
||||
|
|
|
@ -855,7 +855,15 @@ if ( engine && engine->zombified() && ! zombie )
|
|||
}
|
||||
|
||||
solo_blinker->value( Track::soloing() );
|
||||
rec_blinker->value( transport->rolling && transport->rec_enabled() );
|
||||
|
||||
if ( transport->punch_enabled() )
|
||||
rec_blinker->value( transport->rolling &&
|
||||
transport->rec_enabled() &&
|
||||
transport->frame >= timeline->range_start() &&
|
||||
transport->frame <= timeline->range_end() );
|
||||
else
|
||||
rec_blinker->value( transport->rolling && transport->rec_enabled() );
|
||||
|
||||
sm_blinker->value( timeline->session_manager_name() != NULL );
|
||||
sm_blinker->tooltip( timeline->session_manager_name() );
|
||||
selected_blinker->value( timeline->nselected() );
|
||||
|
|
|
@ -1058,6 +1058,15 @@ Timeline::redraw_playhead ( void )
|
|||
static nframes_t last_playhead = -1;
|
||||
static int last_playhead_x = -1;
|
||||
|
||||
|
||||
/* FIXME: kind of a hackish way to invoke punch stop from the UI thread... */
|
||||
|
||||
if ( transport->rolling &&
|
||||
transport->rec_enabled() &&
|
||||
transport->punch_enabled() &&
|
||||
transport->frame > range_end() )
|
||||
transport->stop();
|
||||
|
||||
int playhead_x = ts_to_x( transport->frame );
|
||||
|
||||
if ( last_playhead_x != playhead_x )
|
||||
|
|
|
@ -45,7 +45,7 @@ Transport::Transport ( int X, int Y, int W, int H, const char *L )
|
|||
frame_rate = 48000;
|
||||
frame = 0;
|
||||
|
||||
const int bw = W / 3;
|
||||
const int bw = W / 5;
|
||||
|
||||
type( HORIZONTAL );
|
||||
|
||||
|
@ -77,6 +77,16 @@ Transport::Transport ( int X, int Y, int W, int H, const char *L )
|
|||
o->when( FL_WHEN_CHANGED );
|
||||
o->box( FL_UP_BOX );
|
||||
|
||||
_punch_button = o = new Fl_Button( 0, 0, bw, 0, "Punch" );
|
||||
o->type( FL_TOGGLE_BUTTON );
|
||||
o->labelsize( 9 );
|
||||
o->labeltype( FL_NORMAL_LABEL );
|
||||
o->shortcut( 'P' );
|
||||
o->callback( cb_button, this );
|
||||
o->when( FL_WHEN_CHANGED );
|
||||
o->color2( FL_GREEN );
|
||||
o->box( FL_UP_BOX );
|
||||
|
||||
end();
|
||||
}
|
||||
|
||||
|
@ -147,6 +157,12 @@ Transport::rec_enabled ( void ) const
|
|||
return _record_button->value();
|
||||
}
|
||||
|
||||
bool
|
||||
Transport::punch_enabled ( void ) const
|
||||
{
|
||||
return _punch_button->value();
|
||||
}
|
||||
|
||||
int
|
||||
Transport::handle ( int m )
|
||||
{
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include <jack/transport.h>
|
||||
#include "types.h"
|
||||
|
||||
#include "Timeline.H"
|
||||
|
||||
#include <FL/Fl_Pack.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
|
||||
|
@ -48,6 +46,7 @@ private:
|
|||
Fl_Button *_end_button;
|
||||
Fl_Button *_play_button;
|
||||
Fl_Button *_record_button;
|
||||
Fl_Button *_punch_button;
|
||||
|
||||
void update_record_state ( void );
|
||||
|
||||
|
@ -56,6 +55,7 @@ public:
|
|||
Transport ( int X, int Y, int W, int H, const char *L=0 );
|
||||
|
||||
bool rec_enabled ( void ) const;
|
||||
bool punch_enabled ( void ) const;
|
||||
|
||||
void stop_disables_record ( bool b ) { _stop_disables_record = b; }
|
||||
bool stop_disables_record ( void ) const { return _stop_disables_record; }
|
||||
|
|
Loading…
Reference in New Issue