-
Notifications
You must be signed in to change notification settings - Fork 2
AudYoFlo: Classes: CjvxBareNode1ioRearrange
The class CjvxBareNode1io_rearrange
is proposed as the base class for a processing node with one input and one output connector that uses different input and output settings. The most common use-case is a node which requires one number of input channels and another number of output channels. Since output and input parameters differ it is not a zero-copy module, that is, the input samples always must be copied to the buffers for the output samples.
Typically, to define the supported processing parameters, the node initially sets the input and output constraints in the negotaiation helper member variables neg_input
and neg_output
in the constructor, e.g.,
neg_input._update_parameters_fixed(2);
neg_output._update_parameters_fixed(1);
In that context, no constraints are set by default and we need to update only those parameters which must be defined. In the example, a constraint is given only for the number of input and output channels (2 and 1).
The class holds the current settings for processing internally in the derived class CjvxSimplePropsPars
which are at the same time exposed via property due to a link association. At the moment, this new mechanism is only used if the member variable newParamProps
is set to true
- which it is not be default since a lot of old nodes still rely on the old mechanism. An example where this feature is used is class CjvxAuNCaptureFile
, in which the member variable is set:
CjvxAuNCaptureFile::CjvxAuNCaptureFile(JVX_CONSTRUCTOR_ARGUMENTS_MACRO_DECLARE) :
CjvxBareNode1io_zerocopy(JVX_CONSTRUCTOR_ARGUMENTS_MACRO_CALL)
{
_common_set.theComponentType.unselected(JVX_NODE_TYPE_SPECIFIER_TYPE);
_common_set.theComponentSubTypeDescriptor = JVX_NODE_TYPE_SPECIFIER_DESCRIPTOR;
neg_input._update_parameters_fixed(JVX_SIZE_UNSELECTED, JVX_SIZE_UNSELECTED,
JVX_SIZE_UNSELECTED, JVX_DATAFORMAT_DATA, JVX_DATAFORMAT_GROUP_AUDIO_PCM_DEINTERLEAVED);
newParamProps = true;
}
The node typically has the following basic content:
The elements of type CjvxSimplePropsPars
define the simple connection parameters. The simple connection parameters define a node with all parameters identical for input and output - hence, a zerocopy module.
The elements of type CjvxNode_rearrange_genpcg define an additional set of processing parameters - here, this additional set defines the processing parameters on the output side. It is necessary to hold an extra field here since input and output parameters may differ.
The auto connection feature is based on the implementation of the test_connect_icon
function which is part of the IjvxInputConnector
interface. The implementation for the CjvxBareNode1io_rearrange
class can be found in the base class test_connect_icon
and is only the default implementation. This default implementation is mostly influenced by the negotiation instances neg_input
for the input side and neg_output
for the output side. In both cases, ranges are configured accepted for processing. The default implementation acts as follows:
- In the first step, the parameters as passed from the sussessor output connector are accepted in function
test_connect_icon
and checked in theneg_input
instance. That instance checks if all parameters are in the range of parameters listed as preferred min and max values, function
jvxErrorType CjvxNegotiate_input::_negotiate_connect_icon(
jvxLinkDataDescriptor* theData_in,
IjvxObject* this_pointer,
const char*descror
JVX_CONNECTION_FEEDBACK_TYPE_A(fdb));
- If the negotiation was successful and the input parameters accepted the resulting parameters are copied to the internal data struct in function
update_input_params_from_neg_on_test
which is called in function
- In the next step the function
from_input_to_output
is called. In this function, the relation between input and putput parameters can be implemented.
- In the next step, the test call is forwarded towards the output connector and from here to the next component input connector. On the way out, the function
test_set_output_parameters
is called. This is the location where the chain output parameters can be finally set. In this function the output parameters are constrained according to theneg_output
instance by call of functionconstrain_ldesc_from_neg_output_params
,
- In case the next input connector complains about the input parameter it will call the function
transfer_backward_ocon
. In that function the functionaccept_negotiate_output
is called that may be used to forward the complain to the previous output connector. In the function
jvxErrorType CjvxNegotiate_output::_negotiate_transfer_backward_ocon(
jvxLinkDataDescriptor* ld,
jvxLinkDataDescriptor* dataOut,
IjvxObject* this_pointer,
jvxCBitField* modFlags
JVX_CONNECTION_FEEDBACK_TYPE_A(fdb));
the parameters are finally checked with the allowed preferred parameters in the neg_output
instance.
- Once the overall call was successful, the final output parameters may be stored internally in the function
update_output_params_on_test
which is typically called at the end of functionaccept_input_parameters_stop
,