Class: MIDIMessage::Process::Transpose

Inherits:
Object
  • Object
show all
Includes:
Processor
Defined in:
lib/midi-message/process/transpose.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Processor

included, #process

Constructor Details

#initialize(prop, factor, options = {}) ⇒ Transpose

Returns a new instance of Transpose.



13
14
15
16
17
18
# File 'lib/midi-message/process/transpose.rb', line 13

def initialize(prop, factor, options = {})
  @factor = factor
  @property = prop
  
  initialize_processor(options)
end

Instance Attribute Details

#factorObject (readonly)

Returns the value of attribute factor.



11
12
13
# File 'lib/midi-message/process/transpose.rb', line 11

def factor
  @factor
end

#propertyObject (readonly)

Returns the value of attribute property.



11
12
13
# File 'lib/midi-message/process/transpose.rb', line 11

def property
  @property
end

Instance Method Details

#process_single(message) ⇒ Object



20
21
22
23
24
# File 'lib/midi-message/process/transpose.rb', line 20

def process_single(message)
  val = message.send(@property)
  message.send("#{@property}=", val + @factor)
  message
end