Class: Browser::Audio::Context

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContext

Returns a new instance of Context.

Raises:

  • (NotImplementedError)

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

def initialize
  super `new AudioContext()`
end

Class Method Details

.supported?Boolean

Returns:

  • (Boolean)

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

def self.supported?
  Browser.support?('Audio') || Browser.support?('Audio (Chrome)')
end

Instance Method Details

#biquad_filterObject


49
50
51
# File 'opal/browser/audio.rb', line 49

def biquad_filter
  Node::BiquadFilter.new(self)
end

#delay(max_time) ⇒ Object


41
42
43
# File 'opal/browser/audio.rb', line 41

def delay(max_time)
  Node::Delay.new(self, max_time)
end

#dynamics_compressorObject


45
46
47
# File 'opal/browser/audio.rb', line 45

def dynamics_compressor
  Node::DynamicsCompressor.new(self)
end

#gainObject


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

def gain
  Node::Gain.new(self)
end

#oscillatorObject


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

def oscillator
  Node::Oscillator.new(self)
end

#periodic_wave(real, imaginary) ⇒ Object


57
58
59
# File 'opal/browser/audio.rb', line 57

def periodic_wave(real, imaginary)
  `#{@native}.createPeriodicWave(new Float32Array(#{real}), new Float32Array(#{imaginary}));`
end

#stereo_pannerObject


53
54
55
# File 'opal/browser/audio.rb', line 53

def stereo_panner
  Node::StereoPanner.new(self)
end