cwFlow.cpp : Added 'durLimitSecs' flow system parameter.

This commit is contained in:
kevin 2024-05-29 19:31:22 -04:00
parent 8dde88f6fd
commit bfac35faf6

View File

@ -676,6 +676,7 @@ cw::rc_t cw::flow::create( handle_t& hRef,
bool printNetworkFl = false; bool printNetworkFl = false;
variable_t* proxyVarL = nullptr; variable_t* proxyVarL = nullptr;
unsigned maxCycleCount = kInvalidCnt; unsigned maxCycleCount = kInvalidCnt;
double durLimitSecs = 0;
if(( rc = destroy(hRef)) != kOkRC ) if(( rc = destroy(hRef)) != kOkRC )
return rc; return rc;
@ -700,12 +701,6 @@ cw::rc_t cw::flow::create( handle_t& hRef,
goto errLabel; goto errLabel;
} }
// parse the main audio file processor cfg record
if((rc = flowCfg->getv("network", networkCfg)) != kOkRC )
{
rc = cwLogError(kSyntaxErrorRC,"Error parsing the required flow configuration parameters.");
goto errLabel;
}
p->framesPerCycle = kDefaultFramesPerCycle; p->framesPerCycle = kDefaultFramesPerCycle;
p->sample_rate = kDefaultSampleRate; p->sample_rate = kDefaultSampleRate;
@ -713,22 +708,32 @@ cw::rc_t cw::flow::create( handle_t& hRef,
p->proj_dir = proj_dir; p->proj_dir = proj_dir;
// parse the optional args // parse the optional args
if((rc = flowCfg->getv_opt("framesPerCycle", p->framesPerCycle, if((rc = flowCfg->readv("network", 0, networkCfg,
"sample_rate", p->sample_rate, "framesPerCycle", kOptFl, p->framesPerCycle,
"maxCycleCount", maxCycleCount, "sample_rate", kOptFl, p->sample_rate,
"preset", p->init_net_preset_label, "maxCycleCount", kOptFl, maxCycleCount,
"multiPriPresetProbFl", p->multiPriPresetProbFl, "durLimitSecs", kOptFl, durLimitSecs,
"multiSecPresetProbFl", p->multiSecPresetProbFl, "preset", kOptFl, p->init_net_preset_label,
"multiPresetInterpFl", p->multiPresetInterpFl, "printClassDictFl", kOptFl, printClassDictFl,
"printClassDictFl", printClassDictFl, "printNetworkFl", kOptFl, printNetworkFl,
"printNetworkFl", printNetworkFl)) != kOkRC ) "multiPriPresetProbFl", kOptFl, p->multiPriPresetProbFl,
"multiSecPresetProbFl", kOptFl, p->multiSecPresetProbFl,
"multiPresetInterpFl", kOptFl, p->multiPresetInterpFl)) != kOkRC )
{ {
rc = cwLogError(kSyntaxErrorRC,"Error parsing the optional flow configuration parameters."); rc = cwLogError(kSyntaxErrorRC,"Error parsing the network system parameters.");
goto errLabel; goto errLabel;
} }
// if a maxCycle count was given
if( maxCycleCount != kInvalidCnt ) if( maxCycleCount != kInvalidCnt )
p->maxCycleCount = maxCycleCount; p->maxCycleCount = maxCycleCount;
else
{
// if a durLimitSecs was given - use it to setMaxCycleCount
if( durLimitSecs != 0.0 )
p->maxCycleCount = (unsigned)((durLimitSecs * p->sample_rate) / p->framesPerCycle);
}
for(unsigned i=0; i<deviceN; ++i) for(unsigned i=0; i<deviceN; ++i)
if( deviceA[i].typeId == kAudioDevTypeId ) if( deviceA[i].typeId == kAudioDevTypeId )