Permit setting tempo from (bar) range.
This commit is contained in:
parent
18800a97d9
commit
08e50292c8
|
@ -161,6 +161,17 @@ Timeline::menu_cb ( Fl_Widget *w, void *v )
|
||||||
((Timeline*)v)->menu_cb( (Fl_Menu_*)w );
|
((Timeline*)v)->menu_cb( (Fl_Menu_*)w );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Timeline::fix_range ( void )
|
||||||
|
{
|
||||||
|
if ( p1 > p2 )
|
||||||
|
{
|
||||||
|
nframes_t t = p2;
|
||||||
|
p2 = p1;
|
||||||
|
p1 = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Timeline::menu_cb ( Fl_Menu_ *m )
|
Timeline::menu_cb ( Fl_Menu_ *m )
|
||||||
{
|
{
|
||||||
|
@ -189,22 +200,30 @@ Timeline::menu_cb ( Fl_Menu_ *m )
|
||||||
|
|
||||||
Loggable::block_end();
|
Loggable::block_end();
|
||||||
}
|
}
|
||||||
else if ( ! strcmp( picked, "Tempo from range" ) )
|
else if ( ! strcmp( picked, "Tempo from range (beat)" ) )
|
||||||
{
|
{
|
||||||
if ( p1 != p2 )
|
if ( p1 != p2 )
|
||||||
{
|
{
|
||||||
if ( p1 > p2 )
|
fix_range();
|
||||||
{
|
|
||||||
nframes_t t = p2;
|
|
||||||
p2 = p1;
|
|
||||||
p1 = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
beats_per_minute( p1, sample_rate() * 60 / (float)( p2 - p1 ) );
|
beats_per_minute( p1, sample_rate() * 60 / (float)( p2 - p1 ) );
|
||||||
|
|
||||||
p2 = p1;
|
p2 = p1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( ! strcmp( picked, "Tempo from range (bar)" ) )
|
||||||
|
{
|
||||||
|
if ( p1 != p2 )
|
||||||
|
{
|
||||||
|
fix_range();
|
||||||
|
|
||||||
|
position_info pi = solve_tempomap( p1 );
|
||||||
|
|
||||||
|
beats_per_minute( p1, sample_rate() * 60 / (float)( ( p2 - p1 ) / pi.beats_per_bar ) );
|
||||||
|
|
||||||
|
p2 = p1;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ( ! strcmp( picked, "Playhead to mouse" ) )
|
else if ( ! strcmp( picked, "Playhead to mouse" ) )
|
||||||
{
|
{
|
||||||
int X = Fl::event_x() - Track::width();
|
int X = Fl::event_x() - Track::width();
|
||||||
|
@ -322,7 +341,8 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
|
||||||
/* menu->add( "Add Track", 0, 0, 0 ); */
|
/* menu->add( "Add Track", 0, 0, 0 ); */
|
||||||
|
|
||||||
menu->add( "Add Audio Track", 'a', 0, 0 );
|
menu->add( "Add Audio Track", 'a', 0, 0 );
|
||||||
menu->add( "Tempo from range", 't', 0, 0 );
|
menu->add( "Tempo from range (beat)", 't', 0, 0 );
|
||||||
|
menu->add( "Tempo from range (bar)", FL_CTRL + 't', 0, 0 );
|
||||||
menu->add( "Playhead to mouse", 'p', 0, 0 );
|
menu->add( "Playhead to mouse", 'p', 0, 0 );
|
||||||
menu->add( "P1 to mouse", '[', 0, 0 );
|
menu->add( "P1 to mouse", '[', 0, 0 );
|
||||||
menu->add( "P2 to mouse", ']', 0, 0 );
|
menu->add( "P2 to mouse", ']', 0, 0 );
|
||||||
|
|
|
@ -101,6 +101,7 @@ class Timeline : public Fl_Overlay_Window, public RWLock
|
||||||
void cb_scroll ( Fl_Widget *w );
|
void cb_scroll ( Fl_Widget *w );
|
||||||
static void menu_cb ( Fl_Widget *w, void *v );
|
static void menu_cb ( Fl_Widget *w, void *v );
|
||||||
void menu_cb ( Fl_Menu_ *m );
|
void menu_cb ( Fl_Menu_ *m );
|
||||||
|
void fix_range ( void );
|
||||||
|
|
||||||
int _fpp; /* frames per pixel, power of two */
|
int _fpp; /* frames per pixel, power of two */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue