Work on "takes" system.
This commit is contained in:
parent
8a85a8c217
commit
85ed98e040
|
@ -163,8 +163,13 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
|
||||||
l = o;
|
l = o;
|
||||||
// o->end();
|
// o->end();
|
||||||
|
|
||||||
t->track( o );
|
t->add( o );
|
||||||
|
t->add( new Control_Track( 0, 0, 1, 100 ) );
|
||||||
|
t->show_all_takes();
|
||||||
|
|
||||||
t->color( (Fl_Color)rand() );
|
t->color( (Fl_Color)rand() );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
3
Track.H
3
Track.H
|
@ -107,6 +107,9 @@ public:
|
||||||
void prev ( Track *t ) { _prev = t; }
|
void prev ( Track *t ) { _prev = t; }
|
||||||
void next ( Track *t ) { _next = t; }
|
void next ( Track *t ) { _next = t; }
|
||||||
|
|
||||||
|
const char * name ( void ) const { return _name; }
|
||||||
|
void name ( char *s ) { if ( _name ) free( _name ); _name = s; }
|
||||||
|
|
||||||
void sort ( void );
|
void sort ( void );
|
||||||
|
|
||||||
void remove ( Track_Widget *r );
|
void remove ( Track_Widget *r );
|
||||||
|
|
|
@ -55,6 +55,24 @@ Track_Header::cb_button ( Fl_Widget *w )
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if ( w == take_menu )
|
||||||
|
{
|
||||||
|
printf( "%d\n", take_menu->value() );
|
||||||
|
|
||||||
|
const char *s = take_menu->menu()[ take_menu->value() ].text;
|
||||||
|
|
||||||
|
for ( int i = takes->children(); i--; )
|
||||||
|
{
|
||||||
|
Track *t = (Track*)takes->child( i );
|
||||||
|
if ( ! strcmp( s, t->name() ) )
|
||||||
|
{
|
||||||
|
track( t );
|
||||||
|
redraw();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,10 +80,9 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) :
|
||||||
Fl_Group ( X, Y, W, H, L )
|
Fl_Group ( X, Y, W, H, L )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
_name = NULL;
|
_name = NULL;
|
||||||
_track = NULL;
|
|
||||||
_selected = false;
|
_selected = false;
|
||||||
|
_show_all_takes = false;
|
||||||
_size = 1;
|
_size = 1;
|
||||||
|
|
||||||
Fl_Group::size( w(), height() );
|
Fl_Group::size( w(), height() );
|
||||||
|
@ -122,6 +139,7 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) :
|
||||||
o->box( FL_THIN_UP_BOX );
|
o->box( FL_THIN_UP_BOX );
|
||||||
o->color( FL_LIGHT1 );
|
o->color( FL_LIGHT1 );
|
||||||
o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
|
o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
|
||||||
|
o->callback( cb_button, this );
|
||||||
}
|
}
|
||||||
o->end();
|
o->end();
|
||||||
}
|
}
|
||||||
|
@ -162,8 +180,6 @@ Track_Header::width()
|
||||||
void
|
void
|
||||||
Track_Header::track( Track * t )
|
Track_Header::track( Track * t )
|
||||||
{
|
{
|
||||||
_track = t;
|
t->size( 1, h() );
|
||||||
|
takes->insert( *t, 0 );
|
||||||
t->size( 1, takes->h() );
|
|
||||||
takes->add( t );
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,12 +40,14 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Track * _track;
|
// Track * _track;
|
||||||
|
|
||||||
char *_name;
|
char *_name;
|
||||||
|
|
||||||
bool _selected;
|
bool _selected;
|
||||||
|
|
||||||
|
bool _show_all_takes;
|
||||||
|
|
||||||
int _size;
|
int _size;
|
||||||
|
|
||||||
enum { AUDIO } _type;
|
enum { AUDIO } _type;
|
||||||
|
@ -102,7 +104,7 @@ public:
|
||||||
|
|
||||||
assert( t );
|
assert( t );
|
||||||
|
|
||||||
_track = t;
|
track( t );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,7 +122,7 @@ public:
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
asprintf( &sa[ i++ ], ":name \"%s\"", _name ? _name : "" );
|
asprintf( &sa[ i++ ], ":name \"%s\"", _name ? _name : "" );
|
||||||
asprintf( &sa[ i++ ], ":track 0x%X", _track ? _track->id() : 0 );
|
asprintf( &sa[ i++ ], ":track 0x%X", track() ? track()->id() : 0 );
|
||||||
asprintf( &sa[ i++ ], ":selected %d", _selected );
|
asprintf( &sa[ i++ ], ":selected %d", _selected );
|
||||||
/* asprintf( &sa[ i++ ], ":record %d", record_button->value() ); */
|
/* asprintf( &sa[ i++ ], ":record %d", record_button->value() ); */
|
||||||
/* asprintf( &sa[ i++ ], ":solo %d", solo_button->value() ); */
|
/* asprintf( &sa[ i++ ], ":solo %d", solo_button->value() ); */
|
||||||
|
@ -172,9 +174,17 @@ public:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_size = v;
|
_size = v;
|
||||||
|
|
||||||
|
|
||||||
|
for ( int i = takes->children(); i--; )
|
||||||
|
{
|
||||||
|
takes->child( i )->size( w(), height() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( _show_all_takes )
|
||||||
|
Fl_Group::size( w(), height() * takes->children() );
|
||||||
|
else
|
||||||
Fl_Group::size( w(), height() );
|
Fl_Group::size( w(), height() );
|
||||||
if ( _track )
|
|
||||||
_track->size( _track->w(), height() );
|
|
||||||
|
|
||||||
if ( _size == 0 )
|
if ( _size == 0 )
|
||||||
controls->hide();
|
controls->hide();
|
||||||
|
@ -191,6 +201,8 @@ public:
|
||||||
return table[ _size ];
|
return table[ _size ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void show_all_takes ( void ) { Fl_Group::size( w(), height() * takes->children() ); _show_all_takes = true; }
|
||||||
|
|
||||||
const char * name ( void ) const { return _name; }
|
const char * name ( void ) const { return _name; }
|
||||||
bool mute ( void ) const { return mute_button->value(); }
|
bool mute ( void ) const { return mute_button->value(); }
|
||||||
bool solo ( void ) const { return solo_button->value(); }
|
bool solo ( void ) const { return solo_button->value(); }
|
||||||
|
@ -206,7 +218,22 @@ public:
|
||||||
static int width();
|
static int width();
|
||||||
|
|
||||||
void track( Track * t );
|
void track( Track * t );
|
||||||
Track * track ( void ) { return _track; }
|
Track * track ( void ) { return (Track*)takes->child( 0 ); }
|
||||||
|
|
||||||
|
void add ( Track * t )
|
||||||
|
{
|
||||||
|
takes->add( t );
|
||||||
|
char pat[20];
|
||||||
|
snprintf( pat, sizeof( pat ), "%d", takes->children() );
|
||||||
|
t->name( strdup( pat ) );
|
||||||
|
take_menu->add( t->name() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void remote ( Track *t )
|
||||||
|
{
|
||||||
|
takes->remove( t );
|
||||||
|
// take_menu->remove( t->name() );
|
||||||
|
}
|
||||||
|
|
||||||
int handle ( int m )
|
int handle ( int m )
|
||||||
{
|
{
|
||||||
|
|
12
Waveform.C
12
Waveform.C
|
@ -29,6 +29,9 @@
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
const bool outline = true;
|
||||||
|
const bool vary_color = true;
|
||||||
|
|
||||||
/** draw a portion of /clip/'s waveform. coordinates are the portion to draw */
|
/** draw a portion of /clip/'s waveform. coordinates are the portion to draw */
|
||||||
void
|
void
|
||||||
draw_waveform ( int ox, int X, int Y, int W, int H, Audio_File *_clip, int channel, float fpp, nframes_t _start, nframes_t _end, float _scale, Fl_Color color )
|
draw_waveform ( int ox, int X, int Y, int W, int H, Audio_File *_clip, int channel, float fpp, nframes_t _start, nframes_t _end, float _scale, Fl_Color color )
|
||||||
|
@ -57,8 +60,10 @@ draw_waveform ( int ox, int X, int Y, int W, int H, Audio_File *_clip, int chann
|
||||||
p.max *= _scale;
|
p.max *= _scale;
|
||||||
p.min *= _scale;
|
p.min *= _scale;
|
||||||
|
|
||||||
// FIXME: cache this stuff.
|
if ( vary_color )
|
||||||
fl_color( fl_color_average( FL_RED, color, fabs( p.max - p.min ) - 1.0 ) );
|
fl_color( fl_color_average( FL_RED, color, fabs( p.max - p.min ) - 1.0 ) );
|
||||||
|
else
|
||||||
|
fl_color( color );
|
||||||
|
|
||||||
if ( p.min < -1.0 || p.max > 1.0 )
|
if ( p.min < -1.0 || p.max > 1.0 )
|
||||||
fl_color( FL_RED );
|
fl_color( FL_RED );
|
||||||
|
@ -67,6 +72,9 @@ draw_waveform ( int ox, int X, int Y, int W, int H, Audio_File *_clip, int chann
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( outline )
|
||||||
|
{
|
||||||
|
|
||||||
fl_color( fl_darker( fl_darker( color ) ) );
|
fl_color( fl_darker( fl_darker( color ) ) );
|
||||||
|
|
||||||
fl_line_style( FL_SOLID, 2 );
|
fl_line_style( FL_SOLID, 2 );
|
||||||
|
@ -101,5 +109,7 @@ draw_waveform ( int ox, int X, int Y, int W, int H, Audio_File *_clip, int chann
|
||||||
|
|
||||||
fl_line_style( FL_SOLID, 0 );
|
fl_line_style( FL_SOLID, 0 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
fl_pop_clip();
|
fl_pop_clip();
|
||||||
}
|
}
|
||||||
|
|
3
main.C
3
main.C
|
@ -65,6 +65,7 @@ main ( int argc, char **argv )
|
||||||
|
|
||||||
Fl::get_system_colors();
|
Fl::get_system_colors();
|
||||||
Fl::scheme( "plastic" );
|
Fl::scheme( "plastic" );
|
||||||
|
// Fl::scheme( "gtk+" );
|
||||||
|
|
||||||
Loggable::open( "history" );
|
Loggable::open( "history" );
|
||||||
/* welcome to C++ */
|
/* welcome to C++ */
|
||||||
|
@ -81,7 +82,7 @@ main ( int argc, char **argv )
|
||||||
o->callback( cb_undo, 0 );
|
o->callback( cb_undo, 0 );
|
||||||
|
|
||||||
main_window->end();
|
main_window->end();
|
||||||
main_window->show();
|
main_window->show( argc, argv );
|
||||||
|
|
||||||
Fl::run();
|
Fl::run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue