1 /* tuneit.c -- Detect fundamental frequency of a sound 2 * Copyright (C) 2004, 2005 Mario Lang <mlang@delysid.org> 3 * 4 * Modified for rakarrack by Josep Andreu 5 * MIDIConverter.h MIDIConverter definitions 6 * 7 * This is free software, placed under the terms of the 8 * GNU General Public License, as published by the Free Software Foundation. 9 * Please see the file COPYING for details. 10 */ 11 12 13 #ifndef MIDICONVERTER_H_ 14 #define MIDICONVERTER_H_ 15 16 #include <math.h> 17 #include <stdlib.h> 18 #include <jack/midiport.h> 19 #include <alsa/asoundlib.h> 20 21 22 struct Midi_Event { 23 jack_nframes_t time; 24 int len; /* Length of MIDI message, in bytes. */ 25 jack_midi_data_t *dataloc; 26 } ; 27 28 29 30 class MIDIConverter 31 { 32 public: 33 MIDIConverter (char *jname); 34 ~MIDIConverter (); 35 36 37 float *efxoutl; 38 float *efxoutr; 39 signed short int *schmittBuffer; 40 signed short int *schmittPointer; 41 const char **notes; 42 int note; 43 float nfreq, afreq, freq; 44 float TrigVal; 45 int cents; 46 void schmittFloat (int nframes, float *indatal, float *indatar); 47 void setmidichannel (int channel); 48 void panic (); 49 void setTriggerAdjust (int val); 50 void setVelAdjust (int val); 51 52 int channel; 53 int lanota; 54 int nota_actual; 55 int hay; 56 int preparada; 57 int ponla; 58 int velocity; 59 int moutdatasize; 60 int ev_count; 61 int Moctave; 62 63 float VelVal; 64 jack_midi_data_t moutdata[2048]; 65 Midi_Event Midi_event[2048]; 66 snd_seq_t *port; 67 68 69 private: 70 71 void displayFrequency (float freq); 72 void schmittInit (int size); 73 void schmittS16LE (int nframes, signed short int *indata); 74 void schmittFree (); 75 void MIDI_Send_Note_On (int note); 76 void MIDI_Send_Note_Off (int note); 77 78 int blockSize; 79 80 81 82 }; 83 84 #endif /*MIDICONVERTER_H_ */ 85