Class: Rampi::DSL
- Inherits:
-
Object
- Object
- Rampi::DSL
- Defined in:
- lib/rampi/dsl.rb
Instance Method Summary collapse
-
#code(num, synth, lpf = 0, lpq = 0, delay_ms = 0, delay_feed = 0, pan = 0) ⇒ Object
Set code line for channel
numwithsynthand parameters. - #compile ⇒ Object
-
#hush ⇒ Object
Silence everything!.
-
#initialize(port: 3005, autosync: true) ⇒ DSL
constructor
A new instance of DSL.
-
#ramp(value = nil) ⇒ Object
(also: #r)
Set ramp speed of
value. - #sync ⇒ Object
- #sync! ⇒ Object
Methods included from Helpers
#expe, #invexpe, #len2dur, #step
Methods included from Functions
#abs, #acos, #acosh, #asin, #asinh, #atan, #atan2, #atanh, #cbrt, #ceil, #cond, #cos, #cosh, #drem, #exp, #expm1, #fact, #float, #floor, #fmod, #imodf, #int, #ldexp, #ln, #log10, #log1p, #max, #min, #modf, #pow, #rint, #sin, #sinh, #sqrt, #tan, #tanh
Methods included from Variables
Constructor Details
#initialize(port: 3005, autosync: true) ⇒ DSL
Returns a new instance of DSL.
14 15 16 17 18 19 |
# File 'lib/rampi/dsl.rb', line 14 def initialize(port: 3005, autosync: true) @port = port @autosync = autosync @ramp ||= 1.0 @code ||= {} end |
Instance Method Details
#code(num, synth, lpf = 0, lpq = 0, delay_ms = 0, delay_feed = 0, pan = 0) ⇒ Object
Set code line for channel num with synth and parameters
31 32 33 34 35 |
# File 'lib/rampi/dsl.rb', line 31 def code(num, synth, lpf=0, lpq=0, delay_ms=0, delay_feed=0, pan=0) @code[num] = [synth, lpf, lpq, delay_ms, delay_feed, pan] sync @code[num] end |
#compile ⇒ Object
88 89 90 91 |
# File 'lib/rampi/dsl.rb', line 88 def compile @compiler ||= Compiler.new @compiler.compile(ramp: @ramp, code: @code) end |
#hush ⇒ Object
Silence everything!
38 39 40 41 |
# File 'lib/rampi/dsl.rb', line 38 def hush @code = {} sync end |
#ramp(value = nil) ⇒ Object Also known as: r
Set ramp speed of value
22 23 24 25 26 27 28 |
# File 'lib/rampi/dsl.rb', line 22 def ramp(value=nil) if value @ramp = value sync end @ramp end |
#sync ⇒ Object
75 76 77 |
# File 'lib/rampi/dsl.rb', line 75 def sync sync! if @autosync end |
#sync! ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'lib/rampi/dsl.rb', line 79 def sync! Open3.popen3("pdsend #{@port}") do |i, o, e, t| i.write compile i.close res = o.read puts "pdsend: #{res}" if !res.empty? end end |