diff --git a/cwFlowTypes.cpp b/cwFlowTypes.cpp index 2cdc042..0138e33 100644 --- a/cwFlowTypes.cpp +++ b/cwFlowTypes.cpp @@ -1524,6 +1524,12 @@ void cw::flow::class_desc_destroy( class_desc_t* class_desc) mem::release(pr0); pr0 = pr1; } + + if( class_desc->ui != nullptr ) + { + mem::release(class_desc->ui->presetA); + mem::release(class_desc->ui); + } } @@ -1585,9 +1591,9 @@ void cw::flow::class_dict_print( flow_t* p ) void cw::flow::network_print( const network_t& net ) { // for each proc in the network - for(unsigned i=0; ilabel,proc_label) ) + for(unsigned i=0; ilabel,proc_label) ) multN += 1; return multN; @@ -1701,8 +1707,8 @@ cw::rc_t cw::flow::proc_mult_sfx_id_array( const network_t& net, const char* pro idN_ref = 0; - for(unsigned i=0; ilabel,proc_label) ) + for(unsigned i=0; ilabel,proc_label) ) { if( multN >= idAllocN ) { @@ -1710,7 +1716,7 @@ cw::rc_t cw::flow::proc_mult_sfx_id_array( const network_t& net, const char* pro goto errLabel; } - idA[multN] = net.proc_array[i]->label_sfx_id; + idA[multN] = net.procA[i]->label_sfx_id; multN += 1; } @@ -1803,12 +1809,12 @@ cw::rc_t cw::flow::proc_validate( proc_t* proc ) cw::flow::proc_t* cw::flow::proc_find( network_t& net, const char* proc_label, unsigned sfx_id ) { - for(unsigned i=0; ilabel_sfx_id==sfx_id && textIsEqual(proc_label,net.proc_array[i]->label) ) - return net.proc_array[i]; + if( net.procA[i]->label_sfx_id==sfx_id && textIsEqual(proc_label,net.procA[i]->label) ) + return net.procA[i]; } if( net.poly_link != nullptr ) @@ -2020,6 +2026,29 @@ cw::rc_t cw::flow::var_channelize( proc_t* proc, const char* var_label, unsigne return rc; } +unsigned cw::flow::var_channel_count( proc_t* proc, const char* var_label, unsigned sfx_id ) +{ + rc_t rc = kOkRC; + unsigned chN = kInvalidCnt; + variable_t* base_var = nullptr; + + if((rc = _var_find_on_label_and_ch( proc, var_label, sfx_id, kAnyChIdx, base_var)) != kOkRC || base_var==nullptr) + { + cwLogError(rc,"Var. channel count calc failed."); + goto errLabel; + } + + chN = 0; + for(base_var=base_var->ch_link; base_var!=nullptr; base_var=base_var->ch_link) + if( base_var->chIdx+1 > chN ) + chN = base_var->chIdx + 1; + + +errLabel: + return chN; +} + + cw::rc_t cw::flow::var_call_custom_value_func( variable_t* var ) { rc_t rc; diff --git a/cwFlowTypes.h b/cwFlowTypes.h index 172d909..e323f61 100644 --- a/cwFlowTypes.h +++ b/cwFlowTypes.h @@ -179,9 +179,10 @@ namespace cw const object_t* cfg; // class cfg const char* label; // class label; var_desc_t* varDescL; // varDescL variable description linked on var_desc_t.link - class_preset_t* presetL; // presetA[ presetN ] + class_preset_t* presetL; // preset linked list class_members_t* members; // member functions for this class unsigned polyLimitN; // max. poly copies of this class per network_t or 0 if no limit + ui_proc_desc_t* ui; } class_desc_t; enum { @@ -202,7 +203,7 @@ namespace cw unsigned vid; // this variables numeric id ( cat(vid,chIdx) forms a unique variable identifier on this 'proc' unsigned chIdx; // channel index - unsigned flags; // kLogVarFl + unsigned flags; // See kLogVarFl, kProxiedVarFl, etc unsigned type; // This is the value type as established when the var is initialized - it never changes for the life of the var. var_desc_t* classVarDesc; // pointer to this variables class var desc @@ -319,9 +320,8 @@ namespace cw const object_t* procsCfg; // network proc list const object_t* presetsCfg; // presets designed for this network - struct proc_str** proc_array; - - unsigned proc_arrayN; + struct proc_str** procA; + unsigned procN; network_preset_t* presetA; unsigned presetN; @@ -334,6 +334,8 @@ namespace cw struct network_str* poly_link; unsigned poly_idx; + + ui_net_t* ui_net; } network_t; @@ -510,6 +512,12 @@ namespace cw // automatically generated variable whose channel index is set to 'kAnyChIdx'. rc_t var_channelize( proc_t* proc, const char* var_label, unsigned sfx_id, unsigned chIdx, const object_t* value_cfg, unsigned vid, variable_t*& varRef ); + // Get the count of channels attached to var_label:sfx_id:kAnyChIdx. + // Returns 0 if only kAnyChIdx exists, + // Returns kInvalidCnt if var_label:sfx_id does not exist. + // Otherwise returns count of channels no including kAnyChIdx. (e.g. mono=1, stereo=2, quad=4 ...) + unsigned var_channel_count( proc_t* proc, const char* var_label, unsigned sfx_id ); + // Wrapper around call to var->proc->members->value() rc_t var_call_custom_value_func( variable_t* var );