From 917d8f1a8e20ef79ec1d682b52860a25598b181d Mon Sep 17 00:00:00 2001 From: Nuwan Date: Tue, 4 Jul 2023 12:56:18 +0530 Subject: [PATCH 1/4] WIP midi and audio channel config --- .../ConfigureLiveTracksDialog.js.jsx.coffee | 12 ++-- .../stores/ConfigureTracksStore.js.coffee | 72 ++++++++++--------- 2 files changed, 44 insertions(+), 40 deletions(-) diff --git a/web/app/assets/javascripts/react-components/ConfigureLiveTracksDialog.js.jsx.coffee b/web/app/assets/javascripts/react-components/ConfigureLiveTracksDialog.js.jsx.coffee index 1f064147c..8fcad437e 100644 --- a/web/app/assets/javascripts/react-components/ConfigureLiveTracksDialog.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/ConfigureLiveTracksDialog.js.jsx.coffee @@ -110,7 +110,7 @@ ConfigureTracksStore = @ConfigureTracksStore

Instrument

- {instruments}
@@ -188,7 +188,7 @@ ConfigureTracksStore = @ConfigureTracksStore

Instrument

- {instruments}
@@ -293,7 +293,7 @@ ConfigureTracksStore = @ConfigureTracksStore # instrumentId = $select.val() # ConfigureTracksActions.associateInstrumentWithTrack(instrumentId) - instrumentSelected: `async function(e) { + instrumentSelected: `function(e) { const $root = $(this.getDOMNode()); const $select = $root.find('.instrument-pick'); @@ -365,7 +365,7 @@ ConfigureTracksStore = @ConfigureTracksStore # $root.find('select.instrument-pick').unbind('change').change(@instrumentSelected) # $root.find('select.vsts').unbind('change').change(@vstsChanged) - componentDidUpdate: `async function() { + componentDidUpdate: `function() { const $root = $(this.getDOMNode()); const $manageAudioPlugins = $root.find('.manage-audio-plugins'); @@ -379,7 +379,8 @@ ConfigureTracksStore = @ConfigureTracksStore 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); + $root.find('select.vsts').unbind('change').change(this.vstsChanged); + $root.find('select.midi-select').unbind('change').change(this.updateMidiAssociations); } }` @@ -426,7 +427,6 @@ ConfigureTracksStore = @ConfigureTracksStore midiInterfaceChanged: (e) -> - @updateMidiAssociations() updateMidiAssociations: (e) -> diff --git a/web/app/assets/javascripts/react-components/stores/ConfigureTracksStore.js.coffee b/web/app/assets/javascripts/react-components/stores/ConfigureTracksStore.js.coffee index bac649b70..770efd22f 100644 --- a/web/app/assets/javascripts/react-components/stores/ConfigureTracksStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/ConfigureTracksStore.js.coffee @@ -351,6 +351,7 @@ void removeSearchPath(int typeId, QString pathToRemove); findMidiTrack: () -> midi = null + console.log("__DEBUG__ @trackAssignments", @trackAssignments) for assignment in @trackAssignments.inputs.assigned if assignment.assignment == MIDI_TRACK midi = assignment @@ -600,6 +601,7 @@ void removeSearchPath(int typeId, QString pathToRemove); # context.JK.Banner.showAlert('Unable to save assignments. ' + result); onAssociateInputsWithTrack: `async function(inputId1, inputId2) { + alert('onAssociateInputsWithTrack') if (this.trackNumber == null) { return; } for (let inputs of Array.from(this.editingTrack)) { @@ -646,7 +648,6 @@ void removeSearchPath(int typeId, QString pathToRemove); # logger.debug("synced midi track with #{instrumentId}") # midi.instrument_id = instrumentId - # if(!result || result.length == 0) # else @@ -660,12 +661,9 @@ void removeSearchPath(int typeId, QString pathToRemove); # else # context.JK.Banner.showAlert('Unable to save assignments. ' + result); - onAssociateInstrumentWithTrack: `async function(instrumentId) { - + onAssociateInstrumentWithTrack: `function(instrumentId) { if (this.trackNumber == null) { return; } - console.log("context.jamClient.TrackSetInstrument(trackNumber, track.instrument_id)", this.trackNumber, instrumentId); - let clientInstrumentId = null; if ((instrumentId !== null) && (instrumentId !== '')) { clientInstrumentId = context.JK.instrument_id_to_instrument[instrumentId].client_id; @@ -673,33 +671,37 @@ void removeSearchPath(int typeId, QString pathToRemove); clientInstrumentId = 0; } - await context.jamClient.TrackSetInstrument(this.trackNumber, clientInstrumentId); - - if (this.trackNumber === MIDI_TRACK) { - console.log("checking midi track for track instrument synchronization"); - // keep artificial midi track in sync - const midi = this.findMidiTrack(); - if (midi != null) { - logger.debug('synced midi track with ' + instrumentId); - midi.instrument_id = instrumentId; + const self = this + context.jamClient.TrackSetInstrument(self.trackNumber, clientInstrumentId).then(function(result){ + + console.log("__DEBUG__ TrackSetInstrument result, trackNumber, MIDI_TRACK", result, self.trackNumber, MIDI_TRACK); + + if (self.trackNumber == MIDI_TRACK) { + console.log("checking midi track for track instrument synchronization"); + // keep artificial midi track in sync + const midi = self.findMidiTrack(); + console.log("__DEBUG__ midi", midi) + if (midi != null) { + logger.debug('synced midi track with ' + instrumentId); + midi.instrument_id = instrumentId; + context.jamClient.TrackSaveAssignments().then(function(result){ + if(result.process_status !== 'Success') { + console.log("__DEBUG__ Unable to save1", result) + context.JK.Banner.showAlert('Unable to save assignments.' + result); + } + }).catch(function(){ + context.JK.Banner.showAlert('Unable to save assignments.'); + }) + } } - } - - if(!result || (result.length === 0)) { - - } else { - context.JK.Banner.showAlert('Unable to save assignments. ' + result); - } - - - var result = await context.jamClient.TrackSaveAssignments(); - - if(!result || (result.length === 0)) { - - } else { - return context.JK.Banner.showAlert('Unable to save assignments. ' + result); - } + if(result.process_status !== 'Success') { + context.JK.Banner.showAlert('Unable to save assignments. ' + result); + } + }).catch(function(){ + context.JK.Banner.showAlert('Unable to save assignments.'); + }) + }` # onAssociateVSTWithTrack: (vst) -> @@ -731,7 +733,7 @@ void removeSearchPath(int typeId, QString pathToRemove); # )), 250) onAssociateVSTWithTrack: `async function(vst) { - + alert('onAssociateVSTWithTrack') if (!this.hasVst) { logger.debug("onAssociateVSTWithTrack skipped due to no VST"); return; @@ -996,15 +998,17 @@ void removeSearchPath(int typeId, QString pathToRemove); # )), 250) onAssociateMIDIWithTrack: `async function(midiInterface) { - + alert('onAssociateMIDIWithTrack') this.trackNumber = MIDI_TRACK; if ((midiInterface == null) || (midiInterface === '')) { logger.debug('disabling midiInterface:'+midiInterface+', track:' +this.trackNumber - 1); - await context.jamClient.VST_EnableMidiForTrack(this.trackNumber - 1, false, 0); + res1 = await context.jamClient.VST_EnableMidiForTrack(this.trackNumber - 1, false, 0); + console.log("onAssociateMIDIWithTrack res1", res1) } else { logger.debug('enabling midiInterface:'+midiInterface+', track:' +this.trackNumber - 1); - await context.jamClient.VST_EnableMidiForTrack(this.trackNumber - 1, true, midiInterface); + res2 = await context.jamClient.VST_EnableMidiForTrack(this.trackNumber - 1, true, midiInterface); + console.log("onAssociateMIDIWithTrack res2", res2) } setTimeout((async () => ( From bc71730df41cb128af89775ecd43c1fcab1b7d3e Mon Sep 17 00:00:00 2001 From: Nuwan Date: Thu, 6 Jul 2023 10:05:21 +0530 Subject: [PATCH 2/4] remove alert on session recording stop --- .../javascripts/react-components/stores/SessionStore.js.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee index aac076abf..f462f79fa 100644 --- a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee @@ -828,7 +828,7 @@ ConfigureTracksActions = @ConfigureTracksActions this.app.notifyAlert(title, "Error reason: " + reason); } } else { - alert('TODO: open recording files directory') + logger.debug('backend opens recording files directory.') } break; From 8e0e43359c09a289a10021ffc6aec7d3cc555d38 Mon Sep 17 00:00:00 2001 From: Nuwan Date: Fri, 7 Jul 2023 17:49:55 +0530 Subject: [PATCH 3/4] WIP fixing midi configuration --- .../ConfigureLiveTracksDialog.js.jsx.coffee | 32 +++++------ .../stores/ConfigureTracksStore.js.coffee | 54 ++++++++----------- 2 files changed, 38 insertions(+), 48 deletions(-) diff --git a/web/app/assets/javascripts/react-components/ConfigureLiveTracksDialog.js.jsx.coffee b/web/app/assets/javascripts/react-components/ConfigureLiveTracksDialog.js.jsx.coffee index 8fcad437e..38bcb2d5a 100644 --- a/web/app/assets/javascripts/react-components/ConfigureLiveTracksDialog.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/ConfigureLiveTracksDialog.js.jsx.coffee @@ -286,20 +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: `function(e) { - const $root = $(this.getDOMNode()); - const $select = $root.find('.instrument-pick'); + # instrumentSelected: `function(e) { + # const $root = $(this.getDOMNode()); + # const $select = $root.find('.instrument-pick'); - const instrumentId = $select.val(); - ConfigureTracksActions.associateInstrumentWithTrack.trigger(instrumentId); - }` + # const instrumentId = $select.val(); + # ConfigureTracksActions.associateInstrumentWithTrack.trigger(instrumentId); + # }` doClose: (e) -> @@ -380,7 +380,7 @@ ConfigureTracksStore = @ConfigureTracksStore $root.find('select.input-selectors').unbind('change').change(this.inputChanged); $root.find('select.instrument-pick').unbind('change').change(this.instrumentSelected); $root.find('select.vsts').unbind('change').change(this.vstsChanged); - $root.find('select.midi-select').unbind('change').change(this.updateMidiAssociations); + $root.find('select.midi-select').unbind('change').change(this.midiInterfaceChanged); } }` @@ -438,10 +438,10 @@ ConfigureTracksStore = @ConfigureTracksStore vstSelected = $select.val() logger.debug("updateMidiAssocations", vstSelected, midiInterface) - #if vstSelected != 'NONE' - vstSelected = {file: vstSelected} - #else - # vstSelected = null + if vstSelected != 'NONE' + vstSelected = {file: vstSelected} + else + vstSelected = null if midiInterface == '' midiInterface = null diff --git a/web/app/assets/javascripts/react-components/stores/ConfigureTracksStore.js.coffee b/web/app/assets/javascripts/react-components/stores/ConfigureTracksStore.js.coffee index 770efd22f..14798deb4 100644 --- a/web/app/assets/javascripts/react-components/stores/ConfigureTracksStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/ConfigureTracksStore.js.coffee @@ -351,7 +351,6 @@ void removeSearchPath(int typeId, QString pathToRemove); findMidiTrack: () -> midi = null - console.log("__DEBUG__ @trackAssignments", @trackAssignments) for assignment in @trackAssignments.inputs.assigned if assignment.assignment == MIDI_TRACK midi = assignment @@ -601,7 +600,6 @@ void removeSearchPath(int typeId, QString pathToRemove); # context.JK.Banner.showAlert('Unable to save assignments. ' + result); onAssociateInputsWithTrack: `async function(inputId1, inputId2) { - alert('onAssociateInputsWithTrack') if (this.trackNumber == null) { return; } for (let inputs of Array.from(this.editingTrack)) { @@ -661,7 +659,7 @@ void removeSearchPath(int typeId, QString pathToRemove); # else # context.JK.Banner.showAlert('Unable to save assignments. ' + result); - onAssociateInstrumentWithTrack: `function(instrumentId) { + onAssociateInstrumentWithTrack: `async function(instrumentId) { if (this.trackNumber == null) { return; } let clientInstrumentId = null; @@ -671,36 +669,30 @@ void removeSearchPath(int typeId, QString pathToRemove); clientInstrumentId = 0; } - const self = this - context.jamClient.TrackSetInstrument(self.trackNumber, clientInstrumentId).then(function(result){ + logger.debug("context.jamClient.TrackSetInstrument(trackNumber, track.instrument_id)", this.trackNumber, instrumentId); + + const result1 = await context.jamClient.TrackSetInstrument(this.trackNumber, clientInstrumentId); + if(result1 && result1.process_status === "Success"){ + }else{ + context.JK.Banner.showAlert('Unable to save assignments. ' + result1); + } - console.log("__DEBUG__ TrackSetInstrument result, trackNumber, MIDI_TRACK", result, self.trackNumber, MIDI_TRACK); - - if (self.trackNumber == MIDI_TRACK) { - console.log("checking midi track for track instrument synchronization"); - // keep artificial midi track in sync - const midi = self.findMidiTrack(); - console.log("__DEBUG__ midi", midi) - if (midi != null) { - logger.debug('synced midi track with ' + instrumentId); - midi.instrument_id = instrumentId; - context.jamClient.TrackSaveAssignments().then(function(result){ - if(result.process_status !== 'Success') { - console.log("__DEBUG__ Unable to save1", result) - context.JK.Banner.showAlert('Unable to save assignments.' + result); - } - }).catch(function(){ - context.JK.Banner.showAlert('Unable to save assignments.'); - }) - } + if (this.trackNumber == MIDI_TRACK) { + console.log("checking midi track for track instrument synchronization"); + // keep artificial midi track in sync + const midi = this.findMidiTrack(); + if (midi != null) { + logger.debug('synced midi track with ' + instrumentId); + midi.instrument_id = instrumentId; } + } - if(result.process_status !== 'Success') { - context.JK.Banner.showAlert('Unable to save assignments. ' + result); - } - }).catch(function(){ - context.JK.Banner.showAlert('Unable to save assignments.'); - }) + const result2 = await context.jamClient.TrackSaveAssignments(); + + if(!result2 || result2.length == 0) { + }else{ + context.JK.Banner.showAlert('Unable to save assignments.' + result2); + } }` @@ -733,7 +725,6 @@ void removeSearchPath(int typeId, QString pathToRemove); # )), 250) onAssociateVSTWithTrack: `async function(vst) { - alert('onAssociateVSTWithTrack') if (!this.hasVst) { logger.debug("onAssociateVSTWithTrack skipped due to no VST"); return; @@ -998,7 +989,6 @@ void removeSearchPath(int typeId, QString pathToRemove); # )), 250) onAssociateMIDIWithTrack: `async function(midiInterface) { - alert('onAssociateMIDIWithTrack') this.trackNumber = MIDI_TRACK; if ((midiInterface == null) || (midiInterface === '')) { From f1008baea8560f66c9210cedb709b461d6d99321 Mon Sep 17 00:00:00 2001 From: Nuwan Date: Thu, 6 Jul 2023 10:05:21 +0530 Subject: [PATCH 4/4] remove alert on session recording stop --- .../javascripts/react-components/stores/SessionStore.js.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee index aac076abf..f462f79fa 100644 --- a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee @@ -828,7 +828,7 @@ ConfigureTracksActions = @ConfigureTracksActions this.app.notifyAlert(title, "Error reason: " + reason); } } else { - alert('TODO: open recording files directory') + logger.debug('backend opens recording files directory.') } break;