Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Descript Changes Clearly #2

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* index.d.ts
* web-audio-javascript-webassembly-SDK-interactive-audio
*
* Last modified by srubin on 8/4/21, 3:27 PM
* Copyright © 2021 Descript, Inc. All rights reserved.
*/

export * from './superpowered/Superpowered';
export * from './superpowered/SuperpoweredGlueModule';
export * from './superpowered/SuperpoweredTrackLoaderModule';
Expand Down
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
/*
* index.js
* web-audio-javascript-webassembly-SDK-interactive-audio
*
* Last modified by srubin on 8/4/21, 3:27 PM
* Copyright © 2021 Descript, Inc. All rights reserved.
*/

export * from './superpowered/SuperpoweredWebAudio';
8 changes: 8 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* rollup.config.js
* web-audio-javascript-webassembly-SDK-interactive-audio
*
* Last modified by srubin on 8/17/21, 3:27 PM
* Copyright © 2021 Descript, Inc. All rights reserved.
*/

import pkg from './package.json';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
Expand Down
8 changes: 8 additions & 0 deletions superpowered/Superpowered.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Superpowered.d.ts
* web-audio-javascript-webassembly-SDK-interactive-audio
*
* Last modified by srubin on 8/4/21, 3:27 PM
* Copyright © 2021 Descript, Inc. All rights reserved.
*/

declare class SuperpoweredProcessor {
constructor(samplerate: number);
process: (
Expand Down
8 changes: 8 additions & 0 deletions superpowered/SuperpoweredGlueModule.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* SuperpoweredGlueModule.d.ts
* web-audio-javascript-webassembly-SDK-interactive-audio
*
* Last modified by srubin on 8/4/21, 3:27 PM
* Copyright © 2021 Descript, Inc. All rights reserved.
*/

import {Superpowered, SuperpoweredFloat32Buffer} from "./Superpowered";

export declare class SuperpoweredGlue {
Expand Down
12 changes: 12 additions & 0 deletions superpowered/SuperpoweredGlueModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ class SuperpoweredGlue {
}
}

// BEGIN DESCRIPT CHANGE
// vvvvvvvvvvvvvvvvvvvvv
// srubin[06/14/2021]: added to support mono inputs
monoBufferToWASM(buffer, input) {
let inBuffer = null;
Expand All @@ -502,6 +504,8 @@ class SuperpoweredGlue {
buffer.array[n] = inBuffer[i];
}
}
// ^^^^^^^^^^^^^^^^^^^^^
// END DESCRIPT CHANGE

bufferToJS(buffer, output) {
let outBufferL = null;
Expand All @@ -519,6 +523,8 @@ class SuperpoweredGlue {
}
}

// BEGIN DESCRIPT CHANGE
// vvvvvvvvvvvvvvvvvvvvv
// srubin[06/14/2021]: added to support mono outputs
monoBufferToJs(buffer, output) {
let outBuffer = null;
Expand All @@ -531,6 +537,8 @@ class SuperpoweredGlue {
outBuffer[i] = buffer.array[n];
}
}
// ^^^^^^^^^^^^^^^^^^^^^
// END DESCRIPT CHANGE


arrayBufferToWASM(arrayBuffer, offset = 0) {
Expand All @@ -552,8 +560,12 @@ class SuperpoweredGlue {
}
}

// BEGIN DESCRIPT CHANGE
// vvvvvvvvvvvvvvvvvvvvv
// if (typeof exports === 'object' && typeof module === 'object') module.exports = SuperpoweredGlue;
// else if (typeof define === 'function' && define['amd']) define([], function() { return SuperpoweredGlue; });
// else if (typeof exports === 'object') exports["SuperpoweredGlue"] = SuperpoweredGlue;
// ^^^^^^^^^^^^^^^^^^^^^
// END DESCRIPT CHANGE

export { SuperpoweredGlue };
9 changes: 9 additions & 0 deletions superpowered/SuperpoweredTrackLoaderModule.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* SuperpoweredTrackLoaderModule.d.ts
* web-audio-javascript-webassembly-SDK-interactive-audio
*
* Last modified by srubin on 8/4/21, 3:27 PM
* Copyright © 2021 Descript, Inc. All rights reserved.
*/


export interface SuperpoweredTrackMessage {
data: {
SuperpoweredLoad: string;
Expand Down
4 changes: 4 additions & 0 deletions superpowered/SuperpoweredTrackLoaderModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ class SuperpoweredTrackLoader {
}
}

// BEGIN DESCRIPT CHANGE
// vvvvvvvvvvvvvvvvvvvvv
// if (typeof exports === 'object' && typeof module === 'object') module.exports = { SuperpoweredTrackLoader };
// else if (typeof define === 'function' && define['amd']) define([], function() { return { SuperpoweredTrackLoader }; });
// else if (typeof exports === 'object') exports["SuperpoweredTrackLoader"] = { SuperpoweredTrackLoader };
// ^^^^^^^^^^^^^^^^^^^^^
// END DESCRIPT CHANGE

export { SuperpoweredTrackLoader };
8 changes: 8 additions & 0 deletions superpowered/SuperpoweredWebAudio.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* SuperpoweredWebAudio.d.ts
* web-audio-javascript-webassembly-SDK-interactive-audio
*
* Last modified by srubin on 8/4/21, 3:27 PM
* Copyright © 2021 Descript, Inc. All rights reserved.
*/

import {Superpowered, SuperpoweredFloat32Buffer} from "./Superpowered";

export declare namespace SuperpoweredWebAudio {
Expand Down
12 changes: 12 additions & 0 deletions superpowered/SuperpoweredWebAudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ if (!AudioWorkletHasBrokenModuleImplementation && (typeof AudioWorkletProcessor
processAudio(buffer, parameters) {}
process(inputs, outputs, parameters) {
if (this.ok) {
// BEGIN DESCRIPT CHANGE
// vvvvvvvvvvvvvvvvvvvvv
if (inputs[0].length > 1) {
this.Superpowered.bufferToWASM(this.inputBuffer, inputs);
} else if (inputs[0].length === 1) {
Expand All @@ -169,6 +171,8 @@ if (!AudioWorkletHasBrokenModuleImplementation && (typeof AudioWorkletProcessor
// srubin[06/14/2021]: added this to support mono outputs
this.Superpowered.monoBufferToJs(this.outputBuffer, outputs);
}
// ^^^^^^^^^^^^^^^^^^^^^
// END DESCRIPT CHANGE
}
return true;
}
Expand All @@ -183,7 +187,11 @@ if (!AudioWorkletHasBrokenModuleImplementation && (typeof AudioWorkletProcessor
this.onMessageFromAudioScope = oma;
this.onReady();
}
// BEGIN DESCRIPT CHANGE
// vvvvvvvvvvvvvvvvvvvvv
// onMessageFromAudioScope = null;
// ^^^^^^^^^^^^^^^^^^^^^
// END DESCRIPT CHANGE
onReady() {}
onMessageFromMainScope(message) {}
sendMessageToMainScope(message) { if (!this.loader.onmessage({ data: message })) this.onMessageFromAudioScope(message); }
Expand All @@ -193,8 +201,12 @@ if (!AudioWorkletHasBrokenModuleImplementation && (typeof AudioWorkletProcessor
SuperpoweredWebAudio.AudioWorkletProcessor = SuperpoweredAudioWorkletProcessor;
}

// BEGIN DESCRIPT CHANGE
// vvvvvvvvvvvvvvvvvvvvv
// if (typeof exports === 'object' && typeof module === 'object') module.exports = { SuperpoweredGlue, SuperpoweredWebAudio, SuperpoweredTrackLoader };
// else if (typeof define === 'function' && define['amd']) define([], function() { return { SuperpoweredGlue, SuperpoweredWebAudio, SuperpoweredTrackLoader }; });
// else if (typeof exports === 'object') exports["SuperpoweredModule"] = { SuperpoweredGlue, SuperpoweredWebAudio, SuperpoweredTrackLoader };
// ^^^^^^^^^^^^^^^^^^^^^
// END DESCRIPT CHANGE

export { SuperpoweredGlue, SuperpoweredWebAudio, SuperpoweredTrackLoader };
8 changes: 8 additions & 0 deletions superpowered/superpowered.wasm.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
/*
* superpowered.wasm.d.ts
* web-audio-javascript-webassembly-SDK-interactive-audio
*
* Last modified by hipstersmoothie on 8/11/21, 3:27 PM
* Copyright © 2021 Descript, Inc. All rights reserved.
*/

declare const exportString: string;
export default exportString;