diff --git a/web/app/assets/javascripts/backend_alerts.js b/web/app/assets/javascripts/backend_alerts.js
index 5284f0281..da48d9138 100644
--- a/web/app/assets/javascripts/backend_alerts.js
+++ b/web/app/assets/javascripts/backend_alerts.js
@@ -72,7 +72,7 @@
var alertData = $.extend({}, ALERT_TYPES[type]);
alertData.text = text;
- if(alertData) {
+ if(alertData && alertData.name) {
$document.triggerHandler(alertData.name, alertData);
}
diff --git a/web/app/assets/javascripts/fakeJamClient.js b/web/app/assets/javascripts/fakeJamClient.js
index 3c2a881a0..e571976b2 100644
--- a/web/app/assets/javascripts/fakeJamClient.js
+++ b/web/app/assets/javascripts/fakeJamClient.js
@@ -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;
diff --git a/web/app/assets/javascripts/wizard/gear/step_select_gear.js b/web/app/assets/javascripts/wizard/gear/step_select_gear.js
index 1b3b71662..a08f8f2ed 100644
--- a/web/app/assets/javascripts/wizard/gear/step_select_gear.js
+++ b/web/app/assets/javascripts/wizard/gear/step_select_gear.js
@@ -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;
diff --git a/web/app/assets/javascripts/wizard/gear_test.js b/web/app/assets/javascripts/wizard/gear_test.js
index 7e7f2b352..0683e03aa 100644
--- a/web/app/assets/javascripts/wizard/gear_test.js
+++ b/web/app/assets/javascripts/wizard/gear_test.js
@@ -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.
If you think your gear is connected and working, this support article 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.
If you think your gear is connected and working:
Try a different sample rate
Your device is in use by another application, in which case this support article can help.')
}
diff --git a/web/app/assets/javascripts/wizard/gear_utils.js b/web/app/assets/javascripts/wizard/gear_utils.js
index c66716647..193bc05ed 100644
--- a/web/app/assets/javascripts/wizard/gear_utils.js
+++ b/web/app/assets/javascripts/wizard/gear_utils.js
@@ -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;
diff --git a/web/app/assets/javascripts/wizard/sample_rate.js b/web/app/assets/javascripts/wizard/sample_rate.js
new file mode 100644
index 000000000..2a828ff14
--- /dev/null
+++ b/web/app/assets/javascripts/wizard/sample_rate.js
@@ -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);
\ No newline at end of file
diff --git a/web/app/assets/stylesheets/client/wizard/gearWizard.css.scss b/web/app/assets/stylesheets/client/wizard/gearWizard.css.scss
index 67da47a12..4d2261e7a 100644
--- a/web/app/assets/stylesheets/client/wizard/gearWizard.css.scss
+++ b/web/app/assets/stylesheets/client/wizard/gearWizard.css.scss
@@ -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;
diff --git a/web/app/views/clients/_help.html.slim b/web/app/views/clients/_help.html.slim
index c7fe1b5a0..2ec8bf719 100644
--- a/web/app/views/clients/_help.html.slim
+++ b/web/app/views/clients/_help.html.slim
@@ -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
diff --git a/web/app/views/clients/wizard/_sample_rate.html.slim b/web/app/views/clients/wizard/_sample_rate.html.slim
new file mode 100644
index 000000000..48ffd7341
--- /dev/null
+++ b/web/app/views/clients/wizard/_sample_rate.html.slim
@@ -0,0 +1,4 @@
+select.select-sample-rate
+ option value='PREFER_44' 44100
+ option value='PREFER_48' 48000
+ option value='PREFER_96' 96000
\ No newline at end of file
diff --git a/web/app/views/clients/wizard/gear/_gear_wizard.html.haml b/web/app/views/clients/wizard/gear/_gear_wizard.html.haml
index e626831c5..a28c351b1 100644
--- a/web/app/views/clients/wizard/gear/_gear_wizard.html.haml
+++ b/web/app/views/clients/wizard/gear/_gear_wizard.html.haml
@@ -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
diff --git a/web/config/application.rb b/web/config/application.rb
index 093f1fa26..5c49ae64b 100644
--- a/web/config/application.rb
+++ b/web/config/application.rb
@@ -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