* VRFS-3225 - show sampler ate dropdown

This commit is contained in:
Seth Call 2015-05-08 15:03:19 -05:00
parent f2e2a79b5b
commit 10da152916
11 changed files with 176 additions and 4 deletions

View File

@ -72,7 +72,7 @@
var alertData = $.extend({}, ALERT_TYPES[type]);
alertData.text = text;
if(alertData) {
if(alertData && alertData.name) {
$document.triggerHandler(alertData.name, alertData);
}

View File

@ -64,6 +64,12 @@
function FTUESetPreferredMixerSampleRate() {}
function FTUESetPreferredOutputSampleRate(){ }
function FTUESetPreferredChatSampleRate() {}
function FTUEgetInputDeviceSampleRate() {
return 44100;
}
function FTUEgetOutputDeviceSampleRate() {
return 44100;
}
function FTUESelectVideoCaptureDevice(device, settings) {
@ -1048,6 +1054,8 @@
this.FTUESetPreferredMixerSampleRate = FTUESetPreferredMixerSampleRate;
this.FTUESetPreferredOutputSampleRate = FTUESetPreferredOutputSampleRate;
this.FTUESetPreferredChatSampleRate = FTUESetPreferredChatSampleRate;
this.FTUEgetInputDeviceSampleRate = FTUEgetInputDeviceSampleRate;
this.FTUEgetOutputDeviceSampleRate = FTUEgetOutputDeviceSampleRate;
this.FTUEGetInputLatency = FTUEGetInputLatency;
this.FTUEGetInputVolume = FTUEGetInputVolume;
this.FTUEGetMusicInputs = FTUEGetMusicInputs;

View File

@ -18,6 +18,7 @@
var logger = context.JK.logger;
var rest = context.JK.Rest();
var frameBuffers = new context.JK.FrameBuffers(app);
var sampleRate = new context.JK.SampleRate(app);
var gearTest = new context.JK.GearTest(app);
var loopbackShowing = false;
var adjustGearSettingsShowing = false;
@ -34,6 +35,8 @@
var $inputChannels = null;
var $outputChannels = null;
var $knobs = null;
var $sampleRate = null;
var $selectSampleRate = null;
var $adjustSettingsLink = null;
var $adjustGearForIoFail = null;
var $scoreReport = null;
@ -461,6 +464,7 @@
$audioInput.attr("disabled", "disabled").easyDropDown('disable');
$audioOutput.attr("disabled", "disabled").easyDropDown('disable');
frameBuffers.disable();
sampleRate.disable();
$asioInputControlBtn.on("click", false).addClass('disabled');
$asioOutputControlBtn.on("click", false).addClass('disabled');
$resyncBtn.on('click', false).addClass('disabled');
@ -474,6 +478,7 @@
$audioInput.removeAttr("disabled").easyDropDown('enable');
$audioOutput.removeAttr("disabled").easyDropDown('enable');
frameBuffers.enable();
sampleRate.enable();
$asioInputControlBtn.off("click", false).removeClass('disabled');
$asioOutputControlBtn.off("click", false).removeClass('disabled')
$resyncBtn.off('click', false).removeClass('disabled')
@ -555,6 +560,15 @@
});
}
function onSampleRateChanged() {
console.log("onSampleRateChanged: ", sampleRate.selectedSampleRate())
context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']});
jamClient.FTUESetPreferredMixerSampleRate(sampleRate.selectedSampleRate());
jamClient.FTUESetPreferredOutputSampleRate(sampleRate.selectedSampleRate());
jamClient.FTUESetPreferredChatSampleRate(sampleRate.selectedSampleRate());
invalidateScore();
}
function onFramesizeChanged() {
context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']});
updateDefaultBuffers();
@ -868,6 +882,22 @@
var outputBehavior = null;
}
// deal with sample rate
if(selectedDeviceInfo) {
// get the preferred sample rate for the device, and set that as the initial value of the sample rate dropdown
var inputSampleRate = context.jamClient.FTUEgetInputDeviceSampleRate(selectedDeviceInfo.input.info.port_audio_name);
logger.debug("applying the sample rate based on input device: " + selectedDeviceInfo.input.id + " (" + inputSampleRate + ")");
sampleRate.selectSampleRate(inputSampleRate);
context.jamClient.FTUESetPreferredMixerSampleRate(sampleRate.selectedSampleRate());
context.jamClient.FTUESetPreferredOutputSampleRate(sampleRate.selectedSampleRate());
context.jamClient.FTUESetPreferredChatSampleRate(sampleRate.selectedSampleRate());
$sampleRate.show();
}
else {
$sampleRate.hide();
}
// deal with watch video
if(isInputOutputDifferentTypes()) {
// if we have two types of devices, you need two different videos
@ -1128,7 +1158,8 @@
function onFocus() {
if(validDevice && !loopbackShowing && !adjustGearSettingsShowing && !gearTest.isScoring() && getSelectedInputs().length > 0 && getSelectedOutputs().length == 2 ) {
scheduleRescanSystem(function() { attemptScore(true); }, 3000, false)
//scheduleRescanSystem(function() { attemptScore(true); }, 3000, false)
context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']});
}
}
@ -1136,6 +1167,7 @@
savedProfile = false;
initialScan = false;
deviceInformation = gearUtils.loadDeviceInfo();
sampleRate.setLastSelectedDevice(null);
resetState();
initializeFormElements();
initializeNextButtonState();
@ -1224,6 +1256,8 @@
$inputChannels = $step.find('.input-ports');
$outputChannels = $step.find('.output-ports');
$knobs = $step.find('.frame-and-buffers');
$sampleRate = $step.find('.sample-rate')
$selectSampleRate = $step.find('.select-sample-rate');
$adjustSettingsLink = $knobs.find('.adjust-gear-settings')
$adjustGearForIoFail = $step.find(".adjust-gear-for-io-fail")
$scoreReport = $step.find('.results');
@ -1236,6 +1270,7 @@
$resyncStatus = $step.find('.resync-status');
$resyncStatusText = $step.find('.resynctext');
$latencyScoreBox = $step.find('.latency-score-section')
operatingSystem = context.JK.GetOSAsString();
frameBuffers.initialize($knobs);
$(frameBuffers)
@ -1251,6 +1286,9 @@
.on(gearTest.GEAR_TEST_FAIL, onGearTestFail)
.on(gearTest.GEAR_TEST_INVALIDATED_ASYNC, onGearTestInvalidated)
$adjustGearForIoFail.click(onAdjustGearRequested);
sampleRate.initialize($selectSampleRate)
$(sampleRate).on(sampleRate.SAMPLERATE_CHANGED, onSampleRateChanged);
}
this.getLastAudioTestFailAnalytics = getLastAudioTestFailAnalytics;

