async call fixes for audio gear setup

This commit is contained in:
Nuwan 2022-08-13 00:33:24 +05:30
parent 8e7b9b278a
commit 21af8446ca
8 changed files with 111 additions and 71 deletions

View File

@ -142,7 +142,7 @@
await context.jamClient.TrackDeleteProfile(audioProfileId);
// redraw after deletion of profile
populateAccountAudio();
await populateAccountAudio();
}
async function handleLoopbackAudioProfile(audioProfileId) {
@ -156,7 +156,7 @@
}
else {
// redraw after activation of profile
populateAccountAudio();
await populateAccountAudio();
}
}
@ -192,11 +192,13 @@
}
// redraw after activation of profile
populateAccountAudio();
await populateAccountAudio();
}
app.layout.showDialog('configure-tracks')
.one(EVENTS.DIALOG_CLOSED, populateAccountAudio)
.one(EVENTS.DIALOG_CLOSED, async function(){
await populateAccountAudio()
})
}
async function handleActivateAudioProfile(audioProfileId) {
@ -215,18 +217,18 @@
}
// redraw after activation of profile
populateAccountAudio();
await populateAccountAudio();
}
function handleStartAudioQualification() {
async function handleStartAudioQualification() {
app.afterFtue = function() {
app.afterFtue = async function() {
showingGearWizard = false;
if(populateAccountAudio().length == 1) {
if(await populateAccountAudio().length == 1) {
app.layout.showDialog('join-test-session');
}
};
app.cancelFtue = function() { showingGearWizard = false; populateAccountAudio() };
app.cancelFtue = async function() { showingGearWizard = false; await populateAccountAudio() };
showingGearWizard = true;
app.layout.startNewFtue()
}
@ -235,28 +237,33 @@
// false = don't start audio, true = reload last audio configuration, false = don't re-init tracks
await context.jamClient.ReloadAudioSystem(false, true, false);
populateAccountAudio();
await populateAccountAudio();
}
function registerFtueSuccess() {
$('div[layout-id=ftue]').on("ftue_success", ftueSuccessHandler);
$('div[layout-id=ftue]').on("ftue_success", async function(){
await ftueSuccessHandler()
});
}
function unregisterFtueSuccess() {
$('div[layout-id=ftue]').off("ftue_success", ftueSuccessHandler);
$('div[layout-id=ftue]').off("ftue_success", async function(){
await ftueSuccessHandler();
});
}
function ftueSuccessHandler() {
populateAccountAudio();
async function ftueSuccessHandler() {
await populateAccountAudio();
}
// events for main screen
function events() {
// wire up main panel clicks
$root = $('#account-audio-content-scroller');
$root.on('click', 'a[data-purpose=delete-audio-profile]', function (evt) {
$root.on('click', 'a[data-purpose=delete-audio-profile]', async function (evt) {
evt.stopPropagation();
handleDeleteAudioProfile($(this).attr('data-id'));
alert('')
await handleDeleteAudioProfile($(this).attr('data-id'));
return false;
});
@ -303,10 +310,10 @@
});
$root.on('click', 'a[data-purpose=add-profile]', function (evt) {
$root.on('click', 'a[data-purpose=add-profile]', async function (evt) {
evt.stopPropagation();
cancelRescan();
handleStartAudioQualification();
await handleStartAudioQualification();
return false;
});

View File

@ -492,7 +492,7 @@
let method = Object.keys(response)[0]
switch (method) {
case 'execute_script':
//logger.log(`execute_script: ${response['execute_script']}`);
logger.log(`execute_script: ${response['execute_script']}`);
eval(response['execute_script']);
break;

View File

@ -156,10 +156,14 @@
$('#btn-error-ok').click(context.JK.showOverlay);
$('#btn-save-settings').unbind("click");
$('#btn-save-settings').click(saveSettings);
$('#btn-save-settings').click(async function(){
await saveSettings()
});
$('#btn-cancel-settings').unbind("click");
$('#btn-cancel-settings').click(cancelSettings);
$('#btn-cancel-settings').click(async function(){
await cancelSettings()
});
}
function _handleTrackInputAdd($selectedMusicInputs, selector) {
@ -269,7 +273,7 @@
logger.debug("Called TrackSetMusicDevice with " + $('#audio-drivers').val());
await context.jamClient.TrackLoadAssignments();
initDialogData();
await initDialogData();
// refresh dialog
showVoiceChatPanel(true);
@ -455,36 +459,36 @@
}
}
function initDialogData() {
_initMusicTabData();
_initVoiceChatTabData();
async function initDialogData() {
await _initMusicTabData();
await _initVoiceChatTabData();
}
function _initMusicTabData() {
inputUnassignedList = _loadList(ASSIGNMENT.UNASSIGNED, true, false);
async function _initMusicTabData() {
inputUnassignedList = await _loadList(ASSIGNMENT.UNASSIGNED, true, false);
//logger.debug("inputUnassignedList=" + JSON.stringify(inputUnassignedList));
track1AudioInputChannels = _loadList(ASSIGNMENT.TRACK1, true, false);
track1AudioInputChannels = await _loadList(ASSIGNMENT.TRACK1, true, false);
//logger.debug("track1AudioInputChannels=" + JSON.stringify(track1AudioInputChannels));
track2AudioInputChannels = _loadList(ASSIGNMENT.TRACK2, true, false);
track2AudioInputChannels = await _loadList(ASSIGNMENT.TRACK2, true, false);
//logger.debug("track2AudioInputChannels=" + JSON.stringify(track2AudioInputChannels));
outputUnassignedList = _loadList(ASSIGNMENT.UNASSIGNED, false, false);
outputAssignedList = _loadList(ASSIGNMENT.OUTPUT, false, false);
outputUnassignedList = await _loadList(ASSIGNMENT.UNASSIGNED, false, false);
outputAssignedList = await _loadList(ASSIGNMENT.OUTPUT, false, false);
}
function _initVoiceChatTabData() {
chatUnassignedList = _loadList(ASSIGNMENT.UNASSIGNED, true, false);
async function _initVoiceChatTabData() {
chatUnassignedList = await _loadList(ASSIGNMENT.UNASSIGNED, true, false);
//logger.debug("chatUnassignedList=" + JSON.stringify(chatUnassignedList));
chatAssignedList = _loadList(ASSIGNMENT.CHAT, true, false);
chatAssignedList = await _loadList(ASSIGNMENT.CHAT, true, false);
//logger.debug("chatAssignedList=" + JSON.stringify(chatAssignedList));
chatOtherUnassignedList = _loadList(ASSIGNMENT.UNASSIGNED, true, true);
chatOtherUnassignedList = await _loadList(ASSIGNMENT.UNASSIGNED, true, true);
//logger.debug("chatOtherUnassignedList=" + JSON.stringify(chatOtherUnassignedList));
chatOtherAssignedList = _loadList(ASSIGNMENT.CHAT, true, true);
chatOtherAssignedList = await _loadList(ASSIGNMENT.CHAT, true, true);
//logger.debug("chatOtherAssignedList=" + JSON.stringify(chatOtherAssignedList));
}
@ -552,8 +556,8 @@
return;
}
saveAudioSettings();
saveVoiceChatSettings();
await saveAudioSettings();
await saveVoiceChatSettings();
await context.jamClient.TrackSaveAssignments();
@ -786,7 +790,7 @@
originalDeviceId = await context.jamClient.TrackGetMusicDeviceID();
await context.jamClient.TrackLoadAssignments();
initDialogData();
await initDialogData();
var $option1 = $('#voice-chat-type > option[value="1"]');

View File

@ -58,7 +58,7 @@
await jamClient.FTUERegisterVUCallbacks('', '', '');
if (!successfulFtue && app.cancelFtue) {
app.cancelFtue();
await app.cancelFtue();
app.afterFtue = null;
app.cancelFtue = null;
}
@ -585,7 +585,7 @@
app.layout.closeDialog('ftue');
if (app.afterFtue) {
// If there's a function to invoke, invoke it.
app.afterFtue();
await app.afterFtue();
app.afterFtue = null;
app.cancelFtue = null;
}

View File

@ -110,7 +110,7 @@ ConfigureTracksStore = @ConfigureTracksStore
</div>
<div className="instrument-selection">
<h3>Instrument</h3>
<select className="instrument-pick" name="instrument" onChange={this.instrumentSelected} value={selectedInstrument} disabled={instrumentDisabled}>
<select className="instrument-pick" name="instrument" onChange={() => {this.instrumentSelected()}} value={selectedInstrument} disabled={instrumentDisabled}>
{instruments}
</select>
</div>
@ -188,7 +188,7 @@ ConfigureTracksStore = @ConfigureTracksStore
</div>
<div className="instrument-selection">
<h3>Instrument</h3>
<select className="instrument-pick" name="instrument" onChange={this.instrumentSelected} value={selectedInstrument} disabled={instrumentDisabled}>
<select className="instrument-pick" name="instrument" onChange={async () => { await this.instrumentSelected()}} value={selectedInstrument} disabled={instrumentDisabled}>
{instruments}
</select>
</div>
@ -286,12 +286,20 @@ ConfigureTracksStore = @ConfigureTracksStore
@setState({midiInterface: null})
instrumentSelected: (e) ->
$root = $(@getDOMNode())
$select = $root.find('.instrument-pick')
# instrumentSelected: (e) ->
# $root = $(@getDOMNode())
# $select = $root.find('.instrument-pick')
instrumentId = $select.val()
ConfigureTracksActions.associateInstrumentWithTrack(instrumentId)
# instrumentId = $select.val()
# ConfigureTracksActions.associateInstrumentWithTrack(instrumentId)
instrumentSelected: `async function(e) {
const $root = $(this.getDOMNode());
const $select = $root.find('.instrument-pick');
const instrumentId = $select.val();
await ConfigureTracksActions.associateInstrumentWithTrack(instrumentId);
}`
doClose: (e) ->
@ -342,20 +350,39 @@ ConfigureTracksStore = @ConfigureTracksStore
componentWillUpdate: () ->
$root = $(@getDOMNode())
componentDidUpdate: () ->
$root = $(@getDOMNode())
# componentDidUpdate: () ->
# $root = $(@getDOMNode())
$manageAudioPlugins = $root.find('.manage-audio-plugins')
# $manageAudioPlugins = $root.find('.manage-audio-plugins')
unless $manageAudioPlugins.data('initialized')
$manageAudioPlugins.manageVsts().on(context.JK.EVENTS.VST_OPERATION_SELECTED, @vstOperation).data('initialized', true)
# unless $manageAudioPlugins.data('initialized')
# $manageAudioPlugins.manageVsts().on(context.JK.EVENTS.VST_OPERATION_SELECTED, @vstOperation).data('initialized', true)
if true # easyDropdown support
# if true # easyDropdown support
# context.JK.dropdown($root.find('select'))
# $root.find('select.input-selectors').unbind('change').change(@inputChanged)
# $root.find('select.instrument-pick').unbind('change').change(@instrumentSelected)
# $root.find('select.vsts').unbind('change').change(@vstsChanged)
componentDidUpdate: `async function() {
const $root = $(this.getDOMNode());
const $manageAudioPlugins = $root.find('.manage-audio-plugins');
if (!$manageAudioPlugins.data('initialized')) {
$manageAudioPlugins.manageVsts().on(context.JK.EVENTS.VST_OPERATION_SELECTED, this.vstOperation).data('initialized', true);
}
if (true) { // easyDropdown support
context.JK.dropdown($root.find('select'));
$root.find('select.input-selectors').unbind('change').change(this.inputChanged);
$root.find('select.instrument-pick').unbind('change').change(this.instrumentSelected);
return $root.find('select.vsts').unbind('change').change(this.vstsChanged);
}
}`
context.JK.dropdown($root.find('select'))
$root.find('select.input-selectors').unbind('change').change(@inputChanged)
$root.find('select.instrument-pick').unbind('change').change(@instrumentSelected)
$root.find('select.vsts').unbind('change').change(@vstsChanged)
trackTypeChanged: (event) ->
if @ignoreICheck

View File

@ -25,15 +25,15 @@ MIDI_TRACK = context.JK.MIDI_TRACK
outputs = []
trackAssignments = @state.configureTracks?.trackAssignments
if gon.midi_enabled
addMidiTrack = `<a onClick={this.openLiveTrackDialog.bind(this, 'midi')} className="button-orange">ADD MIDI TRACK . . . </a>`
if trackAssignments
#console.log("trackAssignments.inputs.assigned", trackAssignments.inputs.assigned)
for inputsForTrack, i in trackAssignments.inputs.assigned
candidate = inputsForTrack[0]
inputs = []
if candidate.assignment == MIDI_TRACK
trackTypeLabel = 'MIDI'
@ -46,14 +46,13 @@ MIDI_TRACK = context.JK.MIDI_TRACK
trackTypeLabel = 'AUDIO'
for input in inputsForTrack
inputs.push(`<div key={i} className="live-input">{input.name}</div>`)
if !inputsForTrack.instrument_id?
instrument = `<span className="none">?</span>`
else
instrument = `<span><img src={context.JK.getInstrumentIconMap24()[inputsForTrack.instrument_id].asset} /></span>`
vstName = 'None'
if inputsForTrack.vst? && inputsForTrack.vst.name != 'NONE'

View File

@ -607,6 +607,7 @@ void removeSearchPath(int typeId, QString pathToRemove);
# context.JK.Banner.showAlert('Unable to save assignments. ' + result);
onAssociateInstrumentWithTrack: `async function(instrumentId) {
if (this.trackNumber == null) { return; }
logger.debug("context.jamClient.TrackSetInstrument(trackNumber, track.instrument_id)", this.trackNumber, instrumentId);
@ -619,7 +620,7 @@ void removeSearchPath(int typeId, QString pathToRemove);
}
await context.jamClient.TrackSetInstrument(this.trackNumber, clientInstrumentId);
if (this.trackNumber === MIDI_TRACK) {
logger.debug("checking midi track for track instrument synchronization");
// keep artificial midi track in sync

View File

@ -139,11 +139,11 @@
}
}
function onCanceled() {
async function onCanceled() {
reportFailureAnalytics();
if (app.cancelFtue) {
app.cancelFtue();
await app.cancelFtue();
app.afterFtue = null;
app.cancelFtue = null;
}
@ -151,12 +151,12 @@
return closeDialog();
}
function onClosed() {
async function onClosed() {
reportFailureAnalytics();
if (app.afterFtue) {
// If there's a function to invoke, invoke it.
app.afterFtue();
await app.afterFtue();
app.afterFtue = null;
app.cancelFtue = null;
}
@ -173,7 +173,9 @@
function events() {
$(wizard).on('step_changed', onStepChanged);
$(wizard).on('wizard_cancel', onCanceled);
$(wizard).on('wizard_close', onClosed);
$(wizard).on('wizard_close', async function(){
await onClosed()
});
}
function setNextState(enabled) {