Class: Browser::Audio::ParamSchedule

Inherits:
Object
  • Object
show all
Includes:
Native::Wrapper
Defined in:
opal/browser/audio/param_schedule.rb

Instance Method Summary collapse

Constructor Details

#initialize(audio_param, time = nil) ⇒ ParamSchedule

Returns a new instance of ParamSchedule.


8
9
10
11
12
# File 'opal/browser/audio/param_schedule.rb', line 8

def initialize(audio_param, time = nil)
  @time = time
  @audio_param = audio_param
  super Native.convert(audio_param)
end

Instance Method Details

#at(time) ⇒ Object


14
15
16
# File 'opal/browser/audio/param_schedule.rb', line 14

def at(time)
  new(@audio_param, time)
end

#curve(values, time_hash) ⇒ Object


38
39
40
# File 'opal/browser/audio/param_schedule.rb', line 38

def curve(values, time_hash)
  `#@native.setValueCurveAtTime(values, #{time_hash[:start_time]}, #{time_hash[:time_constant]})`
end

#exponential_ramp_to(value = nil, time = nil) ⇒ Object


29
30
31
32
# File 'opal/browser/audio/param_schedule.rb', line 29

def exponential_ramp_to(value = nil, time = nil)
  `#@native.exponentialRampToValueAtTime(#{@value || value}, #{@time || time})`
  self
end

#linear_ramp_to(value = nil, time = nil) ⇒ Object


24
25
26
27
# File 'opal/browser/audio/param_schedule.rb', line 24

def linear_ramp_to(value = nil, time = nil)
  `#@native.linearRampToValueAtTime(#{@value || value}, #{@time || time})`
  self
end

#target(target, time_hash) ⇒ Object


34
35
36
# File 'opal/browser/audio/param_schedule.rb', line 34

def target(target, time_hash)
  `#@native.setTargetAtTime(target, #{time_hash[:start_time]}, #{time_hash[:time_constant]})`
end

#value(value, time = nil) ⇒ Object


18
19
20
21
22
# File 'opal/browser/audio/param_schedule.rb', line 18

def value(value, time = nil)
  @value = value
  `#@native.setValueAtTime(#{@value}, #{@time || time})`
  self
end