lydown 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60fcdf6a08bf0d2bcb5696459558cc363eedd69e
4
- data.tar.gz: 34a2c3748611306069d495586549a0de7443d133
3
+ metadata.gz: c68a05810e98be2fcb3b537974fca72e8ab957ee
4
+ data.tar.gz: 8fb1263e28187dcb3a2a50c5d293b8f3df03adfc
5
5
  SHA512:
6
- metadata.gz: 866094223b9c739569ec266c621a934eccf9d0cd11ac7eb9453d682c5532ffa3e71e9624af070333fba4854213ec26547369315f969f71b4effb95b52f7899fd
7
- data.tar.gz: 640142f2131b45050bba63b9e25e2f50d5dd477947a0519c840063e4ba4c02df93a72aa8517baabb3306a898d07c47e4e36457e8074418f31bad38e0f222d583
6
+ metadata.gz: f3def62947a128f550444aa070c4c527452af1047adabb5d50de259a9288b518fc17deef3831e5a8c8a82a10b67b6e2f932379eb5cdf67d3b43b4fc502c4f1fa
7
+ data.tar.gz: 0baba95bf6967f19cddc306ea483fca59c09be0803996bc7f1b50170fd96a7de6523ae8cd32803240a9076d06992b4ba8bfbe806b5aaa449b604f6abb3984e81
@@ -275,7 +275,7 @@ module Lydown::Parsing
275
275
  module Command
276
276
  include Root
277
277
  def to_stream(stream)
278
- cmd = {type: :command}
278
+ cmd = {type: :command, raw: text_value}
279
279
  cmd[:once] = true if text_value =~ /^\\\!/
280
280
  _to_stream(self, cmd)
281
281
  stream << cmd
@@ -1,10 +1,15 @@
1
1
  module Lydown::Rendering
2
2
  class Command < Base
3
+ include Notes
4
+
3
5
  def translate
4
- once = @event[:once] ? '\once ' : ''
5
-
6
- cmd = "#{once}\\#{@event[:key]} #{(@event[:arguments] || []).join(' ')} "
7
- @work.emit(:music, cmd)
6
+ if @work['process/duration_macro']
7
+ add_macro_event(@event[:raw])
8
+ else
9
+ once = @event[:once] ? '\once ' : ''
10
+ cmd = "#{once}\\#{@event[:key]} #{(@event[:arguments] || []).join(' ')} "
11
+ @work.emit(:music, cmd)
12
+ end
8
13
  end
9
14
  end
10
15
  end
@@ -123,6 +123,9 @@ parts:
123
123
  viola-da-gamba2:
124
124
  clef: bass
125
125
  midi_instrument: viola
126
+ gamba:
127
+ clef: alto
128
+ midi_instrument: viola
126
129
  gamba1:
127
130
  clef: alto
128
131
  midi_instrument: viola
@@ -174,11 +177,11 @@ parts:
174
177
  midi_instrument: flute
175
178
  score:
176
179
  order:
177
- - [flauto1, flauto2, flauto3, flute1, flute2, flute3]
178
- - [oboe1, oboe2, oboe3]
179
- - [violino1, violino2, violino3, violin1, violin2, violin3]
180
+ - [flute, flauto1, flauto2, flauto3, flute1, flute2, flute3]
181
+ - [oboe, oboe1, oboe2, oboe3]
182
+ - [violino, violino1, violino2, violino3, violin1, violin2, violin3]
180
183
  - viola
181
- - [gamba1, gamba2]
184
+ - [gamba, gamba1, gamba2]
182
185
  - [soprano, alto, tenore, basso]
183
186
  - [soprano1, alto1, tenore1, basso1]
184
187
  - [soprano2, alto2, tenore2, basso2]
