MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / stepBlock

Method stepBlock

src/override/Engine.cpp:545–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543
544
545void Engine::stepBlock(int frames) {
546#ifndef HEADLESS
547 // Start timer before locking
548 double startTime = system::getTime();
549#endif
550
551 SharedLock<SharedMutex> lock(internal->mutex);
552 // Configure thread
553 random::init();
554
555 internal->blockFrame = internal->frame;
556 internal->blockTime = system::getTime();
557 internal->blockFrames = frames;
558
559 // Update expander pointers
560 for (Module* module : internal->modules) {
561 Engine_updateExpander_NoLock(this, module, false);
562 Engine_updateExpander_NoLock(this, module, true);
563 }
564
565 // Step individual frames
566 for (int i = 0; i < frames; i++) {
567 Engine_stepFrame(this);
568 }
569
570 internal->block++;
571
572#ifndef HEADLESS
573 // Stop timer
574 double endTime = system::getTime();
575 double meter = (endTime - startTime) / (frames * internal->sampleTime);
576 internal->meterTotal += meter;
577 internal->meterMax = std::fmax(internal->meterMax, meter);
578 internal->meterCount++;
579
580 // Update meter values
581 const double meterUpdateDuration = 1.0;
582 if (startTime - internal->meterLastTime >= meterUpdateDuration) {
583 internal->meterLastAverage = internal->meterTotal / internal->meterCount;
584 internal->meterLastMax = internal->meterMax;
585 internal->meterLastTime = startTime;
586 internal->meterCount = 0;
587 internal->meterTotal = 0.0;
588 internal->meterMax = 0.0;
589 }
590#endif
591}
592
593
594void Engine::setMasterModule(Module* module) {

Callers 14

runFunction · 0.80
uiIdleFunction · 0.80
runFunction · 0.80
uiIdleFunction · 0.80
runFunction · 0.80
uiIdleFunction · 0.80
runFunction · 0.80
uiIdleFunction · 0.80
runFunction · 0.80
uiIdleFunction · 0.80
runFunction · 0.80
uiIdleFunction · 0.80

Calls 3

Engine_stepFrameFunction · 0.85
initFunction · 0.70

Tested by

no test coverage detected