Skip to content

Commit

Permalink
Clean up demos.
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Aug 28, 2018
1 parent 35f9953 commit bcbb70c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 1 addition & 4 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ document.getElementById('play').onclick = function() {
let modGain = context.createGain();
let noiseGenerator = new AudioWorkletNode(context, 'noise-generator');
noiseGenerator.connect(context.destination);
// Connect the oscillator to 'amplitude' AudioParam.
let paramAmp = noiseGenerator.parameters.get('amplitude');
console.log(paramAmp);
setInterval(() => console.log(paramAmp.value), 250);
modulator.connect(modGain).connect(paramAmp);
modulator.frequency.value = 0.5;
modGain.gain.value = 0.75;
Expand All @@ -48,7 +45,7 @@ document.getElementById('play').onclick = function() {

/*
// Loads module script via AudioWorklet.
context.audioWorklet.addModule('dmeo-worklet.js').then(() => {
context.audioWorklet.addModule('demo-worklet.js').then(() => {
var oscillator = context.createOscillator();
// After the resolution of module loading, an AudioWorkletNode can be constructed.
Expand Down
7 changes: 6 additions & 1 deletion demo/noise-generator-worklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ class NoiseGenerator extends AudioWorkletProcessor {
return [{ name: 'amplitude', defaultValue: 0.25, minValue: 0, maxValue: 1 }];
}

// constructor (options) {
// super();
// console.log('options: ', options);
// console.log(this.port);
// }

process (inputs, outputs, parameters) {
const output = outputs[0];
const amplitude = parameters.amplitude;
// console.log(amplitude);
for (let channel = 0; channel < output.length; ++channel) {
const outputChannel = output[channel];
for (let i = 0; i < outputChannel.length; ++i) {
Expand Down

0 comments on commit bcbb70c

Please sign in to comment.