@@ -0,0 +1,32 @@
1
+ segno = {
2
+ \once \override Score.RehearsalMark #'font-size = #-2
3
+ \mark \markup { \musicglyph #"scripts.segno" }
4
+ }
5
+
6
+ segnobottom = {
7
+ \once \override Score.RehearsalMark #'direction = #DOWN
8
+ \once \override Score.RehearsalMark #'font-size = #-2
9
+ \mark \markup { \musicglyph #"scripts.segno" }
10
+ }
11
+
12
+ dalsegno = {
13
+ \once \override Score.RehearsalMark #'break-visibility = #begin-of-line-invisible
14
+ \once \override Score.RehearsalMark #'direction = #DOWN
15
+ \once \override Score.RehearsalMark #'self-alignment-X = #RIGHT
16
+ \once \override Score.RehearsalMark #'font-size = #-2
17
+ \mark \markup { \fontsize #2 {"dal segno "} \musicglyph #"scripts.segno" }
18
+ }
19
+
20
+ dacapo = {
21
+ \once \override Score.RehearsalMark #'break-visibility = #begin-of-line-invisible
22
+ \once \override Score.RehearsalMark #'direction = #DOWN
23
+ \once \override Score.RehearsalMark #'self-alignment-X = #RIGHT
24
+ \mark \markup {\bold {\italic {"Da capo"}}}
25
+ }
26
+
27
+ dalsegnoadlib = {
28
+ \once \override Score.RehearsalMark #'direction = #DOWN
29
+ \once \override Score.RehearsalMark #'self-alignment-X = #LEFT
30
+ \once \override Score.RehearsalMark #'font-size = #-2
31
+ \mark \markup { \musicglyph #"scripts.segno" ad lib }
32
+ }
@@ -9,6 +9,8 @@ module Lydown::Rendering
9
9
 
10
10
  class Duration < Base
11
11
  def translate
12
+ Notes.cleanup_duration_macro(@work)
13
+
12
14
  # close tuplet braces
13
15
  if @work['process/tuplet_mode']
14
16
  TupletDuration.emit_tuplet_end(@work)
@@ -39,6 +41,8 @@ module Lydown::Rendering
39
41
  end
40
42
 
41
43
  def translate
44
+ Notes.cleanup_duration_macro(@work)
45
+
42
46
  # close tuplet braces
43
47
  if @work['process/tuplet_mode']
44
48
  TupletDuration.emit_tuplet_end(@work)
@@ -226,6 +230,8 @@ module Lydown::Rendering
226
230
 
227
231
  class DurationMacro < Base
228
232
  def translate
233
+ Notes.cleanup_duration_macro(@work)
234
+
229
235
  if @event[:macro] =~ /^[a-zA-Z_]/
230
236
  macro = @work['macros'][@event[:macro]]
231
237
  if macro
@@ -217,7 +217,7 @@ EOF
217
217
  event[:head], event[:octave], event[:accidental_flag],
218
218
  lydown_phrasing_close(event),
219
219
  event[:figures] ? "<#{event[:figures].join}>" : '',
220
- event[:expressions] ? event[:expressions].join : ''
220
+ event[:expressions] ? event[:expressions].join + ' ' : ''
221
221
  ]
222
222
 
223
223
  # replace place holder and repeaters in macro group with actual note
@@ -233,16 +233,47 @@ EOF
233
233
 
234
234
  # if group is complete, compile it just like regular code
235
235
  unless @work['process/macro_group'].include?('_')
236
- # stash macro, in order to compile macro group
236
+ code = LydownParser.parse(@work['process/macro_group'])
237
+
238
+ # stash macro
237
239
  macro = @work['process/duration_macro']
238
240
  @work['process/duration_macro'] = nil
241
+ @work['process/macro_group'] = nil
239
242
 
240
- code = LydownParser.parse(@work['process/macro_group'])
241
243
  @work.process(code, no_reset: true)
242
244
 
243
245
  # restore macro
244
246
  @work['process/duration_macro'] = macro
245
- @work['process/macro_group'] = nil
247
+ end
248
+ end
249
+
250
+ # emits the current macro group up to the first placeholder character.
251
+ # this method is called
252
+ def self.cleanup_duration_macro(work)
253
+ return unless work['process/macro_group']
254
+
255
+ # truncate macro group up until first placeholder
256
+ group = work['process/macro_group'].sub(/_.*$/, '')
257
+
258
+ # stash macro, in order to compile macro group
259
+ macro = work['process/duration_macro']
260
+ work['process/duration_macro'] = nil
261
+ work['process/macro_group'] = nil
262
+
263
+ code = LydownParser.parse(group)
264
+ work.process(code, no_reset: true)
265
+
266
+ # restore macro
267
+ work['process/duration_macro'] = macro
268
+ end
269
+
270
+ def add_macro_event(code)
271
+ case @work['process/macro_group']
272
+ when nil
273
+ @work['process/macro_group'] = @work['process/duration_macro'].clone
274
+ @work['process/macro_group'].insert(0, " #{code} ")
275
+ when /_/
276
+ @work['process/macro_group'].sub!(/([_∞])/, " #{code} \\0")
246
277
  end
247
278
  end
248
279
 
@@ -1,5 +1,7 @@
1
1
  module Lydown::Rendering
2
2
  class Setting < Base
3
+ include Notes
4
+
3
5
  SETTING_KEYS = [
4
6
  'key', 'time', 'pickup', 'clef', 'part', 'movement', 'tempo',
5
7
  'accidentals', 'beams', 'end_barline', 'macros', 'empty_staves'
@@ -16,6 +18,11 @@ module Lydown::Rendering
16
18
  }
17
19
 
18
20
  def translate
21
+ # if setting while doing a macro, insert it into the current macro group
22
+ if @work['process/duration_macro'] && @event[:raw]
23
+ return add_macro_event(@event[:raw])
24
+ end
25
+
19
26
  key = @event[:key]
20
27
  value = @event[:value]
21
28
  level = @event[:level] || 0
@@ -45,4 +45,6 @@ module Lydown::Rendering
45
45
  @idx = idx
46
46
  end
47
47
  end
48
- end
48
+ end
49
+
50
+ LY_LIB_DIR = File.join(File.dirname(__FILE__), 'rendering')
@@ -1,5 +1,9 @@
1
1
  \version "2.18.2"
2
2
 
3
+ <% unless self['render_opts']['no_lib'] %>
4
+ \include "<%= File.join(LY_LIB_DIR, 'lib.ly') %>"
5
+ <% end %>
6
+
3
7
  <% if self['layout'] %>
4
8
  \layout {
5
9
  }
@@ -1,3 +1,3 @@
1
1
  module Lydown
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.5"
3
3
  end
data/lib/lydown/work.rb CHANGED
@@ -48,6 +48,8 @@ module Lydown
48
48
  if @context['process/voice_selector']
49
49
  Lydown::Rendering::VoiceSelect.render_voices(self)
50
50
  end
51
+
52
+ Lydown::Rendering::Notes.cleanup_duration_macro(self)
51
53
 
52
54
  # reset processing variables
53
55
  @context['process'] = {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lydown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-22 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop
@@ -47,6 +47,7 @@ files:
47
47
  - lib/lydown/rendering/comments.rb
48
48
  - lib/lydown/rendering/defaults.yml
49
49
  - lib/lydown/rendering/figures.rb
50
+ - lib/lydown/rendering/lib.ly
50
51
  - lib/lydown/rendering/lyrics.rb
51
52
  - lib/lydown/rendering/movement.rb
52
53
  - lib/lydown/rendering/music.rb