lib/head_music/instrument.rb in head_music-5.0.0 vs lib/head_music/instrument.rb in head_music-6.0.0
- old
+ new
@@ -7,11 +7,11 @@
# family_key: the key for the family of the instrument (e.g. "saxophone")
# classification_keys: an array of classification_keys
# default_clefs: the default clef or system of clefs for the instrument
# - [treble] for instruments that use the treble clef
# - [treble, bass] for instruments that use the grand staff
-# pitch_configurations:
+# pitch_variants:
# a hash of default and alternative fundamental pitches.
# Associations:
# family: the family of the instrument (e.g. "saxophone")
# orchestra_section: the section of the orchestra (e.g. "strings")
class HeadMusic::Instrument
@@ -30,11 +30,11 @@
end
attr_reader(
:name_key, :alias_name_keys,
:family_key, :orchestra_section_key,
- :pitch_configurations, :classification_keys
+ :pitch_variants, :classification_keys
)
def ==(other)
to_s == other.to_s
end
@@ -73,20 +73,20 @@
return false if default_clefs.compact.uniq == [HeadMusic::Clef.get("neutral_clef")]
default_clefs.any?
end
- def default_pitch_configuration
- pitch_configurations.find(&:default?) || pitch_configurations.first
+ def default_pitch_variant
+ pitch_variants.find(&:default?) || pitch_variants.first
end
- def default_staff_configuration
- default_pitch_configuration&.default_staff_configuration
+ def default_staff_scheme
+ default_pitch_variant&.default_staff_scheme
end
def default_staves
- default_staff_configuration&.staves || []
+ default_staff_scheme&.staves || []
end
def default_clefs
default_staves&.map(&:clef) || []
end
@@ -156,12 +156,12 @@
end
def initialize_attributes(record)
@orchestra_section_key ||= record["orchestra_section_key"]
@classification_keys = [@classification_keys, record["classification_keys"]].flatten.compact.uniq
- @pitch_configurations =
- (record["pitch_configurations"] || {}).map do |key, attributes|
- HeadMusic::Instrument::PitchConfiguration.new(key, attributes)
+ @pitch_variants =
+ (record["pitch_variants"] || {}).map do |key, attributes|
+ HeadMusic::Instrument::PitchVariant.new(key, attributes)
end
end
def inferred_name
name_key.to_s.tr("_", " ")