VRFS-782 consolidate add/configure track dialogs

This commit is contained in:
Brian Smith 2013-10-25 21:34:40 -04:00
parent 77d38a41a8
commit dea3a37652
6 changed files with 52 additions and 78 deletions

View File

@ -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');
});

View File

@ -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;

View File

@ -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);
});
}

View File

@ -480,7 +480,7 @@ table.vu td {
.voicechat {
margin-top:10px;
width:152px;
width:130px;
height:25px;
background-color:#242323;
position:absolute;

View File

@ -44,7 +44,7 @@
</div>
</div>
<div class="left">
<div id="track1-input-buttons" class="left w5 ml10 mr10">
<div id="track1-input-buttons" class="left w5 ml10 mr10 mt30">
<div>
<img id="img-track1-input-add" style="cursor:pointer;" src="/assets/content/arrow_right_24.png" width="24" height="24" />
</div>
@ -68,14 +68,14 @@
<div class="left">Track 1 Input:</div>
<div class="clearall"></div>
<div class="left w100">
<select id="track1-input" class="w100" multiple="multiple" style="height:100%"></select>
<select id="track1-input" class="w100" multiple="multiple" style="height:92px"></select>
</div>
</div>
<div class="left w45 ml20">
<div class="left">Track 1 Instrument:</div>
<div class="clearall"></div>
<div class="left w100">
<select id="track1-instrument" class="w100" multiple="multiple" style="height:100%"></select>
<select id="track1-instrument" class="w100" multiple="multiple" style="height:92px"></select>
</div>
</div>

View File

@ -52,10 +52,8 @@
<!-- my tracks -->
<div class="session-mytracks">
<h2>my tracks</h2>
<div id="div-add-track" class="session-add" style="display:block;" mixer-id="{mixerId}">
<a>
<%= image_tag "content/icon_add.png", {:width => 19, :height => 19, :align => "texttop"} %>&nbsp;&nbsp;Add Track
</a>
<div id="track-settings" class="session-add" style="display:block;" layout-link="configure-audio">
<%= image_tag "content/icon_settings_lg.png", {:width => 18, :height => 18} %>&nbsp;&nbsp;Settings
</div>
<div class="session-tracks-scroller">
@ -64,9 +62,6 @@
<div class="voicechat-label">CHAT</div>
<div class="voicechat-gain"></div>
<div class="voicechat-mute enabled" control="mute" mixer-id=""></div>
<div class="voicechat-settings" layout-link="configure-audio">
<%= image_tag "content/icon_settings_lg.png", {:width => 18, :height => 18} %>
</div>
</div>
</div>
</div>