change to autocorrelate

This commit is contained in:
Mark Allyn
2026-11-14 11:52:18 -08:00
parent 3a6fa74735
commit 644a5d29de
3 changed files with 490 additions and 291 deletions

View File

@@ -23,26 +23,24 @@ int piano_window_class::draw_trace(piano_data_struct *input_piano_data)
my_piano_data = input_piano_data;
// point to piano_key_texture
if (my_piano_data->keyboard_key == 0)
// Light the detected key and octive; blank when no note was detected.
// keyboard_key is 0 - 11 and octive is 0 based (0 = octave 1)
texture_current_piano_light = texture_key_blank;
texture_current_octive_light = texture_octive_blank;
if (my_piano_data->valid)
{
texture_current_piano_light = texture_key_blank;
if ((my_piano_data->keyboard_key >= 0) &&
(my_piano_data->keyboard_key < NUMBER_KEY_LIGHTS))
{
texture_current_piano_light = texture_keys[my_piano_data->keyboard_key];
}
if ((my_piano_data->octive >= 0) &&
(my_piano_data->octive < NUMBER_OCTIVE_LIGHTS))
{
texture_current_octive_light = texture_octives[my_piano_data->octive];
}
}
else
{
texture_current_piano_light = texture_keys[my_piano_data->keyboard_key - 1];
}
// point to octive_texture
if (my_piano_data->octive == 0)
{
texture_current_octive_light = texture_octive_blank;
}
else
{
texture_current_octive_light = texture_octives[my_piano_data->octive - 1];
}
// Put on screen
SDL_RenderCopy(renderer_for_piano, texture_current_piano_light, NULL, &rect_for_keys);
SDL_RenderCopy(renderer_for_piano, texture_current_octive_light, NULL, &rect_for_octives);