({ inputBuffer, outputBuffer })
| 181 | |
| 182 | // try to do the same here as in Vanilla+Worklet |
| 183 | process({ inputBuffer, outputBuffer }) { |
| 184 | if (this.workerMessagePort.vanillaWorkerState === "realtimePerformanceEnded") { |
| 185 | setPlayState({ contextUid: this.contextUid, newPlayState: "realtimePerformanceEnded" }); |
| 186 | return true; |
| 187 | } |
| 188 | |
| 189 | if (!this.vanillaInitialized) { |
| 190 | // this minimizes startup glitches |
| 191 | const firstTransferSize = this.softwareBufferSize * PERIODS; |
| 192 | |
| 193 | this.requestPort.postMessage({ |
| 194 | readIndex: 0, |
| 195 | numFrames: firstTransferSize, |
| 196 | }); |
| 197 | |
| 198 | this.pendingFrames += firstTransferSize; |
| 199 | this.vanillaInitialized = true; |
| 200 | return true; |
| 201 | } |
| 202 | |
| 203 | if (!this.vanillaFirstTransferDone) { |
| 204 | return true; |
| 205 | } |
| 206 | |
| 207 | const writeableInputChannels = range(0, this.inputsCount).map((index) => |
| 208 | inputBuffer.getChannelData(index), |
| 209 | ); |
| 210 | const writeableOutputChannels = range(0, this.outputsCount).map((index) => |
| 211 | outputBuffer.getChannelData(index), |
| 212 | ); |
| 213 | |
| 214 | const hasWriteableInputChannels = writeableInputChannels.length > 0; |
| 215 | |
| 216 | const nextOutputReadIndex = |
| 217 | (this.vanillaOutputReadIndex + writeableOutputChannels[0].length) % this.hardwareBufferSize; |
| 218 | |
| 219 | const nextInputReadIndex = hasWriteableInputChannels |
| 220 | ? (this.vanillaInputReadIndex + writeableInputChannels[0].length) % this.hardwareBufferSize |
| 221 | : 0; |
| 222 | |
| 223 | if ( |
| 224 | this.workerMessagePort.vanillaWorkerState !== "realtimePerformanceStarted" && |
| 225 | this.workerMessagePort.vanillaWorkerState !== "realtimePerformanceResumed" |
| 226 | ) { |
| 227 | writeableOutputChannels.forEach((channelBuffer) => { |
| 228 | channelBuffer.fill(0); |
| 229 | }); |
| 230 | return true; |
| 231 | } else if (this.vanillaAvailableFrames >= writeableOutputChannels[0].length) { |
| 232 | writeableOutputChannels.forEach((channelBuffer, channelIndex) => { |
| 233 | channelBuffer.set( |
| 234 | this.vanillaOutputChannels[channelIndex].subarray( |
| 235 | this.vanillaOutputReadIndex, |
| 236 | nextOutputReadIndex < this.vanillaOutputReadIndex |
| 237 | ? this.hardwareBufferSize |
| 238 | : nextOutputReadIndex, |
| 239 | ), |
| 240 | ); |
nothing calls this directly
no test coverage detected