musa-dsl 0.23.10 → 0.23.11

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
  SHA256:
3
- metadata.gz: 03b06753c72ecbea6d6b7b056996afa6defaa57e74edd389272728822c537e52
4
- data.tar.gz: 6580590252818be5df7a5f42094a026897852e874ece2ce77e657a499255b2d1
3
+ metadata.gz: abb4a2e7ffcd4376fd2d54f73172d611fe65da0cf6406365c7341b65e0706d30
4
+ data.tar.gz: 84214e98aa34a365a370e7597e0a64bafb800eafd59e17a6fdd8ac840bd915de
5
5
  SHA512:
6
- metadata.gz: 52a8bb01f12163cac1598946db6a60b10cb460894eac06952c82fb7b9eb32a76c6c05d1ff6b1c2133cd024253f3be5e100eec06c67afc6e0314d3bbbf2332bc2
7
- data.tar.gz: a7eb355bb4d9e13523f4769d4f204f150d0eb59fb2adaf0ddc989750b42e3958f1422074d11d798df99d560990a5e005d748ad06d99205273af0bdf3cf12e5e2
6
+ metadata.gz: 26936f34fc5038249db6df38ee405af52ff67ff7328d47a0f1f030768c33f61f828004b3d5581adc4857e2fbca60aba628e3c2cf14b21b48e3f455b52f587efd
7
+ data.tar.gz: 107fbc88359e3fe58b996d3156ae09b381580807bf6e0fe51fe281a37eb1b476eeeb483eacc63cb28e7c215ebd713d30dc432304d54b3b9155ef6fc304b6a33a
@@ -6,12 +6,13 @@ module Musa
6
6
  def with(*value_parameters, **key_parameters, &block)
7
7
  binder = Musa::Extension::SmartProcBinder::SmartProcBinder.new(block)
8
8
 
9
- keep_block_context = binder.parameters[0][1] == :_ unless binder.parameters.empty?
10
- keep_block_context ||= false
9
+ keep_proc_context = @keep_proc_context_on_with
10
+ keep_proc_context ||= binder.parameters[0][1] == :_ unless binder.parameters.empty?
11
+ keep_proc_context ||= false
11
12
 
12
13
  effective_value_parameters, effective_key_parameters = binder._apply(value_parameters, key_parameters)
13
14
 
14
- if keep_block_context
15
+ if keep_proc_context
15
16
  binder.call(self, *effective_value_parameters, **effective_key_parameters)
16
17
  else
17
18
  if effective_value_parameters.empty? && effective_key_parameters.empty?
@@ -3,7 +3,8 @@ module Musa::Sequencer
3
3
  private def _every(interval, control, block_procedure_binder: nil, &block)
4
4
  block ||= proc {}
5
5
 
6
- block_procedure_binder ||= SmartProcBinder.new block, on_rescue: proc { |e| _rescue_error(e) }
6
+ block_procedure_binder ||=
7
+ Musa::Extension::SmartProcBinder::SmartProcBinder.new block, on_rescue: proc { |e| _rescue_error(e) }
7
8
 
8
9
  _numeric_at position, control do
9
10
  control._start_position ||= position
@@ -1,6 +1,7 @@
1
- using Musa::Extension::Hashify
2
- using Musa::Extension::Arrayfy
1
+ require_relative '../core-ext/arrayfy'
2
+ require_relative '../core-ext/inspect-nice'
3
3
 
4
+ using Musa::Extension::Arrayfy
4
5
  using Musa::Extension::InspectNice
5
6
 
6
7
  module Musa::Sequencer
@@ -1,5 +1,3 @@
1
- using Musa::Extension::DeepCopy
2
-
3
1
  module Musa
4
2
  module Sequencer
5
3
  class BaseSequencer
@@ -1,5 +1,4 @@
1
- using Musa::Extension::Hashify
2
- using Musa::Extension::Arrayfy
1
+ require_relative '../core-ext/inspect-nice'
3
2
 
4
3
  using Musa::Extension::InspectNice
5
4
 
@@ -23,7 +22,7 @@ module Musa::Sequencer
23
22
  last_positions = hash_mode ? {} : []
24
23
  end
25
24
 
26
- binder = SmartProcBinder.new(block)
25
+ binder = Musa::Extension::SmartProcBinder::SmartProcBinder.new(block)
27
26
 
28
27
  _play_timed_step(hash_mode, component_ids, extra_attribute_names, timed_serie,
29
28
  position, last_positions, binder, control)
@@ -1,8 +1,6 @@
1
+ require_relative '../core-ext/inspect-nice'
1
2
  require_relative 'base-sequencer-implementation-play-helper'
2
3
 
3
- using Musa::Extension::Hashify
4
- using Musa::Extension::Arrayfy
5
-
6
4
  using Musa::Extension::InspectNice
7
5
 
8
6
  module Musa::Sequencer
@@ -1,16 +1,10 @@
1
- require_relative '../core-ext/arrayfy'
2
1
  require_relative '../core-ext/smart-proc-binder'
2
+ require_relative '../core-ext/inspect-nice'
3
3
 
4
- using Musa::Extension::Arrayfy
5
- using Musa::Extension::DeepCopy
4
+ using Musa::Extension::InspectNice
6
5
 
7
6
  module Musa::Sequencer
