Class: Deftones::Destination
- Inherits:
-
Object
- Object
- Deftones::Destination
- Extended by:
- Forwardable
- Defined in:
- lib/deftones/destination.rb
Defined Under Namespace
Classes: VolumeProxy
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#mute ⇒ Object
Returns the value of attribute mute.
-
#volume ⇒ Object
readonly
Returns the value of attribute volume.
Class Method Summary collapse
Instance Method Summary collapse
- #apply_volume! ⇒ Object
- #block_time ⇒ Object (also: #blockTime)
- #chain(*nodes) ⇒ Object
- #connect(*arguments, **keywords) ⇒ Object
- #disconnect(*arguments) ⇒ Object
- #fan(*nodes) ⇒ Object
-
#initialize(context:) ⇒ Destination
constructor
A new instance of Destination.
- #input ⇒ Object
- #max_channel_count ⇒ Object (also: #maxChannelCount)
- #mute? ⇒ Boolean
- #name ⇒ Object
- #node ⇒ Object
- #output ⇒ Object
- #sample_time ⇒ Object (also: #sampleTime)
Constructor Details
#initialize(context:) ⇒ Destination
Returns a new instance of Destination.
87 88 89 90 91 92 |
# File 'lib/deftones/destination.rb', line 87 def initialize(context:) @context = context @volume = VolumeProxy.new(self) @mute = false apply_volume! end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
61 62 63 |
# File 'lib/deftones/destination.rb', line 61 def context @context end |
#mute ⇒ Object
Returns the value of attribute mute.
61 62 63 |
# File 'lib/deftones/destination.rb', line 61 def mute @mute end |
#volume ⇒ Object (readonly)
Returns the value of attribute volume.
61 62 63 |
# File 'lib/deftones/destination.rb', line 61 def volume @volume end |
Class Method Details
.node(context: Deftones.context) ⇒ Object
71 72 73 |
# File 'lib/deftones/destination.rb', line 71 def node(context: Deftones.context) registry[context.object_id] ||= new(context: context) end |
.registry ⇒ Object (private)
82 83 84 |
# File 'lib/deftones/destination.rb', line 82 def registry @registry ||= {} end |
.reset! ⇒ Object
75 76 77 78 |
# File 'lib/deftones/destination.rb', line 75 def reset! @registry = {} self end |
Instance Method Details
#apply_volume! ⇒ Object
147 148 149 150 |
# File 'lib/deftones/destination.rb', line 147 def apply_volume! node.gain.value = mute ? 0.0 : Deftones.db_to_gain(@volume.value) self end |
#block_time ⇒ Object Also known as: blockTime
123 124 125 |
# File 'lib/deftones/destination.rb', line 123 def block_time context.buffer_size.to_f / context.sample_rate end |
#chain(*nodes) ⇒ Object
139 140 141 |
# File 'lib/deftones/destination.rb', line 139 def chain(*nodes) node.chain(*nodes) end |
#connect(*arguments, **keywords) ⇒ Object
131 132 133 |
# File 'lib/deftones/destination.rb', line 131 def connect(*arguments, **keywords) node.connect(*arguments, **keywords) end |
#disconnect(*arguments) ⇒ Object
135 136 137 |
# File 'lib/deftones/destination.rb', line 135 def disconnect(*arguments) node.disconnect(*arguments) end |
#fan(*nodes) ⇒ Object
143 144 145 |
# File 'lib/deftones/destination.rb', line 143 def fan(*nodes) node.fan(*nodes) end |
#input ⇒ Object
94 95 96 |
# File 'lib/deftones/destination.rb', line 94 def input node end |
#max_channel_count ⇒ Object Also known as: maxChannelCount
127 128 129 |
# File 'lib/deftones/destination.rb', line 127 def max_channel_count context.channels end |
#mute? ⇒ Boolean
111 112 113 |
# File 'lib/deftones/destination.rb', line 111 def mute? @mute end |
#name ⇒ Object
115 116 117 |
# File 'lib/deftones/destination.rb', line 115 def name "Destination" end |
#node ⇒ Object
102 103 104 |
# File 'lib/deftones/destination.rb', line 102 def node context.output end |
#output ⇒ Object
98 99 100 |
# File 'lib/deftones/destination.rb', line 98 def output node end |
#sample_time ⇒ Object Also known as: sampleTime
119 120 121 |
# File 'lib/deftones/destination.rb', line 119 def sample_time 1.0 / context.sample_rate end |