Sha256: cfa51fd949bfdb56554737450bb71679a727cd6e8a4d0ca407628b29bbc12e83
Contents?: true
Size: 805 Bytes
Versions: 3
Compression:
Stored size: 805 Bytes
Contents
module Music module Transcription class MeasureScore def pack hash = super() hash["start_meter"] = start_meter.to_s hash["meter_changes"] = Hash[ meter_changes.map do |offset,change| a = change.pack a[0] = a[0].to_s [offset,a] end ] return hash end def self.unpack packing unpacked_start_meter = Meter.parse(packing["start_meter"]) unpacked_mcs = Hash[ packing["meter_changes"].map do |k,v| v = v.clone v[0] = Meter.parse(v[0]) [k, Change.from_ary(v) ] end ] note_score = NoteScore.unpack(packing) new(unpacked_start_meter, note_score.start_tempo, meter_changes: unpacked_mcs, tempo_changes: note_score.tempo_changes, program: note_score.program, parts: note_score.parts ) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems