fix for audio input port assignment

this fix addresses the invalid input port assignment issue
due to asynchronous nature of asyncjamClient method calls
This commit is contained in:
Nuwan 2023-07-21 18:32:40 +05:30
parent 81b3fecfd4
commit 60009208c0
1 changed files with 9 additions and 6 deletions

View File

@ -71,6 +71,7 @@
var queueUpdateDeviceList = false;
var cancelRescanFunc = null;
var initialScan = false;
var skipAssertFTUEProfile = false;
// returns a deviceInfo hash for the device matching the deviceId, or undefined.
function findDevice(deviceId) {
@ -297,7 +298,7 @@
}
async function inputChannelChanged($checkbox) {
if (iCheckIgnore) return;
await assertFTUEProfile();
@ -1196,7 +1197,6 @@
iCheckIgnore = true;
$allInputs.eq(0).iCheck('check').attr('checked', 'checked')
iCheckIgnore = false;
var maxTries = 36;
for(var i = 0; i < maxTries; i++) {
var $assignedInputs = $inputChannels.find('input[type="checkbox"]:checked')
@ -1206,16 +1206,18 @@
break;
}
else {
$assignedInputs.each(function(index, item) {
$assignedInputs.each(async function(index, item) {
var $node = $(item)
if ($node.get(0) == firstInputDomNode) {
logger.debug("skipping firstInputDomNode")
}
else {
// the goal of this loop is to just uncheck one. once it's done that, it breaks the loop, so that assigned can be fetched again
iCheckIgnore = true;
$node.iCheck('uncheck').removeAttr('checked')
iCheckIgnore = false;
//$node.iCheck('uncheck').removeAttr('checked'); //uncheck and fires event
$node.prop('checked',false).iCheck('update'); //uncheck without firing event.
skipAssertFTUEProfile = true;
await inputChannelChanged($node);
skipAssertFTUEProfile = false;
return false;
}
})
@ -1327,6 +1329,7 @@
}
async function assertFTUEProfile() {
if(skipAssertFTUEProfile) {return;}
if(savedProfile) {return;} // once we save the profile, it's name no longer starts with FTUE
var profileName = await context.jamClient.FTUEGetMusicProfileName();
if(profileName && profileName.indexOf('FTUE') != 0) {