VRFS-292 added Music Audio tab validations
This commit is contained in:
parent
4bc8491231
commit
8e5bf1f8ab
|
|
@ -522,6 +522,14 @@
|
|||
changeToScreen(screen, data);
|
||||
};
|
||||
|
||||
this.showDialog = function(dialog) {
|
||||
showDialog(dialog);
|
||||
};
|
||||
|
||||
this.close = function(evt) {
|
||||
close(evt);
|
||||
};
|
||||
|
||||
/**
|
||||
* Given information on a grid, and a given card's grid settings, use the
|
||||
* margin options and return a list of [top, left, width, height]
|
||||
|
|
|
|||
|
|
@ -11,6 +11,33 @@
|
|||
var mixers = [];
|
||||
var myTrackCount = 0;
|
||||
|
||||
var instrument_map = {
|
||||
0: "acoustic guitar",
|
||||
1: "bass guitar",
|
||||
2: "computer",
|
||||
3: "drums",
|
||||
4: "electric guitar",
|
||||
5: "keyboard",
|
||||
6: "voice",
|
||||
7: "flute",
|
||||
8: "clarinet",
|
||||
9: "saxophone",
|
||||
10: "trumpet",
|
||||
11: "violin",
|
||||
12: "trombone",
|
||||
13: "banjo",
|
||||
14: "harmonica",
|
||||
15: "accordion",
|
||||
16: "french horn",
|
||||
17: "euphonium",
|
||||
18: "tuba",
|
||||
19: "oboe",
|
||||
20: "ukulele",
|
||||
21: "cello",
|
||||
22: "viola",
|
||||
23: "mandolin"
|
||||
};
|
||||
|
||||
// dialog variables
|
||||
var unusedAudioInputChannels = [];
|
||||
var track1AudioInputChannels = [];
|
||||
|
|
@ -403,7 +430,7 @@
|
|||
var newTrack = context.JK.fillTemplate(template, trackData);
|
||||
$destination.append(newTrack);
|
||||
$('div[mixer-id="' + trackData.mixerId + '"].track-icon-settings').click(function() {
|
||||
initMusicAudioPanel();
|
||||
showMusicAudioPanel();
|
||||
});
|
||||
tracks[trackData.clientId] = new context.JK.SessionTrack(trackData.clientId);
|
||||
}
|
||||
|
|
@ -695,16 +722,16 @@
|
|||
// validate voice chat settings
|
||||
//if (validateVoiceChatSettings()) {
|
||||
setAudioInstructions();
|
||||
initMusicAudioPanel();
|
||||
showMusicAudioPanel();
|
||||
//}
|
||||
});
|
||||
|
||||
$('#tab-configure-voice').click(function() {
|
||||
// validate audio settings
|
||||
//if (validateAudioSettings()) {
|
||||
initVoiceChatPanel();
|
||||
if (validateAudioSettings()) {
|
||||
showVoiceChatPanel();
|
||||
$('#instructions', 'div[layout-id="configure-audio"]').html(configure_voice_instructions);
|
||||
//}
|
||||
}
|
||||
});
|
||||
|
||||
// Track 1 Add
|
||||
|
|
@ -738,7 +765,7 @@
|
|||
});
|
||||
|
||||
$('.voicechat-settings').click(function() {
|
||||
initVoiceChatPanel();
|
||||
showVoiceChatPanel();
|
||||
});
|
||||
|
||||
$('#audio-drivers').change(function() {
|
||||
|
|
@ -750,6 +777,10 @@
|
|||
context.jamClient.TrackOpenControlPanel();
|
||||
});
|
||||
|
||||
$('#btn-cancel-new-audio').click(showOverlay);
|
||||
|
||||
$('#btn-error-ok').click(showOverlay);
|
||||
|
||||
$('#btn-save-settings').click(saveSettings);
|
||||
|
||||
$('#btn-cancel-settings').click(cancelSettings);
|
||||
|
|
@ -759,9 +790,18 @@
|
|||
});
|
||||
}
|
||||
|
||||
function showOverlay() {
|
||||
$('.dialog-overlay').show();
|
||||
}
|
||||
|
||||
function audioDriverChanged() {
|
||||
context.jamClient.TrackSetMusicDevice($('#audio-drivers').val());
|
||||
|
||||
// refresh dialog
|
||||
showMusicAudioPanel();
|
||||
}
|
||||
|
||||
function configureDriverSettingsButton() {
|
||||
if (context.jamClient.TrackHasControlPanel()) {
|
||||
logger.debug("Showing DRIVER SETTINGS button...");
|
||||
$('#btn-driver-settings').show();
|
||||
|
|
@ -772,7 +812,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
function initMusicAudioPanel() {
|
||||
function showMusicAudioPanel() {
|
||||
|
||||
configureDriverSettingsButton();
|
||||
|
||||
$('div[tab-id="music-audio"]').show();
|
||||
$('div[tab-id="voice-chat"]').hide();
|
||||
|
|
@ -844,7 +886,7 @@
|
|||
loadOptions($('#audio-output-selection'), usedAudioOutputChannels, "device_id", "name", -1);
|
||||
}
|
||||
|
||||
function initVoiceChatPanel() {
|
||||
function showVoiceChatPanel() {
|
||||
$('div[tab-id="music-audio"]').hide();
|
||||
$('div[tab-id="voice-chat"]').show();
|
||||
|
||||
|
|
@ -893,7 +935,9 @@
|
|||
usedChatInputChannels.push(val);
|
||||
}
|
||||
else if (assignment === 0) {
|
||||
unusedAudioInputChannels.push(val);
|
||||
if (!val.chat) {
|
||||
unusedAudioInputChannels.push(val);
|
||||
}
|
||||
}
|
||||
else if (assignment === -1) {
|
||||
|
||||
|
|
@ -914,7 +958,9 @@
|
|||
|
||||
}
|
||||
else if (assignment === 0) {
|
||||
unusedAudioOutputChannels.push(val);
|
||||
if (!val.chat) {
|
||||
unusedAudioOutputChannels.push(val);
|
||||
}
|
||||
}
|
||||
else if (assignment === -1) {
|
||||
|
||||
|
|
@ -960,6 +1006,9 @@
|
|||
// update jam-db with settings
|
||||
|
||||
// TODO: reload / refresh Session screen (instrument icons at minimum)
|
||||
original_device_id = $('#audio-drivers').val();
|
||||
|
||||
$('div[layout-id="configure-audio"]').hide();
|
||||
}
|
||||
|
||||
function cancelSettings() {
|
||||
|
|
@ -968,10 +1017,55 @@
|
|||
}
|
||||
|
||||
function validateAudioSettings() {
|
||||
var isValid = true;
|
||||
var noTrackErrMsg = 'You must assign at least one input port to each of your tracks. Please update your settings to correct this. If you want to delete a track, please return to the session screen and delete the track by clicking the "x" box in the upper right-hand corner of the track.';
|
||||
var noInstrumentErrMsg = 'You must specify what instrument is being played for each track. Please update your settings to correct this.';
|
||||
var outputErrMsg = 'You must assign two output ports for stereo session audio to hear music. Please update your settings to correct this.';
|
||||
|
||||
var errMsg;
|
||||
|
||||
// verify Track 1 Input and Instrument exist
|
||||
if ($('#track1-input').val() == null) {
|
||||
errMsg = noTrackErrMsg;
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
if ($('#track1-instrument').val() == null) {
|
||||
errMsg = noInstrumentErrMsg;
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
// if Track 2 exists, verify Input and Instrument exist
|
||||
if (isValid && myTrackCount > 1) {
|
||||
if ($('#track2-input').val() == null) {
|
||||
errMsg = noTrackErrMsg;
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (isValid && $('#track2-instrument').val() == null) {
|
||||
errMsg = noInstrumentErrMsg;
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
// verify Session Audio Output exists
|
||||
return true;
|
||||
if (isValid && ($('#audio-output-selection').val() == null || ("#audio-output-selection :selected").length != 2)) {
|
||||
errMsg = outputErrMsg;
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
showErrorDialog(errMsg);
|
||||
}
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
function showErrorDialog(msg) {
|
||||
app.layout.showDialog('error-dialog');
|
||||
$('#error-msg', 'div[layout-id="error-dialog"]').html(msg);
|
||||
}
|
||||
|
||||
function validateVoiceChatSettings() {
|
||||
|
|
|
|||
|
|
@ -218,13 +218,13 @@
|
|||
<div class="left w30">
|
||||
<br /><br /><br /><br />
|
||||
Track 1 Instrument:<br />
|
||||
<select id="track1-instrument" class="w100" multiple="multiple" style="height:70px">
|
||||
<select id="track1-instrument" class="w100" style="height:70px">
|
||||
</select>
|
||||
<br />
|
||||
<br />
|
||||
<div id="track2-instrument-div">
|
||||
Track 2 Instrument:<br />
|
||||
<select id="track2-instrument" class="w100" multiple="multiple" style="height:70px">
|
||||
<select id="track2-instrument" class="w100" style="height:70px">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -262,7 +262,7 @@
|
|||
<br clear="left" /><br />
|
||||
<div class="right mr30">
|
||||
<a id="btn-cancel-settings" layout-action="close" class="button-grey">CANCEL</a>
|
||||
<a id="btn-save-settings" layout-action="close" class="button-orange">UPDATE SETTINGS</a>
|
||||
<a id="btn-save-settings" class="button-orange">UPDATE SETTINGS</a>
|
||||
</div>
|
||||
<br clear="all" />
|
||||
</div>
|
||||
|
|
@ -330,13 +330,29 @@
|
|||
To add a new audio device, you must exit your current session and test the device using the JamKazam automated test feature.
|
||||
<br clear="left" /><br />
|
||||
<div class="right">
|
||||
<a layout-action="close" class="button-grey">CANCEL</a>
|
||||
<a id="btn-cancel-new-audio" layout-action="close" class="button-grey">CANCEL</a>
|
||||
<a id="btn-leave-session-test" layout-action="close" href="#/ftue1" class="button-orange">LEAVE SESSION & START TEST</a>
|
||||
</div>
|
||||
<br clear="all" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog" layout="dialog" layout-id="error-dialog" style="max-width:550px;">
|
||||
<div class="content-head">
|
||||
<%= image_tag "content/icon_add.png", {:width => 19, :height => 19, :class => 'content-icon' } %>
|
||||
<h1>invalid settings</h1>
|
||||
</div>
|
||||
<div class="dialog-inner">
|
||||
<span id="error-msg"></span>
|
||||
<br clear="left" /><br />
|
||||
<div class="right">
|
||||
<a id="btn-error-ok" layout-action="close" class="button-orange">OK</a>
|
||||
</div>
|
||||
<br clear="all" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Track Template -->
|
||||
<script type="text/template" id="template-session-track">
|
||||
<div class="session-track track" client-id="{clientId}">
|
||||
|
|
|
|||
Loading…
Reference in New Issue