refactor all the audio stuff into classes and a separate file

This commit is contained in:
Jakob Ketterl
2019-10-20 18:53:23 +02:00
parent 91b8c55de9
commit 13d7686258
5 changed files with 305 additions and 308 deletions

View File

@ -1,9 +1,8 @@
class OwrxAudioProcessor extends AudioWorkletProcessor {
constructor(options){
super(options);
this.maxLength = options.processorOptions.maxLength;
// initialize ringbuffer, make sure it aligns with the expected buffer size of 128
this.bufferSize = Math.round(sampleRate * this.maxLength / 128) * 128
this.bufferSize = Math.round(options.processorOptions.maxBufferSize / 128) * 128
this.audioBuffer = new Float32Array(this.bufferSize);
this.inPos = 0;
this.outPos = 0;