- Timestamp:
- Sep 25, 2009, 9:56:22 PM (15 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:
- bab0a12
- Parents:
- c201306
- Location:
- examples
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/utils.c
rc201306 rebbf5a0 83 83 smpl_t curlevel = 0.; 84 84 smpl_t maxonset = 0.; 85 86 /* midi objects */87 aubio_midi_player_t *mplay;88 aubio_midi_driver_t *mdriver;89 aubio_midi_event_t *event;90 85 91 86 smpl_t curnote = 0.; … … 247 242 debug ("Output file : %s\n", output_filename); 248 243 } else { 249 if (HAVE_JACK) { 250 251 252 } else { 253 254 255 256 } 244 #if HAVE_JACK 245 debug ("Jack input output\n"); 246 usejack = 1; 247 #else 248 debug 249 ("Error: Could not switch to jack mode\n aubio was compiled without jack support\n"); 250 exit (1); 251 #endif 257 252 } 258 253 … … 371 366 } 372 367 368 #if HAVE_JACK 369 aubio_jack_t *jack_setup; 370 #endif 371 373 372 void 374 373 examples_common_process (aubio_process_func_t process_func, … … 376 375 { 377 376 if (usejack) { 377 378 378 #if HAVE_JACK 379 aubio_jack_t *jack_setup;380 379 debug ("Jack init ...\n"); 381 380 jack_setup = new_aubio_jack (channels, channels, 382 1, 1, (aubio_process_func_t) process_func); 383 if (usepitch) { 384 debug ("Midi init ...\n"); 385 mplay = new_aubio_midi_player (); 386 mdriver = new_aubio_midi_driver ("alsa_seq", 387 (handle_midi_event_func_t) aubio_midi_send_event, mplay); 388 event = new_aubio_midi_event (); 389 } 381 0, 1, (aubio_process_func_t) process_func); 390 382 debug ("Jack activation ...\n"); 391 383 aubio_jack_activate (jack_setup); … … 393 385 pause (); 394 386 aubio_jack_close (jack_setup); 395 if (usepitch) {396 send_noteon (curnote, 0);397 del_aubio_midi_driver (mdriver);398 }399 387 #else 400 388 usage (stderr, 1); … … 445 433 } 446 434 447 448 435 void 449 436 send_noteon (int pitch, int velo) 450 437 { 451 438 smpl_t mpitch = floor (aubio_freqtomidi (pitch) + .5); 452 /* we should check if we use midi here, not jack */ 453 #if HAVE_ALSA 439 #if HAVE_JACK 440 jack_midi_event_t ev; 441 ev.size = 3; 442 ev.buffer = malloc (3 * sizeof (jack_midi_data_t)); // FIXME 443 ev.time = 0; 454 444 if (usejack) { 445 ev.buffer[2] = velo; 446 ev.buffer[1] = mpitch; 455 447 if (velo == 0) { 456 aubio_midi_event_set_type (event, NOTE_OFF);448 ev.buffer[0] = 0x80; /* note off */ 457 449 } else { 458 aubio_midi_event_set_type (event, NOTE_ON); 459 } 460 aubio_midi_event_set_channel (event, 0); 461 aubio_midi_event_set_pitch (event, mpitch); 462 aubio_midi_event_set_velocity (event, velo); 463 aubio_midi_direct_output (mdriver, event); 450 ev.buffer[0] = 0x90; /* note on */ 451 } 452 aubio_jack_midi_event_write (jack_setup, (jack_midi_event_t *) & ev); 464 453 } else 465 454 #endif -
examples/utils.h
rc201306 rebbf5a0 25 25 #include <unistd.h> 26 26 #include <math.h> /* for isfinite */ 27 #include <string.h> /* for strcmp */ 27 28 #include <aubio.h> 28 29 #include <aubioext.h> … … 115 116 extern smpl_t maxonset; 116 117 117 /* midi objects */118 extern aubio_midi_player_t *mplay;119 extern aubio_midi_driver_t *mdriver;120 extern aubio_midi_event_t *event;121 122 118 extern smpl_t curnote; 123 119 extern smpl_t newnote;
Note: See TracChangeset
for help on using the changeset viewer.