flipcoder / textbeat

🎹 plaintext music sequencer and midi shell, with vim playback and the powers of music theory 🥁
MIT License
406 stars 13 forks source link

Player Parser Refactor Pt1 #9

Closed vanceism7 closed 2 years ago

vanceism7 commented 2 years ago

Beginning of refactoring player.py. It's not a very impressive refactor, we just pull a big try statement out and stick it in it's own function. This PR is WIP - if the refactor is correct, the function should still be given a more appropriate name, and we should add a doc string as well before merging. We could also continue to add more refactorings in this branch before merging if we'd prefer to not have a ton of PRs; just wanted to start small so its easy to review changes

Let me know what you think! Maybe you can enlighten me on what exactly we're doing here. Seems like it has something to do with when playback hits the end of the loop/file or something of that sort.

flipcoder commented 2 years ago

That block of code mainly processes things that need to happen before the prompt shows again in midi shell mode as well as the shell itself. So that involves finishing pending commands and arpeggios, as well as allowing looping. Maybe I should go through and comment that more and we can figure out the best way to break it up. Maybe we could break it into 2 functions, process_pending() and show_prompt()?