async calls in configure audio

adds async/await call for jamClient api calls
This commit is contained in:
Nuwan 2023-01-31 17:58:16 +05:30
parent 009ee6a6dd
commit 6c56fe3af8
3 changed files with 33 additions and 23 deletions

View File

@ -24,7 +24,7 @@ context.JK.ClientInit = class ClientInit
init: `async function(){
if (context.gon.isNativeClient) {
this.nativeClientInit();
await this.nativeClientInit();
}
context.JK.onBackendEvent(this.ALERT_NAMES.WINDOW_OPEN_FOREGROUND_MODE, 'client_init', this.watchBroadcast);
@ -52,9 +52,15 @@ context.JK.ClientInit = class ClientInit
setTimeout(@checkBroadcast, 3000)
nativeClientInit: () =>
@gearUtils.bootstrapDefaultPlaybackProfile();
# nativeClientInit: () =>
# @gearUtils.bootstrapDefaultPlaybackProfile();
context.VideoActions.checkPromptConfigureVideo()
# context.VideoActions.checkPromptConfigureVideo()
nativeClientInit: `async function(){
await this.gearUtils.bootstrapDefaultPlaybackProfile();
return context.VideoActions.checkPromptConfigureVideo();
}`

View File

@ -150,7 +150,7 @@
context.JK.dropdown($audioOutput);
$audioOutput.easyDropDown('disable'); // enable once they pick something in input
await initializeAudioOutputChanged();
initializeAudioOutputChanged();
}
// reloads the backend's channel state for the currently selected audio devices,
@ -169,6 +169,8 @@
var audioInputDeviceId = selectedAudioInput();
var audioOutputDeviceId = selectedAudioOutput();
console.log("===DEBUG===", audioInputDeviceId, audioOutputDeviceId);
var $allInputs = $inputChannels.find('input[type="checkbox"]');
console.log("autoSelectMinimumValidChannels audioInputDeviceId", audioInputDeviceId)
@ -397,8 +399,8 @@
$checkbox.attr('checked', 'checked');
}
context.JK.checkbox($checkbox);
$checkbox.on('ifChanged', function(){
outputChannelChanged($(this))
$checkbox.on('ifChanged', async function(){
await outputChannelChanged($(this))
});
$outputChannels.append($outputPort);
});
@ -577,16 +579,16 @@
safeAtttemptScore();
}
function onBufferInChanged() {
async function onBufferInChanged() {
//context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']});
jamClient.FTUESetInputLatency(frameBuffers.selectedBufferIn());
await jamClient.FTUESetInputLatency(frameBuffers.selectedBufferIn());
invalidateScore();
safeAtttemptScore()
}
function onBufferOutChanged() {
async function onBufferOutChanged() {
//context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']});
jamClient.FTUESetOutputLatency(frameBuffers.selectedBufferOut());
await jamClient.FTUESetOutputLatency(frameBuffers.selectedBufferOut());
invalidateScore();
safeAtttemptScore()
}
@ -666,7 +668,7 @@
if(missingInputDeviceIds.indexOf(selectedInput) > -1) {
// the user had a device selected that's no longer here. we need to notify them of this, and auto-select 'no device'
audioInputDeviceUnselected();
await audioInputDeviceUnselected();
missingInputDevice = originalInputDevices.filter(function(inputDevice) { return selectedInput == inputDevice.deviceId })[0].deviceInfo.displayName;
}
@ -761,7 +763,7 @@
var audioInputDeviceId = selectedAudioInput();
var audioOutputDeviceId = selectedAudioOutput();
if (!audioInputDeviceId) {
audioInputDeviceUnselected();
await audioInputDeviceUnselected();
return false;
}
@ -807,6 +809,7 @@
}
async function changeDevice() {
var audioInputDeviceId = selectedDeviceInfo.input.id;
var audioOutputDeviceId = selectedDeviceInfo.output.id;
@ -844,14 +847,15 @@
}
async function audioDeviceChanged() {
if(! await cacheCurrentAudioInfo()) {
return;
}
await updateDialogForCurrentDevices();
if (await changeDevice()) {
//alert('changeDevice...')
attemptScore();
}
}

View File

@ -899,12 +899,12 @@
if (!foundSystemDefaultPlaybackOnly) {
logger.debug("creating system default profile (playback only)")
if(!gearUtils.createDefaultPlaybackOnlyProfile()) {
if(! await gearUtils.createDefaultPlaybackOnlyProfile()) {
logger.error("unable to create the default playback profile!");
}
}
}
gearUtils.createDefaultPlaybackOnlyProfile = function () {
gearUtils.createDefaultPlaybackOnlyProfile = async function () {
var eMixerInputSampleRate = {
JAMKAZAM_AUTO_SR: 0,
@ -915,15 +915,15 @@
}
// null//upgrade protect
if(context.jamClient.FTUECreateUpdatePlayBackProfile) {
return context.jamClient.FTUECreateUpdatePlayBackProfile(SYSTEM_DEFAULT_PLAYBACK_ONLY,
//if(context.jamClient.FTUECreateUpdatePlayBackProfile) {
return await context.jamClient.FTUECreateUpdatePlayBackProfile(SYSTEM_DEFAULT_PLAYBACK_ONLY,
eMixerInputSampleRate.USE_DEVICE_DEFAULT_SR,
0, // buffering
false); // start audio
}
else {
return false;
}
//}
// else {
// return false;
// }
}
})(window, jQuery);