Class: Pachelbel::OscillatorNode
- Defined in:
- lib/project/Pachelbel.rb
Constant Summary collapse
- TYPES =
[:sine, :square, :sawtooth, :triangle]
Instance Attribute Summary
Attributes inherited from AudioNode
Instance Method Summary collapse
-
#frequency ⇒ Object
API Attributes.
- #frequency=(value) ⇒ Object
-
#start(time) ⇒ Object
API Methods.
- #stop(time) ⇒ Object
- #type ⇒ Object
- #type=(value) ⇒ Object
Methods inherited from AudioNode
#_audio_context=, #_index=, #_js_snippet, #connect, #disconnect, #run_js
Instance Method Details
#frequency ⇒ Object
API Attributes
140 141 142 |
# File 'lib/project/Pachelbel.rb', line 140 def frequency run_js("#{_js_snippet}.frequency.value;").to_f end |
#frequency=(value) ⇒ Object
144 145 146 |
# File 'lib/project/Pachelbel.rb', line 144 def frequency=(value) run_js("#{_js_snippet}.frequency.value = #{value.to_f};").to_f end |
#start(time) ⇒ Object
API Methods
161 162 163 164 |
# File 'lib/project/Pachelbel.rb', line 161 def start(time) js_method = UIDevice.currentDevice.systemVersion[0] == '6' ? 'noteOn' : 'start' run_js("#{_js_snippet}.#{js_method}(#{time});") end |
#stop(time) ⇒ Object
166 167 168 169 |
# File 'lib/project/Pachelbel.rb', line 166 def stop(time) js_method = UIDevice.currentDevice.systemVersion[0] == '6' ? 'noteOff' : 'stop' run_js("#{_js_snippet}.#{js_method}(#{time});") end |
#type ⇒ Object
148 149 150 |
# File 'lib/project/Pachelbel.rb', line 148 def type run_js("#{_js_snippet}.type;").to_sym end |