adding async/await for fixing issues related to promised based pi calls

This commit is contained in:
Nuwan 2022-08-02 09:43:01 +05:30
parent b32621fe42
commit c4a37daa73
2 changed files with 24 additions and 20 deletions

View File

@ -300,19 +300,23 @@
}
async function inputChannelChanged($checkbox) {
if (iCheckIgnore) return;
await assertFTUEProfile();
//var $checkbox = $(this);
console.log('==inputChannelChanged#checkbox', $checkbox.data('id'));
var channelId = $checkbox.data('id');
var isChecked = $checkbox.is(':checked');
console.log('===inputChannelChanged===', $checkbox, channelId, isChecked);
if (isChecked) {
var newAssignment = newInputAssignment();
logger.debug("assigning input channel %o to track: %o", channelId, newAssignment);
await context.jamClient.TrackSetAssignment(channelId, true, newAssignment);
@ -323,7 +327,6 @@
// unassigning creates a hole in our auto-assigned tracks. reassign them all to keep it consistent
await reassignInputChannels();
}
await initializeChannels();
}
@ -340,10 +343,10 @@
}
async function outputChannelChanged() {
async function outputChannelChanged($checkbox) {
if (iCheckIgnore) return;
var $checkbox = $(this);
var channelId = $checkbox.attr('data-id');
//var $checkbox = $(this);
var channelId = $checkbox.data('id');
var isChecked = $checkbox.is(':checked');
// don't allow more than 2 output channels selected at once
@ -399,7 +402,9 @@
$checkbox.attr('checked', 'checked');
}
context.JK.checkbox($checkbox);
$checkbox.on('ifChanged', outputChannelChanged);
$checkbox.on('ifChanged', function(){
outputChannelChanged($(this))
});
$outputChannels.append($outputPort);
});
}
@ -569,10 +574,10 @@
safeAtttemptScore();
}
function onFramesizeChanged() {
async function onFramesizeChanged() {
//context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']});
updateDefaultBuffers();
jamClient.FTUESetFrameSize(frameBuffers.selectedFramesize());
await jamClient.FTUESetFrameSize(frameBuffers.selectedFramesize());
invalidateScore();
safeAtttemptScore();
}
@ -958,7 +963,7 @@
updateDefaultBuffers();
}
function updateDefaultFrameSize() {
async function updateDefaultFrameSize() {
if(selectedDeviceInfo && (selectedDeviceInfo.input.info.type == 'Win32_wdm' || selectedDeviceInfo.output.info.type == 'Win32_wdm')) {
frameBuffers.setFramesize('10');
}
@ -969,12 +974,12 @@
frameBuffers.setFramesize('2.5')
}
jamClient.FTUESetFrameSize(frameBuffers.selectedFramesize());
await jamClient.FTUESetFrameSize(frameBuffers.selectedFramesize());
}
function updateDefaultBuffers() {
gearUtils.updateDefaultBuffers(selectedDeviceInfo, frameBuffers)
async function updateDefaultBuffers() {
await gearUtils.updateDefaultBuffers(selectedDeviceInfo, frameBuffers)
}
// refocused affects how IO testing occurs.
@ -1331,9 +1336,9 @@
}
async function assertFTUEProfile() {
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) {
logger.debug("the profile name *must* start with FTUE during step 2. name=" + profileName)
context.JK.alertSupportedNeeded('The application is no longer modifying a new profile. Please restart the application and try the gear wizard again.');

View File

@ -236,7 +236,7 @@
return loadedDevices;
}
gearUtils.updateDefaultBuffers = function (selectedDeviceInfo, frameBuffers) {
gearUtils.updateDefaultBuffers = async function (selectedDeviceInfo, frameBuffers) {
function hasWDMAssociated() {
return selectedDeviceInfo && (selectedDeviceInfo.input.info.type == 'Win32_wdm' || selectedDeviceInfo.output.info.type == 'Win32_wdm')
}
@ -280,8 +280,8 @@
frameBuffers.setBufferOut(0);
}
context.jamClient.FTUESetInputLatency(frameBuffers.selectedBufferIn());
context.jamClient.FTUESetOutputLatency(frameBuffers.selectedBufferOut());
await context.jamClient.FTUESetInputLatency(frameBuffers.selectedBufferIn());
await context.jamClient.FTUESetOutputLatency(frameBuffers.selectedBufferOut());
}
gearUtils.ftueSummary = async function (operatingSystem, deviceInformation, selectedDeviceInfo, gearTest, frameBuffers, isAutomated) {
@ -493,7 +493,6 @@
// if the user does not have any profiles, show the FTUE
gearUtils.guardAgainstInvalidGearConfiguration = function (app) {
alert('ff')
return new Promise(async function(resolve, reject){
if (await gearUtils.jamClientFTUEGetAllAudioConfigurations().length === 0) {