Changeset 3a8f0bf


Ignore:
Timestamp:
Sep 17, 2018, 3:14:02 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
e561ca7
Parents:
8c4918a (diff), 8ba682a (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 'fix/jack-midi-buffer'

Fixes #183, thanks to cyclopsian

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/utils.c

    r8c4918a r3a8f0bf  
    7676
    7777#if HAVE_JACK
     78#define MAX_MIDI_EVENTS 128
     79#define MAX_MIDI_EVENT_SIZE 3
    7880aubio_jack_t *jack_setup;
    7981jack_midi_event_t ev;
     82jack_midi_data_t midi_data[MAX_MIDI_EVENTS * MAX_MIDI_EVENT_SIZE];
     83size_t midi_event_count = 0;
    8084#endif /* HAVE_JACK */
    8185
     
    129133void examples_common_del (void)
    130134{
    131 #ifdef HAVE_JACK
    132   if (ev.buffer) free(ev.buffer);
    133 #endif
    134135  del_fvec (ibuf);
    135136  del_fvec (obuf);
     
    147148
    148149#ifdef HAVE_JACK
    149     ev.size = 3;
    150     ev.buffer = malloc (3 * sizeof (jack_midi_data_t));
     150    ev.size = MAX_MIDI_EVENT_SIZE;
    151151    ev.time = 0; // send it now
    152152    debug ("Jack activation ...\n");
     
    194194#ifdef HAVE_JACK
    195195  if (usejack) {
     196    ev.buffer = midi_data + midi_event_count++ * MAX_MIDI_EVENT_SIZE;
     197    if (midi_event_count >= MAX_MIDI_EVENTS) {
     198      midi_event_count = 0;
     199    }
    196200    ev.buffer[2] = velo;
    197201    ev.buffer[1] = pitch;
Note: See TracChangeset for help on using the changeset viewer.