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 +4 -4
- data/lib/musa-dsl/core-ext/with.rb +4 -3
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-every.rb +2 -1
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-move.rb +3 -2
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-helper.rb +0 -2
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-timed.rb +2 -3
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-play.rb +1 -3
- data/lib/musa-dsl/sequencer/base-sequencer-implementation.rb +4 -12
- data/lib/musa-dsl/sequencer/sequencer-dsl.rb +11 -6
- data/lib/musa-dsl/series/quantizer-serie.rb +1 -1
- data/musa-dsl.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abb4a2e7ffcd4376fd2d54f73172d611fe65da0cf6406365c7341b65e0706d30
|
4
|
+
data.tar.gz: 84214e98aa34a365a370e7597e0a64bafb800eafd59e17a6fdd8ac840bd915de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
10
|
-
|
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
|
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 ||=
|
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,5 +1,4 @@
|
|
1
|
-
|
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,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::
|
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
|
-
|
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, :
|
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
|
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.
|
4
|
-
s.date = '2021-08-
|
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.
|
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-
|
11
|
+
date: 2021-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: citrus
|