-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added rudimentary MIDI controller support to the standalone tracker #166
Conversation
Sweet! Looks pretty good to me already, minor nits:
type MIDIContext interface {
ListInputDevices(yield func(item MIDIDevice) bool)
}
type MIDIDevice interface {
Name() string
Open() error
} This way the ListInputDevices follows the new iterator support in golang https://bitfieldconsulting.com/posts/iterators, even if we are not yet using golang 1.23. Then the gomidi subpackage could implement this interfaces using gomidi, implementing the PlayerProcessContext and the MIDIContext interfaces. This way we can easily mock the interfaces and make again something like a NullContext later on for testing and if we want to port the tracker to platforms that gomidi don't support (ok that's a stretch but the testing is a valid concern).
|
6731bf2
to
4a9517b
Compare
|
Merged, managed to mess up the commit message despite trying :D Well, next time! Great work! I'll probably do a bit of refactoring but this should not change the fundamental concepts. |
Thanks for the code review! :) |
I just had to use the iterators now that go has those; I even require now go 1.23 just for this ;) But now I can start refactoring other places too to use those, there's a few places where they would have been nice. |
Oh, I learned that the signature for the iterator functions was slightly different than what I suggested to you; sorry! My excuse is that I never actually used them before, because didn't have go 1.23 yet |
don't worry, I took the invitation of this PR to learn a ton about the language and the design patterns coders use in go. :) |
For "style-education" (don't we all love that ;), here's what I've learned:
|
This PR adds a menu with all connected controllers:
After selecting a controller, Note on and Note off are relayed to the player.
I figured I'd open a PR early to leave room for discussion on
That's my first PR with diff in go, please let me know if I used any anti-patterns.