UNPKG

react-native-audio-api

Version:

react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification

36 lines (34 loc) 1.04 kB
"use strict"; import { PeriodicWaveOptionsValidator } from "../options-validators.js"; export function generateRealAndImag(options) { let real; let imag; if (!options || !options.real && !options.imag) { real = new Float32Array(2); imag = new Float32Array(2); imag[1] = 1; } else { real = options.real; imag = options.imag; PeriodicWaveOptionsValidator.validate(options); if (real && !imag) { imag = new Float32Array(real.length); } else if (!real && imag) { real = new Float32Array(imag.length); } } const norm = options?.disableNormalization ? options.disableNormalization : false; return { real, imag, disableNormalization: norm }; } export default class PeriodicWave { /** @internal */ constructor(context, options) { const finalOptions = generateRealAndImag(options); this.periodicWave = context.context.createPeriodicWave(finalOptions.real, finalOptions.imag, finalOptions.disableNormalization); } } //# sourceMappingURL=PeriodicWave.js.map