Class: Webmidi::Message::Channel::ProgramChange
- Defined in:
- lib/webmidi/message/channel.rb
Instance Attribute Summary collapse
-
#program ⇒ Object
readonly
Returns the value of attribute program.
Attributes inherited from Base
Attributes inherited from Base
Instance Method Summary collapse
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(program:, channel: 0, timestamp: nil) ⇒ ProgramChange
constructor
A new instance of ProgramChange.
- #to_bytes ⇒ Object
Methods inherited from Base
#==, #channel, #deconstruct, #eql?, #hash, #same_bytes?, #same_event?, #to_binary, #to_hex, #with
Constructor Details
#initialize(program:, channel: 0, timestamp: nil) ⇒ ProgramChange
Returns a new instance of ProgramChange.
159 160 161 162 163 164 165 |
# File 'lib/webmidi/message/channel.rb', line 159 def initialize(program:, channel: 0, timestamp: nil) validate_channel!(channel) validate_byte!(program, "Program") @program = program @channel = channel super(timestamp: ) end |
Instance Attribute Details
#program ⇒ Object (readonly)
Returns the value of attribute program.
157 158 159 |
# File 'lib/webmidi/message/channel.rb', line 157 def program @program end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
171 172 173 |
# File 'lib/webmidi/message/channel.rb', line 171 def deconstruct_keys(keys) {program: @program, channel: @channel} end |
#to_bytes ⇒ Object
167 168 169 |
# File 'lib/webmidi/message/channel.rb', line 167 def to_bytes [0xC0 | @channel, @program] end |