View File

@ -309,7 +309,7 @@
logger.debug("gear_test: onInvalidAudioDevice")
asynchronousInvalidDevice = true;
$self.triggerHandler(GEAR_TEST_INVALIDATED_ASYNC);
context.JK.Banner.showAlert('Invalid Audio Device', 'It appears this audio device is not currently connected. Attach the device to your computer and restart the application, or select a different device.<br/><br/>If you think your gear is connected and working, this <a rel="external" href="https://jamkazam.desk.com/customer/portal/articles/1723489-jamkazam-thinks-your-gear-is-disconnected---windows-only">support article</a> can help.')
context.JK.Banner.showAlert('Invalid Audio Device', 'It appears this audio device is not currently connected. Attach the device to your computer and restart the application, or select a different device.<br/><br/>If you think your gear is connected and working:<br/><br/>Try a different sample rate<br/><br/>Your device is in use by another application, in which case this <a rel="external" href="https://jamkazam.desk.com/customer/portal/articles/1723489-jamkazam-thinks-your-gear-is-disconnected---windows-only">support article</a> can help.')
}

View File

@ -215,6 +215,7 @@
var deviceInfo = {};
deviceInfo.id = device.guid;
deviceInfo.port_audio_name = device.port_audio_name;
deviceInfo.type = determineDeviceType(device.guid, device.display_name);
deviceInfo.displayType = AUDIO_DEVICE_BEHAVIOR[deviceInfo.type].display;
deviceInfo.displayName = device.display_name;

View File

@ -0,0 +1,102 @@
(function (context, $) {
"use strict";
context.JK = context.JK || {};
context.JK.SampleRate = function (app) {
var $sampleRate = null;
var $self = $(this);
var logger = context.JK.logger;
var lastSelectedDevice = null;
var SAMPLERATE_CHANGED = 'sample_rate.sample_rate_changed';
var BACKEND_SAMPLE_RATES = {
JAMKAZAM_AUTO_SR: 0,
USE_DEVICE_DEFAULT_SR: 1,
PREFER_44: 2,
PREFER_48: 3,
PREFER_96: 4,
PREFER_88: 5
}
function setLastSelectedDevice(_lastSelectedDevice) {
lastSelectedDevice = _lastSelectedDevice;
}
function getLastSelectedDevice() {
return lastSelectedDevice;
}
function selectedSampleRate() {
return BACKEND_SAMPLE_RATES[$sampleRate.val()];
}
function selectSampleRate(value) {
var setter = 'PREFER_44'
if(value == 44100) {
setter = 'PREFER_44'
}
else if(value == 48000) {
setter = 'PREFER_48'
}
else if(value == 96000) {
setter = 'PREFER_96'
}
console.log("SELECT SAMPLE RATE" + value, setter);
context.JK.dropdown($sampleRate.val(setter).easyDropDown('select', setter.toString(), true))
}
function render() {
context.JK.dropdown($sampleRate);
}
function disable() {
$sampleRate.attr("disabled", "disabled").easyDropDown('disable');
}
function enable() {
$sampleRate.removeAttr("disabled").easyDropDown('enable');
}
function resetValues() {
$sampleRate.val('PREFER_44').easyDropDown('select', 'PREFER_44', true)
}
function events() {
$sampleRate.unbind('change').change(function () {
$self.triggerHandler(SAMPLERATE_CHANGED, {value: selectedSampleRate()});
});
}
function initialize(_$sampleRate) {
$sampleRate = _$sampleRate;
if(!_$sampleRate.is('.select-sample-rate')) {
throw "$sampleRate != .select-sample-rate"
}
events();
render();
}
this.SAMPLERATE_CHANGED = SAMPLERATE_CHANGED;
this.initialize = initialize;
this.selectedSampleRate = selectedSampleRate;
this.selectSampleRate = selectSampleRate;
this.render = render;
this.enable = enable;
this.disable = disable;
this.resetValues = resetValues;
this.getLastSelectedDevice = getLastSelectedDevice;
this.setLastSelectedDevice = setLastSelectedDevice;
return this;
}
})(window, jQuery);

View File

@ -568,6 +568,21 @@
width: 100%;
max-width: 220px;
}
.sample-rate {
padding:8px 0 0;
line-height: 24px;
vertical-align: middle;
h2.sample-rate-header {
display:inline;
}
.easydropdown-wrapper {
width:auto;
float:right;
}
}
.ftue-new {
clear: both;
position: relative;

View File

@ -21,7 +21,7 @@ script type="text/template" id="template-help-select-output"
| Select an output device, because the current input device has no candidate output ports.
script type="text/template" id="template-help-push-resync-when-done"
| Push 'Resync' when done modifying Framesize, Buffer In, or Buffer Out.
| Push 'Resync' when done modifying device settings.
script type="text/template" id="template-help-can-move-on"
.help-can-move-on

View File

@ -0,0 +1,4 @@
select.select-sample-rate
option value='PREFER_44' 44100
option value='PREFER_48' 48000
option value='PREFER_96' 96000

View File

@ -56,6 +56,9 @@
%option Same as input
%h2.audio-channels Audio Output Ports
.ftue-box.list.ports.output-ports
.sample-rate
%h2.sample-rate-header Sample Rate:
= render :partial => '/clients/wizard/sample_rate'
%a.button-orange.asio-settings-output-btn ASIO SETTINGS...
= render :partial => "/clients/wizard/framebuffers"
.wizard-step-column

View File

@ -334,5 +334,6 @@ if defined?(Bundler)
config.gear_check_ignore_high_latency = false
config.remove_whitespace_credit_card = false
config.estimate_texas_taxes = false
end
end