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

Function Tuna

tuna.js:127–147  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

125 * @returns {Tuna} A new Tuna instance.
126 */
127export default function Tuna(context) {
128 if (!(this instanceof Tuna)) {
129 return new Tuna(context);
130 }
131
132 var _window = typeof window === "undefined" ? {} : window;
133
134 if (!_window.AudioContext) {
135 _window.AudioContext = _window.webkitAudioContext;
136 }
137 if (!context) {
138 console.log("tuna.js: Missing audio context! Creating a new context for you.");
139 context = _window.AudioContext && (new _window.AudioContext());
140 }
141 if (!context) {
142 throw new Error("Tuna cannot initialize because this environment does not support web audio.");
143 }
144 connectify(context);
145 userContext = context;
146 userInstance = this;
147}
148
149function connectify(context) {
150 if (context.__connectified__ === true) return;

Callers

nothing calls this directly

Calls 1

connectifyFunction · 0.85

Tested by

no test coverage detected