/* Copyright (C) 2004 Ian Esten This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /******************** * Thu Nov 16 17:09:08 CET 2017 * changed by TV to output a midi command according to a decimal * coded multiple number command line * until enmty line is read * timing of midi jack message is not important in this example, * ecven though it comes along with jack sync * ******************/ #include #include #include #include #include #include jack_client_t *client; jack_port_t *output_port; unsigned char mi[1024]; unsigned int mii = 0 ; jack_nframes_t* note_lengths; static void signal_handler(int sig) { jack_client_close(client); fprintf(stderr, "signal received, exiting ...\n"); exit(0); } static void usage() { fprintf(stderr, "usage: jack_midimes \n"); fprintf(stderr, " take line with decimal midi codes output \n"); fprintf(stderr, " to jack midi out\n"); } static int process(jack_nframes_t nframes, void *arg) { int i,j; void* port_buf = jack_port_get_buffer(output_port, nframes); unsigned char* buffer; jack_midi_clear_buffer(port_buf); /*memset(buffer, 0, nframes*sizeof(jack_default_audio_sample_t));*/ if (mii > 0) { buffer = jack_midi_event_reserve(port_buf, 0, mii); for (i=0; i