Hi Rackheads, Since I liked to use trowaSoft trigseq(64) and voltSeq very much but had to get rid of them because they eat up way too much cpu. I took a look at the source these days and did quite a simple hack to reduce CPU usage of them drastically (trigseq64 from > 10% CPU to <1% CPU) when running on external clock which is my standard use case. The main idea is to not fully run on each sample but only each 32 samples but still checking the external clock trigger input to keep exact timing. For those who are interested, here are my code changes:
Module_trigSeq.cpp and /Module_voltSeq.cpp in process():
if (!initialized)
return;
// adapt the lightLambda used to calculate step light fading
// because the process is executed completely only every 32nd time
if (inputs[EXT_CLOCK_INPUT].isConnected())
lightLambda = 0.05 / IDLESKIP;
else
lightLambda = 0.05;
idleCnt = (idleCnt + 1) % IDLESKIP;
double newExtTrg = inputs[EXT_CLOCK_INPUT].getVoltage();
// return if not each 32th sample, ext clk is connected and the trigger input did not change
if (idleCnt != 0 && inputs[EXT_CLOCK_INPUT].isConnected() && newExtTrg == extTrg) {
return; // return if idle to reduce cpu time
}
// save old ext trigger input state to detect change
extTrg = newExtTrg;
bool gOn = true;
bool pulse = false;
in TSSequencerModuleBase.hpp:
// If this was loaded from a save, what version
int saveVersion = -1;
// removed conts to allow changing depending on ext clk connect state
float lightLambda = 0.05;
// The number of structured random patterns to actually use.
// Should be <= TROWA_SEQ_NUM_RANDOM_PATTERNS.
int numStructuredRandomPatterns = TROWA_SEQ_BOOLEAN_NUM_RANDOM_PATTERNS;
// defines and global variables used by my hack
#define IDLESKIP 32
int idleCnt = -1;
double extTrg = 0;
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-