Struct musical_keyboard::MusicalKeyboard [] [src]

pub struct MusicalKeyboard {
    pub octave: Octave,
    pub velocity: Velocity,
    pub currently_pressed_keys: HashMap<Key, Octave>,
}

A struct used for creating musical Notes via the computer keyboard.

Fields

The current base octave for the keyboard.

The current velocity for the generated notes.

The currently pressed keys.

Methods

impl MusicalKeyboard
[src]

Constructor for MusicalKeyboard.

Return a NoteOn given some pressed key.

  • Z will step the octave down.
  • X will step the octave up.
  • C will step the velocity down.
  • V will step the velocity up.
  • Home-row and some of the top row will trigger notes or release them depending on is_pressed.

Return a NoteOff given some released key.

Translates a key into it's respective note. This key pattern is an attempt at modelling a piano's keys, where Key::A is a piano's C.

Translates a pressed key to a note on event.

If the given key is already pressed, it is ignored. This helps to avoid triggering notes from a window's key-repeat function.

Translates a released key to a note off event.

Trait Implementations

impl Clone for MusicalKeyboard
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for MusicalKeyboard
[src]

Formats the value using the given formatter.

impl Default for MusicalKeyboard
[src]

Returns the "default value" for a type. Read more