Changeset 088760e for examples/utils.c


Ignore:
Timestamp:
Oct 31, 2018, 10:26:52 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/constantq
Children:
c03d191
Parents:
45c2c5c (diff), 7a54b37 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into feature/constantq

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/utils.c

    r45c2c5c r088760e  
    5555// more general stuff
    5656smpl_t silence_threshold = -90.;
     57smpl_t release_drop = 10.;
    5758uint_t mix_input = 0;
    5859
     
    6364aubio_source_t *this_source = NULL;
    6465aubio_sink_t *this_sink = NULL;
    65 fvec_t *ibuf;
    66 fvec_t *obuf;
     66fvec_t *input_buffer;
     67fvec_t *output_buffer;
    6768
    6869smpl_t miditap_note = 69.;
     
    7677
    7778#if HAVE_JACK
     79#define MAX_MIDI_EVENTS 128
     80#define MAX_MIDI_EVENT_SIZE 3
    7881aubio_jack_t *jack_setup;
    7982jack_midi_event_t ev;
     83jack_midi_data_t midi_data[MAX_MIDI_EVENTS * MAX_MIDI_EVENT_SIZE];
     84size_t midi_event_count = 0;
    8085#endif /* HAVE_JACK */
    8186
     
    122127#endif /* HAVE_JACK */
    123128  }
    124   ibuf = new_fvec (hop_size);
    125   obuf = new_fvec (hop_size);
     129  input_buffer = new_fvec (hop_size);
     130  output_buffer = new_fvec (hop_size);
    126131
    127132}
     
    129134void examples_common_del (void)
    130135{
    131 #ifdef HAVE_JACK
    132   if (ev.buffer) free(ev.buffer);
    133 #endif
    134   del_fvec (ibuf);
    135   del_fvec (obuf);
     136  del_fvec (input_buffer);
     137  del_fvec (output_buffer);
    136138  aubio_cleanup ();
    137139  fflush(stderr);
     
    147149
    148150#ifdef HAVE_JACK
    149     ev.size = 3;
    150     ev.buffer = malloc (3 * sizeof (jack_midi_data_t));
     151    ev.size = MAX_MIDI_EVENT_SIZE;
    151152    ev.time = 0; // send it now
    152153    debug ("Jack activation ...\n");
     
    166167
    167168    do {
    168       aubio_source_do (this_source, ibuf, &read);
    169       process_func (ibuf, obuf);
     169      aubio_source_do (this_source, input_buffer, &read);
     170      process_func (input_buffer, output_buffer);
    170171      // print to console if verbose or no output given
    171172      if (verbose || sink_uri == NULL) {
     
    173174      }
    174175      if (this_sink) {
    175         aubio_sink_do (this_sink, obuf, hop_size);
     176        aubio_sink_do (this_sink, output_buffer, hop_size);
    176177      }
    177178      blocks++;
     
    194195#ifdef HAVE_JACK
    195196  if (usejack) {
     197    ev.buffer = midi_data + midi_event_count++ * MAX_MIDI_EVENT_SIZE;
     198    if (midi_event_count >= MAX_MIDI_EVENTS) {
     199      midi_event_count = 0;
     200    }
    196201    ev.buffer[2] = velo;
    197202    ev.buffer[1] = pitch;
Note: See TracChangeset for help on using the changeset viewer.