Browse Source

Remove Engine::setFrame(). Guarantee that Engine frame only increases by 1 with no jumps.

tags/v2.2.3
Andrew Belt 1 year ago
parent
commit
6eaf11ed7a
2 changed files with 8 additions and 19 deletions
  1. +5
    -11
      include/engine/Engine.hpp
  2. +3
    -8
      src/engine/Engine.cpp

+ 5
- 11
include/engine/Engine.hpp View File

@@ -63,29 +63,23 @@ struct Engine {
Call this in your Module::stepBlock() method to hint that the operation will take more than ~0.1 ms.
*/
void yieldWorkers();
/** Returns the number of stepBlock() calls since the Engine was created.
*/
int64_t getBlock();
/** Returns the frame counter which increases every sample step.
Not necessarily monotonically increasing. Can be reset at any time.
/** Returns the number of sample frames since the Engine was created.
*/
int64_t getFrame();
/** Sets the frame counter.
Useful for when the DAW playhead position jumps to a new position.
Rack plugins and standalone Rack should not call this function.
/** Returns the number of stepBlock() calls since the Engine was created.
*/
void setFrame(int64_t frame);
int64_t getBlock();
/** Returns the frame when stepBlock() was last called.
*/
int64_t getBlockFrame();
/** Returns the time in seconds when stepBlock() was last called.
*/
double getBlockTime();
/** Returns the total number of frames in the current stepBlock() call.
/** Returns the number of frames requested by the last stepBlock() call.
*/
int getBlockFrames();
/** Returns the total time that stepBlock() is advancing, in seconds.
Calculated by `stepFrames / sampleRate`.
Calculated by `blockFrames / sampleRate`.
*/
double getBlockDuration();
/** Returns the average block processing time divided by block time in the last T seconds.


+ 3
- 8
src/engine/Engine.cpp View File

@@ -201,8 +201,8 @@ struct Engine::Internal {

float sampleRate = 0.f;
float sampleTime = 0.f;
int64_t block = 0;
int64_t frame = 0;
int64_t block = 0;
int64_t blockFrame = 0;
double blockTime = 0.0;
int blockFrames = 0;
@@ -674,18 +674,13 @@ void Engine::yieldWorkers() {
}


int64_t Engine::getBlock() {
return internal->block;
}


int64_t Engine::getFrame() {
return internal->frame;
}


void Engine::setFrame(int64_t frame) {
internal->frame = frame;
int64_t Engine::getBlock() {
return internal->block;
}




Loading…
Cancel
Save