Remove 2 context._.each statements combined with async

This commit is contained in:
Seth Call 2022-08-14 17:00:38 -05:00
parent 21af8446ca
commit 98aa2adc42
4 changed files with 20 additions and 14 deletions

View File

@ -611,4 +611,4 @@
setupWebSocketConnection();
return setupAsyncProxy();
};
})(window, jQuery);
})(window, jQuery);

View File

@ -47,11 +47,11 @@
async function newSession() {
inputs = null;
context._.each(STEPS, async function(stepInfo, stepNumber) {
for(const [stepInfo, stepNumber] of Object.entries(STEPS)) {
if(stepInfo.newSession) {
await stepInfo.newSession.call(stepInfo);
}
});
}
}
function onStepChanged(e, data) {

View File

@ -277,14 +277,15 @@
await assertFTUEProfile();
var $assignedInputs = $inputChannels.find('input[type="checkbox"]:checked');
var assigned = 0;
context._.each($assignedInputs, async function (assignedInput) {
for(var i = 0; i < $assignedInputs.length; i++) {
var assignedInput = $assignedInputs[i];
var $assignedInput = $(assignedInput);
var assignedChannelId = $assignedInput.attr('data-id');
var newAssignment = Math.floor(assigned / 2) + 1;
logger.debug("re-assigning input channel %o to track: %o", assignedChannelId, newAssignment);
await context.jamClient.TrackSetAssignment(assignedChannelId, true, newAssignment);
assigned += 1;
});
}
}
async function reassignOutputChannels() {

View File

@ -201,19 +201,23 @@
var loadedDevices = {};
// augment these devices by determining their type
context._.each(devices.devices, async function (device) {
console.log("DEVICE S DEVICES", devices.devices, devices.devices.length)
for (let index = 0; index < devices.devices.length; index++) {
let device = devices.devices[index];
console.log("index device", index, device)
if (device.name == "JamKazam Virtual Monitor") {
return;
continue;
}
if (device.name == JAMKAZAM_VIRTUAL_INPUT) {
return;
continue;
}
if ((device.name == 'Default Input' || device.name == 'Default Output') && operatingSystem == 'Win32'){
console.log("dropping " + device.name)
return;
continue;
}
var deviceInfo = {};
@ -221,17 +225,18 @@
deviceInfo.id = device.guid;
deviceInfo.port_audio_name = device.port_audio_name;
deviceInfo.type = await determineDeviceType(device.guid, device.display_name);
console.log('device', device)
console.log('deviceInfo', deviceInfo)
//console.log('device', device)
//console.log('deviceInfo', deviceInfo)
deviceInfo.displayType = AUDIO_DEVICE_BEHAVIOR[deviceInfo.type].display;
deviceInfo.displayName = device.display_name;
deviceInfo.inputCount = device.input_count;
deviceInfo.outputCount = device.output_count;
loadedDevices[device.guid] = deviceInfo;
})
}
logger.debug(context.JK.dlen(loadedDevices) + " devices loaded.", loadedDevices);
console.log(context.JK.dlen(loadedDevices) + " devices loaded.", loadedDevices);
return loadedDevices;
}
@ -782,4 +787,4 @@
}
}
})(window, jQuery);
})(window, jQuery);