Class: Webmidi::Message::Channel::ChannelPressure

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(pressure:, channel: 0, timestamp: nil) ⇒ ChannelPressure

Returns a new instance of ChannelPressure.



179
180
181
182
183
184
185
# File 'lib/webmidi/message/channel.rb', line 179

def initialize(pressure:, channel: 0, timestamp: nil)
  validate_channel!(channel)
  validate_byte!(pressure, "Pressure")
  @pressure = pressure
  @channel = channel
  super(timestamp: timestamp)
end

Instance Attribute Details

#pressureObject (readonly)

Returns the value of attribute pressure.



177
178
179
# File 'lib/webmidi/message/channel.rb', line 177

def pressure
  @pressure
end

Instance Method Details

#deconstruct_keys(keys) ⇒ Object



191
192
193
# File 'lib/webmidi/message/channel.rb', line 191

def deconstruct_keys(keys)
  {pressure: @pressure, channel: @channel}
end

#to_bytesObject



187
188
189
# File 'lib/webmidi/message/channel.rb', line 187

def to_bytes
  [0xD0 | @channel, @pressure]
end