You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For those who stumble upon this. still just was never implemented.
It would look something like
impl From<U7> for Note {
fn from(value: U7) -> Note {
//either massive match or transmute here
}
}
It' only doesn't exist because it was a bit tedious to write out (eg safest is a big. match) and I didn't have the immediate need. In my use case I had a known set of midi notes, so from button presses I created the enum (safest, statically verified).
So I didn't have the use-case for calculation, hence not implemented. It's a relatively straight forward PR though.
Is your feature request related to a problem? Please describe.
I need to calculate a
Note
, but there is no way to do any calculation as the enum is opaque. Now, I use transmute:https://github.com/TeXitoi/midi-grid/blob/master/src/main.rs#L195-L196
Describe the solution you'd like
What about overflow? Saturating? Modulo? Panic?
Describe alternatives you've considered
transmute
Additional context
Thanks for this crate, was able to make a midi keyboard within an hour! https://github.com/TeXitoi/midi-grid
When we agree on the design, I can implement it if you want.
The text was updated successfully, but these errors were encountered: