Skip to content

Commit

Permalink
1) Added option in forward buffer to allow buffer underrun without re…
Browse files Browse the repository at this point in the history
…porting errors via processing chain. This was and actually is the default setting

2) Extended MixChainEnterLeave to allow or disallow divergence of i/o relation. That is, if the input does not provide any data, the output will not produce either
  • Loading branch information
hkbinaurics committed Jul 8, 2024
1 parent e91676b commit 3d7744c
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ SECTION PROPERTIES
INIT_SET = 0;
READ_WRITE_ACCESS = "JVX_PROPERTY_ACCESS_FULL_READ_AND_WRITE";
};

SECTION out_fail_no_report
{
TYPE = "JVX_DATAFORMAT_BOOL";
INIT_SET = 1;
READ_WRITE_ACCESS = "JVX_PROPERTY_ACCESS_FULL_READ_AND_WRITE";
};
};

SECTION monitor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -866,12 +866,11 @@ CjvxAuNForwardBuffer::push_on_pull_one_buffer(jvxHandle* data, jvxBool runStartS
case JVX_DSP_ERROR_BUFFER_OVERFLOW:
// Count the underflow events - even if the chan -- but not if not yet ready.
genForwardBuffer_node::monitor.number_overflows.value++;

[[fallthrough]];

case JVX_DSP_ERROR_ABORT:


res = resL;
// No output from buffer, copy silence
for (i = 0; i < _common_set_ocon.theData_out.con_params.number_channels; i++)
{
Expand All @@ -883,14 +882,27 @@ CjvxAuNForwardBuffer::push_on_pull_one_buffer(jvxHandle* data, jvxBool runStartS
// If the sample buffer does not deliver we need to wakeup the thread!!
refThreads.cpPtr->trigger_wakeup();
}
res = JVX_NO_ERROR;

if (genForwardBuffer_node::config.out_fail_no_report.value)
{
// We see an error at this place, and here, we do not report this error
res = JVX_NO_ERROR;
}
else
{
// We see an error at this place, and here, we report this error
// res = JVX_NO_ERROR;
}
break;

default:
break;
}

_common_set_ocon.theData_out.con_link.connect_to->process_buffers_icon();
if (res == JVX_NO_ERROR)
{
_common_set_ocon.theData_out.con_link.connect_to->process_buffers_icon();
}

if (runStartStop)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,17 @@ SECTION PROPERTIES
READ_WRITE_ACCESS = "JVX_PROPERTY_ACCESS_READ_ONLY";
};
};

