Module: MIDICommunicationsMacOS::TypeConversion
- Extended by:
- TypeConversion
- Included in:
- TypeConversion
- Defined in:
- lib/midi-communications-macos/type_conversion.rb
Overview
Helper for convertig MIDI data
Instance Method Summary collapse
-
#numeric_bytes_to_hex_string(bytes) ⇒ String
Convert an array of numeric byes to a hex string (e.g. [0x90, 0x40, 0x40] becomes “904040”).
Instance Method Details
#numeric_bytes_to_hex_string(bytes) ⇒ String
Convert an array of numeric byes to a hex string (e.g. [0x90, 0x40, 0x40] becomes “904040”)
9 10 11 12 13 14 15 16 |
# File 'lib/midi-communications-macos/type_conversion.rb', line 9 def numeric_bytes_to_hex_string(bytes) string_bytes = bytes.map do |byte| str = byte.to_s(16).upcase str = "0#{str}" if byte < 16 str end string_bytes.join end |