Midi-Mapper: Don't get confused if user neglects to operate all controls on the first run.

This commit is contained in:
Jonathan Moore Liles 2020-09-26 20:32:51 -07:00
parent cd4896b762
commit 10bcd0c2d7
1 changed files with 9 additions and 4 deletions

View File

@ -438,6 +438,9 @@ save_settings ( void )
} }
static int max_signal = 0;
bool bool
load_settings ( void ) load_settings ( void )
{ {
@ -451,12 +454,16 @@ load_settings ( void )
char *signal_name; char *signal_name;
char *midi_event; char *midi_event;
max_signal = 0;
while ( 2 == fscanf( fp, "[%m[^]]] %m[^\n]\n", &midi_event, &signal_name ) ) while ( 2 == fscanf( fp, "[%m[^]]] %m[^\n]\n", &midi_event, &signal_name ) )
{ {
DMESSAGE( "%s, %s", midi_event, signal_name ); DMESSAGE( "%s, %s", midi_event, signal_name );
if ( sig_map.find( midi_event ) == sig_map.end() ) if ( sig_map.find( midi_event ) == sig_map.end() )
{ {
++max_signal;
signal_mapping m; signal_mapping m;
m.deserialize( midi_event ); m.deserialize( midi_event );
@ -700,8 +707,6 @@ main ( int argc, char **argv )
DMESSAGE( "waiting for events" ); DMESSAGE( "waiting for events" );
static int max_signal = 1;
jack_midi_event_t ev; jack_midi_event_t ev;
midievent e; midievent e;
while ( ! got_sigterm ) while ( ! got_sigterm )
@ -749,7 +754,7 @@ main ( int argc, char **argv )
{ {
char *s; char *s;
asprintf( &s, "/control/%i", max_signal++ ); asprintf( &s, "/control/%i", ++max_signal );
signal_mapping m; signal_mapping m;