Skip to content

Commit

Permalink
Better handling of channel update in generic wrapper in case negotiat…
Browse files Browse the repository at this point in the history
…ions require adaptations
  • Loading branch information
hkbinaurics committed Mar 10, 2024
1 parent 69f7262 commit f085b61
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1338,8 +1338,13 @@ CjvxGenericWrapperDevice::test_connect_icon_core(JVX_CONNECTION_FEEDBACK_TYPE(fd

assert(delta == 0);

// Show channels as newly selected
// Pass the new selection to the connect device
pass_channelsetup_nolock(false, true);

// Update external exposure
updateChannelExposure_nolock();

// Update the output channel count - dependent properties
updateDependentVariables_lock(CjvxAudioDevice_genpcg::properties_active.outputchannelselection.globalIdx,
CjvxAudioDevice_genpcg::properties_active.outputchannelselection.category, false,
JVX_PROPERTY_CALL_PURPOSE_INTERNAL_PASS);
Expand Down Expand Up @@ -1631,17 +1636,23 @@ CjvxGenericWrapperDevice::transfer_backward_ocon(jvxLinkDataTransferType tp, jvx

assert(delta == 0);

// Show channels as newly selected
// Pass the new selection to the connect device
pass_channelsetup_nolock(true, false);

// Update channel exposure
updateChannelExposure_nolock();

// Derive dependent properties
updateDependentVariables_lock(CjvxAudioDevice_genpcg::properties_active.inputchannelselection.globalIdx,
CjvxAudioDevice_genpcg::properties_active.inputchannelselection.category, false,
JVX_PROPERTY_CALL_PURPOSE_INTERNAL_PASS);

// Add this code extract here to transfer the new channel selection also to wrapped device!!
/* // Add this code extract here to transfer the new channel selection also to wrapped device!!
this->lock_settings();
rearrangeChannelMapper_noLock();
updateChannelInternal_nolock();
this->unlock_settings();
*/

}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ class CjvxGenericWrapperDevice: public JVX_MY_BASE_CLASS_D,
void updateDependentVariables_lock(jvxSize propId, jvxPropertyCategoryType category, jvxBool updateAll, jvxPropertyCallPurpose callPurpose = JVX_PROPERTY_CALL_PURPOSE_NONE_SPECIFIC);

void updateSWSamplerateAndBuffersize_nolock(jvxLinkDataDescriptor* fromDevice, jvxLinkDataDescriptor* toDevice JVX_CONNECTION_FEEDBACK_TYPE_A(fdb));
void pass_channelsetup_nolock();
void pass_channelsetup_nolock(jvxBool inputChannels = true, jvxBool outputChannels = true);

void numberActiveHardwareChannelsInput(jvxInt32& num);
void numberActiveHardwareChannelsOutput(jvxInt32& num);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,17 +500,6 @@ CjvxGenericWrapperDevice::updateChannelExposure_nolock()
jvx_bitSet(CjvxAudioDevice_genpcg::properties_active.outputchannelselection.value.selection(), i);
}
}

/*
// Now update the second version of channels
genGenericWrapper_device::properties_active.inputchannelselection_order.value.entries = CjvxAudioDevice_genpcg::properties_active.inputchannelselection.value.entries;
genGenericWrapper_device::properties_active.inputchannelselection_order.value.selection() = CjvxAudioDevice_genpcg::properties_active.inputchannelselection.value.selection;
genGenericWrapper_device::properties_active.inputchannelselection_order.value.exclusive = CjvxAudioDevice_genpcg::properties_active.inputchannelselection.value.exclusive;
genGenericWrapper_device::properties_active.outputchannelselection_order.value.entries = CjvxAudioDevice_genpcg::properties_active.outputchannelselection.value.entries;
genGenericWrapper_device::properties_active.outputchannelselection_order.value.selection() = CjvxAudioDevice_genpcg::properties_active.outputchannelselection.value.selection;
genGenericWrapper_device::properties_active.outputchannelselection_order.value.exclusive = CjvxAudioDevice_genpcg::properties_active.outputchannelselection.value.exclusive;
*/
}

jvxErrorType
Expand Down Expand Up @@ -693,7 +682,7 @@ CjvxGenericWrapperDevice::pushProperties_lock()


