Class: Webmidi::Message::Channel::NoteOff
- Defined in:
- lib/webmidi/message/channel.rb
Instance Attribute Summary collapse
-
#note ⇒ Object
readonly
Returns the value of attribute note.
-
#velocity ⇒ Object
readonly
Returns the value of attribute velocity.
Attributes inherited from Base
Attributes inherited from Base
Instance Method Summary collapse
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(note:, velocity: 0, channel: 0, timestamp: nil) ⇒ NoteOff
constructor
A new instance of NoteOff.
- #to_bytes ⇒ Object
Methods inherited from Base
#==, #channel, #deconstruct, #eql?, #hash, #same_bytes?, #same_event?, #to_binary, #to_hex, #with
Constructor Details
#initialize(note:, velocity: 0, channel: 0, timestamp: nil) ⇒ NoteOff
Returns a new instance of NoteOff.
49 50 51 52 53 54 55 56 57 |
# File 'lib/webmidi/message/channel.rb', line 49 def initialize(note:, velocity: 0, channel: 0, timestamp: nil) validate_channel!(channel) validate_byte!(note, "Note") validate_byte!(velocity, "Velocity") @note = note @velocity = velocity @channel = channel super(timestamp: ) end |
Instance Attribute Details
#note ⇒ Object (readonly)
Returns the value of attribute note.
47 48 49 |
# File 'lib/webmidi/message/channel.rb', line 47 def note @note end |
#velocity ⇒ Object (readonly)
Returns the value of attribute velocity.
47 48 49 |
# File 'lib/webmidi/message/channel.rb', line 47 def velocity @velocity end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
63 64 65 |
# File 'lib/webmidi/message/channel.rb', line 63 def deconstruct_keys(keys) {note: @note, velocity: @velocity, channel: @channel} end |
#to_bytes ⇒ Object
59 60 61 |
# File 'lib/webmidi/message/channel.rb', line 59 def to_bytes [0x80 | @channel, @note, @velocity] end |