Class: MIDIEvents::Constant::Map

Inherits:
Object
  • Object
show all
Defined in:
lib/midi-events/constant.rb

Overview

A single constant mapping (name to value pair)

Represents an individual MIDI constant, pairing a human-readable name with its numeric MIDI value.

Examples:

map = MIDIEvents::Constant::Map.new("C4", 60)
map.key    # => "C4"
map.value  # => 60

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value) ⇒ Map

Create a new constant mapping

Parameters:

  • key (String)

    The constant name (e.g., "C4", "Note On")

  • value (Object)

    The constant value (e.g., 60, 0x9)



200
201
202
203
# File 'lib/midi-events/constant.rb', line 200

def initialize(key, value)
  @key = key
  @value = value
end

Instance Attribute Details

#keyString (readonly)

Returns The human-readable name of the constant.

Returns:

  • (String)

    The human-readable name of the constant



191
192
193
# File 'lib/midi-events/constant.rb', line 191

def key
  @key
end

#valueObject (readonly)

Returns The numeric MIDI value.

Returns:

  • (Object)

    The numeric MIDI value



194
195
196
# File 'lib/midi-events/constant.rb', line 194

def value
  @value
end