Class: Vissen::Input::Message::Note
- Defined in:
- lib/vissen/input/message/note.rb
Overview
From the MIDI Association:
Note On event. This message is sent when a note is depressed (start).
Note Off event. This message is sent when a note is released (ended).
Constant Summary collapse
- STATUS_MASK =
0xE0
- STATUS =
0x80
- NOTE_ON =
Note On specifies the value of the lowest status bit for note on messages.
0x10
- NOTE_OFF =
Note On specifies the value of the lowest status bit for note off messages.
0x00
Constants inherited from Base
Constants included from Vissen::Input::Message
Instance Attribute Summary
Attributes included from Vissen::Input::Message
Class Method Summary collapse
Instance Method Summary collapse
-
#note ⇒ Integer
The note value.
-
#off? ⇒ true, false
True if the note was released.
-
#on? ⇒ true, false
True if the note was depressed.
-
#velocity ⇒ Integer
The velocity value.
Methods inherited from Base
[], factory, match, match?, matcher, #valid?
Methods included from Vissen::Input::Message
#channel, #fetch, #initialize, #status, #to_h, #valid?
Class Method Details
Instance Method Details
#note ⇒ Integer
Returns the note value.
28 29 30 |
# File 'lib/vissen/input/message/note.rb', line 28 def note data[1] end |
#off? ⇒ true, false
Returns true if the note was released.
38 39 40 |
# File 'lib/vissen/input/message/note.rb', line 38 def off? (data[0] & NOTE_ON).zero? end |
#on? ⇒ true, false
Returns true if the note was depressed.
43 44 45 |
# File 'lib/vissen/input/message/note.rb', line 43 def on? !off? end |
#velocity ⇒ Integer
Returns the velocity value.
33 34 35 |
# File 'lib/vissen/input/message/note.rb', line 33 def velocity data[2] end |