summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main-sdl.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/main-sdl.c b/main-sdl.c
index 6bc3970..6014198 100644
--- a/main-sdl.c
+++ b/main-sdl.c
@@ -52,12 +52,12 @@ find_harfe()
52 while ((dp = readdir(dev)) != NULL) { 52 while ((dp = readdir(dev)) != NULL) {
53 size_t len = dp->d_namlen; 53 size_t len = dp->d_namlen;
54 char *name = dp->d_name; 54 char *name = dp->d_name;
55 int i, tail = 3; 55 int i;
56 56
57 if (len < 6 || name[0] != 'c' || name[1] != 'u' || name[2] != '.') 57 if (len < 6 || name[0] != 'c' || name[1] != 'u' || name[2] != '.')
58 continue; 58 continue;
59 59
60 for (i = 0; i < len - tail; ++i) 60 for (i = 0; i < len - 3; ++i)
61 if (name[i] == 'H' && name[i + 1] == 'A' && name[i + 2] == 'R' ) { 61 if (name[i] == 'H' && name[i + 1] == 'A' && name[i + 2] == 'R' ) {
62 if ((harfe = calloc(1, 5 + len + 1))) { 62 if ((harfe = calloc(1, 5 + len + 1))) {
63 sprintf(harfe, "/dev/"); 63 sprintf(harfe, "/dev/");
@@ -313,6 +313,7 @@ main(int argc, char **argv)
313 L - Load config from local default (config_midi) 313 L - Load config from local default (config_midi)
314 314
315 Y - Invert String order 315 Y - Invert String order
316 X - Invert Octave order
316 317
317 Q - Reset local Config 318 Q - Reset local Config
318 C - Start calibration 319 C - Start calibration
@@ -330,16 +331,6 @@ main(int argc, char **argv)
330 if (ev.key.keysym.scancode == SDL_SCANCODE_DOWN) g_down_pressed = 0; 331 if (ev.key.keysym.scancode == SDL_SCANCODE_DOWN) g_down_pressed = 0;
331 break; 332 break;
332 case SDL_KEYDOWN: 333 case SDL_KEYDOWN:
333/*
334 if ( ev.key.keysym.sym >= SDLK_1 && ev.key.keysym.sym <= SDLK_9 )
335 engine_select_string( ev.key.keysym.sym - SDLK_1 );
336 if ( ev.key.keysym.sym == SDLK_BACKSPACE || ev.key.keysym.sym == SDLK_DELETE )
337 engine_delete_selected_string( );
338 if ( ev.key.keysym.sym == SDLK_d ) {
339 g_stringsdescending = 1 - g_stringsdescending;
340 printf( "String order (left to right) is now %sscending.\n", g_stringsdescending ? "de" : "a" );
341 }
342*/
343 if ( ev.key.keysym.scancode == SDL_SCANCODE_0) 334 if ( ev.key.keysym.scancode == SDL_SCANCODE_0)
344 engine_select_config(sel_none); 335 engine_select_config(sel_none);
345 if ( ev.key.keysym.scancode == SDL_SCANCODE_1) 336 if ( ev.key.keysym.scancode == SDL_SCANCODE_1)
@@ -349,14 +340,16 @@ main(int argc, char **argv)
349 if ( ev.key.keysym.scancode == SDL_SCANCODE_3) 340 if ( ev.key.keysym.scancode == SDL_SCANCODE_3)
350 engine_select_config(sel_2_oct); 341 engine_select_config(sel_2_oct);
351 if ( ev.key.keysym.scancode == SDL_SCANCODE_4) 342 if ( ev.key.keysym.scancode == SDL_SCANCODE_4)
352 engine_select_config(sel_3_oct_top);
353 if ( ev.key.keysym.scancode == SDL_SCANCODE_5)
354 engine_select_config(sel_3_oct_bottom); 343 engine_select_config(sel_3_oct_bottom);
344 if ( ev.key.keysym.scancode == SDL_SCANCODE_5)
345 engine_select_config(sel_3_oct_top);
355 346
356 if ( ev.key.keysym.scancode == SDL_SCANCODE_UP && ! g_up_pressed++) 347 if ( ev.key.keysym.scancode == SDL_SCANCODE_UP)
357 engine_change_selected(1); 348 if ( ev.key.repeat || ! g_up_pressed++)
358 if ( ev.key.keysym.scancode == SDL_SCANCODE_DOWN && ! g_down_pressed++) 349 engine_change_selected(1);
359 engine_change_selected(-1); 350 if ( ev.key.keysym.scancode == SDL_SCANCODE_DOWN)
351 if ( ev.key.repeat || ! g_down_pressed++)
352 engine_change_selected(-1);
360 353
361 if ( ev.key.keysym.scancode == SDL_SCANCODE_S) { /* export locally */ 354 if ( ev.key.keysym.scancode == SDL_SCANCODE_S) { /* export locally */
362 const char *homeDir = getenv("HOME"); 355 const char *homeDir = getenv("HOME");
@@ -419,7 +412,7 @@ main(int argc, char **argv)
419 calib_fetch(); 412 calib_fetch();
420 else 413 else
421 calib_init(); 414 calib_init();
422 g_calibration_running = 1 - g_calibration_running; 415 g_calibration_running ^= 1;
423 } 416 }
424 if ( ev.key.keysym.scancode == SDL_SCANCODE_E) { 417 if ( ev.key.keysym.scancode == SDL_SCANCODE_E) {
425 char confdump[512]; 418 char confdump[512];
@@ -461,7 +454,7 @@ main(int argc, char **argv)
461 engine_handle_point(&p, now()); 454 engine_handle_point(&p, now());
462 } 455 }
463 break; 456 break;
464 case SDL_DROPFILE: { // In case if dropped file 457 case SDL_DROPFILE: {
465 char t[512]; 458 char t[512];
466 int ret; 459 int ret;
467 snprintf( t, sizeof(t), "Do you want to import config file %s?\n", ev.drop.file); 460 snprintf( t, sizeof(t), "Do you want to import config file %s?\n", ev.drop.file);