1. caw program parameters are now in snake_case rather than camelCase.
2. Column headers are now printed for caw 'log' output. 3. The websocket LLL_NOTICE logs may now be turned off using the 'extraLogsFl'. 4. Changed the 'Number' processor to work with the 'feedback' example. 5. README.md updates.
This commit is contained in:
parent
35f95f3eac
commit
c55f7d34ec
@ -1148,6 +1148,7 @@ channel that does not exist.
|
||||
|
||||
- DONE: All cfg to value conversion should go through `cfg_to_value()`.
|
||||
|
||||
- Try using adding 'time' type and 'cfg' types to a 'log:{...}' stmt.
|
||||
|
||||
Names
|
||||
------
|
||||
|
15
cwFlow.cpp
15
cwFlow.cpp
@ -710,17 +710,18 @@ cw::rc_t cw::flow::create( handle_t& hRef,
|
||||
p->sample_rate = kDefaultSampleRate;
|
||||
p->maxCycleCount = kInvalidCnt;
|
||||
p->proj_dir = proj_dir;
|
||||
p->printLogHdrFl = true;
|
||||
|
||||
// parse the optional args
|
||||
if((rc = flowCfg->readv("network", 0, p->networkCfg,
|
||||
"non_real_time_fl", kOptFl, p->non_real_time_fl,
|
||||
"framesPerCycle", kOptFl, p->framesPerCycle,
|
||||
"frames_per_cycle", kOptFl, p->framesPerCycle,
|
||||
"sample_rate", kOptFl, p->sample_rate,
|
||||
"maxCycleCount", kOptFl, maxCycleCount,
|
||||
"durLimitSecs", kOptFl, durLimitSecs,
|
||||
"max_cycle_count", kOptFl, maxCycleCount,
|
||||
"dur_limit_secs", kOptFl, durLimitSecs,
|
||||
"preset", kOptFl, p->init_net_preset_label,
|
||||
"printClassDictFl", kOptFl, printClassDictFl,
|
||||
"printNetworkFl", kOptFl, p->printNetworkFl,
|
||||
"print_class_dict_fl", kOptFl, printClassDictFl,
|
||||
"print_network_fl", kOptFl, p->printNetworkFl,
|
||||
"multiPriPresetProbFl", kOptFl, p->multiPriPresetProbFl,
|
||||
"multiSecPresetProbFl", kOptFl, p->multiSecPresetProbFl,
|
||||
"multiPresetInterpFl", kOptFl, p->multiPresetInterpFl)) != kOkRC )
|
||||
@ -875,10 +876,10 @@ cw::rc_t cw::flow::exec_cycle( handle_t h )
|
||||
cw::rc_t cw::flow::exec( handle_t h )
|
||||
{
|
||||
rc_t rc = kOkRC;
|
||||
flow_t* p = _handleToPtr(h);
|
||||
//flow_t* p = _handleToPtr(h);
|
||||
|
||||
while( rc == kOkRC )
|
||||
rc = exec_cycle(p->net);
|
||||
rc = exec_cycle(h);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -2220,7 +2220,7 @@ namespace cw
|
||||
|
||||
// Register variables and get their current value
|
||||
if((rc = var_register_and_get( proc, kAnyChIdx,
|
||||
kChCntPid, "chCnt", kBaseSfxId, chCnt,
|
||||
kChCntPid, "ch_cnt", kBaseSfxId, chCnt,
|
||||
kSratePId, "srate", kBaseSfxId, srate)) != kOkRC )
|
||||
{
|
||||
goto errLabel;
|
||||
@ -5181,7 +5181,7 @@ namespace cw
|
||||
rc_t rc = kOkRC;
|
||||
const char* out_type_label = nullptr;
|
||||
unsigned out_type_fl = kInvalidTFl;
|
||||
variable_t* dum = nullptr;
|
||||
variable_t* first_in_var = nullptr;
|
||||
unsigned inVarN = var_mult_count(proc,"in");
|
||||
unsigned inSfxIdA[ inVarN ];
|
||||
|
||||
@ -5206,12 +5206,15 @@ namespace cw
|
||||
// register each of the input vars
|
||||
for(unsigned i=0; i<p->inVarN; ++i)
|
||||
{
|
||||
variable_t* dum;
|
||||
if((rc = var_register(proc, "in", inSfxIdA[i], kInPId+i, kAnyChIdx, nullptr, dum )) != kOkRC )
|
||||
variable_t* foo;
|
||||
if((rc = var_register(proc, "in", inSfxIdA[i], kInPId+i, kAnyChIdx, nullptr, foo )) != kOkRC )
|
||||
{
|
||||
rc = cwLogError(rc,"Variable registration failed for the variable 'in:%i'.",inSfxIdA[i]);;
|
||||
goto errLabel;
|
||||
}
|
||||
|
||||
if( i==0 )
|
||||
first_in_var = foo;
|
||||
}
|
||||
|
||||
|
||||
@ -5227,14 +5230,14 @@ namespace cw
|
||||
if( textIsEqual(out_type_label,"") )
|
||||
{
|
||||
// ... then get the type of the first input variable
|
||||
if((rc = var_find(proc, kInPId, kAnyChIdx, dum )) != kOkRC )
|
||||
if((rc = var_find(proc, kInPId, kAnyChIdx, first_in_var )) != kOkRC )
|
||||
{
|
||||
goto errLabel;
|
||||
}
|
||||
|
||||
// if the first input variable's type has a valid type is not included in the
|
||||
if( dum->value != nullptr )
|
||||
out_type_fl = (dum->value->tflag & kTypeMask) ;
|
||||
if( first_in_var->value != nullptr )
|
||||
out_type_fl = (first_in_var->value->tflag & kTypeMask) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5248,7 +5251,7 @@ namespace cw
|
||||
}
|
||||
|
||||
// Create the output variable
|
||||
if((rc = var_create( proc, "out", kBaseSfxId, kOutPId, kAnyChIdx, nullptr, out_type_fl, dum )) != kOkRC )
|
||||
if((rc = var_create( proc, "out", kBaseSfxId, kOutPId, kAnyChIdx, nullptr, out_type_fl, first_in_var )) != kOkRC )
|
||||
{
|
||||
goto errLabel;
|
||||
}
|
||||
@ -5267,7 +5270,6 @@ namespace cw
|
||||
{
|
||||
if( var->vid == kTriggerPId )
|
||||
{
|
||||
if( proc->ctx->isInRuntimeFl )
|
||||
p->store_vid = kOutPId;
|
||||
}
|
||||
else
|
||||
@ -5279,7 +5281,11 @@ namespace cw
|
||||
p->store_vid = var->vid;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This call to set the a variable is safe because
|
||||
// we are in init-time not runtime and therefore single threaded
|
||||
var_set( proc, kOutPId, kAnyChIdx, var->value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ namespace cw
|
||||
break;
|
||||
|
||||
case kStringTFl:
|
||||
cwLogPrint("%s ", v->u.s);
|
||||
cwLogPrint("s:%s ", v->u.s);
|
||||
break;
|
||||
|
||||
case kTimeTFl:
|
||||
@ -299,6 +299,7 @@ namespace cw
|
||||
break;
|
||||
|
||||
case kCfgTFl:
|
||||
cwLogPrint("c:");
|
||||
if( v->u.cfg != nullptr )
|
||||
v->u.cfg->print();
|
||||
break;
|
||||
@ -2009,8 +2010,17 @@ cw::rc_t cw::flow::var_call_custom_value_func( variable_t* var )
|
||||
goto errLabel;
|
||||
|
||||
if( var->flags & kLogVarFl )
|
||||
{
|
||||
cwLogPrint("cycle: %8i ",var->proc->ctx->cycleIndex);
|
||||
{
|
||||
|
||||
if( var->proc->ctx->printLogHdrFl )
|
||||
{
|
||||
cwLogPrint("%s","exe cycle: process: id: variable: id vid ch : : : type:value : destination\n");
|
||||
cwLogPrint("%s","---------- ----------- ----- --------------- -- --- ----- ------------: -------------\n");
|
||||
//: 0 : a: 0: out: 0 vid: 2 ch: -1 : : : <invalid>:
|
||||
var->proc->ctx->printLogHdrFl = false;
|
||||
}
|
||||
|
||||
cwLogPrint("%8i ",var->proc->ctx->cycleIndex);
|
||||
cwLogPrint("%10s:%5i", var->proc->label,var->proc->label_sfx_id);
|
||||
|
||||
if( var->chIdx == kAnyChIdx )
|
||||
|
@ -345,7 +345,6 @@ namespace cw
|
||||
const object_t* networkCfg; // 'network' cfg from flowCfg
|
||||
|
||||
bool printNetworkFl;
|
||||
|
||||
bool non_real_time_fl; // set if this is a non-real-time program
|
||||
unsigned framesPerCycle; // sample frames per cycle (64)
|
||||
srate_t sample_rate; // default sample rate (48000.0)
|
||||
@ -354,7 +353,9 @@ namespace cw
|
||||
|
||||
bool isInRuntimeFl; // Set when compile-time is complete
|
||||
|
||||
unsigned cycleIndex; // Incremented with each processing cycle
|
||||
unsigned cycleIndex; // Incremented with each processing cycle
|
||||
|
||||
bool printLogHdrFl;
|
||||
|
||||
bool multiPriPresetProbFl; // If set then probability is used to choose presets on multi-preset application
|
||||
bool multiSecPresetProbFl; //
|
||||
|
12
cwUi.cpp
12
cwUi.cpp
@ -2337,6 +2337,7 @@ cw::rc_t cw::ui::ws::parseArgs( const object_t& o, args_t& args, const char* ob
|
||||
"idleMsgPeriodMs", args.idleMsgPeriodMs,
|
||||
"queueBlkCnt", args.queueBlkCnt,
|
||||
"queueBlkByteCnt", args.queueBlkByteCnt,
|
||||
"extraLogsFl", args.extraLogsFl,
|
||||
"uiCfgFn", uiCfgFn )) != kOkRC )
|
||||
{
|
||||
rc = cwLogError(rc,"'ui' cfg. parse failed.");
|
||||
@ -2401,7 +2402,8 @@ cw::rc_t cw::ui::ws::create( handle_t& h,
|
||||
args.xmtBufByteN,
|
||||
args.fmtBufByteN,
|
||||
args.queueBlkCnt,
|
||||
args.queueBlkByteCnt);
|
||||
args.queueBlkByteCnt,
|
||||
args.extraLogsFl);
|
||||
}
|
||||
|
||||
|
||||
@ -2420,7 +2422,8 @@ cw::rc_t cw::ui::ws::create( handle_t& h,
|
||||
unsigned xmtBufByteN,
|
||||
unsigned fmtBufByteN,
|
||||
unsigned queueBlkCnt,
|
||||
unsigned queueBlkByteCnt )
|
||||
unsigned queueBlkByteCnt,
|
||||
bool extraLogsFl)
|
||||
{
|
||||
rc_t rc = kOkRC;
|
||||
|
||||
@ -2440,7 +2443,7 @@ cw::rc_t cw::ui::ws::create( handle_t& h,
|
||||
void* wsCbA = wsCbFunc==nullptr ? p : cbArg;
|
||||
|
||||
// create the websocket
|
||||
if((rc = websock::create(p->wsH, wsCbF, wsCbA, physRootDir, dfltPageFn, port, protocolA, protocolN, queueBlkCnt, queueBlkByteCnt )) != kOkRC )
|
||||
if((rc = websock::create(p->wsH, wsCbF, wsCbA, physRootDir, dfltPageFn, port, protocolA, protocolN, queueBlkCnt, queueBlkByteCnt, extraLogsFl )) != kOkRC )
|
||||
{
|
||||
cwLogError(rc,"UI Websock create failed.");
|
||||
goto errLabel;
|
||||
@ -2630,7 +2633,8 @@ cw::rc_t cw::ui::srv::create( handle_t& h,
|
||||
unsigned xmtBufByteN,
|
||||
unsigned fmtBufByteN,
|
||||
unsigned queueBlkCnt,
|
||||
unsigned queueBlkByteCnt )
|
||||
unsigned queueBlkByteCnt,
|
||||
bool extraLogsFl )
|
||||
{
|
||||
rc_t rc = kOkRC;
|
||||
if((rc = destroy(h)) != kOkRC )
|
||||
|
7
cwUi.h
7
cwUi.h
@ -195,6 +195,7 @@ namespace cw
|
||||
unsigned idleMsgPeriodMs; // min period without messages before an idle message is generated
|
||||
unsigned queueBlkCnt;
|
||||
unsigned queueBlkByteCnt;
|
||||
bool extraLogsFl; // Report the websock LLL_NOTICE logs
|
||||
} args_t;
|
||||
|
||||
rc_t parseArgs( const object_t& o, args_t& args, const char* object_label="ui" );
|
||||
@ -224,7 +225,8 @@ namespace cw
|
||||
unsigned xmtBufByteN = 1024,
|
||||
unsigned fmtBufByteN = 4096,
|
||||
unsigned queueBlkCnt = 4,
|
||||
unsigned queueBlkByteCnt = 4096 );
|
||||
unsigned queueBlkByteCnt = 4096,
|
||||
bool extraLogsFl = false );
|
||||
|
||||
rc_t destroy( handle_t& h );
|
||||
|
||||
@ -275,7 +277,8 @@ namespace cw
|
||||
unsigned xmtBufByteN = 1024,
|
||||
unsigned fmtBufByteN = 4096,
|
||||
unsigned queueBlkCnt = 4,
|
||||
unsigned queueBlkByteCnt = 4096 );
|
||||
unsigned queueBlkByteCnt = 4096,
|
||||
bool extraLogsFl = false );
|
||||
|
||||
|
||||
rc_t destroy( handle_t& h );
|
||||
|
@ -596,7 +596,8 @@ cw::rc_t cw::websock::create(
|
||||
const protocol_t* protocolArgA,
|
||||
unsigned protocolN,
|
||||
unsigned queueBlkCnt,
|
||||
unsigned queueBlkByteCnt )
|
||||
unsigned queueBlkByteCnt,
|
||||
bool extraLogsFl )
|
||||
{
|
||||
rc_t rc;
|
||||
struct lws_context_creation_info info;
|
||||
@ -606,8 +607,11 @@ cw::rc_t cw::websock::create(
|
||||
return rc;
|
||||
|
||||
websock_t* p = mem::allocZ<websock_t>();
|
||||
|
||||
int logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE;
|
||||
|
||||
int logs = LLL_USER | LLL_ERR | LLL_WARN;
|
||||
if( extraLogsFl )
|
||||
logs |= LLL_NOTICE;
|
||||
|
||||
lws_set_log_level(logs, nullptr);
|
||||
|
||||
p->_event_loop_ops_custom = {};
|
||||
|
@ -47,7 +47,8 @@ namespace cw
|
||||
const protocol_t* protocolA,
|
||||
unsigned protocolN,
|
||||
unsigned queueBlkCnt,
|
||||
unsigned queueBlkByteCnt );
|
||||
unsigned queueBlkByteCnt,
|
||||
bool extraLogsFl);
|
||||
|
||||
rc_t destroy( handle_t& h );
|
||||
|
||||
|
@ -59,7 +59,8 @@ cw::rc_t cw::websockSrv::create(
|
||||
unsigned protocolN,
|
||||
unsigned timeOutMs,
|
||||
unsigned queueBlkCnt,
|
||||
unsigned queueBlkByteCnt )
|
||||
unsigned queueBlkByteCnt,
|
||||
bool extraLogsFl )
|
||||
{
|
||||
rc_t rc;
|
||||
if((rc = destroy(h)) != kOkRC )
|
||||
@ -67,7 +68,7 @@ cw::rc_t cw::websockSrv::create(
|
||||
|
||||
websockSrv_t* p = mem::allocZ<websockSrv_t>();
|
||||
|
||||
if((rc = websock::create( p->_websockH, cbFunc, cbArg, physRootDir, dfltHtmlPageFn, port, protocolA, protocolN, queueBlkCnt, queueBlkByteCnt )) != kOkRC )
|
||||
if((rc = websock::create( p->_websockH, cbFunc, cbArg, physRootDir, dfltHtmlPageFn, port, protocolA, protocolN, queueBlkCnt, queueBlkByteCnt, extraLogsFl )) != kOkRC )
|
||||
goto errLabel;
|
||||
|
||||
|
||||
@ -181,6 +182,7 @@ cw::rc_t cw::websockSrvTest( const object_t* cfg )
|
||||
unsigned xmtBufByteN = 128;
|
||||
unsigned queueBlkCnt = 3;
|
||||
unsigned queueBlkByteCnt= 4096;
|
||||
bool extraLogsFl = true;
|
||||
appCtx_t appCtx;
|
||||
|
||||
enum
|
||||
@ -203,7 +205,7 @@ cw::rc_t cw::websockSrvTest( const object_t* cfg )
|
||||
unsigned protocolN = sizeof(protocolA)/sizeof(protocolA[0]);
|
||||
|
||||
|
||||
if((rc = websockSrv::create( h, websockCb, &appCtx, physRootDir, dfltHtmlPageFn, port, protocolA, protocolN, timeOutMs, queueBlkCnt, queueBlkByteCnt )) != kOkRC )
|
||||
if((rc = websockSrv::create( h, websockCb, &appCtx, physRootDir, dfltHtmlPageFn, port, protocolA, protocolN, timeOutMs, queueBlkCnt, queueBlkByteCnt, extraLogsFl )) != kOkRC )
|
||||
return rc;
|
||||
|
||||
appCtx.wsH = websockSrv::websockHandle(h);
|
||||
|
@ -18,7 +18,8 @@ namespace cw {
|
||||
unsigned protocolN,
|
||||
unsigned websockTimeOutMs,
|
||||
unsigned queueBlkCnt,
|
||||
unsigned queueBlkByteCnt);
|
||||
unsigned queueBlkByteCnt,
|
||||
bool extraLogsFl );
|
||||
|
||||
rc_t destroy( handle_t& h );
|
||||
|
||||
|
@ -142,7 +142,7 @@
|
||||
sine_tone: {
|
||||
vars: {
|
||||
srate: { type:srate, value:0, doc:"Sine tone sample rate. 0=Use default system sample rate"}
|
||||
chCnt: { type:uint, value:2, doc:"Output signal channel count."},
|
||||
ch_cnt: { type:uint, value:2, doc:"Output signal channel count."},
|
||||
hz: { type:coeff, value:440.0, doc:"Frequency in Hertz."},
|
||||
phase: { type:coeff, value:0.0, doc:"Offset phase in radians."},
|
||||
dc: { type:coeff, value:0.0, doc:"DC offset applied after gain."},
|
||||
@ -154,7 +154,7 @@
|
||||
a220 : { hz:220 },
|
||||
a440 : { hz:440 },
|
||||
a880 : { hz:880 },
|
||||
mono: { chCnt:1, gain:0.75 }
|
||||
mono: { ch_cnt:1, gain:0.75 }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user