WIP fixing midi configuration

This commit is contained in:
Nuwan 2023-07-07 17:49:55 +05:30
parent 5932cc3d67
commit 42ee0bcf26
2 changed files with 38 additions and 48 deletions

View File

@ -286,20 +286,20 @@ ConfigureTracksStore = @ConfigureTracksStore
@setState({midiInterface: null}) @setState({midiInterface: null})
# instrumentSelected: (e) -> instrumentSelected: (e) ->
# $root = $(@getDOMNode()) $root = $(@getDOMNode())
# $select = $root.find('.instrument-pick') $select = $root.find('.instrument-pick')
# instrumentId = $select.val() instrumentId = $select.val()
# ConfigureTracksActions.associateInstrumentWithTrack(instrumentId) ConfigureTracksActions.associateInstrumentWithTrack(instrumentId)
instrumentSelected: `function(e) { # instrumentSelected: `function(e) {
const $root = $(this.getDOMNode()); # const $root = $(this.getDOMNode());
const $select = $root.find('.instrument-pick'); # const $select = $root.find('.instrument-pick');
const instrumentId = $select.val(); # const instrumentId = $select.val();
ConfigureTracksActions.associateInstrumentWithTrack.trigger(instrumentId); # ConfigureTracksActions.associateInstrumentWithTrack.trigger(instrumentId);
}` # }`
doClose: (e) -> doClose: (e) ->
@ -380,7 +380,7 @@ ConfigureTracksStore = @ConfigureTracksStore
$root.find('select.input-selectors').unbind('change').change(this.inputChanged); $root.find('select.input-selectors').unbind('change').change(this.inputChanged);
$root.find('select.instrument-pick').unbind('change').change(this.instrumentSelected); $root.find('select.instrument-pick').unbind('change').change(this.instrumentSelected);
$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); $root.find('select.midi-select').unbind('change').change(this.midiInterfaceChanged);
} }
}` }`
@ -438,10 +438,10 @@ ConfigureTracksStore = @ConfigureTracksStore
vstSelected = $select.val() vstSelected = $select.val()
logger.debug("updateMidiAssocations", vstSelected, midiInterface) logger.debug("updateMidiAssocations", vstSelected, midiInterface)
#if vstSelected != 'NONE' if vstSelected != 'NONE'
vstSelected = {file: vstSelected} vstSelected = {file: vstSelected}
#else else
# vstSelected = null vstSelected = null
if midiInterface == '' if midiInterface == ''
midiInterface = null midiInterface = null

View File

@ -351,7 +351,6 @@ void removeSearchPath(int typeId, QString pathToRemove);
findMidiTrack: () -> findMidiTrack: () ->
midi = null midi = null
console.log("__DEBUG__ @trackAssignments", @trackAssignments)
for assignment in @trackAssignments.inputs.assigned for assignment in @trackAssignments.inputs.assigned
if assignment.assignment == MIDI_TRACK if assignment.assignment == MIDI_TRACK
midi = assignment midi = assignment
@ -601,7 +600,6 @@ void removeSearchPath(int typeId, QString pathToRemove);
# context.JK.Banner.showAlert('Unable to save assignments. ' + result); # context.JK.Banner.showAlert('Unable to save assignments. ' + result);
onAssociateInputsWithTrack: `async function(inputId1, inputId2) { onAssociateInputsWithTrack: `async function(inputId1, inputId2) {
alert('onAssociateInputsWithTrack')
if (this.trackNumber == null) { return; } if (this.trackNumber == null) { return; }
for (let inputs of Array.from(this.editingTrack)) { for (let inputs of Array.from(this.editingTrack)) {
@ -661,7 +659,7 @@ void removeSearchPath(int typeId, QString pathToRemove);
# else # else
# context.JK.Banner.showAlert('Unable to save assignments. ' + result); # context.JK.Banner.showAlert('Unable to save assignments. ' + result);
onAssociateInstrumentWithTrack: `function(instrumentId) { onAssociateInstrumentWithTrack: `async function(instrumentId) {
if (this.trackNumber == null) { return; } if (this.trackNumber == null) { return; }
let clientInstrumentId = null; let clientInstrumentId = null;
@ -671,36 +669,30 @@ void removeSearchPath(int typeId, QString pathToRemove);
clientInstrumentId = 0; clientInstrumentId = 0;
} }
const self = this logger.debug("context.jamClient.TrackSetInstrument(trackNumber, track.instrument_id)", this.trackNumber, instrumentId);
context.jamClient.TrackSetInstrument(self.trackNumber, clientInstrumentId).then(function(result){
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 (this.trackNumber == MIDI_TRACK) {
console.log("checking midi track for track instrument synchronization");
if (self.trackNumber == MIDI_TRACK) { // keep artificial midi track in sync
console.log("checking midi track for track instrument synchronization"); const midi = this.findMidiTrack();
// keep artificial midi track in sync if (midi != null) {
const midi = self.findMidiTrack(); logger.debug('synced midi track with ' + instrumentId);
console.log("__DEBUG__ midi", midi) midi.instrument_id = instrumentId;
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.process_status !== 'Success') { const result2 = await context.jamClient.TrackSaveAssignments();
context.JK.Banner.showAlert('Unable to save assignments. ' + result);
} if(!result2 || result2.length == 0) {
}).catch(function(){ }else{
context.JK.Banner.showAlert('Unable to save assignments.'); context.JK.Banner.showAlert('Unable to save assignments.' + result2);
}) }
}` }`
@ -733,7 +725,6 @@ void removeSearchPath(int typeId, QString pathToRemove);
# )), 250) # )), 250)
onAssociateVSTWithTrack: `async function(vst) { onAssociateVSTWithTrack: `async function(vst) {
alert('onAssociateVSTWithTrack')
if (!this.hasVst) { if (!this.hasVst) {
logger.debug("onAssociateVSTWithTrack skipped due to no VST"); logger.debug("onAssociateVSTWithTrack skipped due to no VST");
return; return;
@ -998,7 +989,6 @@ void removeSearchPath(int typeId, QString pathToRemove);
# )), 250) # )), 250)
onAssociateMIDIWithTrack: `async function(midiInterface) { onAssociateMIDIWithTrack: `async function(midiInterface) {
alert('onAssociateMIDIWithTrack')
this.trackNumber = MIDI_TRACK; this.trackNumber = MIDI_TRACK;
if ((midiInterface == null) || (midiInterface === '')) { if ((midiInterface == null) || (midiInterface === '')) {