-
Notifications
You must be signed in to change notification settings - Fork 2
AudYoFlo: Behavior: Component IjvxAutomation to Automate Processes
Simple audio processing applications are organized in a straight forward way: there is an audio device which provides input data which is processed by the audio node. The output from the audio node is forwarded to the audio device and finally rendered by the connected soundcard. The involved mechanisms of automation are the connection rules as well as the inherent parameter negotiations. These mechanisms allow the user to select different audio technologoes, audio devices and also audio nodes if desired.
In more complex processing schemes, however, connections are added and removed dynamically. Every connection typically involves a device component that has been dynamically spawned. From the spawned device to the running connection, several steps are often required to have the chain up and running propperly. The mentioned default mechansims connection rules and parameter negotiations are in use but no longer sufficient. Therefore, another component type is defined that helps applications to automate all required steps: The component of type JVX_COMPONENT_SYSTEM_AUTOMATION
.
The component of type JVX_COMPONENT_SYSTEM_AUTOMATION
fulfills interface type IjvxSimpleComponent
. Two additional interfaces are defined to receive events from the host that drive automation steps, interface IjvxReportSystem
and interface IjvxAutoDataConnect
. The interface IjvxReportSystem
allows the automation component to receive event objects that are emitted to the host via the IjvxReportSystem
interface exposed by the host.
The automation component implementation is either available as a dynamic library or - the more likely case - is linked to the application by providing an entry in the jvx_access_link_objects
hook of the project.
jvxErrorType jvx_access_link_objects(jvxInitObject_tp* funcInit, jvxTerminateObject_tp* funcTerm, jvxApiString* adescr, jvxComponentType tp, jvxSize id)
{
jvxSize cnt = 0;
switch (tp)
{
...
case JVX_COMPONENT_SYSTEM_AUTOMATION:
if (id == cnt)
{
adescr->assign("Fernlive Automation");
*funcInit = ayfATBinRender_init;
*funcTerm = ayfATBinRender_terminate;
return(JVX_NO_ERROR);
}
cnt++;
break;
...
}
return JVX_NO_ERROR;
}
If the component is loaded, however, it must be activated by telling the host to look for the right component module name. This can be achieved by setting the following entry in the host config features in the jvx_configure_factoryhost_features
hook:
jvxErrorType jvx_configure_factoryhost_features(configureFactoryHost_features* features)
{
features->request_specialization(reinterpret_cast<jvxHandle**>(&theFeatureL), JVX_HOST_IMPLEMENTATION_LIB_HOST);
if (theFeatureL)
{
theFeaturesCH = static_cast<configureHost_features*>(theFeatureL);
}
theFeaturesCH->automation.mod_selection = "ayfATBinRender";
return(JVX_NO_ERROR);
}
This information provided the host will load the first component in the system that fits the constraint.
The host automatically loads exactly one component of type JVX_COMPONENT_SYSTEM_AUTOMATION
. Once that component is available, the component is requested to deliver the interfaces IjvxReportSystem
and IjvxAutoDataConnect
. These are stored in the struct to store the configure host features,
theFeaturesCH->automation.if_report_automate
theFeaturesCH->automation.if_autoconnect
As a consequence, the automation interfaces might also be setup in the jvx_configure_factoryhost_features
hook.
Once the automation component has been assigned to the interface pointer variables, it is activated before any other component. The early activation makes sense to allow the automation component to act already at the activation of any other system component.
The interface IjvxReportSystem
is the extension of the host implementation of interface IjvxReportSystem
. That is, an event that is passed to the host will be forwarded to the automation component if the event was emitted with the property jvxReportCommandBroadcastType::JVX_REPORT_COMMAND_BROADCAST_AUTOMATION
, e.g.,
CjvxReportCommandRequest_id theRequestId(
jvxReportCommandRequest::JVX_REPORT_COMMAND_REQUEST_REPORT_BORN_SUBDEVICE,
this->_common_set.theComponentType, ident.c_str(),
jvxReportCommandBroadcastType::JVX_REPORT_COMMAND_BROADCAST_AUTOMATION);
Typically, the event is forwarded to the automation component if a new device was borned. In that case, the parameter ident
holds the name of the new device. If the device is reported as new, the automation component typically tries to activate it automatically.