react-native-audio-api
Version:
react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification
26 lines (25 loc) • 920 B
JavaScript
;
import { InvalidStateError } from "../errors/index.js";
import AudioScheduledSourceNode from "./AudioScheduledSourceNode.web.js";
import AudioParam from "./AudioParam.web.js";
export default class OscillatorNode extends AudioScheduledSourceNode {
constructor(context, options) {
const node = new globalThis.OscillatorNode(context.context, options);
super(context, node);
this.detune = new AudioParam(node.detune, context);
this.frequency = new AudioParam(node.frequency, context);
}
get type() {
return this.node.type;
}
set type(value) {
if (value === 'custom') {
throw new InvalidStateError("'type' cannot be set directly to 'custom'. Use setPeriodicWave() to create a custom Oscillator type.");
}
this.node.type = value;
}
setPeriodicWave(wave) {
this.node.setPeriodicWave(wave.periodicWave);
}
}
//# sourceMappingURL=OscillatorNode.web.js.map