Changeset 71482a9
- Timestamp:
- Jun 29, 2006, 8:49:42 PM (18 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:
- 4b58c43
- Parents:
- 3ba55dd6
- Location:
- examples
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/Makefile.am
r3ba55dd6 r71482a9 4 4 5 5 # global flags 6 AM_CFLAGS = -DAUBIO_PREFIX=\"$(prefix)\" -I$(top_srcdir)/src -I$(top_srcdir)/ext @LA DCCA_CFLAGS@ @FFTWLIB_CFLAGS@7 AM_LDFLAGS = -L$(top_builddir)/src -L$(top_builddir)/ext -laubioext -laubio @LA DCCA_LIBS@6 AM_CFLAGS = -DAUBIO_PREFIX=\"$(prefix)\" -I$(top_srcdir)/src -I$(top_srcdir)/ext @LASH_CFLAGS@ @FFTWLIB_CFLAGS@ 7 AM_LDFLAGS = -L$(top_builddir)/src -L$(top_builddir)/ext -laubioext -laubio @LASH_LIBS@ 8 8 #AM_SOURCES = utils.c 9 9 -
examples/utils.c
r3ba55dd6 r71482a9 13 13 #include "utils.h" 14 14 15 /* not supported yet */ 16 #ifdef LADCCA_SUPPORT 17 #include <ladcca/ladcca.h> 18 cca_client_t * aubio_cca_client; 19 #endif /* LADCCA_SUPPORT */ 15 #ifdef LASH_SUPPORT 16 #include <lash/lash.h> 17 #include <pthread.h> 18 lash_client_t * aubio_lash_client; 19 lash_args_t * lash_args; 20 void * lash_thread_main (void * data); 21 int lash_main (void); 22 void save_data (void); 23 void restore_data(lash_config_t * config); 24 pthread_t lash_thread; 25 #endif /* LASH_SUPPORT */ 20 26 21 27 /* settings */ … … 121 127 {NULL , 0, NULL, 0} 122 128 }; 129 #ifdef LASH_SUPPORT 130 lash_args = lash_extract_args(&argc, &argv); 131 #endif /* LASH_SUPPORT */ 123 132 prog_name = argv[0]; 124 133 if( argc < 1 ) { … … 228 237 } 229 238 } 239 230 240 return 0; 231 241 } … … 260 270 fileout = new_aubio_sndfile_wo(file, output_filename); 261 271 } 272 #ifdef LASH_SUPPORT 273 else { 274 aubio_lash_client = lash_init(lash_args, argv[0], 275 LASH_Config_Data_Set | LASH_Terminal, 276 LASH_PROTOCOL(2, 0)); 277 if (!aubio_lash_client) { 278 fprintf(stderr, "%s: could not initialise lash\n", __FUNCTION__); 279 } 280 /* tell the lash server our client id */ 281 if (lash_enabled(aubio_lash_client)) { 282 lash_event_t * event = (lash_event_t *)lash_event_new_with_type(LASH_Client_Name); 283 lash_event_set_string(event, "aubio"); 284 lash_send_event(aubio_lash_client, event); 285 } 286 } 287 pthread_create(&lash_thread, NULL, lash_thread_main, NULL); 288 #endif /* LASH_SUPPORT */ 262 289 263 290 ibuf = new_fvec(overlap_size, channels); … … 407 434 } 408 435 436 #if LASH_SUPPORT 437 438 void * lash_thread_main(void *data) 439 { 440 printf("LASH thread running\n"); 441 442 while (!lash_main()) 443 usleep(1000); 444 445 printf("LASH thread finished\n"); 446 return NULL; 447 } 448 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)) { 455 case LASH_Quit: 456 lash_event_destroy(event); 457 exit(1); 458 return 1; 459 case LASH_Restore_Data_Set: 460 lash_send_event(aubio_lash_client, event); 461 break; 462 case LASH_Save_Data_Set: 463 save_data(); 464 lash_send_event(aubio_lash_client, event); 465 break; 466 case LASH_Server_Lost: 467 return 1; 468 default: 469 printf("%s: received unknown LASH event of type %d", 470 __FUNCTION__, lash_event_get_type(event)); 471 lash_event_destroy(event); 472 break; 473 } 474 } 475 476 while ((config = lash_get_config(aubio_lash_client))) { 477 restore_data(config); 478 lash_config_destroy(config); 479 } 480 481 return 0; 482 } 483 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); 500 return; 501 } 502 503 } 504 505 #endif /* LASH_SUPPORT */ 506
Note: See TracChangeset
for help on using the changeset viewer.