Changeset f7771c6 for examples/utils.c


Ignore:
Timestamp:
Sep 17, 2018, 4:31:55 AM (6 years ago)
Author:
cyclopsian <cycl0ps@tuta.io>
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:
d47ad546
Parents:
230101d
Message:

Fix examples failing to send more than one JACK midi event per frame

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/utils.c

    r230101d rf7771c6  
    7676
    7777#if HAVE_JACK
     78#define MAX_MIDI_EVENTS 128
    7879aubio_jack_t *jack_setup;
    7980jack_midi_event_t ev;
     81jack_midi_data_t midi_data[MAX_MIDI_EVENTS * 3];
     82size_t midi_event_count = 0;
    8083#endif /* HAVE_JACK */
    8184
     
    129132void examples_common_del (void)
    130133{
    131 #ifdef HAVE_JACK
    132   if (ev.buffer) free(ev.buffer);
    133 #endif
    134134  del_fvec (ibuf);
    135135  del_fvec (obuf);
     
    148148#ifdef HAVE_JACK
    149149    ev.size = 3;
    150     ev.buffer = malloc (3 * sizeof (jack_midi_data_t));
    151150    ev.time = 0; // send it now
    152151    debug ("Jack activation ...\n");
     
    194193#ifdef HAVE_JACK
    195194  if (usejack) {
     195    ev.buffer = midi_data + midi_event_count++ * 3;
     196    if (midi_event_count >= MAX_MIDI_EVENTS) {
     197      midi_event_count = 0;
     198    }
    196199    ev.buffer[2] = velo;
    197200    ev.buffer[1] = pitch;
Note: See TracChangeset for help on using the changeset viewer.