Skip to content

Calculating a midi note #8

@TeXitoi

Description

@TeXitoi

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

impl core::ops::Add<Rhs = u8> for Note;
impl core::ops::Sub<Rhs = u8> for Note;

What about overflow? Saturating? Modulo? Panic?

Describe alternatives you've considered

transmute

impl From<U7> for Note;

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions