@@ -92,7 +92,7 @@ Engine::sync ( jack_transport_state_t state, jack_position_t *pos ) | |||||
/* FIXME: what's the right thing to do here? */ | /* FIXME: what's the right thing to do here? */ | ||||
// request_locate( pos->frame ); | // request_locate( pos->frame ); | ||||
return 1; | return 1; | ||||
// return transport.frame == pos->frame; | |||||
// return transport->frame == pos->frame; | |||||
break; | break; | ||||
default: | default: | ||||
printf( "unknown transport state.\n" ); | printf( "unknown transport state.\n" ); | ||||
@@ -105,9 +105,9 @@ Engine::sync ( jack_transport_state_t state, jack_position_t *pos ) | |||||
int | int | ||||
Engine::process ( nframes_t nframes ) | Engine::process ( nframes_t nframes ) | ||||
{ | { | ||||
transport.poll(); | |||||
transport->poll(); | |||||
if ( ! transport.rolling ) | |||||
if ( ! transport->rolling ) | |||||
/* FIXME: fill all ports with silence */ | /* FIXME: fill all ports with silence */ | ||||
return 0; | return 0; | ||||
@@ -561,7 +561,7 @@ Timeline::draw ( void ) | |||||
void | void | ||||
Timeline::draw_playhead ( void ) | Timeline::draw_playhead ( void ) | ||||
{ | { | ||||
int x = ( ts_to_x( transport.frame ) - ts_to_x( xoffset ) ) + tracks->x() + Track::width(); | |||||
int x = ( ts_to_x( transport->frame ) - ts_to_x( xoffset ) ) + tracks->x() + Track::width(); | |||||
if ( x < tracks->x() + Track::width() || x > tracks->x() + tracks->w() ) | if ( x < tracks->x() + Track::width() || x > tracks->x() + tracks->w() ) | ||||
return; | return; | ||||
@@ -590,10 +590,10 @@ Timeline::redraw_playhead ( void ) | |||||
{ | { | ||||
static nframes_t last_playhead = -1; | static nframes_t last_playhead = -1; | ||||
if ( last_playhead != transport.frame ) | |||||
if ( last_playhead != transport->frame ) | |||||
{ | { | ||||
redraw_overlay(); | redraw_overlay(); | ||||
last_playhead = transport.frame; | |||||
last_playhead = transport->frame; | |||||
} | } | ||||
} | } | ||||
@@ -702,19 +702,21 @@ Timeline::handle ( int m ) | |||||
return 1; | return 1; | ||||
} | } | ||||
case FL_Home: | |||||
transport.locate( 0 ); | |||||
return 1; | |||||
case ' ': | |||||
transport.toggle(); | |||||
return 1; | |||||
/* case FL_Home: */ | |||||
/* transport->locate( 0 ); */ | |||||
/* return 1; */ | |||||
/* case ' ': */ | |||||
/* transport->toggle(); */ | |||||
/* return 1; */ | |||||
case 'p': | case 'p': | ||||
{ | { | ||||
int X = Fl::event_x() - Track::width(); | int X = Fl::event_x() - Track::width(); | ||||
if ( X > 0 ) | if ( X > 0 ) | ||||
{ | { | ||||
transport.locate( xoffset + x_to_ts( X ) ); | |||||
transport->locate( xoffset + x_to_ts( X ) ); | |||||
} | } | ||||
return 1; | return 1; | ||||
@@ -62,9 +62,9 @@ Track::cb_button ( Fl_Widget *w ) | |||||
{ | { | ||||
/* FIXME: wrong place for this! */ | /* FIXME: wrong place for this! */ | ||||
if ( record_button->value() ) | if ( record_button->value() ) | ||||
record_ds->start( transport.frame ); | |||||
record_ds->start( transport->frame ); | |||||
else | else | ||||
record_ds->stop( transport.frame ); | |||||
record_ds->stop( transport->frame ); | |||||
} | } | ||||
else | else | ||||
if ( w == take_menu ) | if ( w == take_menu ) | ||||
@@ -20,7 +20,7 @@ | |||||
#include "Transport.H" | #include "Transport.H" | ||||
#include "Engine.H" | #include "Engine.H" | ||||
Transport transport; | |||||
// Transport transport; | |||||
#define client engine->client() | #define client engine->client() | ||||
@@ -22,8 +22,69 @@ | |||||
#include <jack/transport.h> | #include <jack/transport.h> | ||||
#include "types.h" | #include "types.h" | ||||
struct Transport : public jack_position_t | |||||
#include <FL/Fl_Pack.H> | |||||
#include <FL/Fl_Button.H> | |||||
#include <stdio.h> | |||||
struct Transport : public jack_position_t, public Fl_Pack | |||||
{ | { | ||||
private: | |||||
Fl_Button *_home_button; | |||||
Fl_Button *_play_button; | |||||
Fl_Button *_record_button; | |||||
static | |||||
void | |||||
cb_button ( Fl_Widget *w, void *v ) | |||||
{ | |||||
((Transport*)v)->cb_button( w ); | |||||
} | |||||
void | |||||
cb_button ( Fl_Widget *w ) | |||||
{ | |||||
if ( w == _home_button ) | |||||
locate( 0 ); | |||||
else if ( w == _play_button ) | |||||
toggle(); | |||||
else if ( w == _record_button ) | |||||
printf( "FIXME: record now\n" ); | |||||
} | |||||
public: | |||||
Transport ( int X, int Y, int W, int H, const char *L=0 ) | |||||
: Fl_Pack( X, Y, W, H, L ) | |||||
{ | |||||
const int bw = W / 3; | |||||
type( HORIZONTAL ); | |||||
Fl_Button *o; | |||||
_home_button = o = new Fl_Button( 0, 0, bw, 0, "@<|" ); | |||||
o->labeltype( FL_EMBOSSED_LABEL ); | |||||
o->callback( cb_button, this ); | |||||
o->shortcut( FL_Home ); | |||||
o->box( FL_UP_BOX ); | |||||
_play_button = o = new Fl_Button( 0, 0, bw, 0, "@>" ); | |||||
o->labeltype( FL_EMBOSSED_LABEL ); | |||||
o->callback( cb_button, this ); | |||||
o->shortcut( ' ' ); | |||||
o->box( FL_UP_BOX ); | |||||
_record_button = o = new Fl_Button( 0, 0, bw, 0, "@circle" ); | |||||
o->labeltype( FL_EMBOSSED_LABEL ); | |||||
o->labelcolor( FL_RED ); | |||||
o->shortcut( 'R' ); | |||||
o->callback( cb_button, this ); | |||||
o->box( FL_UP_BOX ); | |||||
end(); | |||||
} | |||||
bool rolling; | bool rolling; | ||||
void poll ( void ); | void poll ( void ); | ||||
@@ -33,4 +94,4 @@ struct Transport : public jack_position_t | |||||
void toggle ( void ); | void toggle ( void ); | ||||
}; | }; | ||||
extern Transport transport; | |||||
extern Transport* transport; |
@@ -47,14 +47,16 @@ | |||||
#include "Time_Sequence.H" | #include "Time_Sequence.H" | ||||
#include "Control_Sequence.H" | #include "Control_Sequence.H" | ||||
#include "Transport.H" | |||||
#include "Loggable.H" | #include "Loggable.H" | ||||
#include "Track.H" | #include "Track.H" | ||||
// #include "const.h" | |||||
#include "Engine.H" | #include "Engine.H" | ||||
Engine *engine; | Engine *engine; | ||||
Timeline *timeline; | Timeline *timeline; | ||||
Transport *transport; | |||||
void cb_undo ( Fl_Widget *w, void *v ) | void cb_undo ( Fl_Widget *w, void *v ) | ||||
{ | { | ||||
@@ -67,6 +69,7 @@ main ( int argc, char **argv ) | |||||
Fl_Window *main_window = new Fl_Window( 0, 0, 1024, 768 ); | Fl_Window *main_window = new Fl_Window( 0, 0, 1024, 768 ); | ||||
Fl::visual( FL_RGB8 ); | Fl::visual( FL_RGB8 ); | ||||
Fl::visible_focus( 0 ); | |||||
Fl::get_system_colors(); | Fl::get_system_colors(); | ||||
Fl::scheme( "plastic" ); | Fl::scheme( "plastic" ); | ||||
@@ -83,6 +86,10 @@ main ( int argc, char **argv ) | |||||
/* TODO: change to seesion dir */ | /* TODO: change to seesion dir */ | ||||
transport = new Transport( 0, 0, 300, 24 ); | |||||
main_window->add( transport ); | |||||
/* we don't really need a pointer for this */ | /* we don't really need a pointer for this */ | ||||
engine = new Engine; | engine = new Engine; | ||||
engine->init(); | engine->init(); | ||||