Even better, let the compiler give you the best possible number, use
Pitch_cc = ((128.0/24.0*semi_key)-1);
And since the controlChange function takes a byte (0-255) value, round it
Pitch_cc = ((128.0/24.0*semi_key)-1)+0.5;
Even better, let the compiler give you the best possible number, use
Pitch_cc = ((128.0/24.0*semi_key)-1);
And since the controlChange function takes a byte (0-255) value, round it
Pitch_cc = ((128.0/24.0*semi_key)-1)+0.5;