New FTUE panel controls mostly working.
This commit is contained in:
parent
1d168257d0
commit
33eed269ed
|
|
@ -25,6 +25,8 @@
|
|||
};
|
||||
|
||||
var faderMap = {
|
||||
'ftue-2-audio-input-fader': jamClient.FTUESetInputVolume,
|
||||
'ftue-2-voice-input-fader': jamClient.FTUESetOutputVolume,
|
||||
'ftue-audio-input-fader': jamClient.FTUESetInputVolume,
|
||||
'ftue-voice-input-fader': jamClient.FTUESetChatInputVolume,
|
||||
'ftue-audio-output-fader': jamClient.FTUESetOutputVolume
|
||||
|
|
@ -44,6 +46,10 @@
|
|||
|
||||
function beforeShow(data) {
|
||||
var vuMeters = [
|
||||
'#ftue-2-audio-input-vu-left',
|
||||
'#ftue-2-audio-input-vu-right',
|
||||
'#ftue-2-voice-input-vu-left',
|
||||
'#ftue-2-voice-input-vu-right',
|
||||
'#ftue-audio-input-vu-left',
|
||||
'#ftue-audio-input-vu-right',
|
||||
'#ftue-voice-input-vu-left',
|
||||
|
|
@ -80,6 +86,8 @@
|
|||
// Always reset the driver select box to "Choose..." which forces everything
|
||||
// to sync properly when the user reselects their driver of choice.
|
||||
// VRFS-375 and VRFS-561
|
||||
$('[layout-wizard="ftue"] [layout-wizard-step="0"] .settings-2-device select').val("");
|
||||
$('[layout-wizard="ftue"] [layout-wizard-step="0"] .settings-2-voice select').val("");
|
||||
$('[layout-wizard="ftue"] [layout-wizard-step="2"] .asio-settings .settings-driver select').val("");
|
||||
}
|
||||
|
||||
|
|
@ -317,6 +325,14 @@
|
|||
$('#asio-framesize').on('change', setAsioFrameSize);
|
||||
$('#asio-input-latency').on('change', setAsioInputLatency);
|
||||
$('#asio-output-latency').on('change', setAsioOutputLatency);
|
||||
// New FTUE events
|
||||
$('.ftue-new .settings-2-device select').on('change', newFtueAudioDeviceChanged);
|
||||
$('.ftue-new .settings-2-voice select').on('change', newFtueAudioDeviceChanged);
|
||||
$('#btn-ftue-2-asio-resync').on('click', newFtueAsioResync);
|
||||
$('#btn-ftue-2-asio-control-panel').on('click', openASIOControlPanel);
|
||||
$('#ftue-2-asio-framesize').on('change', newFtueSetAsioFrameSize);
|
||||
$('#ftue-2-asio-input-latency').on('change', newFtueSetAsioInputLatency);
|
||||
$('#ftue-2-asio-output-latency').on('change', newFtueSetAsioOutputLatency);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -368,7 +384,6 @@
|
|||
* Load available drivers and populate the driver select box.
|
||||
*/
|
||||
function loadAudioDrivers() {
|
||||
|
||||
var drivers = jamClient.FTUEGetDevices();
|
||||
|
||||
var driverOptionFunc = function(driverKey, index, list) {
|
||||
|
|
@ -377,11 +392,217 @@
|
|||
};
|
||||
|
||||
var optionsHtml = '<option selected="selected" value="">Choose...</option>';
|
||||
var $select = $('[layout-wizard-step="2"] .settings-driver select');
|
||||
$select.empty();
|
||||
var selectors = [
|
||||
'[layout-wizard-step="0"] .settings-2-device select',
|
||||
'[layout-wizard-step="0"] .settings-2-voice select',
|
||||
'[layout-wizard-step="2"] .settings-driver select'
|
||||
];
|
||||
var sortedDeviceKeys = context._.keys(drivers).sort();
|
||||
context._.each(sortedDeviceKeys, driverOptionFunc);
|
||||
$select.html(optionsHtml);
|
||||
$.each(selectors, function(index, selector) {
|
||||
var $select = $(selector);
|
||||
$select.empty();
|
||||
$select.html(optionsHtml);
|
||||
});
|
||||
}
|
||||
|
||||
// Handler for when the audio device is changed in the new FTUE screen
|
||||
// This works differently from the old FTUE. There is no input/output selection,
|
||||
// as soon as the user chooses a driver, we auto-assign inputs and outputs.
|
||||
// We also call jamClient.FTUEGetExpectedLatency, which returns a structure like:
|
||||
// { latency: 11.1875, latencyknown: true, latencyvar: 1}
|
||||
function newFtueAudioDeviceChanged(evt) {
|
||||
var $select = $(evt.currentTarget);
|
||||
|
||||
var $audioSelect = $('.ftue-new .settings-2-device select');
|
||||
var $voiceSelect = $('.ftue-new .settings-2-voice select');
|
||||
var audioDriverId = $audioSelect.val();
|
||||
var voiceDriverId = $voiceSelect.val();
|
||||
jamClient.FTUESetMusicDevice(audioDriverId);
|
||||
jamClient.FTUESetChatInput(voiceDriverId);
|
||||
if (voiceDriverId) { // Let the back end know whether a voice device is selected
|
||||
jamClient.TrackSetChatEnable(true);
|
||||
} else {
|
||||
jamClient.TrackSetChatEnable(false);
|
||||
}
|
||||
if (!audioDriverId) {
|
||||
// reset back to 'Choose...'
|
||||
newFtueEnableControls(false);
|
||||
return;
|
||||
}
|
||||
var musicInputs = jamClient.FTUEGetMusicInputs();
|
||||
var musicOutputs = jamClient.FTUEGetMusicOutputs();
|
||||
|
||||
// set the music input to the first available input,
|
||||
// and output to the first available output
|
||||
var kin = null, kout = null, k = null;
|
||||
// TODO FIXME - this jamClient call returns a dictionary.
|
||||
// It's difficult to know what to auto-choose.
|
||||
// For example, with my built-in audio, the keys I get back are
|
||||
// digital in, line in, mic in and stereo mix. Which should we pick for them?
|
||||
for (k in musicInputs) {
|
||||
kin = k;
|
||||
break;
|
||||
}
|
||||
for (k in musicOutputs) {
|
||||
kout = k;
|
||||
break;
|
||||
}
|
||||
var result;
|
||||
if (kin && kout) {
|
||||
jamClient.FTUESetMusicInput(kin);
|
||||
jamClient.FTUESetMusicOutput(kout);
|
||||
} else {
|
||||
// TODO FIXME - how to handle a driver selection where we are unable to
|
||||
// autoset both inputs and outputs? (I'd think this could happen if either
|
||||
// the input or output side returned no values)
|
||||
context.alert("TODO - handle 'unable to set both inputs/outputs' case");
|
||||
return;
|
||||
}
|
||||
|
||||
newFtueEnableControls(true);
|
||||
newFtueOsSpecificSettings();
|
||||
setLevels(0);
|
||||
newFtueUpdateLatencyView('loading');
|
||||
jamClient.FTUESave(false);
|
||||
setVuCallbacks();
|
||||
|
||||
var latency = jamClient.FTUEGetExpectedLatency();
|
||||
newFtueUpdateLatencyView(latency);
|
||||
|
||||
}
|
||||
|
||||
function newFtueSave(persist) {
|
||||
newFtueUpdateLatencyView('loading');
|
||||
jamClient.FTUESave(persist);
|
||||
var latency = jamClient.FTUEGetExpectedLatency();
|
||||
newFtueUpdateLatencyView(latency);
|
||||
}
|
||||
|
||||
function newFtueAsioResync(evt) {
|
||||
// In theory, we should be calling the following, but it causes
|
||||
// us to not have both inputs/outputs loaded, and simply calling
|
||||
// FTUE Save appears to resync things.
|
||||
//jamClient.FTUERefreshDevices();
|
||||
newFtueSave(false);
|
||||
}
|
||||
|
||||
function newFtueSetAsioFrameSize(evt) {
|
||||
var val = parseFloat($(evt.currentTarget).val(),10);
|
||||
if (isNaN(val)) {
|
||||
return;
|
||||
}
|
||||
logger.debug("Calling FTUESetFrameSize(" + val + ")");
|
||||
jamClient.FTUESetFrameSize(val);
|
||||
newFtueSave(false);
|
||||
}
|
||||
function newFtueSetAsioInputLatency(evt) {
|
||||
var val = parseInt($(evt.currentTarget).val(),10);
|
||||
if (isNaN(val)) {
|
||||
return;
|
||||
}
|
||||
logger.debug("Calling FTUESetInputLatency(" + val + ")");
|
||||
jamClient.FTUESetInputLatency(val);
|
||||
newFtueSave(false);
|
||||
}
|
||||
function newFtueSetAsioOutputLatency(evt) {
|
||||
var val = parseInt($(evt.currentTarget).val(),10);
|
||||
if (isNaN(val)) {
|
||||
return;
|
||||
}
|
||||
logger.debug("Calling FTUESetOutputLatency(" + val + ")");
|
||||
jamClient.FTUESetOutputLatency(val);
|
||||
newFtueSave(false);
|
||||
}
|
||||
|
||||
// Enable or Disable the frame/buffer controls in the new FTUE screen
|
||||
function newFtueEnableControls(enable) {
|
||||
var $frame = $('#ftue-2-asio-framesize');
|
||||
var $bin = $('#ftue-2-asio-input-latency');
|
||||
var $bout = $('#ftue-2-asio-output-latency');
|
||||
if (enable) {
|
||||
$frame.removeAttr("disabled");
|
||||
$bin.removeAttr("disabled");
|
||||
$bout.removeAttr("disabled");
|
||||
} else {
|
||||
$frame.attr("disabled", "disabled");
|
||||
$bin.attr("disabled", "disabled");
|
||||
$bout.attr("disabled", "disabled");
|
||||
}
|
||||
}
|
||||
|
||||
// Based on OS and Audio Hardware, set Frame/Buffer settings appropriately
|
||||
// and show/hide the ASIO button.
|
||||
function newFtueOsSpecificSettings() {
|
||||
var $frame = $('#ftue-2-asio-framesize');
|
||||
var $bin = $('#ftue-2-asio-input-latency');
|
||||
var $bout = $('#ftue-2-asio-output-latency');
|
||||
var $asioBtn = $('#btn-ftue-2-asio-control-panel');
|
||||
if (jamClient.GetOSAsString() === "Win32") {
|
||||
if (jamClient.FTUEHasControlPanel()) {
|
||||
// Win32 + ControlPanel = ASIO
|
||||
// frame=2.5, buffers=0
|
||||
$asioBtn.show();
|
||||
$frame.val(2.5);
|
||||
$bin.val(0);
|
||||
$bout.val(0);
|
||||
} else {
|
||||
// Win32, no ControlPanel = WDM/Kernel Streaming
|
||||
// frame=10, buffers=0
|
||||
$asioBtn.hide();
|
||||
$frame.val(10);
|
||||
// TODO FIXME - the old FTUE set the buffers to 1 for WDM/Kernel streaming
|
||||
// The new FTUE spec says to use 0, as I've done here...
|
||||
$bin.val(0);
|
||||
$bout.val(0);
|
||||
}
|
||||
} else { // Assuming Mac. TODO: Linux check here
|
||||
// frame=2.5, buffers=0
|
||||
$asioBtn.hide();
|
||||
$frame.val(2.5);
|
||||
$bin.val(0);
|
||||
$bout.val(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Given a latency structure, update the view.
|
||||
function newFtueUpdateLatencyView(latency) {
|
||||
var $report = $('.ftue-new .latency .report');
|
||||
var $instructions = $('.ftue-new .latency .instructions');
|
||||
var latencyClass = "neutral";
|
||||
var latencyValue = "N/A";
|
||||
if (latency && latency.latencyknown) {
|
||||
latencyValue = latency.latency;
|
||||
// Round latency to two decimal places.
|
||||
latencyValue = Math.round(latencyValue * 100) / 100;
|
||||
if (latency.latency <= 10) {
|
||||
latencyClass = "good";
|
||||
} else if (latency.latency <= 20) {
|
||||
latencyClass = "acceptable";
|
||||
} else {
|
||||
latencyClass = "bad";
|
||||
}
|
||||
} else {
|
||||
// TODO FIXME - handle unknown expected latency
|
||||
// latency unknown...
|
||||
}
|
||||
|
||||
$('.ms-label', $report).html(latencyValue);
|
||||
$('p', $report).html('milliseconds');
|
||||
|
||||
$report.removeClass('good acceptable bad');
|
||||
$report.addClass(latencyClass);
|
||||
|
||||
var instructionClasses = ['neutral', 'good', 'acceptable', 'bad', 'start', 'loading'];
|
||||
$.each(instructionClasses, function(idx, val) {
|
||||
$('p.' + val, $instructions).hide();
|
||||
});
|
||||
if (latency === 'loading') {
|
||||
$('p.loading', $instructions).show();
|
||||
} else {
|
||||
$('p.' + latencyClass, $instructions).show();
|
||||
}
|
||||
}
|
||||
|
||||
function audioDriverChanged(evt) {
|
||||
|
|
@ -459,6 +680,7 @@
|
|||
var dialogBindings = { 'beforeShow': beforeShow,
|
||||
'afterShow': afterShow, 'afterHide': afterHide };
|
||||
app.bindDialog('ftue', dialogBindings);
|
||||
app.registerWizardStepFunction("0", settingsInit);
|
||||
app.registerWizardStepFunction("2", settingsInit);
|
||||
app.registerWizardStepFunction("4", testLatency);
|
||||
app.registerWizardStepFunction("6", testComplete);
|
||||
|
|
@ -484,6 +706,8 @@
|
|||
};
|
||||
|
||||
context.JK.ftueAudioInputVUCallback = function(dbValue) {
|
||||
context.JK.ftueVUCallback(dbValue, '#ftue-2-audio-input-vu-left');
|
||||
context.JK.ftueVUCallback(dbValue, '#ftue-2-audio-input-vu-right');
|
||||
context.JK.ftueVUCallback(dbValue, '#ftue-audio-input-vu-left');
|
||||
context.JK.ftueVUCallback(dbValue, '#ftue-audio-input-vu-right');
|
||||
};
|
||||
|
|
@ -492,6 +716,8 @@
|
|||
context.JK.ftueVUCallback(dbValue, '#ftue-audio-output-vu-right');
|
||||
};
|
||||
context.JK.ftueChatInputVUCallback = function(dbValue) {
|
||||
context.JK.ftueVUCallback(dbValue, '#ftue-2-voice-input-vu-left');
|
||||
context.JK.ftueVUCallback(dbValue, '#ftue-2-voice-input-vu-right');
|
||||
context.JK.ftueVUCallback(dbValue, '#ftue-voice-input-vu-left');
|
||||
context.JK.ftueVUCallback(dbValue, '#ftue-voice-input-vu-right');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -259,6 +259,8 @@
|
|||
if (!(context.jamClient.FTUEGetStatus())) {
|
||||
app.layout.showDialog('ftue');
|
||||
}
|
||||
// TODO FIXME REMOVE ME - Testing Only
|
||||
app.layout.showDialog('ftue');
|
||||
}
|
||||
|
||||
this.unloadFunction = function() {
|
||||
|
|
|
|||
|
|
@ -146,17 +146,43 @@ div.dialog.ftue {
|
|||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
.report.neutral, .report.start {
|
||||
background-color: #666;
|
||||
}
|
||||
.report.good {
|
||||
background-color: #72a43b;
|
||||
}
|
||||
.report.acceptable {
|
||||
background-color: #D6A800;
|
||||
}
|
||||
.report.bad {
|
||||
background-color: #7B0C00;
|
||||
}
|
||||
.instructions {
|
||||
color:#fff;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 125px;
|
||||
width: 595px;
|
||||
height: 36px;
|
||||
height: 50px;
|
||||
padding: 10px;
|
||||
padding-top: 24px;
|
||||
background-color: #666;
|
||||
}
|
||||
.instructions p.start, .instructions p.neutral {
|
||||
padding-top: 4px;
|
||||
}
|
||||
.instructions p.good {
|
||||
padding-top: 4px;
|
||||
}
|
||||
.instructions p.acceptable {
|
||||
margin-top: -6px;
|
||||
}
|
||||
.instructions p.bad {
|
||||
margin-top: -6px;
|
||||
}
|
||||
.instructions p a {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.column {
|
||||
position:absolute;
|
||||
|
|
|
|||
|
|
@ -31,25 +31,23 @@
|
|||
<select></select>
|
||||
<!-- VU/Fader for audio device -->
|
||||
<div class="controls">
|
||||
<!-- FIXME IDS -->
|
||||
<div id="ftue-audio-output-vu-left" class="ftue-vu-left"></div>
|
||||
<div id="ftue-audio-output-fader" class="ftue-fader"></div>
|
||||
<div id="ftue-2-audio-input-vu-left" class="ftue-vu-left"></div>
|
||||
<div id="ftue-2-audio-input-fader" class="ftue-fader"></div>
|
||||
<div class="gain-label">GAIN</div>
|
||||
<div id="ftue-audio-output-vu-right" class="ftue-vu-right"></div>
|
||||
<div id="ftue-2-audio-input-vu-right" class="ftue-vu-right"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column settings-2-center">
|
||||
<div class="buttons">
|
||||
<!-- FIXME - change ids -->
|
||||
<a class="button-grey" id="btn-asio-resync">
|
||||
<a class="button-grey" id="btn-ftue-2-asio-resync">
|
||||
<%= image_tag "content/icon_resync.png", {:width => 12, :height => 14} %>
|
||||
RESYNC
|
||||
</a>
|
||||
<a class="button-grey" id="btn-asio-control-panel">ASIO SETTINGS</a>
|
||||
<a class="button-grey" id="btn-ftue-2-asio-control-panel">ASIO SETTINGS</a>
|
||||
</div>
|
||||
<div class="subcolumn first">
|
||||
Frame<br />
|
||||
<select disabled="disabled" id="asio-framesize">
|
||||
<select disabled="disabled" id="ftue-2-asio-framesize">
|
||||
<option value=""></option>
|
||||
<option value="2.5">2.5</option>
|
||||
<option value="5">5</option>
|
||||
|
|
@ -58,7 +56,7 @@
|
|||
</div>
|
||||
<div class="subcolumn second">
|
||||
Buffer/In<br />
|
||||
<select disabled="disabled" id="asio-input-latency">
|
||||
<select disabled="disabled" id="ftue-2-asio-input-latency">
|
||||
<option value="0">0</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
|
|
@ -74,7 +72,7 @@
|
|||
</div>
|
||||
<div class="subcolumn third">
|
||||
Buffer/Out<br />
|
||||
<select disabled="disabled" id="asio-output-latency">
|
||||
<select disabled="disabled" id="ftue-2-asio-output-latency">
|
||||
<option value="0">0</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
|
|
@ -95,22 +93,27 @@
|
|||
Voice Chat Input:<br />
|
||||
<select></select>
|
||||
<div class="controls">
|
||||
<div id="ftue-audio-input-vu-left" class="ftue-vu-left"></div>
|
||||
<div id="ftue-audio-input-fader" class="ftue-fader"></div>
|
||||
<div id="ftue-2-voice-input-vu-left" class="ftue-vu-left"></div>
|
||||
<div id="ftue-2-voice-input-fader" class="ftue-fader"></div>
|
||||
<div class="gain-label">GAIN</div>
|
||||
<div id="ftue-audio-input-vu-right" class="ftue-vu-right"></div>
|
||||
<div id="ftue-2-voice-input-vu-right" class="ftue-vu-right"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Latency -->
|
||||
<div class="latency">
|
||||
Latency:<br />
|
||||
<div class="report">
|
||||
<div class="ms-label">9.83</div>
|
||||
<p>milliseconds</p>
|
||||
<div class="report neutral">
|
||||
<div class="ms-label"></div>
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="instructions">
|
||||
Your audio speed is good. When done with settings, click Save Settings to continue.
|
||||
<p class="start" style="display:block;">Choose an audio device to continue...</p>
|
||||
<p class="neutral" style="display:none;">Unable to determine latency.</p>
|
||||
<p class="neutral loading" style="display:none;">Estimating latency...</p>
|
||||
<p class="good" style="display:none;">Your audio speed is good. When done with settings, click Save Settings to continue.</p>
|
||||
<p class="acceptable" style="display:none;">Your audio speed is acceptable, but borderline. Try setting Frame to 2.5 and Buffers to 0 and see if your audio quality is still OK. When done with settings, click Save Settings to continue. You can also view the <a href="#">Choosing an Audio Device</a> article for information on faster audio devices.</p>
|
||||
<p class="bad" style="display:none;">We're sorry, but your audio speed is too slow to use JamKazam. Try setting Frame to 2.5 and Buffers to 0 and see if your audio quality is still OK. You can also view the <a href="#">Choosing an Audio Device</a> article for information on faster audio devices.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue