MCPcopy Create free account
hub / github.com/audacity/audacity / RealtimeProcessStart

Method RealtimeProcessStart

libraries/lib-vst/VSTInstance.cpp:265–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265bool VSTInstance::RealtimeProcessStart(MessagePackage& package)
266{
267 const bool applyChunkInMainThread = ChunkMustBeAppliedInMainThread();
268
269 if (applyChunkInMainThread)
270 mDeferredChunkMutex.lock();
271
272 if (!package.pMessage)
273 return true;
274
275 auto& message = static_cast<VSTMessage&>(*package.pMessage);
276
277 auto &chunk = message.mChunk;
278
279 if (!chunk.empty())
280 {
281 if (applyChunkInMainThread)
282 {
283 // Apply the chunk later
284 //
285 mChunkToSetAtIdleTime = chunk;
286 }
287 else
288 {
289 // Apply the chunk now
290 ApplyChunk(chunk);
291 }
292
293 // Don't apply the chunk again until another message supplies a chunk
294 chunk.resize(0);
295
296 // Don't return yet. Maybe some slider movements also accumulated after
297 // the change of the chunk.
298
299 const bool IsAudioThread = (mMainThreadId != std::this_thread::get_id());
300 if (IsAudioThread)
301 {
302 // At the moment, the only reason why this method would be called in the audio thread,
303 // is because a preset was loaded while playing
304
305 mPresetLoadedWhilePlaying.store(true);
306 }
307
308 }
309
310
311 assert(message.mParamsVec.size() == mAEffect->numParams);
312
313 for (size_t paramID=0; paramID < mAEffect->numParams; paramID++)
314 {
315 if (message.mParamsVec[paramID])
316 {
317 float val = (float)(*message.mParamsVec[paramID]);
318
319 // set the change on the recruited "this" instance
320 callSetParameter(paramID, val);
321
322 // set the change on any existing slaves

Callers 2

SetMethod · 0.45
ProcessStartMethod · 0.45

Calls 5

callSetParameterMethod · 0.80
lockMethod · 0.45
emptyMethod · 0.45
storeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected