diff --git a/web/app/assets/javascripts/addNewGear.js b/web/app/assets/javascripts/addNewGear.js index b12573b9c..4d7ba9907 100644 --- a/web/app/assets/javascripts/addNewGear.js +++ b/web/app/assets/javascripts/addNewGear.js @@ -14,7 +14,6 @@ // ON TOP OF OTHER DIALOGS. ANY OTHER DIALOGS THAT // USE THIS NEED TO BE ADDED TO THE FOLLOWING LIST. // NEED TO FIGURE OUT A CLEANER WAY TO HANDLE THIS. - app.layout.closeDialog('add-track'); app.layout.closeDialog('configure-audio'); }); diff --git a/web/app/assets/javascripts/configureTrack.js b/web/app/assets/javascripts/configureTrack.js index 4470c0599..9cb70f842 100644 --- a/web/app/assets/javascripts/configureTrack.js +++ b/web/app/assets/javascripts/configureTrack.js @@ -41,17 +41,17 @@ var originalVoiceChat; var configure_audio_instructions = { - "Win32": "Choose the audio profile you would like to use for this session. If needed, use arrow buttons to assign audio inputs " + + "Win32": "Choose the audio device you would like to use for this session. If needed, use arrow buttons to assign audio inputs " + "to your tracks, to indicate what instrument you are playing on each track, and to assign audio outputs for listening. " + "If you want to use a new audio device you have not tested/certified for latency using JamKazam, click the Add New Audio " + "Gear button to test that device.", - "MacOSX": "Choose the audio profile you would like to use for this session. If needed, use arrow buttons to assign audio inputs " + + "MacOSX": "Choose the audio device you would like to use for this session. If needed, use arrow buttons to assign audio inputs " + "to your tracks, to indicate what instrument you are playing on each track, and to assign audio outputs for listening. " + "If you want to use a new audio device you have not tested/certified for latency using JamKazam, click the Add New Audio " + "Gear button to test that device.", - "Unix": "Choose the audio profile you would like to use for this session. If needed, use arrow buttons to assign audio inputs " + + "Unix": "Choose the audio device you would like to use for this session. If needed, use arrow buttons to assign audio inputs " + "to your tracks, to indicate what instrument you are playing on each track, and to assign audio outputs for listening. " + "If you want to use a new audio device you have not tested/certified for latency using JamKazam, click the Add New Audio " + "Gear button to test that device." @@ -61,25 +61,6 @@ "for both music and chat. Otherwise, choose a device to use for voice chat, and use arrow buttons to " + "select an input on that device."; - function toggleTrack2ConfigDetails(visible) { - if (visible) { - $('#track2-details').show(); - $('#track2-input-buttons').show(); - $('#track1-input').height('92px'); - $('#track1-instrument').height('92px'); - $('#track1-input-buttons').addClass('mt30'); - $('#track1-input-buttons').removeClass('mt65'); - } - else { - $('#track2-details').hide(); - $('#track2-input-buttons').hide(); - $('#track1-input').height('195px'); - $('#track1-instrument').height('195px'); - $('#track1-input-buttons').addClass('mt65'); - $('#track1-input-buttons').removeClass('mt30'); - } - } - function events() { // Music Audio Tab @@ -425,15 +406,12 @@ context.JK.loadOptions($('#template-option').html(), $('#track1-instrument'), instrument_array, "id", "description", current_instrument); - // load Track 2 config details if necessary - if (myTrackCount > 1) { - // load Track 2 Input(s) - context.JK.loadOptions($('#template-option').html(), $('#track2-input'), track2AudioInputChannels, "id", "name", -1); + // load Track 2 Input(s) + context.JK.loadOptions($('#template-option').html(), $('#track2-input'), track2AudioInputChannels, "id", "name", -1); - // load Track 2 Instrument - current_instrument = context.jamClient.TrackGetInstrument(ASSIGNMENT.TRACK2); - context.JK.loadOptions($('#template-option').html(), $('#track2-instrument'), instrument_array, "id", "description", current_instrument); - } + // load Track 2 Instrument + current_instrument = context.jamClient.TrackGetInstrument(ASSIGNMENT.TRACK2); + context.JK.loadOptions($('#template-option').html(), $('#track2-instrument'), instrument_array, "id", "description", current_instrument); // load Unused Outputs context.JK.loadOptions($('#template-option').html(), $('#audio-output-unused'), outputUnassignedList, "id", "name", -1); @@ -614,17 +592,38 @@ context.jamClient.TrackSetInstrument(ASSIGNMENT.TRACK1, instrumentVal); // UPDATE SERVER - //logger.debug("Updating track " + myTracks[0].trackId + " with instrument " + instrumentText); + logger.debug("Updating track " + myTracks[0].trackId + " with instrument " + instrumentText); var data = {}; data.instrument_id = instrumentText; sessionModel.updateTrack(sessionId, myTracks[0].trackId, data); - if (myTrackCount > 1) { - // TRACK 2 INPUTS - $('#track2-input > option').each(function() { - logger.debug("Saving track 2 input = " + this.value); - context.jamClient.TrackSetAssignment(this.value, true, ASSIGNMENT.TRACK2); - }); + // TRACK 2 INPUTS + var track2Selected = false; + $('#track2-input > option').each(function() { + track2Selected = true; + logger.debug("Saving track 2 input = " + this.value); + context.jamClient.TrackSetAssignment(this.value, true, ASSIGNMENT.TRACK2); + }); + + if (track2Selected) { + // track 2 new - add + if (myTrackCount === 1) { + data = {}; + // use the first track's connection_id (not sure why we need this on the track data model) + logger.debug("myTracks[0].connection_id=" + myTracks[0].connection_id); + data.connection_id = myTracks[0].connection_id; + data.instrument_id = instrumentText; + data.sound = "stereo"; + sessionModel.addTrack(sessionId, data); + } + // track 2 exists - update + else if (myTrackCount === 2) { + // UPDATE SERVER + logger.debug("Updating track " + myTracks[1].trackId + " with instrument " + instrumentText); + data = {}; + data.instrument_id = instrumentText; + sessionModel.updateTrack(sessionId, myTracks[1].trackId, data); + } // TRACK 2 INSTRUMENT instrumentVal = $('#track2-instrument').val(); @@ -632,11 +631,13 @@ logger.debug("Saving track 2 instrument = " + instrumentVal); context.jamClient.TrackSetInstrument(ASSIGNMENT.TRACK2, instrumentVal); - - // UPDATE SERVER - //logger.debug("Updating track " + myTracks[1].trackId + " with instrument " + instrumentText); - data.instrument_id = instrumentText; - sessionModel.updateTrack(sessionId, myTracks[1].trackId, data); + } + else { + // track 2 was removed + if (myTrackCount === 2) { + logger.debug("Deleting track " + myTracks[1].trackId); + sessionModel.deleteTrack(sessionId, myTracks[1].trackId); + } } // UNASSIGNED OUTPUTS @@ -723,7 +724,7 @@ logger.debug("validateAudioSettings:myTrackCount=" + myTrackCount); // if Track 2 exists, verify Input and Instrument exist - if (isValid && myTrackCount > 1) { + if (isValid) { if ($('#track2-input > option').size() === 0 || $('#track2-input > option').size() > 2) { errMsg = noTrackErrMsg; isValid = false; @@ -834,7 +835,6 @@ _init(); myTrackCount = myTracks.length; logger.debug("initialize:myTrackCount=" + myTrackCount); - toggleTrack2ConfigDetails(myTrackCount > 1); }; this.showMusicAudioPanel = showMusicAudioPanel; diff --git a/web/app/assets/javascripts/session.js b/web/app/assets/javascripts/session.js index 31767142e..a3d11b01b 100644 --- a/web/app/assets/javascripts/session.js +++ b/web/app/assets/javascripts/session.js @@ -12,7 +12,6 @@ var mixers = []; var configureTrackDialog; - var addTrackDialog; var addNewGearDialog; var screenActive = false; @@ -212,7 +211,6 @@ function _initDialogs() { configureTrackDialog.initialize(); - addTrackDialog.initialize(); addNewGearDialog.initialize(); } @@ -436,24 +434,7 @@ }); configureTrackDialog = new context.JK.ConfigureTrackDialog(app, myTracks, sessionId, sessionModel); - addTrackDialog = new context.JK.AddTrackDialog(app, myTracks, sessionId, sessionModel); addNewGearDialog = new context.JK.AddNewGearDialog(app, ftueCallback); - - // # NO LONGER HIDING ADD TRACK even when there are 2 tracks (VRFS-537) - - $('#div-add-track').off('click'); - $('#div-add-track').on('click', function() { - if (myTracks.length === 2) { - $('#btn-error-ok').click(function() { - app.layout.closeDialog('error-dialog'); - }); - context.JK.showErrorDialog(app, "You can only have a maximum of 2 personal tracks per session.", "max # of tracks"); - } - else { - app.layout.showDialog('add-track'); - addTrackDialog.showDialog(); - } - }); } function ftueCallback() { @@ -811,10 +792,9 @@ $('#session-contents').on("click", '[action="delete"]', deleteSession); $('#tracks').on('click', 'div[control="mute"]', toggleMute); - $('.voicechat-settings').click(function() { - // call this to initialize Music Audio tab - configureTrackDialog.showMusicAudioPanel(true); + $('#track-settings').click(function() { configureTrackDialog.showVoiceChatPanel(true); + configureTrackDialog.showMusicAudioPanel(true); }); } diff --git a/web/app/assets/stylesheets/client/session.css.scss b/web/app/assets/stylesheets/client/session.css.scss index a69227bc1..9a1e4491e 100644 --- a/web/app/assets/stylesheets/client/session.css.scss +++ b/web/app/assets/stylesheets/client/session.css.scss @@ -480,7 +480,7 @@ table.vu td { .voicechat { margin-top:10px; - width:152px; + width:130px; height:25px; background-color:#242323; position:absolute; diff --git a/web/app/views/clients/_configureTrack.html.erb b/web/app/views/clients/_configureTrack.html.erb index f017a661b..aad27491f 100644 --- a/web/app/views/clients/_configureTrack.html.erb +++ b/web/app/views/clients/_configureTrack.html.erb @@ -44,7 +44,7 @@