Class: Webmidi::Message::Channel::PolyphonicPressure
- Defined in:
- lib/webmidi/message/channel.rb
Instance Attribute Summary collapse
-
#note ⇒ Object
readonly
Returns the value of attribute note.
-
#pressure ⇒ Object
readonly
Returns the value of attribute pressure.
Attributes inherited from Base
Attributes inherited from Base
Instance Method Summary collapse
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(note:, pressure:, channel: 0, timestamp: nil) ⇒ PolyphonicPressure
constructor
A new instance of PolyphonicPressure.
- #to_bytes ⇒ Object
Methods inherited from Base
#==, #channel, #deconstruct, #eql?, #hash, #same_bytes?, #same_event?, #to_binary, #to_hex, #with
Constructor Details
#initialize(note:, pressure:, channel: 0, timestamp: nil) ⇒ PolyphonicPressure
Returns a new instance of PolyphonicPressure.
71 72 73 74 75 76 77 78 79 |
# File 'lib/webmidi/message/channel.rb', line 71 def initialize(note:, pressure:, channel: 0, timestamp: nil) validate_channel!(channel) validate_byte!(note, "Note") validate_byte!(pressure, "Pressure") @note = note @pressure = pressure @channel = channel super(timestamp: ) end |
Instance Attribute Details
#note ⇒ Object (readonly)
Returns the value of attribute note.
69 70 71 |
# File 'lib/webmidi/message/channel.rb', line 69 def note @note end |
#pressure ⇒ Object (readonly)
Returns the value of attribute pressure.
69 70 71 |
# File 'lib/webmidi/message/channel.rb', line 69 def pressure @pressure end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
85 86 87 |
# File 'lib/webmidi/message/channel.rb', line 85 def deconstruct_keys(keys) {note: @note, pressure: @pressure, channel: @channel} end |
#to_bytes ⇒ Object
81 82 83 |
# File 'lib/webmidi/message/channel.rb', line 81 def to_bytes [0xA0 | @channel, @note, @pressure] end |