Fix-issue-16

MrDham-fix-issue-16
MrDham 5 years ago committed by GitHub
parent 58ef025a86
commit a1beba039a
  1. 17
      Open_Theremin_V3/application.cpp

@ -549,21 +549,28 @@ void Application::midi_application ()
delta_loop_cc_val = (double)new_midi_loop_cc_val - (double)old_midi_loop_cc_val; delta_loop_cc_val = (double)new_midi_loop_cc_val - (double)old_midi_loop_cc_val;
// Calculate log freq // Calculate log freq
if (vPointerIncrement < 18) if ((vPointerIncrement < 18) || (vPointerIncrement > 65518))
{ {
// Highest note // Lowest note
double_log_freq = 0; double_log_freq = 0;
} }
else if (vPointerIncrement > 26315) else if ((vPointerIncrement > 26315) && (vPointerIncrement < 39221))
{ {
// Lowest note // Highest note
double_log_freq = 127; double_log_freq = 127;
} }
else else if (vPointerIncrement < 32768)
{ {
// Positive frequencies
// Find note in the playing range // Find note in the playing range
double_log_freq = (log (vPointerIncrement/17.152) / 0.057762265); // Precise note played in the logaritmic scale double_log_freq = (log (vPointerIncrement/17.152) / 0.057762265); // Precise note played in the logaritmic scale
} }
else
{
// Negative frequencies
// Find note in the playing range
double_log_freq = (log ((65535-vPointerIncrement+1)/17.152) / 0.057762265); // Precise note played in the logaritmic scale
}
// Calculate rod antena cc value for midi // Calculate rod antena cc value for midi
new_midi_rod_cc_val = round (double_log_freq); new_midi_rod_cc_val = round (double_log_freq);

Loading…
Cancel
Save