Don't fail if instrument definitions cannot be found. Use C Major as default mapping.

This commit is contained in:
Jonathan Moore Liles 2008-02-10 23:20:39 -06:00
parent 8f3f02d9aa
commit 0af405908d
5 changed files with 33 additions and 42 deletions

1
TODO
View File

@ -5,6 +5,7 @@
; General
* show playback progress on playlist.
* per phrase tempo setting? Perhaps a percentage of global tempo?
* add channel field to event list widget (but channel bits in pattern
event lists are currently meaningless.)

View File

@ -89,24 +89,13 @@ Canvas::handle_event_change ( void )
}
/** change grid to /g/, returns TRUE if new grid size differs from old */
bool
void
Canvas::grid ( Grid *g )
{
bool r = false;
if ( m.grid )
{
}
m.grid = g;
if ( ! g )
return false;
if ( m.vp )
if ( m.vp->w != g->viewport.w ||
m.vp->h != g->viewport.h )
r = true;
return;
m.vp = &g->viewport;
@ -114,11 +103,11 @@ Canvas::grid ( Grid *g )
DEBUG( "viewport: %s", s );
free( s );
m.mapping_drawn = m.ruler_drawn = false;
m.ruler_drawn = false;
resize_grid();
_update_row_mapping();
changed_mapping();
m.shape = m.grid->draw_shape();
@ -129,8 +118,6 @@ Canvas::grid ( Grid *g )
signal_draw();
signal_settings_change();
return r;
}
/** keep row compaction tables up-to-date */

View File

@ -124,7 +124,7 @@ public:
void handle_event_change ( void );
void set ( int x, int y );
bool grid ( Grid *g );
void grid ( Grid *g );
void changed_mapping ( void );
Grid * grid ( void );
void resize ( void );

View File

@ -636,18 +636,18 @@ if ( 0 == strncmp( picked, "Scale", strlen( "Scale" ) ) )
pattern_c->changed_mapping();
pattern_key_combo->activate();
}}
}} open selected
xywh {609 734 30 24} labeltype NO_LABEL
code0 {update_mapping_menu();}
} {
Submenu mapping_instrument_menu {
label Instrument open
xywh {10 10 74 25}
} {}
Submenu mapping_scale_menu {
label Scale open
xywh {25 25 74 25}
} {}
Submenu mapping_instrument_menu {
label Instrument open
xywh {10 10 74 25}
} {}
}
Fl_Choice pattern_key_combo {
label {&Key}
@ -1058,8 +1058,7 @@ if ( g->notes() )
else
pattern_notes_buffer->text( strdup( "" ) );} {}
}
Function {update_phrase_widgets()} {open
} {
Function {update_phrase_widgets()} {} {
code {phrase *g = (phrase *)phrase_c->grid();
if ( ! g )
@ -1075,8 +1074,7 @@ if ( g->notes() )
else
phrase_notes_buffer->text( strdup( "" ) );} {}
}
Function {update_sequence_widgets()} {open
} {
Function {update_sequence_widgets()} {} {
code {if ( playlist->notes() )
sequence_notes_buffer->text( playlist->notes() );
else
@ -1121,17 +1119,22 @@ o->value( val );
free( s );} {}
}
Function {update_mapping_menu()} {} {
Function {update_mapping_menu()} {open
} {
code {char **sa = Instrument::listing();
for ( int i = 0; sa[i]; i++ )
if ( sa )
{
for ( int i = 0; sa[i]; i++ )
{
char pat[512];
snprintf( pat, 512, "Instrument/%s", sa[i] );
mapping_menu->add( pat, 0, 0, 0, 0 );
free( sa[i] );
}
free( sa );
}
free( sa );
sa = Scale::listing();
for ( int i = 0; sa[i]; i++ )
@ -1151,7 +1154,7 @@ free( sa );} {}
if ( phrase_c->grid() )
ui->update_phrase_widgets();} {}
}
Function {find_numeric_menu_item( const Fl_Menu_Item *menu, int n )} {open return_type {static int}
Function {find_numeric_menu_item( const Fl_Menu_Item *menu, int n )} {return_type {static int}
} {
code {for ( unsigned int i = 0; menu[i].text; i++ )
{
@ -1161,7 +1164,7 @@ if ( phrase_c->grid() )
return 0;} {}
}
Function {save_dialog( const char *name )} {open return_type void
Function {save_dialog( const char *name )} {return_type void
} {
code {if ( ! name )
{
@ -1183,7 +1186,7 @@ return 0;} {}
if ( ! save_song( name ) )
fl_alert( "Could not save song" );} {}
}
Function {show_help_dialog( const char *file )} {open return_type void
Function {show_help_dialog( const char *file )} {return_type void
} {
code {char pat[256];
@ -1198,10 +1201,9 @@ help->load( pat );
help->show();
// FIXME: need to delete it somehow.
// help->show(1, argv);} {selected
// help->show(1, argv);} {}
}
}
Function {maybe_save_song()} {open return_type bool
Function {maybe_save_song()} {return_type bool
} {
code {if ( song.dirty )
{
@ -1222,7 +1224,7 @@ help->show();
return true;} {}
}
Function {switch_to_pattern( int n )} {open return_type void
Function {switch_to_pattern( int n )} {return_type void
} {
code {pattern *p = pattern::pattern_by_number( n );

View File

@ -53,7 +53,8 @@ pattern::pattern ( void )
d->length = x_to_ts( _bpb * _ppqn * _bars );
mapping.open( Mapping::INSTRUMENT, "Default" );
// mapping.open( Mapping::INSTRUMENT, "Default" );
mapping.open( Mapping::SCALE, "Major" );
_add();