comparison projects/d-box/render.cpp @ 51:4f8db16f17b5 newapi

D-Box updates; should work as old version did
author andrewm
date Sat, 30 May 2015 13:25:51 -0500
parents be427da6fb9c
children 3c3a1357657d
comparison
equal deleted inserted replaced
50:be427da6fb9c 51:4f8db16f17b5
104 104
105 // pitch vars 105 // pitch vars
106 float octaveSplitter; 106 float octaveSplitter;
107 float semitones[((int)N_OCT*12)+1]; 107 float semitones[((int)N_OCT*12)+1];
108 float deltaTouch = 0; 108 float deltaTouch = 0;
109 float deltaWeightP = 0.5; 109 float deltaWeightP = 0.5 / 65536.0;
110 float deltaWeightI = 0.0005; 110 float deltaWeightI = 0.0005 / 65536.0;
111 111
112 // filter vars 112 // filter vars
113 ne10_fir_instance_f32_t filter[2]; 113 ne10_fir_instance_f32_t filter[2];
114 ne10_float32_t *filterIn[2]; 114 ne10_float32_t *filterIn[2];
115 ne10_float32_t *filterOut[2]; 115 ne10_float32_t *filterOut[2];
368 if(gSensor0LatestTouchNum>0) 368 if(gSensor0LatestTouchNum>0)
369 { 369 {
370 // current pitch is gPitchLatestInput, already retrieved 370 // current pitch is gPitchLatestInput, already retrieved
371 semitoneIndex = ( gPitchLatestInput * 12 * N_OCT )+0.5; // closest semitone 371 semitoneIndex = ( gPitchLatestInput * 12 * N_OCT )+0.5; // closest semitone
372 deltaTarget = (semitones[semitoneIndex]-gPitchLatestInput); // delta between pitch and target 372 deltaTarget = (semitones[semitoneIndex]-gPitchLatestInput); // delta between pitch and target
373 deltaTouch += deltaTarget*deltaWeightI; // update feedback [previous + current] 373 deltaTouch += deltaTarget*(deltaWeightI); // update feedback [previous + current]
374 } 374 }
375 else 375 else
376 deltaTouch = 0; 376 deltaTouch = 0;
377 377
378 float nextOut = touchPosInt + deltaTarget*deltaWeightP + deltaTouch; // add feedback to touch -> next out 378 float nextOut = touchPosInt + deltaTarget*deltaWeightP + deltaTouch; // add feedback to touch -> next out