Changeset 155cc10 for examples/utils.c
- Timestamp:
- Mar 10, 2017, 2:26:32 PM (7 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler
- Children:
- ee8a57c
- Parents:
- 00d0275 (diff), 67b6618 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/utils.c
r00d0275 r155cc10 44 44 char_t * onset_method = "default"; 45 45 smpl_t onset_threshold = 0.0; // will be set if != 0. 46 smpl_t onset_minioi = 0.0; // will be set if != 0. 46 47 // pitch stuff 47 48 char_t * pitch_unit = "default"; … … 65 66 fvec_t *obuf; 66 67 68 smpl_t miditap_note = 69.; 69 smpl_t miditap_velo = 65.; 70 67 71 /* settings */ 68 72 int blocks = 0; … … 73 77 #if HAVE_JACK 74 78 aubio_jack_t *jack_setup; 75 #endif 79 jack_midi_event_t ev; 80 #endif /* HAVE_JACK */ 76 81 77 82 void examples_common_init (int argc, char **argv); … … 115 120 samplerate = aubio_jack_get_samplerate (jack_setup); 116 121 source_uri = "jack"; 117 #endif 122 #endif /* HAVE_JACK */ 118 123 } 119 124 ibuf = new_fvec (hop_size); … … 124 129 void examples_common_del (void) 125 130 { 131 #ifdef HAVE_JACK 132 if (ev.buffer) free(ev.buffer); 133 #endif 126 134 del_fvec (ibuf); 127 135 del_fvec (obuf); … … 138 146 if (usejack) { 139 147 140 #if HAVE_JACK 148 #ifdef HAVE_JACK 149 ev.size = 3; 150 ev.buffer = malloc (3 * sizeof (jack_midi_data_t)); 151 ev.time = 0; // send it now 141 152 debug ("Jack activation ...\n"); 142 153 aubio_jack_activate (jack_setup, process_func); … … 144 155 pause (); 145 156 aubio_jack_close (jack_setup); 146 #else 157 #else /* HAVE_JACK */ 147 158 usage (stderr, 1); 148 159 outmsg ("Compiled without jack output, exiting.\n"); 149 #endif 160 #endif /* HAVE_JACK */ 150 161 151 162 } else { … … 179 190 180 191 void 181 send_noteon (int pitch, int velo) 182 { 183 smpl_t mpitch = floor (aubio_freqtomidi (pitch) + .5); 184 #if HAVE_JACK 185 jack_midi_event_t ev; 186 ev.size = 3; 187 ev.buffer = malloc (3 * sizeof (jack_midi_data_t)); // FIXME 188 ev.time = 0; 192 send_noteon (smpl_t pitch, smpl_t velo) 193 { 194 #ifdef HAVE_JACK 189 195 if (usejack) { 190 196 ev.buffer[2] = velo; 191 ev.buffer[1] = mpitch;197 ev.buffer[1] = pitch; 192 198 if (velo == 0) { 193 199 ev.buffer[0] = 0x80; /* note off */ … … 202 208 outmsg ("\n"); 203 209 } else { 204 outmsg ("%f\t", mpitch);210 outmsg ("%f\t", pitch); 205 211 print_time (blocks * hop_size); 206 212 outmsg ("\t");
Note: See TracChangeset
for help on using the changeset viewer.