MCPcopy
hub / github.com/Theodeus/tuna / connectify

Function connectify

tuna.js:149–165  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

147}
148
149function connectify(context) {
150 if (context.__connectified__ === true) return;
151
152 var gain = context.createGain(),
153 proto = Object.getPrototypeOf(Object.getPrototypeOf(gain)),
154 oconnect = proto.connect;
155
156 proto.connect = shimConnect;
157 context.__connectified__ = true; // Prevent overriding connect more than once
158
159 function shimConnect() {
160 var node = arguments[0];
161 arguments[0] = Super.isPrototypeOf ? (Super.isPrototypeOf(node) ? node.input : node) : (node.input || node);
162 oconnect.apply(this, arguments);
163 return node;
164 }
165}
166
167function dbToWAVolume(db) {
168 return Math.max(0, Math.round(100 * Math.pow(2, db / 6)) / 100);

Callers 1

TunaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected