- Timestamp:
- Jul 6, 2006, 6:33:39 PM (19 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 660cad22
- Parents:
- 8e3a067
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/utils.c
r8e3a067 r55c6da4 21 21 int lash_main (void); 22 22 void save_data (void); 23 void restore_data(lash_config_t * config);23 void restore_data(lash_config_t * lash_config); 24 24 pthread_t lash_thread; 25 25 #endif /* LASH_SUPPORT */ … … 448 448 449 449 int lash_main(void) { 450 lash_event_t * event;451 lash_config_t * config;452 453 while (( event = lash_get_event(aubio_lash_client))) {454 switch (lash_event_get_type( event)) {450 lash_event_t *lash_event; 451 lash_config_t *lash_config; 452 453 while ((lash_event = lash_get_event(aubio_lash_client))) { 454 switch (lash_event_get_type(lash_event)) { 455 455 case LASH_Quit: 456 lash_event_destroy( event);456 lash_event_destroy(lash_event); 457 457 exit(1); 458 458 return 1; 459 459 case LASH_Restore_Data_Set: 460 lash_send_event(aubio_lash_client, event);460 lash_send_event(aubio_lash_client, lash_event); 461 461 break; 462 462 case LASH_Save_Data_Set: 463 463 save_data(); 464 lash_send_event(aubio_lash_client, event);464 lash_send_event(aubio_lash_client, lash_event); 465 465 break; 466 466 case LASH_Server_Lost: … … 468 468 default: 469 469 printf("%s: received unknown LASH event of type %d", 470 __FUNCTION__, lash_event_get_type( event));471 lash_event_destroy( event);470 __FUNCTION__, lash_event_get_type(lash_event)); 471 lash_event_destroy(lash_event); 472 472 break; 473 473 } 474 474 } 475 475 476 while (( config = lash_get_config(aubio_lash_client))) {477 restore_data( config);478 lash_config_destroy( config);476 while ((lash_config = lash_get_config(aubio_lash_client))) { 477 restore_data(lash_config); 478 lash_config_destroy(lash_config); 479 479 } 480 480 … … 483 483 484 484 void save_data() { 485 lash_config_t * config;486 487 config = lash_config_new_with_key("threshold");488 lash_config_set_value_double( config, threshold);489 lash_send_config(aubio_lash_client, config);490 491 } 492 493 void restore_data(lash_config_t * config) {494 const char * key;495 496 key = lash_config_get_key(config);497 498 if (strcmp( key, "threshold") == 0) {499 threshold = lash_config_get_value_double( config);485 lash_config_t *lash_config; 486 487 lash_config = lash_config_new_with_key("threshold"); 488 lash_config_set_value_double(lash_config, threshold); 489 lash_send_config(aubio_lash_client, lash_config); 490 491 } 492 493 void restore_data(lash_config_t * lash_config) { 494 const char *lash_key; 495 496 lash_key = lash_config_get_key(lash_config); 497 498 if (strcmp(lash_key, "threshold") == 0) { 499 threshold = lash_config_get_value_double(lash_config); 500 500 return; 501 501 }
Note: See TracChangeset
for help on using the changeset viewer.