void
CjvxGenericWrapperDevice::pass_channelsetup_nolock()
CjvxGenericWrapperDevice::pass_channelsetup_nolock(jvxBool inputChannels, jvxBool outputChannels)
{
jvxSize i;
jvxErrorType res = JVX_NO_ERROR;
Expand All @@ -712,74 +701,77 @@ CjvxGenericWrapperDevice::pass_channelsetup_nolock()
jvxCallManagerProperties callGate;
callGate.call_purpose = JVX_PROPERTY_CALL_PURPOSE_INTERNAL_PASS;

if(jvx_findPropertyDescriptor("jvx_selection_input_channels_sellist", &idx, &format, &num, &decHtTp))
if (inputChannels)
{
fldSelList.bitFieldSelected() = 0;
for(i = 0; i < runtime.channelMappings.inputChannelMapper.size(); i++)
if (jvx_findPropertyDescriptor("jvx_selection_input_channels_sellist", &idx, &format, &num, &decHtTp))
{
if(
(runtime.channelMappings.inputChannelMapper[i].theChannelType == JVX_GENERIC_WRAPPER_CHANNEL_TYPE_DEVICE) &&
(runtime.channelMappings.inputChannelMapper[i].isSelected == true))
fldSelList.bitFieldSelected() = 0;
for (i = 0; i < runtime.channelMappings.inputChannelMapper.size(); i++)
{
jvx_bitSet(fldSelList.bitFieldSelected(), runtime.channelMappings.inputChannelMapper[i].toHwFile.pointsToIdAllThisDevice);
if (
(runtime.channelMappings.inputChannelMapper[i].theChannelType == JVX_GENERIC_WRAPPER_CHANNEL_TYPE_DEVICE) &&
(runtime.channelMappings.inputChannelMapper[i].isSelected == true))
{
jvx_bitSet(fldSelList.bitFieldSelected(), runtime.channelMappings.inputChannelMapper[i].toHwFile.pointsToIdAllThisDevice);
}
}
}

// If we end up in "report_properties", we should not procede any modification!
this->runtime.lockParams.allParamsLocked = true;
if(runtime.theProps)
// If we end up in "report_properties", we should not procede any modification!
this->runtime.lockParams.allParamsLocked = true;
if (runtime.theProps)
{
jvx::propertyAddress::CjvxPropertyAddressGlobalId ident(idx, JVX_PROPERTY_CATEGORY_PREDEFINED);
jvx::propertyDetail::CjvxTranferDetail trans(true);
res = runtime.theProps->set_property(callGate, jPRG(&fldSelList, 1, JVX_DATAFORMAT_SELECTION_LIST), ident, trans);
}
this->runtime.lockParams.allParamsLocked = false;
assert(res == JVX_NO_ERROR);
}
else
{
jvx::propertyAddress::CjvxPropertyAddressGlobalId ident(idx, JVX_PROPERTY_CATEGORY_PREDEFINED);
jvx::propertyDetail::CjvxTranferDetail trans(true);

res = runtime.theProps->set_property(callGate, jPRG(&fldSelList, 1, JVX_DATAFORMAT_SELECTION_LIST), ident, trans);
assert(0);
}
this->runtime.lockParams.allParamsLocked = false;
assert(res == JVX_NO_ERROR);
}
else
{
assert(0);
}

idx = 0;
format = JVX_DATAFORMAT_NONE;
num = 0;
decHtTp = JVX_PROPERTY_DECODER_NONE;
isValid = false;
accessType = JVX_PROPERTY_ACCESS_READ_ONLY;

if(jvx_findPropertyDescriptor("jvx_selection_output_channels_sellist", &idx, &format, &num, &decHtTp))
if (outputChannels)
{
fldSelList.bitFieldSelected() = 0;
for(i = 0; i < runtime.channelMappings.outputChannelMapper.size(); i++)
idx = 0;
format = JVX_DATAFORMAT_NONE;
num = 0;
decHtTp = JVX_PROPERTY_DECODER_NONE;
isValid = false;
accessType = JVX_PROPERTY_ACCESS_READ_ONLY;

if (jvx_findPropertyDescriptor("jvx_selection_output_channels_sellist", &idx, &format, &num, &decHtTp))
{
if(
(runtime.channelMappings.outputChannelMapper[i].theChannelType == JVX_GENERIC_WRAPPER_CHANNEL_TYPE_DEVICE) &&
(runtime.channelMappings.outputChannelMapper[i].isSelected == true))
fldSelList.bitFieldSelected() = 0;
for (i = 0; i < runtime.channelMappings.outputChannelMapper.size(); i++)
{
jvx_bitSet(fldSelList.bitFieldSelected(), runtime.channelMappings.outputChannelMapper[i].toHwFile.pointsToIdAllThisDevice);
if (
(runtime.channelMappings.outputChannelMapper[i].theChannelType == JVX_GENERIC_WRAPPER_CHANNEL_TYPE_DEVICE) &&
(runtime.channelMappings.outputChannelMapper[i].isSelected == true))
{
jvx_bitSet(fldSelList.bitFieldSelected(), runtime.channelMappings.outputChannelMapper[i].toHwFile.pointsToIdAllThisDevice);
}
}
// If we end up in "report_properties", we should not procede any modification!
this->runtime.lockParams.allParamsLocked = true;
if (runtime.theProps)
{
jvx::propertyAddress::CjvxPropertyAddressGlobalId ident(idx, JVX_PROPERTY_CATEGORY_PREDEFINED);
jvx::propertyDetail::CjvxTranferDetail trans(true);

res = runtime.theProps->set_property(callGate, jPRG(&fldSelList, 1, JVX_DATAFORMAT_SELECTION_LIST),
ident, trans);
}
this->runtime.lockParams.allParamsLocked = false;
assert(res == JVX_NO_ERROR);
}
// If we end up in "report_properties", we should not procede any modification!
this->runtime.lockParams.allParamsLocked = true;
if(runtime.theProps)
else
{
jvx::propertyAddress::CjvxPropertyAddressGlobalId ident(idx, JVX_PROPERTY_CATEGORY_PREDEFINED);
jvx::propertyDetail::CjvxTranferDetail trans(true);

res = runtime.theProps->set_property(callGate, jPRG(&fldSelList, 1, JVX_DATAFORMAT_SELECTION_LIST),
ident, trans);
assert(0);
}
this->runtime.lockParams.allParamsLocked = false;
assert(res == JVX_NO_ERROR);
}
else
{
assert(0);
}

//onInit.connectedDevice->prepare(XX, YY);
}
}

Expand Down

0 comments on commit f085b61

Please sign in to comment.