head_music 12.1.0 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/head_music/style/guidelines/first_bar_entry.rb +13 -0
- data/lib/head_music/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ccf523b5bb7b74f26a5d52696e46d227428c97279c9218642a0fda8277c845a0
|
|
4
|
+
data.tar.gz: 9dacc76d972594748d14b5fad8e479b551c758c9ef7882f88354a28e62d316b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be9bb15716c3f20d398bb1ba6f3d1faebe08233c271dd3e451da41f2654d7d3a9b3d6272a551c7f4214c28638962712bbb8b4eda412782c86204fd5a9c1eeb29
|
|
7
|
+
data.tar.gz: 7285191b3b8be97a2d9cad0f2a650eb7f7e708723047c42d7ea5a80fdc77cc0f303e34727e6d827f40f598d3b735f67353e33b722f4e50877b41214b7d1a6b76
|
data/Gemfile.lock
CHANGED
|
@@ -24,6 +24,7 @@ class HeadMusic::Style::Guidelines::FirstBarEntry < HeadMusic::Style::Annotation
|
|
|
24
24
|
def valid_first_bar?(bar_notes, bar_rests)
|
|
25
25
|
bar_notes.any? &&
|
|
26
26
|
all_correct_beat_unit?(bar_notes) &&
|
|
27
|
+
valid_note_count?(bar_notes) &&
|
|
27
28
|
valid_rests?(bar_rests)
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -31,6 +32,18 @@ class HeadMusic::Style::Guidelines::FirstBarEntry < HeadMusic::Style::Annotation
|
|
|
31
32
|
bar_notes.all? { |note| note.rhythmic_value == expected_rhythmic_value }
|
|
32
33
|
end
|
|
33
34
|
|
|
35
|
+
def valid_note_count?(bar_notes)
|
|
36
|
+
expected = expected_notes_in_first_bar
|
|
37
|
+
bar_notes.length == expected ||
|
|
38
|
+
(bar_notes.length == expected - 1 && bar_notes.first.position.count > 1)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def expected_notes_in_first_bar
|
|
42
|
+
meter = composition.meter_at(1)
|
|
43
|
+
bar_duration = meter.count_unit.relative_value * meter.counts_per_bar
|
|
44
|
+
(bar_duration / expected_rhythmic_value.total_value).round
|
|
45
|
+
end
|
|
46
|
+
|
|
34
47
|
def valid_rests?(bar_rests)
|
|
35
48
|
bar_rests.empty? ||
|
|
36
49
|
(bar_rests.length == 1 &&
|
data/lib/head_music/version.rb
CHANGED