From f085b615b36d2aef27602741f7f2c2dfa47d1d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hauke=20Kr=C3=BCger?= Date: Sun, 10 Mar 2024 11:37:12 +0100 Subject: [PATCH] Better handling of channel update in generic wrapper in case negotiations require adaptations --- .../src/CjvxGenericWrapperDevice.cpp | 17 ++- .../src/CjvxGenericWrapperDevice.h | 2 +- .../src/CjvxGenericWrapperDevice_props.cpp | 118 ++++++++---------- 3 files changed, 70 insertions(+), 67 deletions(-) diff --git a/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice.cpp b/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice.cpp index 28fbac92..78605057 100644 --- a/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice.cpp +++ b/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice.cpp @@ -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); @@ -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 diff --git a/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice.h b/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice.h index 42b9c36f..3c29e33a 100644 --- a/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice.h +++ b/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice.h @@ -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); diff --git a/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice_props.cpp b/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice_props.cpp index 1825a665..bad2d605 100644 --- a/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice_props.cpp +++ b/sources/jvxComponents/jvxAudioTechnologies/jvxAuTGenericWrapper/src/CjvxGenericWrapperDevice_props.cpp @@ -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 @@ -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; @@ -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); } }