Class: Webmidi::Message::Channel::PolyphonicPressure

Inherits:
Base
  • Object
show all
Defined in:
lib/webmidi/message/channel.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#channel

Attributes inherited from Base

#timestamp

Instance Method Summary collapse

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: timestamp)
end

Instance Attribute Details

#noteObject (readonly)

Returns the value of attribute note.



69
70
71
# File 'lib/webmidi/message/channel.rb', line 69

def note
  @note
end

#pressureObject (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_bytesObject



81
82
83
# File 'lib/webmidi/message/channel.rb', line 81

def to_bytes
  [0xA0 | @channel, @note, @pressure]
end