MCPcopy Create free account
hub / github.com/QuarkGluonPlasma/react-course-code / createAudioNode

Function createAudioNode

audio-flow/src/Audio.ts:63–83  ·  view source on GitHub ↗
(id: string, type: string, data: Record<string, any>)

Source from the content-addressed store, hash-verified

61
62
63export function createAudioNode(id: string, type: string, data: Record<string, any>) {
64 switch (type) {
65 case 'osc': {
66 const node = context.createOscillator();
67 node.frequency.value = data.frequency;
68 node.type = data.type;
69 node.start();
70
71 nodes.set(id, node);
72 break;
73 }
74
75 case 'volume': {
76 const node = context.createGain();
77 node.gain.value = data.gain;
78
79 nodes.set(id, node);
80 break;
81 }
82 }
83}

Callers 2

addOscNodeFunction · 0.90
addVolumeNodeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected