Refactoring Madness

refactor-meme.jpg

In the previous blog post, it was described how some refactoring was needed to get the smooth playhead with latency compensation working properly. Well, it turns out that big parts of what controls song position and how it is presented in the UI has to get a relatively major overhaul. On the plus side this will fix some minor quirks and awkward code in addition to solving latency issues.

The refactoring is necessary so that the grid playhead, groups and main menu timeline can show the same smooth, latency compensated playhead. Additionally, the notes has to draw sparks at the same time the playhead crosses them, which can be in the future relative to when they were sent to the audio hardware. The grid also might show non-retriggered notes differently, and with different velocities, depending on wether they are currently playing in the speakers or not. This makes the issue a bit more complex, as there has to be maintained a log of notes and what happened when those notes got played.

I hope to have some progress to show with regards to this next week.