8
7
  class BaseSequencer
9
- include Musa::Extension::SmartProcBinder
10
- include Musa::Extension::DeepCopy
11
-
12
- using Musa::Extension::InspectNice
13
-
14
8
  private def _tick(position_to_run)
15
9
  @before_tick.each { |block| block.call position_to_run }
16
10
  queue = @timeslots[position_to_run]
@@ -72,7 +66,7 @@ module Musa::Sequencer
72
66
  at_position = _quantize_position(at_position)
73
67
 
74
68
  block_key_parameters_binder =
75
- SmartProcBinder.new block, on_rescue: proc { |e| _rescue_error(e) }
69
+ Musa::Extension::SmartProcBinder::SmartProcBinder.new block, on_rescue: proc { |e| _rescue_error(e) }
76
70
 
77
71
  key_parameters = {}
78
72
  key_parameters[:control] = control if block_key_parameters_binder.key?(:control)
@@ -133,8 +127,6 @@ module Musa::Sequencer
133
127
  end
134
128
 
135
129
  class EventHandler
136
- include Musa::Extension::SmartProcBinder
137
-
138
130
  attr_accessor :continue_parameters
139
131
 
140
132
  @@counter = 0
@@ -174,7 +166,7 @@ module Musa::Sequencer
174
166
  @handlers[event] ||= {}
175
167
 
176
168
  # TODO: add on_rescue: proc { |e| _rescue_block_error(e) } [this method is on Sequencer, not in EventHandler]
177
- @handlers[event][name] = { block: SmartProcBinder.new(block), only_once: only_once }
169
+ @handlers[event][name] = { block: Musa::Extension::SmartProcBinder::SmartProcBinder.new(block), only_once: only_once }
178
170
  end
179
171
 
180
172
  def launch(event, *value_parameters, **key_parameters)
@@ -18,7 +18,7 @@ module Musa
18
18
  :event_handler
19
19
 
20
20
  def_delegators :@dsl, :position, :quantize_position, :logger, :debug
21
- def_delegators :@dsl, :with, :now, :at, :wait, :play, :play_timed, :every, :move
21
+ def_delegators :@dsl, :now, :at, :wait, :play, :play_timed, :every, :move
22
22
  def_delegators :@dsl, :everying, :playing, :moving
23
23
  def_delegators :@dsl, :launch, :on
24
24
  def_delegators :@dsl, :run
@@ -28,6 +28,7 @@ module Musa
28
28
  sequencer: nil,
29
29
  logger: nil,
30
30
  do_log: nil, do_error_log: nil, log_position_format: nil,
31
+ keep_proc_context: nil,
31
32
  &block)
32
33
 
33
34
  @sequencer = sequencer
@@ -37,14 +38,17 @@ module Musa
37
38
  do_error_log: do_error_log,
38
39
  log_position_format: log_position_format
39
40
 
40
- @dsl = DSLContext.new @sequencer
41
+ @dsl = DSLContext.new @sequencer, keep_proc_context: keep_proc_context
41
42
 
42
- with &block if block_given?
43
+ @dsl.with &block if block_given?
44
+ end
45
+
46
+ def with(&block)
47
+ @dsl.with &block
43
48
  end
44
49
 
45
50
  class DSLContext
46
51
  extend Forwardable
47
- include Musa::Extension::SmartProcBinder
48
52
  include Musa::Extension::With
49
53
 
50
54
  attr_reader :sequencer
@@ -57,8 +61,9 @@ module Musa
57
61
  :ticks_per_bar, :logger, :debug, :inspect,
58
62
  :run
59
63
 
60
- def initialize(sequencer)
64
+ def initialize(sequencer, keep_proc_context:)
61
65
  @sequencer = sequencer
66
+ @keep_proc_context_on_with = keep_proc_context
62
67
  end
63
68
 
64
69
  def now(*value_parameters, **key_parameters, &block)
@@ -104,7 +109,7 @@ module Musa
104
109
  block ||= proc {}
105
110
 
106
111
  @sequencer.every *value_parameters, **key_parameters do |*value_args, **key_args|
107
- args = SmartProcBinder.new(block)._apply(value_args, key_args)
112
+ args = Musa::Extension::SmartProcBinder::SmartProcBinder.new(block)._apply(value_args, key_args)
108
113
  with *args.first, **args.last, &block
109
114
  end
110
115
  end
@@ -15,7 +15,7 @@ module Musa
15
15
  left_open: nil,
16
16
  right_open: nil)
17
17
 
18
- Series.QUANTIZE(self,
18
+ Series::Constructors.QUANTIZE(self,
19
19
  reference: reference,
20
20
  step: step,
21
21
  value_attribute: value_attribute,
data/musa-dsl.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'musa-dsl'
3
- s.version = '0.23.10'
4
- s.date = '2021-08-05'
3
+ s.version = '0.23.11'
4
+ s.date = '2021-08-31'
5
5
  s.summary = 'A simple Ruby DSL for making complex music'
6
6
  s.description = 'Musa-DSL: A Ruby framework and DSL for algorithmic sound and musical thinking and composition'
7
7
  s.authors = ['Javier Sánchez Yeste']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: musa-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.10
4
+ version: 0.23.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Sánchez Yeste
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-05 00:00:00.000000000 Z
11
+ date: 2021-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: citrus