Merge pull request #17 from MrDham/MrDham-fix-issue-16

Fix-issue-16
pull/23/head V2.2
MrDham 6 years ago committed by GitHub
commit 2e4f8f62ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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;
// Calculate log freq
if (vPointerIncrement < 18)
if ((vPointerIncrement < 18) || (vPointerIncrement > 65518))
{
// Highest note
// Lowest note
double_log_freq = 0;
}
else if (vPointerIncrement > 26315)
else if ((vPointerIncrement > 26315) && (vPointerIncrement < 39221))
{
// Lowest note
// Highest note
double_log_freq = 127;
}
else
else if (vPointerIncrement < 32768)
{
// Positive frequencies
// Find note in the playing range
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
new_midi_rod_cc_val = round (double_log_freq);

Loading…
Cancel
Save