SECTION monitor
{
GENERATE_ENTRIES_CONFIG_FILE = "no"; // Defaults to "no" if not present
ALLOWED_STATE_MASK = {"JVX_STATE_ACTIVE", "JVX_STATE_PREPARED", "JVX_STATE_PROCESSING"};

SECTION ioLinkActiveCnt
{
TYPE = "JVX_DATAFORMAT_SIZE";
INIT_SET = 0;
READ_WRITE_ACCESS = "JVX_PROPERTY_ACCESS_READ_ONLY";
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ CjvxSpNMixChainEnterLeave::select(IjvxObject* owner)
genMixChain::allocate__config();
genMixChain::register__config(this);

genMixChain::init__monitor();
genMixChain::allocate__monitor();
genMixChain::register__monitor(this);

genMixChain::init__sources_channel_routing();
genMixChain::allocate__sources_channel_routing();
genMixChain::register__sources_channel_routing(this);
Expand All @@ -57,6 +61,9 @@ CjvxSpNMixChainEnterLeave::unselect()
genMixChain::unregister__sources_channel_routing(this);
genMixChain::deallocate__sources_channel_routing();

genMixChain::unregister__monitor(this);
genMixChain::deallocate__monitor();

genMixChain::unregister__config(this);
genMixChain::deallocate__config();

Expand Down Expand Up @@ -257,7 +264,7 @@ CjvxSpNMixChainEnterLeave::test_connect_icon(JVX_CONNECTION_FEEDBACK_TYPE(fdb))
cnt++;
}

for (auto& elm : presets_channel_routing)
for (auto& elm : presets_io_routing)
{
for (i = 0; i < elm.second.channel_num; i++)
{
Expand Down Expand Up @@ -286,7 +293,7 @@ CjvxSpNMixChainEnterLeave::test_connect_icon(JVX_CONNECTION_FEEDBACK_TYPE(fdb))
cnt++;
}

for (auto& elm : presets_channel_routing)
for (auto& elm : presets_io_routing)
{
for (i = 0; i < elm.second.channel_num; i++)
{
Expand Down Expand Up @@ -368,6 +375,8 @@ CjvxSpNMixChainEnterLeave::prepare_connect_icon(JVX_CONNECTION_FEEDBACK_TYPE(fdb
// Lock some of the properties
_update_properties_on_start();

genMixChain::monitor.ioLinkActiveCnt.value = 0;

if (operationMode != jvxOperationModeMixChain::JVX_OPERTION_MODE_MIX_CHAIN_TALKTHROUGH)
{
// Here, we have seen the following copy before:
Expand Down Expand Up @@ -564,11 +573,17 @@ CjvxSpNMixChainEnterLeave::process_buffers_icon(jvxSize mt_mask, jvxSize idx_sta
lock();
for (auto& elm : CjvxConnectorCollection<CjvxSingleOutputConnector, CjvxSingleOutputConnectorMulti>::processingConnectors)
{
jvxErrorType resOther = elm.second.ioconn->resultFromInputConnector();
if(
(resOther == JVX_ERROR_UNKNOWN) ||
jvxErrorType resOther = resOther = elm.second.ioconn->resultFromInputConnector();
if (
(resOther == JVX_ERROR_UNKNOWN) ||
resOther == JVX_NO_ERROR)
{
elm.second.ioconn->trigger_put_data();
}
else
{
genMixChain::monitor.ioLinkActiveCnt.value++;
}
}
unlock();
break;
Expand Down Expand Up @@ -734,10 +749,10 @@ CjvxSpNMixChainEnterLeave::check_positive_zero_copy()
}

jvxErrorType
CjvxSpNMixChainEnterLeave::check_preset_channels(CjvxConnectorOffsetAndMaxChans& conParams, jvxComponentIdentification cpId)
CjvxSpNMixChainEnterLeave::check_preset_channels(CjvxConnectorOffsetAndMaxChans& conParams, jvxBool& linkIoActive, jvxComponentIdentification cpId)
{
jvxErrorType res = JVX_ERROR_ELEMENT_NOT_FOUND;
for (auto& elm : presets_channel_routing)
for (auto& elm : presets_io_routing)
{
if (elm.first.tp == cpId.tp)
{
Expand All @@ -750,6 +765,7 @@ CjvxSpNMixChainEnterLeave::check_preset_channels(CjvxConnectorOffsetAndMaxChans&
(elm.first.slotsubid == cpId.slotsubid))
{
conParams = static_cast<CjvxConnectorOffsetAndMaxChans> (elm.second);
linkIoActive = elm.second.linkIo;
res = JVX_NO_ERROR;
break;
}
Expand All @@ -758,4 +774,4 @@ CjvxSpNMixChainEnterLeave::check_preset_channels(CjvxConnectorOffsetAndMaxChans&
}
return res;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class chanOffsetAndMaxChans: public CjvxConnectorOffsetAndMaxChans
public:
jvxComponentIdentification cpId;
std::string deviceChannelPrefix = "Channel";
jvxBool linkIo = false;
};

class CjvxSpNMixChainEnterLeave : public CjvxBareNode1ioRearrange,
Expand All @@ -44,7 +45,8 @@ class CjvxSpNMixChainEnterLeave : public CjvxBareNode1ioRearrange,

// Add entries via properties:
// <component identification>, <offset>, <max_chans>
std::map<jvxComponentIdentification, chanOffsetAndMaxChans> presets_channel_routing;
std::map<jvxComponentIdentification, chanOffsetAndMaxChans> presets_io_routing;
// std::map<jvxComponentIdentification, jvxBool> presets_inout_coupling;

/*
struct
Expand Down Expand Up @@ -117,7 +119,8 @@ class CjvxSpNMixChainEnterLeave : public CjvxBareNode1ioRearrange,
bool check_positive_zero_copy()override;

void offset_channels_to_property();
jvxErrorType check_preset_channels(CjvxConnectorOffsetAndMaxChans& conParams, jvxComponentIdentification cpId);
jvxErrorType check_preset_channels(CjvxConnectorOffsetAndMaxChans& conParams, jvxBool& linkIoActive, jvxComponentIdentification cpId);
// jvxErrorType check_linkage_sources(jvxBool& linkInOut, jvxComponentIdentification cpId);

jvxErrorType transfer_backward_ocon(jvxLinkDataTransferType tp, jvxHandle* data, JVX_CONNECTION_FEEDBACK_TYPE(fdb))override;
jvxErrorType transfer_forward_icon(jvxLinkDataTransferType tp, jvxHandle* data JVX_CONNECTION_FEEDBACK_TYPE_A(fdb))override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ CjvxSpNMixChainEnterLeave::report_test_connector(CjvxSingleInputConnector* iconn
if (iconn->_common_set_icon.theData_in->con_link.connect_from->transfer_backward_ocon(jvxLinkDataTransferType::JVX_LINKDATA_TRANSFER_REQUEST_REAL_MASTER,
&cpId JVX_CONNECTION_FEEDBACK_CALL_A(fdb)) == JVX_NO_ERROR)
{
res = check_preset_channels(iconn->chanSetting, cpId);
res = check_preset_channels(iconn->chanSetting, iconn->linkageIoActive, cpId);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ CjvxSpNMixChainEnterLeave::report_test_connector(CjvxSingleOutputConnector* ocon
{
if (oconn->_common_set_ocon.theData_out.con_link.connect_to->transfer_forward_icon(jvxLinkDataTransferType::JVX_LINKDATA_TRANSFER_REQUEST_REAL_MASTER, &cpId JVX_CONNECTION_FEEDBACK_CALL_A(fdb)) == JVX_NO_ERROR)
{
res = check_preset_channels(oconn->chanSetting, cpId);
res = check_preset_channels(oconn->chanSetting, oconn->linkageIoActive, cpId);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ CjvxSpNMixChainEnterLeave::offset_channels_to_property()
genMixChain::sources_channel_routing.all_definitions.value.entries.clear();
jvx_bitFClear(genMixChain::sources_channel_routing.all_definitions.value.selection(0));

for (auto& elm : presets_channel_routing)
for (auto& elm : presets_io_routing)
{
genMixChain::sources_channel_routing.all_definitions.value.entries.push_back(jvxComponentIdentification_txt(elm.first));
std::string str = jvxComponentIdentification_txt(elm.first);
str += "--" + elm.second.deviceChannelPrefix;
str += "--[" + jvx_size2String(elm.second.idxOffset);
str += "->" + jvx_size2String(elm.second.idxOffset+elm.second.channel_num-1) + "]";
if (elm.second.linkIo)
{
str += "::i/o";
}
genMixChain::sources_channel_routing.all_definitions.value.entries.push_back(str);
}
if (presets_channel_routing.size())
if (presets_io_routing.size())
{
jvx_bitZSet(genMixChain::sources_channel_routing.all_definitions.value.selection(0), 0);
}
Expand Down Expand Up @@ -63,6 +71,7 @@ JVX_PROPERTIES_FORWARD_C_CALLBACK_EXECUTE_FULL(CjvxSpNMixChainEnterLeave, specif
{
chanOffsetAndMaxChans newElm;
bool err = false;
jvxBool inoutCoupling = false;
auto res = jvxComponentIdentification_decode(newElm.cpId, lst[0]);
if (res != JVX_NO_ERROR)
{
Expand All @@ -89,10 +98,18 @@ JVX_PROPERTIES_FORWARD_C_CALLBACK_EXECUTE_FULL(CjvxSpNMixChainEnterLeave, specif

if (!err)
{
auto elmI = presets_channel_routing.find(newElm.cpId);
if (elmI == presets_channel_routing.end())
if (lst.size() > 4)
{
newElm.linkIo = (lst[4] == "yes");
}
}

if (!err)
{
auto elmI = presets_io_routing.find(newElm.cpId);
if (elmI == presets_io_routing.end())
{
presets_channel_routing[newElm.cpId] = newElm;
presets_io_routing[newElm.cpId] = newElm;
genMixChain::sources_channel_routing.last_error.value = jvxErrorType_txt(JVX_NO_ERROR);
offset_channels_to_property();
}
Expand All @@ -119,12 +136,12 @@ JVX_PROPERTIES_FORWARD_C_CALLBACK_EXECUTE_FULL(CjvxSpNMixChainEnterLeave, remove
jvxSize idx = jvx_bitfieldSelection2Id(genMixChain::sources_channel_routing.all_definitions);
if (JVX_CHECK_SIZE_SELECTED(idx))
{
if (idx < presets_channel_routing.size())
if (idx < presets_io_routing.size())
{
auto itElm = presets_channel_routing.begin();
auto itElm = presets_io_routing.begin();
std::advance(itElm, idx);

presets_channel_routing.erase(itElm);
presets_io_routing.erase(itElm);
genMixChain::sources_channel_routing.last_error.value = jvxErrorType_txt(JVX_NO_ERROR);
CjvxProperties::add_property_report_collect(genMixChain::sources_channel_routing.last_error.descriptor.std_str(), false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class CjvxConnector : public T1
jvxBool withTriggerConnector = false;
jvxSize conId = 0;
CjvxConnectorOffsetAndMaxChans chanSetting;
jvxBool linkageIoActive = false;

// Physically the largest number of channels to be accepted
jvxSize channelWidthMax = JVX_SIZE_UNSELECTED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ CjvxSingleInputTriggerConnector::latest_result_data()
{
if (bwdRef)
{
jvxErrorType res = bwdRef->resLatestGetData;
bwdRef->resLatestGetData = JVX_ERROR_UNKNOWN;
jvxErrorType res = JVX_NO_ERROR;
if (bwdRef->linkageIoActive)
{
res = bwdRef->resLatestGetData;
bwdRef->resLatestGetData = JVX_ERROR_UNKNOWN;
}
return res;
}
return JVX_ERROR_UNKNOWN;
Expand Down

0 comments on commit 3d7744c

Please sign in to comment.