cwFlowTypes.h/cpp:

1. Added ui_net to network_t.
2. Added ui to class_desc_t.
3. Changed name of proc_t.proc_array to procA.
4. Added var_channel_count().
This commit is contained in:
kevin 2024-10-12 15:22:17 -04:00
parent 0dab461a6e
commit ab9feebc7a
2 changed files with 53 additions and 16 deletions

View File

@ -1525,6 +1525,12 @@ void cw::flow::class_desc_destroy( class_desc_t* class_desc)
pr0 = pr1; pr0 = pr1;
} }
if( class_desc->ui != nullptr )
{
mem::release(class_desc->ui->presetA);
mem::release(class_desc->ui);
}
} }
cw::flow::class_desc_t* cw::flow::class_desc_find( flow_t* p, const char* label ) cw::flow::class_desc_t* cw::flow::class_desc_find( flow_t* p, const char* label )
@ -1585,9 +1591,9 @@ void cw::flow::class_dict_print( flow_t* p )
void cw::flow::network_print( const network_t& net ) void cw::flow::network_print( const network_t& net )
{ {
// for each proc in the network // for each proc in the network
for(unsigned i=0; i<net.proc_arrayN; ++i) for(unsigned i=0; i<net.procN; ++i)
{ {
proc_t* proc = net.proc_array[i]; proc_t* proc = net.procA[i];
proc_print(proc); proc_print(proc);
// if this proc has an internal network // if this proc has an internal network
@ -1687,8 +1693,8 @@ const cw::flow::network_preset_t* cw::flow::network_preset_from_label( const net
unsigned cw::flow::proc_mult_count( const network_t& net, const char* proc_label ) unsigned cw::flow::proc_mult_count( const network_t& net, const char* proc_label )
{ {
unsigned multN = 0; unsigned multN = 0;
for(unsigned i=0; i<net.proc_arrayN; ++i) for(unsigned i=0; i<net.procN; ++i)
if( textIsEqual(net.proc_array[i]->label,proc_label) ) if( textIsEqual(net.procA[i]->label,proc_label) )
multN += 1; multN += 1;
return multN; 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; idN_ref = 0;
for(unsigned i=0; i<net.proc_arrayN; ++i) for(unsigned i=0; i<net.procN; ++i)
if( textIsEqual(net.proc_array[i]->label,proc_label) ) if( textIsEqual(net.procA[i]->label,proc_label) )
{ {
if( multN >= idAllocN ) 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; goto errLabel;
} }
idA[multN] = net.proc_array[i]->label_sfx_id; idA[multN] = net.procA[i]->label_sfx_id;
multN += 1; 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 ) cw::flow::proc_t* cw::flow::proc_find( network_t& net, const char* proc_label, unsigned sfx_id )
{ {
for(unsigned i=0; i<net.proc_arrayN; ++i) for(unsigned i=0; i<net.procN; ++i)
{ {
assert( net.proc_array[i] != nullptr ); assert( net.procA[i] != nullptr );
if( net.proc_array[i]->label_sfx_id==sfx_id && textIsEqual(proc_label,net.proc_array[i]->label) ) if( net.procA[i]->label_sfx_id==sfx_id && textIsEqual(proc_label,net.procA[i]->label) )
return net.proc_array[i]; return net.procA[i];
} }
if( net.poly_link != nullptr ) 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; 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 ) cw::rc_t cw::flow::var_call_custom_value_func( variable_t* var )
{ {
rc_t rc; rc_t rc;

View File

@ -179,9 +179,10 @@ namespace cw
const object_t* cfg; // class cfg const object_t* cfg; // class cfg
const char* label; // class label; const char* label; // class label;
var_desc_t* varDescL; // varDescL variable description linked on var_desc_t.link 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 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 unsigned polyLimitN; // max. poly copies of this class per network_t or 0 if no limit
ui_proc_desc_t* ui;
} class_desc_t; } class_desc_t;
enum { 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 vid; // this variables numeric id ( cat(vid,chIdx) forms a unique variable identifier on this 'proc'
unsigned chIdx; // channel index 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. 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 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* procsCfg; // network proc list
const object_t* presetsCfg; // presets designed for this network const object_t* presetsCfg; // presets designed for this network
struct proc_str** proc_array; struct proc_str** procA;
unsigned procN;
unsigned proc_arrayN;
network_preset_t* presetA; network_preset_t* presetA;
unsigned presetN; unsigned presetN;
@ -335,6 +335,8 @@ namespace cw
struct network_str* poly_link; struct network_str* poly_link;
unsigned poly_idx; unsigned poly_idx;
ui_net_t* ui_net;
} network_t; } network_t;
@ -510,6 +512,12 @@ namespace cw
// automatically generated variable whose channel index is set to 'kAnyChIdx'. // 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 ); 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() // Wrapper around call to var->proc->members->value()
rc_t var_call_custom_value_func( variable_t* var ); rc_t var_call_custom_value_func( variable_t* var );