Advertisement
retrokits

RK002 Pitchbend on a key

Jul 19th, 2022
1,534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int pd=0;
  2. int tpd=0;
  3. void RK002_onHeartBeat() // we use heartbeat for button debouncing
  4. {
  5.   if(tpd!=pd){
  6.     tpd+=(pd-tpd)/4;
  7.     RK002_sendPitchBend(0,tpd);
  8.   }
  9. }
  10. boolean RK002_onNoteOn(byte channel, byte key, byte velocity)
  11. {
  12.   bool retval=true;
  13.   if (key==49){pd=-8173;retval=false;}
  14.   if (key==51){pd=8174;retval=false;}
  15.   return retval;
  16. }
  17.  
  18. boolean RK002_onNoteOff(byte channel, byte key, byte velocity)
  19. {
  20.   bool retval=true;
  21.   if (key==49){pd=0;retval=false;}
  22.   if (key==51){pd=0;retval==false;}
  23.   return retval;
  24. }
  25. void setup()
  26. {
  27. }
  28.  
  29. void loop()
  30. {
  31. }  
  32.        
  33.        
  34.        
  35.        
  36.        
  37.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement