Document remaining functions
This commit is contained in:
parent
d516d765d5
commit
c62428ca27
25 changed files with 179 additions and 94 deletions
|
|
@ -35,7 +35,9 @@ class OLAProcessor extends AudioWorkletProcessor {
|
|||
}
|
||||
|
||||
/** Handles dynamic reallocation of input/output channels buffer
|
||||
(channel numbers may lety during lifecycle) **/
|
||||
* (channel numbers may vary during lifecycle)
|
||||
* @tags internals
|
||||
**/
|
||||
reallocateChannelsIfNeeded(inputs, outputs) {
|
||||
for (let i = 0; i < this.nbInputs; i++) {
|
||||
let nbChannels = inputs[i].length;
|
||||
|
|
@ -88,7 +90,10 @@ class OLAProcessor extends AudioWorkletProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
/** Read next web audio block to input buffers **/
|
||||
/**
|
||||
* Read next web audio block to input buffers
|
||||
* @tags internals
|
||||
**/
|
||||
readInputs(inputs) {
|
||||
// when playback is paused, we may stop receiving new samples
|
||||
if (inputs[0].length && inputs[0][0].length == 0) {
|
||||
|
|
@ -108,7 +113,9 @@ class OLAProcessor extends AudioWorkletProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
/** Write next web audio block from output buffers **/
|
||||
/** Write next web audio block from output buffers
|
||||
* @tags internals
|
||||
**/
|
||||
writeOutputs(outputs) {
|
||||
for (let i = 0; i < this.nbInputs; i++) {
|
||||
for (let j = 0; j < this.inputBuffers[i].length; j++) {
|
||||
|
|
@ -118,7 +125,9 @@ class OLAProcessor extends AudioWorkletProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
/** Shift left content of input buffers to receive new web audio block **/
|
||||
/** Shift left content of input buffers to receive new web audio block
|
||||
* @tags internals
|
||||
**/
|
||||
shiftInputBuffers() {
|
||||
for (let i = 0; i < this.nbInputs; i++) {
|
||||
for (let j = 0; j < this.inputBuffers[i].length; j++) {
|
||||
|
|
@ -127,7 +136,9 @@ class OLAProcessor extends AudioWorkletProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
/** Shift left content of output buffers to receive new web audio block **/
|
||||
/** Shift left content of output buffers to receive new web audio block
|
||||
* @tags internals
|
||||
**/
|
||||
shiftOutputBuffers() {
|
||||
for (let i = 0; i < this.nbOutputs; i++) {
|
||||
for (let j = 0; j < this.outputBuffers[i].length; j++) {
|
||||
|
|
@ -137,7 +148,9 @@ class OLAProcessor extends AudioWorkletProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
/** Copy contents of input buffers to buffer actually sent to process **/
|
||||
/** Copy contents of input buffers to buffer actually sent to process
|
||||
* @tags internals
|
||||
**/
|
||||
prepareInputBuffersToSend() {
|
||||
for (let i = 0; i < this.nbInputs; i++) {
|
||||
for (let j = 0; j < this.inputBuffers[i].length; j++) {
|
||||
|
|
@ -146,7 +159,9 @@ class OLAProcessor extends AudioWorkletProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
/** Add contents of output buffers just processed to output buffers **/
|
||||
/** Add contents of output buffers just processed to output buffers
|
||||
* @tags internals
|
||||
**/
|
||||
handleOutputBuffersToRetrieve() {
|
||||
for (let i = 0; i < this.nbOutputs; i++) {
|
||||
for (let j = 0; j < this.outputBuffers[i].length; j++) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ var reverbGen = {};
|
|||
|
||||
/** Generates a reverb impulse response.
|
||||
|
||||
@tags internals
|
||||
@param {!Object} params TODO: Document the properties.
|
||||
@param {!function(!AudioBuffer)} callback Function to call when
|
||||
the impulse response has been generated. The impulse response
|
||||
|
|
@ -48,7 +49,7 @@ reverbGen.generateReverb = function (params, callback) {
|
|||
|
||||
/** Creates a canvas element showing a graph of the given data.
|
||||
|
||||
|
||||
@tags internals
|
||||
@param {!Float32Array} data An array of numbers, or a Float32Array.
|
||||
@param {number} width Width in pixels of the canvas.
|
||||
@param {number} height Height in pixels of the canvas.
|
||||
|
|
@ -80,7 +81,7 @@ reverbGen.generateGraph = function (data, width, height, min, max) {
|
|||
@param {number} lpFreqEndAt
|
||||
@param {!function(!AudioBuffer)} callback May be called
|
||||
immediately within the current execution context, or later.
|
||||
@tags effects
|
||||
@tags internals
|
||||
*/
|
||||
var applyGradualLowpass = function (input, lpFreqStart, lpFreqEnd, lpFreqEndAt, callback) {
|
||||
if (lpFreqStart == 0) {
|
||||
|
|
|
|||
|
|
@ -221,6 +221,7 @@ export async function fetchSampleMap(url) {
|
|||
|
||||
/**
|
||||
* Loads a collection of samples to use with `s`
|
||||
* @tags samples
|
||||
* @example
|
||||
* samples('github:tidalcycles/dirt-samples');
|
||||
* s("[bd ~]*2, [~ hh]*2, ~ sd")
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ async function aliasBankPath(path) {
|
|||
* Optionally accepts a single argument string of a path to a JSON file containing bank aliases.
|
||||
* @param {string} bank - The bank to alias
|
||||
* @param {string} alias - The alias to use for the bank
|
||||
*
|
||||
* @tags samples
|
||||
*/
|
||||
export async function aliasBank(...args) {
|
||||
switch (args.length) {
|
||||
|
|
@ -109,6 +111,7 @@ export async function aliasBank(...args) {
|
|||
|
||||
/**
|
||||
* Register an alias for a sound.
|
||||
* @tags samples
|
||||
* @param {string} original - The original sound name
|
||||
* @param {string} alias - The alias to use for the sound
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ export function registerWaveTable(key, tables, params) {
|
|||
* Loads a collection of wavetables to use with `s`
|
||||
*
|
||||
* @name tables
|
||||
* @tags effects
|
||||
*/
|
||||
export const tables = async (url, frameLen, json, options = {}) => {
|
||||
if (json !== undefined) return _processTables(json, url, frameLen);
|
||||
|
|
|
|||
|
|
@ -635,14 +635,18 @@ class PhaseVocoderProcessor extends OLAProcessor {
|
|||
this.timeCursor += this.hopSize;
|
||||
}
|
||||
|
||||
/** Apply Hann window in-place */
|
||||
/** Apply Hann window in-place
|
||||
* @tags internals
|
||||
*/
|
||||
applyHannWindow(input) {
|
||||
for (var i = 0; i < this.blockSize; i++) {
|
||||
input[i] = input[i] * this.hannWindow[i] * 1.62;
|
||||
}
|
||||
}
|
||||
|
||||
/** Compute squared magnitudes for peak finding **/
|
||||
/** Compute squared magnitudes for peak finding
|
||||
* @tags internals
|
||||
**/
|
||||
computeMagnitudes() {
|
||||
var i = 0,
|
||||
j = 0;
|
||||
|
|
@ -656,7 +660,9 @@ class PhaseVocoderProcessor extends OLAProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
/** Find peaks in spectrum magnitudes **/
|
||||
/** Find peaks in spectrum magnitudes
|
||||
* @tags internals
|
||||
**/
|
||||
findPeaks() {
|
||||
this.nbPeaks = 0;
|
||||
var i = 2;
|
||||
|
|
@ -680,7 +686,9 @@ class PhaseVocoderProcessor extends OLAProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
/** Shift peaks and regions of influence by pitchFactor into new specturm */
|
||||
/** Shift peaks and regions of influence by pitchFactor into new specturm
|
||||
* @tags internals
|
||||
*/
|
||||
shiftPeaks(pitchFactor) {
|
||||
// zero-fill new spectrum
|
||||
this.freqComplexBufferShifted.fill(0);
|
||||
|
|
@ -843,7 +851,9 @@ class PulseOscillatorProcessor extends AudioWorkletProcessor {
|
|||
|
||||
registerProcessor('pulse-oscillator', PulseOscillatorProcessor);
|
||||
|
||||
/** BYTE BEATS */
|
||||
/** BYTE BEATS
|
||||
* @tags internals
|
||||
*/
|
||||
const chyx = {
|
||||
/*bit*/ bitC: function (x, y, z) {
|
||||
return x & y ? z : 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue