From 8638cdda92011a6a869b4e81e81c304518be824a Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 25 Jan 2016 10:29:27 -0600 Subject: [PATCH] * VRFS-2035 allow static port config in UI --- .../dialog/clientPreferencesDialog.js | 73 + web/app/assets/javascripts/fakeJamClient.js | 3023 ++++++++++------- .../dialogs/clientPreferencesDialog.css.scss | 32 +- .../_clientPreferencesDialog.html.slim | 15 +- 4 files changed, 1839 insertions(+), 1304 deletions(-) diff --git a/web/app/assets/javascripts/dialog/clientPreferencesDialog.js b/web/app/assets/javascripts/dialog/clientPreferencesDialog.js index 9b4f0fa72..20bbf217e 100644 --- a/web/app/assets/javascripts/dialog/clientPreferencesDialog.js +++ b/web/app/assets/javascripts/dialog/clientPreferencesDialog.js @@ -11,17 +11,76 @@ var $dialog = null; var $autoStartField = null; var $autoStartInput = null; + var $useStaticPortField = null; + var $useStaticPortInput = null; + var $staticPortField = null; + var $staticPortInput = null; var $btnSave = null; + var beforeValues = {} + + function validate() { + + var staticPort = $staticPortInput.val(); + + staticPort = new Number(staticPort); + + console.log("staticPort", staticPort) + if(context._.isNaN(staticPort)) { + app.layout.notify({title: 'No Settings Have Been Saved!', text: 'Please enter a number from 1026-49150.'}) + return false; + } + + /** + if (staticPort % 2 == 1) { + app.layout.notify({title: 'No Settings Have Been Saved!', text: 'Please pick an even port number.'}) + return false; + } + */ + + if (staticPort < 1026 || staticPort >= 65525) { + app.layout.notify({title: 'No Settings Have Been Saved!', text: 'Please pick a port from 1026 to 65524.'}) + return false; + } + + return true; + } + function events() { context.JK.checkbox($autoStartInput); + context.JK.checkbox($useStaticPortInput); $btnSave.click(function() { + if (!validate()) { + return false; + } + var autostart = $autoStartField.find('.icheckbox_minimal').is('.checked'); context.jamClient.SetAutoStart(autostart); + + var useStaticPort = $useStaticPortField.find('.icheckbox_minimal').is('.checked'); + context.jamClient.SetUseStaticPort(useStaticPort); + + var staticPort = new Number($staticPortInput.val()); + context.jamClient.SetStaticPort(staticPort); + app.layout.closeDialog('client-preferences-dialog') context.jamClient.SaveSettings(); + + logger.debug("New Client Settings", {autostart: autostart, useStaticPort: useStaticPort, staticPort: staticPort}) + if ((beforeValues.useStaticPort != useStaticPort) || (beforeValues.staticPort != staticPort)) { + context.JK.Banner.showYesNo({ + title: "Please Restart", + html: "The changes you made won't take effect until you restart JamKazam. Restart now?", + yes: function() { + context.jamClient.RestartApplication(); + }, + no : function() { + context.JK.Banner.hide(); + } + }) + } return false; }) } @@ -29,6 +88,16 @@ function beforeShow() { var autostart = context.jamClient.GetAutoStart(); autostart ? $autoStartInput.iCheck('check') : $autoStartInput.iCheck('uncheck'); + + var useStaticPort = context.jamClient.GetUseStaticPort(); + useStaticPort ? $useStaticPortInput.iCheck('check') : $useStaticPortInput.iCheck('uncheck'); + + var staticPort = context.jamClient.GetStaticPort(); + + $staticPortInput.val(staticPort); + + beforeValues = {autostart: autostart, useStaticPort: useStaticPort, staticPort: staticPort} + logger.debug("Client Settings:", beforeValues) } function afterHide() { @@ -47,6 +116,10 @@ $dialog = $(dialogId); $autoStartField = $dialog.find('.field[data-purpose="autostart"]') $autoStartInput = $dialog.find('input[name="autostart"]') + $useStaticPortField = $dialog.find('.field[data-purpose="use-static-port"]') + $useStaticPortInput = $dialog.find('input[name="use-static-port"]') + $staticPortField = $dialog.find('.field[data-purpose="static-port"]') + $staticPortInput = $dialog.find('input[name="static-port"]') $btnSave = $dialog.find('.btnSave') events(); diff --git a/web/app/assets/javascripts/fakeJamClient.js b/web/app/assets/javascripts/fakeJamClient.js index 793ca89b1..7e2da352e 100644 --- a/web/app/assets/javascripts/fakeJamClient.js +++ b/web/app/assets/javascripts/fakeJamClient.js @@ -1,1350 +1,1791 @@ -(function(context,$) { +(function (context, $) { - "use strict"; + "use strict"; - context.JK = context.JK || {}; - context.JK.FakeJamClient = function(app, p2pMessageFactory) { - var ChannelGroupIds = context.JK.ChannelGroupIds - var logger = context.JK.logger; - logger.info("*** Fake JamClient instance initialized. ***"); + context.JK = context.JK || {}; + context.JK.FakeJamClient = function (app, p2pMessageFactory) { + var ChannelGroupIds = context.JK.ChannelGroupIds + var logger = context.JK.logger; + logger.info("*** Fake JamClient instance initialized. ***"); - // Change this to false if you want to see FTUE with fake jam client - var ftueStatus = true; - var eventCallbackName = ''; - var alertCallbackName = ''; - var eventCallbackRate = 1000; - var vuValue = -70; - var vuChange = 10; - var callbackTimer = null; - var _mix = -30; - var device_id = -1; - var latencyCallback = null; - var frameSize = 2.5; - var fakeJamClientRecordings = null; - var p2pCallbacks = null; - var videoShared = false; - var metronomeActive=false; - var metronomeBPM=false; - var metronomeSound=false; - var metronomeMeter=0; - var backingTrackPath = ""; - var backingTrackLoop = false; - var simulateNoInputs = false; + // Change this to false if you want to see FTUE with fake jam client + var ftueStatus = true; + var eventCallbackName = ''; + var alertCallbackName = ''; + var eventCallbackRate = 1000; + var vuValue = -70; + var vuChange = 10; + var callbackTimer = null; + var _mix = -30; + var device_id = -1; + var latencyCallback = null; + var frameSize = 2.5; + var fakeJamClientRecordings = null; + var p2pCallbacks = null; + var videoShared = false; + var metronomeActive = false; + var metronomeBPM = false; + var metronomeSound = false; + var metronomeMeter = 0; + var backingTrackPath = ""; + var backingTrackLoop = false; + var simulateNoInputs = false; - function dbg(msg) { logger.debug('FakeJamClient: ' + msg); } + function dbg(msg) { + logger.debug('FakeJamClient: ' + msg); + } - // Bummer that javascript doesn't have much in the way of reflection. - // arguments.callee.name would probably do what we want, but it's deprecated - // and not allowed when using "strict" - // (Wishing I could write a single function which debug logs the name of the - // current function and a JSON stringify of the arguments). + // Bummer that javascript doesn't have much in the way of reflection. + // arguments.callee.name would probably do what we want, but it's deprecated + // and not allowed when using "strict" + // (Wishing I could write a single function which debug logs the name of the + // current function and a JSON stringify of the arguments). - function getClientParentChildRole() { - // 0 = client - // 1 = parent - return 1; - } + function getClientParentChildRole() { + // 0 = client + // 1 = parent + return 1; + } - function getParentClientId() { - return null; - } + function getParentClientId() { + return null; + } - function OpenSystemBrowser(href) { - dbg("OpenSystemBrowser('" + href + "')"); - context.window.open(href); - } - - function RestartApplication() {} - function ShutdownApplication() {} - function FTUEPageEnter() {} - function FTUEPageLeave() {} - function FTUECancel() {} - function FTUEGetMusicProfileName() { + function OpenSystemBrowser(href) { + dbg("OpenSystemBrowser('" + href + "')"); + context.window.open(href); + } - if(simulateNoInputs) { - return "System Default (Playback Only)" + function RestartApplication() { + } + + function ShutdownApplication() { + } + + function FTUEPageEnter() { + } + + function FTUEPageLeave() { + } + + function FTUECancel() { + } + + function FTUEGetMusicProfileName() { + + if (simulateNoInputs) { + return "System Default (Playback Only)" + } + else { + return "FTUEAttempt-1" + } + } + + function FTUESetMusicProfileName() { + + } + + function FTUESetPreferredMixerSampleRate() { + } + + function FTUESetPreferredOutputSampleRate() { + } + + function FTUESetPreferredChatSampleRate() { + } + + function FTUEgetInputDeviceSampleRate() { + return 44100; + } + + function FTUEgetOutputDeviceSampleRate() { + return 44100; + } + + + function FTUESelectVideoCaptureDevice(device, settings) { + return true; + } + + function FTUESetVideoEncodeResolution(resolution) { + + } + + function testVideoRender() { + + } + + function FTUEGetVideoCaptureDeviceNames() { + return {"xy323ss": "Built-in Webcam HD"} + } + + function FTUECurrentSelectedVideoDevice() { + //return {} + return {"xy323ss": "Built-in Webcam HD"} + } + + function FTUEGetAvailableEncodeVideoResolutions() { + return { + 1: "CIF (352X288)", + 2: "VGA (640X480)", + 3: "4CIF (704X576)", + 4: "1/2WHD (640X360)", + 5: "WHD (1280X720)", + 6: "FHD (1920x1080)" + } + } + + function FTUEGetVideoCaptureDeviceCapabilities() { + return {} + } + + function FTUESetSendFrameRates(fps) { + + } + + function FTUEGetSendFrameRates() { + return {20: 20, 24: 24, 30: 30} + } + + function GetCurrentVideoResolution() { + return 3; + } + + function GetCurrentVideoFrameRate() { + return 30; + } + + function GetSampleRate() { + return 48; + } + + function FTUESetVideoShareEnable() { + + } + + function FTUEGetVideoShareEnable() { + return false; + } + + function isSessVideoShared() { + return videoShared; + } + + function SessStopVideoSharing() { + videoShared = false; + } + + function SessStartVideoSharing(bitrate) { + if (!bitrate || typeof(bitrate) == "undefined") { + bitrate = 0 + } + videoShared = true; + } + + function FTUEGetInputLatency() { + dbg("FTUEGetInputLatency"); + return 2; + } + + function FTUESetInputLatency(latency) { + dbg("FTUESetInputLatency:" + latency); + } + + function FTUEGetOutputLatency() { + dbg("FTUEGetOutputLatency"); + return 2; + } + + function FTUESetOutputLatency(latency) { + dbg("FTUESetOutputLatency:" + latency); + } + + function FTUEGetVolumeRanges() { + dbg("FTUEGetVolumeRanges"); + return { + input_maximum: 20, + input_minimum: -80, + output_maximum: 20, + output_minimum: -80 + }; + } + + function FTUEHasControlPanel() { + dbg("FTUEHasControlPanel"); + return true; + } + + function FTUEGetFrameSize(newSize) { + dbg("FTUEGetFrameSize"); + return frameSize; + } + + function FTUESetFrameSize(newSize) { + dbg("FTUESetFrameSize:" + newSize); + // one of 2.5, 5 or 10 + frameSize = newSize; + } + + function FTUEOpenControlPanel() { + dbg("FTUEOpenControlPanel"); + context.alert("Simulated ASIO Dialog"); + } + + function FTUEInit() { + dbg("FTUEInit"); + } + + function FTUERefreshDevices() { + dbg("FTUERefreshDevices()"); + } + + function FTUESave(b) { + dbg("FTUESave(" + b + ")"); + return {}; + } + + function FTUEGetStatus() { + return ftueStatus; + } + + function FTUESetStatus(b) { + ftueStatus = b; + } + + function FTUESetMusicDevice(id) { + dbg("FTUESetMusicDevice"); + } + + function FTUEGetAudioDevices() { + return { + "devices": [{ + "display_name": "Built-in", + "guid": "Built-in", + "input_count": 1, + "name": "Built-in", + "output_count": 1, + "port_audio_name": "Built-in" + }, { + "display_name": "JamKazam Virtual Monitor", + "guid": "JamKazam Virtual Monitor", + "input_count": 0, + "name": "JamKazam Virtual Monitor", + "output_count": 1, + "port_audio_name": "JamKazam Virtual Monitor" + }] + } + } + + function FTUEGetDevices() { + dbg('FTUEGetMusicDevices'); + return { + "ASIO4ALL v2": "ASIO4ALL v2 - ASIO", + "M-Audio FW ASIO": "M-AUDIO FW ASIO - ASIO" + }; + } + + function FTUEGetMusicInputs() { + dbg('FTUEGetMusicInputs'); + return { + "i~11~MultiChannel (FWAPMulti)~0^i~11~Multichannel (FWAPMulti)~1": "Multichannel (FWAPMulti) - Channel 1/Multichannel (FWAPMulti) - Channel 2" + }; + } + + function FTUEGetMusicOutputs() { + dbg('FTUEGetMusicOutputs'); + return { + "o~11~Multichannel (FWAPMulti)~0^o~11~Multichannel (FWAPMulti)~1": "Multichannel (FWAPMulti) - Channel 1/Multichannel (FWAPMulti) - Channel 2" + }; + } + + function FTUEGetChatInputs() { + dbg('FTUEGetChatInputs'); + return { + "i~11~MultiChannel (FWAPMulti)~0^i~11~Multichannel (FWAPMulti)~1": "Multichannel (FWAPMulti) - Channel 1/Multichannel (FWAPMulti) - Channel 2" + }; + } + + function FTUEGetChannels() { + return { + "inputs": [ + { + "assignment": 1, + "chat": false, + "device_id": "Built-in Microph", + "device_type": 5, + "id": "i~5~Built-in Microph~0~0~Built-in", + "name": "Built-in Microph - Left", + "number": 0 + }, + { + "assignment": 0, + "chat": false, + "device_id": "Built-in Microph", + "device_type": 5, + "id": "i~5~Built-in Microph~1~0~Built-in", + "name": "Built-in Microph - Right", + "number": 1 } - else { - return "FTUEAttempt-1" + ], + "outputs": [ + { + "assignment": -1, + "chat": false, + "device_id": "Built-in Output", + "device_type": 5, + "id": "o~5~Built-in Output~0~0~Built-in", + "name": "Built-in Output - Left", + "number": 0 + }, + { + "assignment": -1, + "chat": false, + "device_id": "Built-in Output", + "device_type": 5, + "id": "o~5~Built-in Output~1~0~Built-in", + "name": "Built-in Output - Right", + "number": 1 } - } - function FTUESetMusicProfileName() { - - } - - function FTUESetPreferredMixerSampleRate() {} - function FTUESetPreferredOutputSampleRate(){ } - function FTUESetPreferredChatSampleRate() {} - function FTUEgetInputDeviceSampleRate() { - return 44100; - } - function FTUEgetOutputDeviceSampleRate() { - return 44100; - } - - - function FTUESelectVideoCaptureDevice(device, settings) { - return true; - } - function FTUESetVideoEncodeResolution(resolution) { - - } - - function testVideoRender() { - - } - function FTUEGetVideoCaptureDeviceNames() { - return {"xy323ss": "Built-in Webcam HD"} - } - function FTUECurrentSelectedVideoDevice() { - //return {} - return {"xy323ss": "Built-in Webcam HD"} - } - function FTUEGetAvailableEncodeVideoResolutions() { - return { - 1 : "CIF (352X288)", - 2 : "VGA (640X480)", - 3 : "4CIF (704X576)", - 4 : "1/2WHD (640X360)", - 5 : "WHD (1280X720)", - 6 : "FHD (1920x1080)" - } - } - - function FTUEGetVideoCaptureDeviceCapabilities() { - return {} - } - - function FTUESetSendFrameRates(fps) { - - } - - function FTUEGetSendFrameRates() { - return {20:20, 24:24, 30:30} - } - - function GetCurrentVideoResolution() { - return 3; - } - - function GetCurrentVideoFrameRate() { - return 30; - } - - function GetSampleRate() { - return 48; - } - function FTUESetVideoShareEnable(){ - - } - - function FTUEGetVideoShareEnable() { - return false; - } - - function isSessVideoShared() { - return videoShared; - } - - function SessStopVideoSharing() { - videoShared=false; - } - - function SessStartVideoSharing(bitrate) { - if (!bitrate || typeof(bitrate)=="undefined") { - bitrate = 0 - } - videoShared=true; - } - - function FTUEGetInputLatency() { - dbg("FTUEGetInputLatency"); - return 2; - } - function FTUESetInputLatency(latency) { - dbg("FTUESetInputLatency:" + latency); - } - function FTUEGetOutputLatency() { - dbg("FTUEGetOutputLatency"); - return 2; - } - function FTUESetOutputLatency(latency) { - dbg("FTUESetOutputLatency:" + latency); - } - function FTUEGetVolumeRanges () { - dbg("FTUEGetVolumeRanges"); - return { - input_maximum: 20, - input_minimum: -80, - output_maximum: 20, - output_minimum: -80 - }; - } - function FTUEHasControlPanel() { - dbg("FTUEHasControlPanel"); - return true; - } - function FTUEGetFrameSize(newSize) { - dbg("FTUEGetFrameSize"); - return frameSize; - } - function FTUESetFrameSize(newSize) { - dbg("FTUESetFrameSize:" + newSize); - // one of 2.5, 5 or 10 - frameSize = newSize; - } - function FTUEOpenControlPanel() { - dbg("FTUEOpenControlPanel"); - context.alert("Simulated ASIO Dialog"); - } - function FTUEInit() { dbg("FTUEInit"); } - function FTUERefreshDevices() { dbg("FTUERefreshDevices()"); } - function FTUESave(b) { dbg("FTUESave(" + b + ")"); return {}; } - function FTUEGetStatus() { return ftueStatus; } - function FTUESetStatus(b) { ftueStatus = b; } - function FTUESetMusicDevice(id) { dbg("FTUESetMusicDevice"); } - function FTUEGetAudioDevices() { - return {"devices":[{"display_name":"Built-in","guid":"Built-in","input_count":1,"name":"Built-in","output_count":1,"port_audio_name":"Built-in"},{"display_name":"JamKazam Virtual Monitor","guid":"JamKazam Virtual Monitor","input_count":0,"name":"JamKazam Virtual Monitor","output_count":1,"port_audio_name":"JamKazam Virtual Monitor"}]} - } - function FTUEGetDevices() { - dbg('FTUEGetMusicDevices'); - return { - "ASIO4ALL v2":"ASIO4ALL v2 - ASIO", - "M-Audio FW ASIO":"M-AUDIO FW ASIO - ASIO" - }; - } - function FTUEGetMusicInputs() { - dbg('FTUEGetMusicInputs'); - return { - "i~11~MultiChannel (FWAPMulti)~0^i~11~Multichannel (FWAPMulti)~1": - "Multichannel (FWAPMulti) - Channel 1/Multichannel (FWAPMulti) - Channel 2" - }; - } - function FTUEGetMusicOutputs() { - dbg('FTUEGetMusicOutputs'); - return { - "o~11~Multichannel (FWAPMulti)~0^o~11~Multichannel (FWAPMulti)~1": - "Multichannel (FWAPMulti) - Channel 1/Multichannel (FWAPMulti) - Channel 2" - }; - } - function FTUEGetChatInputs() { - dbg('FTUEGetChatInputs'); - return { - "i~11~MultiChannel (FWAPMulti)~0^i~11~Multichannel (FWAPMulti)~1": - "Multichannel (FWAPMulti) - Channel 1/Multichannel (FWAPMulti) - Channel 2" - }; - } - function FTUEGetChannels() { - return { - "inputs": [ - { - "assignment": 1, - "chat": false, - "device_id": "Built-in Microph", - "device_type": 5, - "id": "i~5~Built-in Microph~0~0~Built-in", - "name": "Built-in Microph - Left", - "number": 0 - }, - { - "assignment": 0, - "chat": false, - "device_id": "Built-in Microph", - "device_type": 5, - "id": "i~5~Built-in Microph~1~0~Built-in", - "name": "Built-in Microph - Right", - "number": 1 - } - ], - "outputs": [ - { - "assignment": -1, - "chat": false, - "device_id": "Built-in Output", - "device_type": 5, - "id": "o~5~Built-in Output~0~0~Built-in", - "name": "Built-in Output - Left", - "number": 0 - }, - { - "assignment": -1, - "chat": false, - "device_id": "Built-in Output", - "device_type": 5, - "id": "o~5~Built-in Output~1~0~Built-in", - "name": "Built-in Output - Right", - "number": 1 - } - ] - }; - } - - function FTUEClearChannelAssignments(){} - function FTUEClearChatInput(){} - function FTUEGetAudioDevices() { - return { - "devices": [ - { - "display_name": "Built-in", - "guid": "Built-in", - "input_count": 1, - "name": "Built-in", - "output_count": 1, - "port_audio_name": "Built-in" - }, - { - "display_name": "JamKazam Virtual Monitor", - "guid": "JamKazam Virtual Monitor", - "input_count": 0, - "name": "JamKazam Virtual Monitor", - "output_count": 1, - "port_audio_name": "JamKazam Virtual Monitor" - } - ] - }; - } - function FTUEStartIoPerfTest() {} - function FTUEGetIoPerfData() { - return { - "in_var" : 0.15, - "out_var" : 0.25, - "in_median" : 399.9, - "out_median" : 400.3, - "in_target" : 400, - "out_target" : 400 - }; - } - function FTUESetInputMusicDevice() { } - function FTUESetOutputMusicDevice() { } - function FTUEGetInputMusicDevice() { return 'Built-in'; } - function FTUEGetOutputMusicDevice() { return 'Built-in'; } - - function FTUESetMusicInput() { dbg('FTUESetMusicInput'); } - function FTUESetChatInput() { dbg('FTUESetChatInput'); } - function FTUESetMusicOutput() { dbg('FTUESetMusicOutput'); } - function FTUEGetInputVolume() { dbg('FTUEGetInputVolume'); return -60; } - function FTUESetInputVolume() { dbg('FTUESetInputVolume'); } - function FTUEGetOutputVolume() { dbg('FTUEGetOutputVolume'); return -40; } - function FTUESetOutputVolume() { dbg('FTUESetOutputVolume'); } - function FTUEGetChatInputVolume() { dbg('FTUEGetChatInputVolume'); return -10; } - function FTUESetChatInputVolume() { dbg('FTUESetChatInputVolume'); } - function FTUERegisterVUCallbacks() { - dbg('FTUERegisterVUCallbacks'); - } - function FTUERegisterLatencyCallback(functionName) { - dbg('FTUERegisterLatencyCallback'); - latencyCallback = functionName; - } - function FTUEStartLatency() { - function cb() { - // Change 4192 to modify latency MS results (in microseconds) - eval(latencyCallback + "(10.0)"); - } - context.setTimeout(cb, 1000); - } - - function FTUEGetExpectedLatency() { - return {latencyknown:true, latency:5} - } - - function FTUEGetGoodConfigurationList() { - return ['default']; - } - - function FTUEGetAllAudioConfigurations() { - return ['default']; - } - - function FTUEGetGoodAudioConfigurations() { - return ['default']; - } - - function FTUEGetConfigurationDevice() { - return 'Good Device'; - } - - function FTUELoadAudioConfiguration() { - return true; - } - - function FTUEIsMusicDeviceWDM() { - return false; - } - - function FTUECreateUpdatePlayBackProfile() { - return true; - } - - function RegisterVolChangeCallBack(functionName) { - dbg('RegisterVolChangeCallBack'); - } - - - function GetOS() { return 100000000; } - function GetOSAsString() { - //return "Win32"; - return "MacOSX"; - } - - function LatencyUpdated(map) { dbg('LatencyUpdated:' + JSON.stringify(map)); } - function LeaveSession(map) { dbg('LeaveSession:' + JSON.stringify(map)); } - - // this is not a real bridge method; purely used by the fake jam client - function RegisterP2PMessageCallbacks(callbacks) { - p2pCallbacks = callbacks; - } - - function P2PMessageReceived(from, payload) { - - dbg('P2PMessageReceived'); - // this function is different in that the payload is a JSON ready string; - // whereas a real p2p message is base64 encoded binary packaged data - - try { - payload = JSON.parse(payload); - } - catch(e) { - logger.warn("unable to parse payload as JSON from client %o, %o, %o", from, e, payload); - } - - var callback = p2pCallbacks[payload.type]; - if(callback) { - callback(from, payload); - } - } - - function JoinSession(sessionId) {dbg('JoinSession:' + sessionId);} - function ParticipantLeft(session, participant) { - dbg('ParticipantLeft:' + JSON.stringify(session) + ',' + - JSON.stringify(participant)); - } - function ParticipantJoined(session, participant) { - dbg('ParticipantJoined:' + JSON.stringify(session) + ',' + - JSON.stringify(participant)); - } - function RecordTestBegin() { dbg('RecordTestBegin'); } - function RecordTestEnd() { dbg('RecordTestBegin'); } - function RecordTestPlayback() { dbg('RecordTestBegin'); } - function SendP2PMessage(s1,s2) { dbg('SendP2PMessage:' + s1 + ',' + s2); } - function SetASIOEnabled(i1, i2, i3, i4, i5, i6) { - dbg('SetASIOEnabled(' + i1 + ',' + i2 + ',' + i3 + ',' + i4 + ',' + i5 + ',' + i6 + ')'); - } - function SignalLatencyUpdated(client) { - dbg('SignalLatencyUpdated:' + JSON.stringify(client)); - } - function SignalSendP2PMessage(s1,ba) { - dbg('SignalSendP2PMessage:' + JSON.stringify(arguments)); - } - function StartPlayTest(s) { dbg('StartPlayTest' + JSON.stringify(arguments)); } - function StartRecordTest(s) { dbg('StartRecordTest' + JSON.stringify(arguments)); } - function StartRecording(recordingId, groupedClientTracks) { - dbg('StartRecording'); - fakeJamClientRecordings.StartRecording(recordingId, groupedClientTracks); - } - function StopPlayTest() { dbg('StopPlayTest'); } - function StopRecording(recordingId, groupedTracks, errorReason, detail) { - dbg('StopRecording'); - fakeJamClientRecordings.StopRecording(recordingId, groupedTracks, errorReason, detail); - } - - function AbortRecording(recordingId, errorReason, errorDetail) { - dbg('AbortRecording'); - fakeJamClientRecordings.AbortRecording(recordingId, errorReason, errorDetail); - } - function OnTrySyncCommand(cmd) { - - } - function GetRecordingManagerState() { - return {running: false} - } - - function TestASIOLatency(s) { dbg('TestASIOLatency' + JSON.stringify(arguments)); } - - function TestLatency(clientID, callbackFunctionName, timeoutCallbackName) { - logger.debug("Fake JamClient: TestLatency called with client, " + clientID + " and callback function name: " + callbackFunctionName); - var response = { - clientID: clientID, - latency: 50 - }; - var js = callbackFunctionName + "(" + JSON.stringify(response) + ");"; - eval(js); - } - - function IsMyNetworkWireless() { - // 1=true, 0 = false, -1=unknown - return 1; - } - - function SetNetworkTestScore(numClients) { - - } - - function SetVideoNetworkTestScore(numClients) { - - } - - function GetNetworkTestScore() { - return 8; - } - - - function GetVideoNetworkTestScore() { - return 8; - } - - function SetLatencyTestBlocked(blocked) { - - } - - function isLatencyTestBlocked() { - return false; - } - - function GetLastLatencyTestTimes() { - return { initiated: 10000, requested: 10000} - } - - function GetASIODevices() { - var response =[{"device_id":0,"device_name":"Realtek High Definition Audio","device_type": 0,"interfaces":[{"interface_id":0,"interface_name":"Realtek HDA SPDIF Out","pins":[{"is_input":false,"pin_id":0,"pin_name":"PC Speaker"}]},{"interface_id":1,"interface_name":"Realtek HD Audio rear output","pins":[{"is_input":false,"pin_id":0,"pin_name":"PC Speaker"}]},{"interface_id":2,"interface_name":"Realtek HD Audio Mic input","pins":[{"is_input":true,"pin_id":0,"pin_name":"Recording Control"}]},{"interface_id":3,"interface_name":"Realtek HD Audio Line input","pins":[{"is_input":true,"pin_id":0,"pin_name":"Recording Control"}]},{"interface_id":4,"interface_name":"Realtek HD Digital input","pins":[{"is_input":true,"pin_id":0,"pin_name":"Capture"}]},{"interface_id":5,"interface_name":"Realtek HD Audio Stereo input","pins":[{"is_input":true,"pin_id":0,"pin_name":"Recording Control"}]}],"wavert_supported":false},{"device_id":1,"device_name":"M-Audio FW Audiophile","device_type": 1,"interfaces":[{"interface_id":0,"interface_name":"FWAPMulti","pins":[{"is_input":false,"pin_id":0,"pin_name":"Output"},{"is_input":true,"pin_id":1,"pin_name":"Input"}]},{"interface_id":1,"interface_name":"FW AP 1/2","pins":[{"is_input":false,"pin_id":0,"pin_name":"Output"},{"is_input":true,"pin_id":1,"pin_name":"Input"}]},{"interface_id":2,"interface_name":"FW AP SPDIF","pins":[{"is_input":false,"pin_id":0,"pin_name":"Output"},{"is_input":true,"pin_id":1,"pin_name":"Input"}]},{"interface_id":3,"interface_name":"FW AP 3/4","pins":[{"is_input":false,"pin_id":0,"pin_name":"Output"}]}],"wavert_supported":false},{"device_id":2,"device_name":"Virtual Audio Cable","device_type": 2,"interfaces":[{"interface_id":0,"interface_name":"Virtual Cable 2","pins":[{"is_input":true,"pin_id":0,"pin_name":"Capture"},{"is_input":false,"pin_id":1,"pin_name":"Output"}]},{"interface_id":1,"interface_name":"Virtual Cable 1","pins":[{"is_input":true,"pin_id":0,"pin_name":"Capture"},{"is_input":false,"pin_id":1,"pin_name":"Output"}]}],"wavert_supported":false},{"device_id":3,"device_name":"WebCamDV WDM Audio Capture","device_type": 3,"interfaces":[{"interface_id":0,"interface_name":"WebCamDV Audio","pins":[{"is_input":true,"pin_id":0,"pin_name":"Recording Control"},{"is_input":false,"pin_id":1,"pin_name":"Volume Control"}]}],"wavert_supported":false}]; - return response; - } - - // Session Functions - - function SessionCurrrentJamTrackPlayPosMs() { - return 0; - } - - function GetJamTrackSettings() { - return {tracks:[]} - } - function SessionGetJamTracksPlayDurationMs() { - return 60000; - } - function SessionAddTrack() {} - - function SessionAudioResync() { - logger.debug("Fake JamClient: SessionAudioResync()"); - } - - function SessionGetAllControlState(isMasterOrPersonal) { - var mixerIds = SessionGetIDs() - return SessionGetControlState(mixerIds, isMasterOrPersonal); - } - function SessionGetControlState(mixerIds, isMasterOrPersonal) { - dbg("SessionGetControlState"); - var groups = - [ChannelGroupIds.MasterGroup, - ChannelGroupIds.MonitorGroup, - ChannelGroupIds.AudioInputMusicGroup, - ChannelGroupIds.AudioInputChatGroup, - ChannelGroupIds.AudioInputChatGroup, - ChannelGroupIds.UserMusicInputGroup, - ChannelGroupIds.UserChatInputGroup, - ChannelGroupIds.PeerMediaTrackGroup, - ChannelGroupIds.JamTrackGroup, - ChannelGroupIds.MetronomeGroup]; - var names = [ - "FWAPMulti", - "FWAPMulti", - "FWAPMulti", - "FWAPMulti", - "", - "", - "", - "", - "", - "" - ]; - - var media_types = [ - "Master", - "Monitor", - "AudioInputMusic", - "AudioInputChat", - "StreamOutMusic", - "UserMusicInput", - "PeerAudioInputMusic", - "PeerMediaTrack", - "JamTrack", - "MetronomeTrack" - ] - var clientIds = [ - "", - "", - "", - "", - "3933ebec-913b-43ab-a4d3-f21dc5f8955b", - "", - "", - "", - "", - "" - ]; - var response = []; - for (var i=0; i 10 || vuValue < -70) { + vuChange = vuChange * -1; + } + + } + + function SetVURefreshRate(rateMS) { + eventCallbackRate = rateMS; + if (callbackTimer) { + context.clearInterval(callbackTimer); + } + if (eventCallbackName) { + callbackTimer = context.setInterval(doCallbacks, eventCallbackRate); + } + } + + // Track Functions + + + // Returns a list of objects representing all available audio devices and + // pins on the current system. On my windows box, I get 38 objects back. + // First couple examples included here. Note that the list tends to come + // back with all of the left inputs, then all the right inputs, then all + // the left outputs, then all the right outputs. + function TrackGetChannels() { + // Real example: + /* + { + device_id: "1394\\M-Audio&FW_Audiophile", + full_id: "i~1~\\\\?\\1394#m-audio&fw_audiophile#d4eb0700036c0d00#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\\fwap_12", + id: "\\\\?\\1394#m-audio&fw_audiophile#d4eb0700036c0d00#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\\fwap_12", + input: true, + left: true, + name: "M-Audio FW Audiophile: FW AP 1/2 - Left" + }, + */ + + // But we'll just build a list of names and fake it + var devices = [ + "M-Audio FW Audiophile: FW AP 1/2" + //"M-Audio FW Audiophile: FW Multi 1/2", + //"M-Audio FW Audiophile: FW SPDIF 1/2", + //"Realtek High Definition Audio: Realtek HD Digital", + // "Realtek High Definition Audio: Realtek HD Line", + // "Realtek High Definition Audio: Realtek HD Audio Mic", + // "Realtek High Definition Audio: Realtek HD Audio Stereo", + //"WebCamDV WDM Audio Capture: WebCamDV Audio" + ]; + var suffixes = [" - Left", " - Right", " - Left", " - Right"]; + var lefts = [true, false, true, false]; + var inputs = [true, true, false, false]; + var types = ["music", "non-music", "music", "non-music"]; + var response = []; + var name, o, i, j; + for (j = 0; j < 4; j++) { + for (i = 0; i < devices.length; i++) { + name = devices[i] + suffixes[j]; + o = { + device_id: name, + full_id: name, + id: name, + input: inputs[j], + left: lefts[j], + name: name, + device_type: types[j] + }; + response.push(o); } + } + return response; + } - function SessionSetControlState(stringValue, isMasterOrPersonal) { - dbg('SessionSetControlState: ' + stringValue + " m/p=" + isMasterOrPersonal); - } - function SessionSetRecordingFilename(filename) {} - function SessionSetRecordingFolder(folderName) {} - function SessionStartPlay() {} - function SessionStartRecording() {} - function SessionStopPlay() {} - function SessionStopRecording() {} - function SessionAddPlayTrack() {return true;} - function SessionRemoveAllPlayTracks(){} - function isSessionTrackPlaying() { return false; } - function SessionCurrrentPlayPosMs() { return 0; } - function SessionGetTracksPlayDurationMs() { return 0; } - function SessionGetDeviceLatency() { return 10.0; } - function SessionPageEnter() {logger.debug("FakeJamClient: SessionPageEnter"); return {}} - function SessionPageLeave() {logger.debug("FakeJamClient: SessionPageLeave")} - function SetMixerMode(mode) {} - function SessionGetMasterLocalMix() { - logger.debug('SessionGetMasterLocalMix. Returning: ' + _mix); - return _mix; - } - function SessionSetMasterLocalMix(level) { - logger.debug('SessionSetMasterLocalMix(' + level + ')'); - _mix = level; - } - function SessionSetUserName(client_id,name){ + function TrackGetCount() { + return 1; // Real version returns whatever was set + } - } + function TrackGetInstrument(trackNumber) { + if (trackNumber === 1) { + return 100; + } + else { + return 200; + } + } - function doCallbacks() { - var names = ["vu"]; - //var ids = ["FWAPMulti_2_10200", "FWAPMulti_0_10000"]; - var ids= ["i~11~MultiChannel (FWAPMulti)~0^i~11~Multichannel (FWAPMulti)~1", - "i~11~MultiChannel (FWAPMulti)~0^i~11~Multichannel (FWAPMulti)~2"]; + function TrackGetChatEnable() { + return true; + } - var args = []; - for (var i=0; i 10 || vuValue < -70) { vuChange = vuChange * -1; } + } - } - function SetVURefreshRate(rateMS) { - eventCallbackRate = rateMS; - if (callbackTimer) { context.clearInterval(callbackTimer); } - if (eventCallbackName) { - callbackTimer = context.setInterval(doCallbacks, eventCallbackRate); - } - } + function TrackSaveAssignments() { + } - // Track Functions + function TrackGetDevices() { + var response = { + "Built-in": "Built-in", + "ASIO4ALL v2": "ASIO4ALL v2 - ASIO", + "BEHRINGER USB AUDIO": "BEHRINGER USB AUDIO - ASIO", + "{2B7D1F21-FA6E-11D4-0002-DDCA793267F2}": "SoundMAX HD Audio O - WDM", + "{ABCC5A6C-C263-463B-A72F-A5BF64C86EBA}": "Generic USB Audio Device - WDM" + }; + return response; + } + + function TrackDeleteProfile(id) { + + } - // Returns a list of objects representing all available audio devices and - // pins on the current system. On my windows box, I get 38 objects back. - // First couple examples included here. Note that the list tends to come - // back with all of the left inputs, then all the right inputs, then all - // the left outputs, then all the right outputs. - function TrackGetChannels() { - // Real example: - /* -{ - device_id: "1394\\M-Audio&FW_Audiophile", - full_id: "i~1~\\\\?\\1394#m-audio&fw_audiophile#d4eb0700036c0d00#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\\fwap_12", - id: "\\\\?\\1394#m-audio&fw_audiophile#d4eb0700036c0d00#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\\fwap_12", - input: true, - left: true, - name: "M-Audio FW Audiophile: FW AP 1/2 - Left" -}, - */ + function TrackGetMusicDeviceID() { + return device_id; + } - // But we'll just build a list of names and fake it - var devices = [ - "M-Audio FW Audiophile: FW AP 1/2" - //"M-Audio FW Audiophile: FW Multi 1/2", - //"M-Audio FW Audiophile: FW SPDIF 1/2", - //"Realtek High Definition Audio: Realtek HD Digital", - // "Realtek High Definition Audio: Realtek HD Line", - // "Realtek High Definition Audio: Realtek HD Audio Mic", - // "Realtek High Definition Audio: Realtek HD Audio Stereo", - //"WebCamDV WDM Audio Capture: WebCamDV Audio" - ]; - var suffixes = [ " - Left", " - Right", " - Left", " - Right"]; - var lefts = [true, false, true, false]; - var inputs = [true, true, false, false]; - var types = ["music", "non-music", "music", "non-music"]; - var response = []; - var name, o, i, j; - for (j=0; j<4; j++) { - for (i=0; i 0.5 + } + } + + function getPeerState(clientId) { + return { + ntp_stable: Math.random() > 0.5 + } + } - function TrackGetMusicDeviceID() { - return device_id; - } + // stun + function NetworkTestResult() { + return {remote_udp_blocked: false} + } - function TrackSetMusicDevice(id) { - device_id = id; - } + // Client Update Functions + function IsAppInWritableVolume() { + return true; + } - function TrackGetMusicDeviceNames(input) { - var names = []; - names.push("Built-in"); - return names; - } + function ClientUpdateVersion() { + return "Compiled 1.2.3"; + } - // mock response of this method by allowing only even device IDs to open control panel - function TrackHasControlPanel() { - return true; - } + function ClientUpdateStartDownload(url, progressCallback, successCallback, failureCallback) { - function TrackIsMusicDeviceType(type) { - return true; - } + // simulate a bunch of download callbacks + var count = 0; + var max = 100; + var bytesReceived = 0; + var bytesTotal = 10000; - function TrackGetChatUsesMusic() { - return 0; - } + function fire() { + count++; + context.setTimeout(function () { + bytesReceived = ( count / max ) * bytesTotal; + context.JK.ClientUpdate.DownloadProgressCallback(bytesReceived, bytesTotal, 0, 0); - function TrackSetChatUsesMusic(usesMusic) { - } - - function TrackOpenControlPanel() { - return; - } - - function TrackLoadAssignments() {} - - function TrackSave() {} - - // Set a Track Assignment. - // assignment is an enum: - // CHAT = -2, OUTPUT = -1, UNASSIGNED = 0 - function TrackSetAssignment(chanId, isInput, assignment) {} - - // Get a Track Assignment. - function TrackGetAssignment(chanId, isInput) { - // CHAT = -2, OUTPUT = -1, UNASSIGNED = 0 - return 0; - } - - function TrackSetCount(count) {} - - function TrackSetInstrument(track, instrumentId) {} - - function JamTrackStopPlay() {} - function JamTrackPlay(){return true; } - function JamTrackIsPlayable() { - return true; - } - function JamTrackGetTrackDetail() { - return {key_state: 'unknown'} - } - function JamTrackKeysRequest() {} - function JamTrackDownload() {} - // Method which sets volume - function UpdateMixer(mixerId) {} - - // scoring knobs - function GetScoreWorkTimingInterval() { return {interval: 1000, backoff:60000} } - function SetScoreWorkTimingInterval(knobs) {return true;} - - function SessionOpenBackingTrackFile(path, loop) { - backingTrackPath = path - backingTrackLoop = loop - } - - function SessionSetBackingTrackFileLoop(path, loop) { - backingTrackPath = path - backingTrackLoop = loop - } - - function SessionCloseBackingTrackFile(path) { - backingTrackPath="" - } - - function SessionOpenMetronome(bpm, click, meter, mode){ - logger.debug("Setting metronome BPM: ", bpm) - metronomeActive =true - metronomeBPM = bpm - metronomeSound = click - metronomeMeter = meter - } - - //change setting - click. Mode 0: = mono, 1, = left ear, 2= right ear - function SessionSetMetronome(bpm,click,meter, mode){ - SessionOpenMetronome(bpm, click, meter, mode) - } - - //close everywhere - function SessionCloseMetronome(){ - metronomeActive=false - } - - function setMetronomeOpenCallback(callback) { - - } - - function getMyNetworkState() { - return { - ntp_stable: Math.random() > 0.5 - } - } - - function getPeerState(clientId) { - return { - ntp_stable: Math.random() > 0.5 - } - } - - - // stun - function NetworkTestResult() { return {remote_udp_blocked: false} } - - // Client Update Functions - function IsAppInWritableVolume() { return true; } - function ClientUpdateVersion() { return "Compiled 1.2.3"; } - function ClientUpdateStartDownload(url, progressCallback, successCallback, failureCallback) { - - // simulate a bunch of download callbacks - var count = 0; - var max = 100; - var bytesReceived = 0; - var bytesTotal = 10000; - - function fire() { - count++; - context.setTimeout(function() { - bytesReceived = ( count / max ) * bytesTotal; - context.JK.ClientUpdate.DownloadProgressCallback(bytesReceived, bytesTotal, 0, 0); - - if(count < max) { - fire(); - } - else { - context.JK.ClientUpdate.DownloadFailureCallback("/some/path/here"); - } - }, 50); - } + if (count < max) { fire(); - - } - - function getBackingTrackList() { - return {backing_tracks: [ - {name:"This is a really long name for a song dude.mp3", size:4283}, - {name:"foo.mp3",size:325783838} - ]}; - } - - function ClientUpdateStartUpdate(path, successCallback, failureCallback) {} - - // ------------------------------- - // fake jam client methods - // not a part of the actual bridge - // ------------------------------- - function SetFakeRecordingImpl(fakeRecordingsImpl) { - fakeJamClientRecordings = fakeRecordingsImpl; - } - - function TestNetworkPktBwRate(targetClientId, successCallback, timeoutCallback, testType, duration, numClients, payloadSize) { - var progress = {progress:true, - upthroughput:.95, - downthroughput:.95, - upjitter: 2.3, - downjitter: 2.3 - } - var count = 0; - var interval = setInterval(function() { - - eval(successCallback + "(" + JSON.stringify(progress) + ");"); - - if(progress.upthroughput < 1) { - progress.upthroughput += .05; - } - if(progress.downthroughput < 1) { - progress.downthroughput += .05; - } - - count++; - if(count == duration) { - clearInterval(interval); - - delete progress['progress'] - progress.pass = true; - eval(successCallback + "(" + JSON.stringify(progress) + ");"); - } - }, 1000); - } - function StopNetworkTest(targetClientId) {} - function OnLoggedIn(userId, sessionToken) {} - function OnLoggedOut() {} - function UserAttention(option) {} - function IsFrontendVisible() {return true;} - function LastUsedProfileName() {return 'default'}; - function SetLastUsedProfileName(name) {return true;}; - function log(level, message) { - console.log("beep : " + message) - } - - function getOperatingMode() { - if (location.pathname == '/latency_tester') { - return 'server'; } else { - return 'client'; + context.JK.ClientUpdate.DownloadFailureCallback("/some/path/here"); } + }, 50); + } + + fire(); + + } + + function getBackingTrackList() { + return { + backing_tracks: [ + {name: "This is a really long name for a song dude.mp3", size: 4283}, + {name: "foo.mp3", size: 325783838} + ] + }; + } + + function ClientUpdateStartUpdate(path, successCallback, failureCallback) { + } + + // ------------------------------- + // fake jam client methods + // not a part of the actual bridge + // ------------------------------- + function SetFakeRecordingImpl(fakeRecordingsImpl) { + fakeJamClientRecordings = fakeRecordingsImpl; + } + + function TestNetworkPktBwRate(targetClientId, successCallback, timeoutCallback, testType, duration, numClients, payloadSize) { + var progress = { + progress: true, + upthroughput: .95, + downthroughput: .95, + upjitter: 2.3, + downjitter: 2.3 + } + var count = 0; + var interval = setInterval(function () { + + eval(successCallback + "(" + JSON.stringify(progress) + ");"); + + if (progress.upthroughput < 1) { + progress.upthroughput += .05; + } + if (progress.downthroughput < 1) { + progress.downthroughput += .05; } - // passed an array of recording objects from the server - function GetLocalRecordingState(recordings) { - var result = { recordings:[]}; - var recordingResults = result.recordings; + count++; + if (count == duration) { + clearInterval(interval); - var possibleAnswers = ['HQ', 'RT', 'MISSING', 'PARTIALLY_MISSING']; - - $.each(recordings, function(i, recording) { - // just make up a random yes-hq/yes-rt/missing answer - var recordingResult = {}; - recordingResult['aggregate_state'] = possibleAnswers[Math.floor((Math.random()*4))]; - recordingResults.push(recordingResult); - }) - - return result; + delete progress['progress'] + progress.pass = true; + eval(successCallback + "(" + JSON.stringify(progress) + ");"); } + }, 1000); + } - function OpenRecording(claimedRecording) { - return {success: true} - } - function PreviewRecording(claimedRecording) { - return OpenRecording(claimedRecording); - } - function CloseRecording() {} - function ClosePreviewRecording() {CloseRecording();} - function OnDownloadAvailable() {} - function SaveToClipboard(text) {} - function IsNativeClient() { /* must always return false in all scenarios due to not ruin scoring !*/ return false; } - function IsAudioStarted() { logger.debug("FakeJamClient: IsAudioStarted"); return false; } - function StopAudio() {logger.debug("FakeJamClient: StopAudio"); } - function ResetPageCounters() {logger.debug("FakeJamClient: ResetPageCounters"); } - function ReloadAudioSystem(leaveRunning, loadLastProfile, reinitAssignments) {logger.debug("FakeJamClient: ReloadAudioSystem"); return {};} - function SessionLiveBroadcastStart(host, port, mount, sourceUser, sourcePass, preferredClientId, bitrate) - { - logger.debug("SessionLiveBroadcastStart requested"); - } + function StopNetworkTest(targetClientId) { + } - function SessionLiveBroadcastStop() { - logger.debug("SessionLiveBroadcastStop requested"); - } + function OnLoggedIn(userId, sessionToken) { + } - function RegisterQuitCallback() { } - function LeaveSessionAndMinimize() {} - function SetAutoStart() {} - function GetAutoStart() { return true; } - function SaveSettings() {} + function OnLoggedOut() { + } + function UserAttention(option) { + } - function VSTLoad() {} - function VSTScan(callback) {setTimeout(eval(callback+ "()"), 1000)} - function hasVstHost() { return false;} - function getPluginList() { return {vsts:[]} } + function IsFrontendVisible() { + return true; + } - function clearPluginList() {} - function listTrackAssignments() { - return {} - } - - // Javascript Bridge seems to camel-case - // Set the instance functions: - this.AbortRecording = AbortRecording; - this.OnTrySyncCommand = OnTrySyncCommand; - this.GetRecordingManagerState = GetRecordingManagerState; - this.GetASIODevices = GetASIODevices; - this.GetOS = GetOS; - this.GetOSAsString = GetOSAsString; - this.JoinSession = JoinSession; - this.LatencyUpdated = LatencyUpdated; - this.LeaveSession = LeaveSession; - this.P2PMessageReceived = P2PMessageReceived; - this.ParticipantJoined = ParticipantJoined; - this.ParticipantLeft = ParticipantLeft; - this.RecordTestBegin = RecordTestBegin; - this.RecordTestEnd = RecordTestEnd; - this.RecordTestPlayback = RecordTestPlayback; - this.RegisterVolChangeCallBack = RegisterVolChangeCallBack; - this.SendP2PMessage = SendP2PMessage; - this.SetASIOEnabled = SetASIOEnabled; - this.SignalLatencyUpdated = SignalLatencyUpdated; - this.SignalSendP2PMessage = SignalSendP2PMessage; - this.StartPlayTest = StartPlayTest; - this.StartRecordTest = StartRecordTest; - this.StartRecording = StartRecording; - this.StopPlayTest = StopPlayTest; - this.StopRecording = StopRecording; - this.TestASIOLatency = TestASIOLatency; - this.TestLatency = TestLatency; - this.IsMyNetworkWireless = IsMyNetworkWireless; - this.SetNetworkTestScore = SetNetworkTestScore; - this.GetNetworkTestScore = GetNetworkTestScore; - this.SetVideoNetworkTestScore = SetVideoNetworkTestScore; - this.GetVideoNetworkTestScore = GetVideoNetworkTestScore; - this.SetLatencyTestBlocked = SetLatencyTestBlocked; - this.isLatencyTestBlocked = isLatencyTestBlocked; - this.GetLastLatencyTestTimes = GetLastLatencyTestTimes; - this.RegisterQuitCallback = RegisterQuitCallback; - this.LeaveSessionAndMinimize = LeaveSessionAndMinimize; - this.GetAutoStart = GetAutoStart; - this.SetAutoStart = SetAutoStart; - this.connected = true; - - // FTUE (round 3) - this.FTUESetInputMusicDevice = FTUESetInputMusicDevice; - this.FTUESetOutputMusicDevice = FTUESetOutputMusicDevice; - this.FTUEGetInputMusicDevice = FTUEGetInputMusicDevice; - this.FTUEGetOutputMusicDevice = FTUEGetOutputMusicDevice; - this.FTUEGetChatInputVolume = FTUEGetChatInputVolume; - this.FTUEGetChatInputs = FTUEGetChatInputs; - this.FTUEGetChannels = FTUEGetChannels; - this.FTUEGetAudioDevices = FTUEGetAudioDevices; - this.FTUEStartIoPerfTest = FTUEStartIoPerfTest; - this.FTUEGetIoPerfData = FTUEGetIoPerfData; - this.FTUEGetDevices = FTUEGetDevices; - this.FTUEGetFrameSize = FTUEGetFrameSize; - this.FTUECancel = FTUECancel; - this.FTUEPageEnter = FTUEPageEnter; - this.FTUEPageLeave = FTUEPageLeave; - this.FTUEGetMusicProfileName = FTUEGetMusicProfileName; - this.FTUESetMusicProfileName = FTUESetMusicProfileName; - this.FTUESetPreferredMixerSampleRate = FTUESetPreferredMixerSampleRate; - this.FTUESetPreferredOutputSampleRate = FTUESetPreferredOutputSampleRate; - this.FTUESetPreferredChatSampleRate = FTUESetPreferredChatSampleRate; - this.FTUEgetInputDeviceSampleRate = FTUEgetInputDeviceSampleRate; - this.FTUEgetOutputDeviceSampleRate = FTUEgetOutputDeviceSampleRate; - this.FTUEGetInputLatency = FTUEGetInputLatency; - this.FTUEGetInputVolume = FTUEGetInputVolume; - this.FTUEGetMusicInputs = FTUEGetMusicInputs; - this.FTUEGetMusicOutputs = FTUEGetMusicOutputs; - this.FTUEGetOutputLatency = FTUEGetOutputLatency; - this.FTUEGetOutputVolume = FTUEGetOutputVolume; - this.FTUEGetStatus = FTUEGetStatus; - this.FTUEGetVolumeRanges = FTUEGetVolumeRanges; - this.FTUEHasControlPanel = FTUEHasControlPanel; - this.FTUEInit = FTUEInit; - this.FTUEOpenControlPanel = FTUEOpenControlPanel; - this.FTUERegisterLatencyCallback = FTUERegisterLatencyCallback; - this.FTUERegisterVUCallbacks = FTUERegisterVUCallbacks; - this.FTUERefreshDevices = FTUERefreshDevices; - this.FTUESave = FTUESave; - this.FTUESetChatInput = FTUESetChatInput; - this.FTUESetChatInputVolume = FTUESetChatInputVolume; - this.FTUESetInputVolume = FTUESetInputVolume; - this.FTUESetFrameSize = FTUESetFrameSize; - this.FTUESetInputLatency = FTUESetInputLatency; - this.FTUESetMusicDevice = FTUESetMusicDevice; - this.FTUESetMusicInput = FTUESetMusicInput; - this.FTUESetMusicOutput = FTUESetMusicOutput; - this.FTUESetOutputLatency = FTUESetOutputLatency; - this.FTUESetOutputVolume = FTUESetOutputVolume; - this.FTUESetStatus = FTUESetStatus; - this.FTUEStartLatency = FTUEStartLatency; - this.FTUEGetExpectedLatency = FTUEGetExpectedLatency; - this.FTUEGetGoodConfigurationList = FTUEGetGoodConfigurationList; - this.FTUEGetAllAudioConfigurations = FTUEGetAllAudioConfigurations; - this.FTUEGetGoodAudioConfigurations = FTUEGetGoodAudioConfigurations; - this.FTUEGetConfigurationDevice = FTUEGetConfigurationDevice; - this.FTUEIsMusicDeviceWDM = FTUEIsMusicDeviceWDM; - this.FTUELoadAudioConfiguration = FTUELoadAudioConfiguration; - this.FTUEClearChannelAssignments = FTUEClearChannelAssignments; - this.FTUEClearChatInput = FTUEClearChatInput; - this.FTUECreateUpdatePlayBackProfile = FTUECreateUpdatePlayBackProfile; - - // Session - this.SessionAddTrack = SessionAddTrack; - this.SessionCurrrentJamTrackPlayPosMs = SessionCurrrentJamTrackPlayPosMs; - this.SessionGetJamTracksPlayDurationMs = SessionGetJamTracksPlayDurationMs; - this.SessionGetControlState = SessionGetControlState; - this.SessionGetAllControlState = SessionGetAllControlState; - this.SessionSetUserName = SessionSetUserName; - this.SessionGetIDs = SessionGetIDs; - this.RegisterRecordingManagerCallbacks = RegisterRecordingManagerCallbacks; - this.RegisterRecordingCallbacks = RegisterRecordingCallbacks; - this.SessionRegisterCallback = SessionRegisterCallback; - this.SessionSetAlertCallback = SessionSetAlertCallback; - this.SessionSetControlState = SessionSetControlState; - this.SessionSetRecordingFilename = SessionSetRecordingFilename; - this.SessionSetRecordingFolder = SessionSetRecordingFolder; - this.SessionStartPlay = SessionStartPlay; - this.SessionStartRecording = SessionStartRecording; - this.SessionStopPlay = SessionStopPlay; - this.SessionAddPlayTrack = SessionAddPlayTrack; - this.SessionRemoveAllPlayTracks = SessionRemoveAllPlayTracks; - this.SessionStopRecording = SessionStopRecording; - this.isSessionTrackPlaying = isSessionTrackPlaying; - this.SessionCurrrentPlayPosMs = SessionCurrrentPlayPosMs; - this.SessionGetTracksPlayDurationMs = SessionGetTracksPlayDurationMs; - this.SessionPageEnter = SessionPageEnter; - this.SessionPageLeave = SessionPageLeave; - this.SetMixerMode = SetMixerMode; - - this.SetVURefreshRate = SetVURefreshRate; - this.SessionGetMasterLocalMix = SessionGetMasterLocalMix; - this.SessionSetMasterLocalMix = SessionSetMasterLocalMix; - this.SessionGetDeviceLatency = SessionGetDeviceLatency; - this.SessionAudioResync = SessionAudioResync; - - // Track - this.TrackGetChannels = TrackGetChannels; - this.TrackSetAssignment = TrackSetAssignment; - this.TrackGetAssignment = TrackGetAssignment; - this.TrackSetCount = TrackSetCount; - this.TrackGetCount = TrackGetCount; - this.TrackSave = TrackSave; - this.TrackLoadAssignments = TrackLoadAssignments; - this.TrackSetInstrument = TrackSetInstrument; - this.TrackGetInstrument = TrackGetInstrument; - this.TrackSaveAssignments = TrackSaveAssignments; - - this.TrackGetDevices = TrackGetDevices; - this.TrackDeleteProfile = TrackDeleteProfile; - this.TrackGetMusicDeviceID = TrackGetMusicDeviceID; - this.TrackSetMusicDevice = TrackSetMusicDevice; - this.TrackGetMusicDeviceNames = TrackGetMusicDeviceNames; - this.TrackHasControlPanel = TrackHasControlPanel; - this.TrackOpenControlPanel = TrackOpenControlPanel; - this.TrackIsMusicDeviceType = TrackIsMusicDeviceType; - - this.TrackGetChatEnable = TrackGetChatEnable; - this.TrackSetChatEnable = TrackSetChatEnable; - - this.TrackGetChatUsesMusic = TrackGetChatUsesMusic; - this.TrackSetChatUsesMusic = TrackSetChatUsesMusic; - - this.GetJamTrackSettings = GetJamTrackSettings; - this.JamTrackStopPlay = JamTrackStopPlay; - this.JamTrackPlay = JamTrackPlay; - this.JamTrackIsPlayable = JamTrackIsPlayable; - this.JamTrackGetTrackDetail = JamTrackGetTrackDetail; - this.JamTrackKeysRequest = JamTrackKeysRequest; - this.JamTrackDownload = JamTrackDownload; - - // Scoring Knobs - this.GetScoreWorkTimingInterval = GetScoreWorkTimingInterval; - this.SetScoreWorkTimingInterval = SetScoreWorkTimingInterval; - - // Backing tracks: - this.getBackingTrackList = getBackingTrackList; - this.SessionCloseBackingTrackFile = SessionCloseBackingTrackFile; - this.SessionOpenBackingTrackFile = SessionOpenBackingTrackFile; - this.SessionSetBackingTrackFileLoop = SessionSetBackingTrackFileLoop; - - // Metronome: - this.SessionCloseMetronome = SessionCloseMetronome; - this.SessionOpenMetronome = SessionOpenMetronome; - this.SessionSetMetronome = SessionSetMetronome; - this.setMetronomeOpenCallback = setMetronomeOpenCallback; - this.getMyNetworkState = getMyNetworkState; - this.getPeerState = getPeerState; - - // Client Update - this.IsAppInWritableVolume = IsAppInWritableVolume; - this.ClientUpdateVersion = ClientUpdateVersion; - this.ClientUpdateStartDownload = ClientUpdateStartDownload; - this.ClientUpdateStartUpdate = ClientUpdateStartUpdate; - - this.getClientParentChildRole = getClientParentChildRole; - this.getParentClientId = getParentClientId; - this.OpenSystemBrowser = OpenSystemBrowser; - this.RestartApplication = RestartApplication; - this.ShutdownApplication = ShutdownApplication; - - // Websocket/Auth sessions - this.OnLoggedIn = OnLoggedIn; - this.OnLoggedOut = OnLoggedOut; - - this.UserAttention = UserAttention; - this.IsFrontendVisible = IsFrontendVisible; - this.LastUsedProfileName = LastUsedProfileName; - this.SetLastUsedProfileName = SetLastUsedProfileName; - - // Recording Playback - this.GetLocalRecordingState = GetLocalRecordingState; - this.OpenRecording = OpenRecording; - this.CloseRecording = CloseRecording; - this.PreviewRecording = PreviewRecording; - this.ClosePreviewRecording = ClosePreviewRecording; - this.OnDownloadAvailable = OnDownloadAvailable; - - // Video functionality: - this.testVideoRender = testVideoRender; - this.FTUESelectVideoCaptureDevice = FTUESelectVideoCaptureDevice; - this.FTUESetVideoEncodeResolution = FTUESetVideoEncodeResolution; - this.FTUEGetVideoCaptureDeviceNames = FTUEGetVideoCaptureDeviceNames; - this.FTUECurrentSelectedVideoDevice = FTUECurrentSelectedVideoDevice; - this.FTUEGetAvailableEncodeVideoResolutions = FTUEGetAvailableEncodeVideoResolutions; - this.FTUEGetVideoCaptureDeviceCapabilities = FTUEGetVideoCaptureDeviceCapabilities; - this.FTUEGetSendFrameRates = FTUEGetSendFrameRates; - this.FTUESetSendFrameRates = FTUESetSendFrameRates; - this.GetCurrentVideoResolution = GetCurrentVideoResolution; - this.GetCurrentVideoFrameRate = GetCurrentVideoFrameRate; - this.GetSampleRate = GetSampleRate; - this.FTUESetVideoShareEnable = FTUESetVideoShareEnable; - this.FTUEGetVideoShareEnable = FTUEGetVideoShareEnable; - this.isSessVideoShared = isSessVideoShared; - this.SessStopVideoSharing = SessStopVideoSharing; - this.SessStartVideoSharing = SessStartVideoSharing; - - // Clipboard - this.SaveToClipboard = SaveToClipboard; - - // Capabilities - this.IsNativeClient = IsNativeClient; - - // Audio - this.IsAudioStarted = IsAudioStarted; - this.StopAudio = StopAudio; - this.ResetPageCounters = ResetPageCounters; - this.ReloadAudioSystem = ReloadAudioSystem; - - // Broadcasting - this.SessionLiveBroadcastStart = SessionLiveBroadcastStart; - this.SessionLiveBroadcastStop = SessionLiveBroadcastStop; - this.SessionSetConnectionStatusRefreshRate = SessionSetConnectionStatusRefreshRate; - - // fake calls; not a part of the actual jam client - this.RegisterP2PMessageCallbacks = RegisterP2PMessageCallbacks; - this.SetFakeRecordingImpl = SetFakeRecordingImpl; - - // network test - this.TestNetworkPktBwRate = TestNetworkPktBwRate; - this.StopNetworkTest = StopNetworkTest; - this.log = log; - this.getOperatingMode = getOperatingMode; - this.VSTLoad = VSTLoad; - this.VSTScan = VSTScan; - this.hasVstHost = hasVstHost; - this.getPluginList = getPluginList; - this.clearPluginList = clearPluginList; - this.listTrackAssignments = listTrackAssignments; - this.clientID = "devtester"; + function LastUsedProfileName() { + return 'default' }; + function SetLastUsedProfileName(name) { + return true; + }; + function log(level, message) { + console.log("beep : " + message) + } - })(window,jQuery); + function getOperatingMode() { + if (location.pathname == '/latency_tester') { + return 'server'; + } + else { + return 'client'; + } + } + + // passed an array of recording objects from the server + function GetLocalRecordingState(recordings) { + var result = {recordings: []}; + var recordingResults = result.recordings; + + var possibleAnswers = ['HQ', 'RT', 'MISSING', 'PARTIALLY_MISSING']; + + $.each(recordings, function (i, recording) { + // just make up a random yes-hq/yes-rt/missing answer + var recordingResult = {}; + recordingResult['aggregate_state'] = possibleAnswers[Math.floor((Math.random() * 4))]; + recordingResults.push(recordingResult); + }) + + return result; + } + + function OpenRecording(claimedRecording) { + return {success: true} + } + + function PreviewRecording(claimedRecording) { + return OpenRecording(claimedRecording); + } + + function CloseRecording() { + } + + function ClosePreviewRecording() { + CloseRecording(); + } + + function OnDownloadAvailable() { + } + + function SaveToClipboard(text) { + } + + function IsNativeClient() { /* must always return false in all scenarios due to not ruin scoring !*/ + return false; + } + + function IsAudioStarted() { + logger.debug("FakeJamClient: IsAudioStarted"); + return false; + } + + function StopAudio() { + logger.debug("FakeJamClient: StopAudio"); + } + + function ResetPageCounters() { + logger.debug("FakeJamClient: ResetPageCounters"); + } + + function ReloadAudioSystem(leaveRunning, loadLastProfile, reinitAssignments) { + logger.debug("FakeJamClient: ReloadAudioSystem"); + return {}; + } + + function SessionLiveBroadcastStart(host, port, mount, sourceUser, sourcePass, preferredClientId, bitrate) { + logger.debug("SessionLiveBroadcastStart requested"); + } + + function SessionLiveBroadcastStop() { + logger.debug("SessionLiveBroadcastStop requested"); + } + + function RegisterQuitCallback() { + } + + function LeaveSessionAndMinimize() { + } + + function SetAutoStart() { + } + + function GetAutoStart() { + return true; + } + + function SaveSettings() { + } + + function GetUseStaticPort() { + return false; + } + + function SetUseStaticPort() { + } + + function GetStaticPort() { + return 0 + } + + function SetStaticPort() { + } + + + function VSTLoad() { + } + + function VSTScan(callback) { + setTimeout(eval(callback + "()"), 1000) + } + + function hasVstHost() { + return false; + } + + function getPluginList() { + return {vsts: []} + } + + function clearPluginList() { + } + + function listTrackAssignments() { + return {} + } + + // Javascript Bridge seems to camel-case + // Set the instance functions: + this.AbortRecording = AbortRecording; + this.OnTrySyncCommand = OnTrySyncCommand; + this.GetRecordingManagerState = GetRecordingManagerState; + this.GetASIODevices = GetASIODevices; + this.GetOS = GetOS; + this.GetOSAsString = GetOSAsString; + this.JoinSession = JoinSession; + this.LatencyUpdated = LatencyUpdated; + this.LeaveSession = LeaveSession; + this.P2PMessageReceived = P2PMessageReceived; + this.ParticipantJoined = ParticipantJoined; + this.ParticipantLeft = ParticipantLeft; + this.RecordTestBegin = RecordTestBegin; + this.RecordTestEnd = RecordTestEnd; + this.RecordTestPlayback = RecordTestPlayback; + this.RegisterVolChangeCallBack = RegisterVolChangeCallBack; + this.SendP2PMessage = SendP2PMessage; + this.SetASIOEnabled = SetASIOEnabled; + this.SignalLatencyUpdated = SignalLatencyUpdated; + this.SignalSendP2PMessage = SignalSendP2PMessage; + this.StartPlayTest = StartPlayTest; + this.StartRecordTest = StartRecordTest; + this.StartRecording = StartRecording; + this.StopPlayTest = StopPlayTest; + this.StopRecording = StopRecording; + this.TestASIOLatency = TestASIOLatency; + this.TestLatency = TestLatency; + this.IsMyNetworkWireless = IsMyNetworkWireless; + this.SetNetworkTestScore = SetNetworkTestScore; + this.GetNetworkTestScore = GetNetworkTestScore; + this.SetVideoNetworkTestScore = SetVideoNetworkTestScore; + this.GetVideoNetworkTestScore = GetVideoNetworkTestScore; + this.SetLatencyTestBlocked = SetLatencyTestBlocked; + this.isLatencyTestBlocked = isLatencyTestBlocked; + this.GetLastLatencyTestTimes = GetLastLatencyTestTimes; + this.RegisterQuitCallback = RegisterQuitCallback; + this.LeaveSessionAndMinimize = LeaveSessionAndMinimize; + this.GetAutoStart = GetAutoStart; + this.SetAutoStart = SetAutoStart; + this.GetUseStaticPort = GetUseStaticPort; + this.SetUseStaticPort = SetUseStaticPort; + this.GetStaticPort = GetStaticPort; + this.SetStaticPort = SetStaticPort; + this.connected = true; + + // FTUE (round 3) + this.FTUESetInputMusicDevice = FTUESetInputMusicDevice; + this.FTUESetOutputMusicDevice = FTUESetOutputMusicDevice; + this.FTUEGetInputMusicDevice = FTUEGetInputMusicDevice; + this.FTUEGetOutputMusicDevice = FTUEGetOutputMusicDevice; + this.FTUEGetChatInputVolume = FTUEGetChatInputVolume; + this.FTUEGetChatInputs = FTUEGetChatInputs; + this.FTUEGetChannels = FTUEGetChannels; + this.FTUEGetAudioDevices = FTUEGetAudioDevices; + this.FTUEStartIoPerfTest = FTUEStartIoPerfTest; + this.FTUEGetIoPerfData = FTUEGetIoPerfData; + this.FTUEGetDevices = FTUEGetDevices; + this.FTUEGetFrameSize = FTUEGetFrameSize; + this.FTUECancel = FTUECancel; + this.FTUEPageEnter = FTUEPageEnter; + this.FTUEPageLeave = FTUEPageLeave; + this.FTUEGetMusicProfileName = FTUEGetMusicProfileName; + this.FTUESetMusicProfileName = FTUESetMusicProfileName; + this.FTUESetPreferredMixerSampleRate = FTUESetPreferredMixerSampleRate; + this.FTUESetPreferredOutputSampleRate = FTUESetPreferredOutputSampleRate; + this.FTUESetPreferredChatSampleRate = FTUESetPreferredChatSampleRate; + this.FTUEgetInputDeviceSampleRate = FTUEgetInputDeviceSampleRate; + this.FTUEgetOutputDeviceSampleRate = FTUEgetOutputDeviceSampleRate; + this.FTUEGetInputLatency = FTUEGetInputLatency; + this.FTUEGetInputVolume = FTUEGetInputVolume; + this.FTUEGetMusicInputs = FTUEGetMusicInputs; + this.FTUEGetMusicOutputs = FTUEGetMusicOutputs; + this.FTUEGetOutputLatency = FTUEGetOutputLatency; + this.FTUEGetOutputVolume = FTUEGetOutputVolume; + this.FTUEGetStatus = FTUEGetStatus; + this.FTUEGetVolumeRanges = FTUEGetVolumeRanges; + this.FTUEHasControlPanel = FTUEHasControlPanel; + this.FTUEInit = FTUEInit; + this.FTUEOpenControlPanel = FTUEOpenControlPanel; + this.FTUERegisterLatencyCallback = FTUERegisterLatencyCallback; + this.FTUERegisterVUCallbacks = FTUERegisterVUCallbacks; + this.FTUERefreshDevices = FTUERefreshDevices; + this.FTUESave = FTUESave; + this.FTUESetChatInput = FTUESetChatInput; + this.FTUESetChatInputVolume = FTUESetChatInputVolume; + this.FTUESetInputVolume = FTUESetInputVolume; + this.FTUESetFrameSize = FTUESetFrameSize; + this.FTUESetInputLatency = FTUESetInputLatency; + this.FTUESetMusicDevice = FTUESetMusicDevice; + this.FTUESetMusicInput = FTUESetMusicInput; + this.FTUESetMusicOutput = FTUESetMusicOutput; + this.FTUESetOutputLatency = FTUESetOutputLatency; + this.FTUESetOutputVolume = FTUESetOutputVolume; + this.FTUESetStatus = FTUESetStatus; + this.FTUEStartLatency = FTUEStartLatency; + this.FTUEGetExpectedLatency = FTUEGetExpectedLatency; + this.FTUEGetGoodConfigurationList = FTUEGetGoodConfigurationList; + this.FTUEGetAllAudioConfigurations = FTUEGetAllAudioConfigurations; + this.FTUEGetGoodAudioConfigurations = FTUEGetGoodAudioConfigurations; + this.FTUEGetConfigurationDevice = FTUEGetConfigurationDevice; + this.FTUEIsMusicDeviceWDM = FTUEIsMusicDeviceWDM; + this.FTUELoadAudioConfiguration = FTUELoadAudioConfiguration; + this.FTUEClearChannelAssignments = FTUEClearChannelAssignments; + this.FTUEClearChatInput = FTUEClearChatInput; + this.FTUECreateUpdatePlayBackProfile = FTUECreateUpdatePlayBackProfile; + + // Session + this.SessionAddTrack = SessionAddTrack; + this.SessionCurrrentJamTrackPlayPosMs = SessionCurrrentJamTrackPlayPosMs; + this.SessionGetJamTracksPlayDurationMs = SessionGetJamTracksPlayDurationMs; + this.SessionGetControlState = SessionGetControlState; + this.SessionGetAllControlState = SessionGetAllControlState; + this.SessionSetUserName = SessionSetUserName; + this.SessionGetIDs = SessionGetIDs; + this.RegisterRecordingManagerCallbacks = RegisterRecordingManagerCallbacks; + this.RegisterRecordingCallbacks = RegisterRecordingCallbacks; + this.SessionRegisterCallback = SessionRegisterCallback; + this.SessionSetAlertCallback = SessionSetAlertCallback; + this.SessionSetControlState = SessionSetControlState; + this.SessionSetRecordingFilename = SessionSetRecordingFilename; + this.SessionSetRecordingFolder = SessionSetRecordingFolder; + this.SessionStartPlay = SessionStartPlay; + this.SessionStartRecording = SessionStartRecording; + this.SessionStopPlay = SessionStopPlay; + this.SessionAddPlayTrack = SessionAddPlayTrack; + this.SessionRemoveAllPlayTracks = SessionRemoveAllPlayTracks; + this.SessionStopRecording = SessionStopRecording; + this.isSessionTrackPlaying = isSessionTrackPlaying; + this.SessionCurrrentPlayPosMs = SessionCurrrentPlayPosMs; + this.SessionGetTracksPlayDurationMs = SessionGetTracksPlayDurationMs; + this.SessionPageEnter = SessionPageEnter; + this.SessionPageLeave = SessionPageLeave; + this.SetMixerMode = SetMixerMode; + + this.SetVURefreshRate = SetVURefreshRate; + this.SessionGetMasterLocalMix = SessionGetMasterLocalMix; + this.SessionSetMasterLocalMix = SessionSetMasterLocalMix; + this.SessionGetDeviceLatency = SessionGetDeviceLatency; + this.SessionAudioResync = SessionAudioResync; + + // Track + this.TrackGetChannels = TrackGetChannels; + this.TrackSetAssignment = TrackSetAssignment; + this.TrackGetAssignment = TrackGetAssignment; + this.TrackSetCount = TrackSetCount; + this.TrackGetCount = TrackGetCount; + this.TrackSave = TrackSave; + this.TrackLoadAssignments = TrackLoadAssignments; + this.TrackSetInstrument = TrackSetInstrument; + this.TrackGetInstrument = TrackGetInstrument; + this.TrackSaveAssignments = TrackSaveAssignments; + + this.TrackGetDevices = TrackGetDevices; + this.TrackDeleteProfile = TrackDeleteProfile; + this.TrackGetMusicDeviceID = TrackGetMusicDeviceID; + this.TrackSetMusicDevice = TrackSetMusicDevice; + this.TrackGetMusicDeviceNames = TrackGetMusicDeviceNames; + this.TrackHasControlPanel = TrackHasControlPanel; + this.TrackOpenControlPanel = TrackOpenControlPanel; + this.TrackIsMusicDeviceType = TrackIsMusicDeviceType; + + this.TrackGetChatEnable = TrackGetChatEnable; + this.TrackSetChatEnable = TrackSetChatEnable; + + this.TrackGetChatUsesMusic = TrackGetChatUsesMusic; + this.TrackSetChatUsesMusic = TrackSetChatUsesMusic; + + this.GetJamTrackSettings = GetJamTrackSettings; + this.JamTrackStopPlay = JamTrackStopPlay; + this.JamTrackPlay = JamTrackPlay; + this.JamTrackIsPlayable = JamTrackIsPlayable; + this.JamTrackGetTrackDetail = JamTrackGetTrackDetail; + this.JamTrackKeysRequest = JamTrackKeysRequest; + this.JamTrackDownload = JamTrackDownload; + + // Scoring Knobs + this.GetScoreWorkTimingInterval = GetScoreWorkTimingInterval; + this.SetScoreWorkTimingInterval = SetScoreWorkTimingInterval; + + // Backing tracks: + this.getBackingTrackList = getBackingTrackList; + this.SessionCloseBackingTrackFile = SessionCloseBackingTrackFile; + this.SessionOpenBackingTrackFile = SessionOpenBackingTrackFile; + this.SessionSetBackingTrackFileLoop = SessionSetBackingTrackFileLoop; + + // Metronome: + this.SessionCloseMetronome = SessionCloseMetronome; + this.SessionOpenMetronome = SessionOpenMetronome; + this.SessionSetMetronome = SessionSetMetronome; + this.setMetronomeOpenCallback = setMetronomeOpenCallback; + this.getMyNetworkState = getMyNetworkState; + this.getPeerState = getPeerState; + + // Client Update + this.IsAppInWritableVolume = IsAppInWritableVolume; + this.ClientUpdateVersion = ClientUpdateVersion; + this.ClientUpdateStartDownload = ClientUpdateStartDownload; + this.ClientUpdateStartUpdate = ClientUpdateStartUpdate; + + this.getClientParentChildRole = getClientParentChildRole; + this.getParentClientId = getParentClientId; + this.OpenSystemBrowser = OpenSystemBrowser; + this.RestartApplication = RestartApplication; + this.ShutdownApplication = ShutdownApplication; + + // Websocket/Auth sessions + this.OnLoggedIn = OnLoggedIn; + this.OnLoggedOut = OnLoggedOut; + + this.UserAttention = UserAttention; + this.IsFrontendVisible = IsFrontendVisible; + this.LastUsedProfileName = LastUsedProfileName; + this.SetLastUsedProfileName = SetLastUsedProfileName; + + // Recording Playback + this.GetLocalRecordingState = GetLocalRecordingState; + this.OpenRecording = OpenRecording; + this.CloseRecording = CloseRecording; + this.PreviewRecording = PreviewRecording; + this.ClosePreviewRecording = ClosePreviewRecording; + this.OnDownloadAvailable = OnDownloadAvailable; + + // Video functionality: + this.testVideoRender = testVideoRender; + this.FTUESelectVideoCaptureDevice = FTUESelectVideoCaptureDevice; + this.FTUESetVideoEncodeResolution = FTUESetVideoEncodeResolution; + this.FTUEGetVideoCaptureDeviceNames = FTUEGetVideoCaptureDeviceNames; + this.FTUECurrentSelectedVideoDevice = FTUECurrentSelectedVideoDevice; + this.FTUEGetAvailableEncodeVideoResolutions = FTUEGetAvailableEncodeVideoResolutions; + this.FTUEGetVideoCaptureDeviceCapabilities = FTUEGetVideoCaptureDeviceCapabilities; + this.FTUEGetSendFrameRates = FTUEGetSendFrameRates; + this.FTUESetSendFrameRates = FTUESetSendFrameRates; + this.GetCurrentVideoResolution = GetCurrentVideoResolution; + this.GetCurrentVideoFrameRate = GetCurrentVideoFrameRate; + this.GetSampleRate = GetSampleRate; + this.FTUESetVideoShareEnable = FTUESetVideoShareEnable; + this.FTUEGetVideoShareEnable = FTUEGetVideoShareEnable; + this.isSessVideoShared = isSessVideoShared; + this.SessStopVideoSharing = SessStopVideoSharing; + this.SessStartVideoSharing = SessStartVideoSharing; + + // Clipboard + this.SaveToClipboard = SaveToClipboard; + + // Capabilities + this.IsNativeClient = IsNativeClient; + + // Audio + this.IsAudioStarted = IsAudioStarted; + this.StopAudio = StopAudio; + this.ResetPageCounters = ResetPageCounters; + this.ReloadAudioSystem = ReloadAudioSystem; + + // Broadcasting + this.SessionLiveBroadcastStart = SessionLiveBroadcastStart; + this.SessionLiveBroadcastStop = SessionLiveBroadcastStop; + this.SessionSetConnectionStatusRefreshRate = SessionSetConnectionStatusRefreshRate; + + // fake calls; not a part of the actual jam client + this.RegisterP2PMessageCallbacks = RegisterP2PMessageCallbacks; + this.SetFakeRecordingImpl = SetFakeRecordingImpl; + + // network test + this.TestNetworkPktBwRate = TestNetworkPktBwRate; + this.StopNetworkTest = StopNetworkTest; + this.log = log; + this.getOperatingMode = getOperatingMode; + this.VSTLoad = VSTLoad; + this.VSTScan = VSTScan; + this.hasVstHost = hasVstHost; + this.getPluginList = getPluginList; + this.clearPluginList = clearPluginList; + this.listTrackAssignments = listTrackAssignments; + this.clientID = "devtester"; + }; + +})(window, jQuery); diff --git a/web/app/assets/stylesheets/dialogs/clientPreferencesDialog.css.scss b/web/app/assets/stylesheets/dialogs/clientPreferencesDialog.css.scss index 8040d541a..c808f23ba 100644 --- a/web/app/assets/stylesheets/dialogs/clientPreferencesDialog.css.scss +++ b/web/app/assets/stylesheets/dialogs/clientPreferencesDialog.css.scss @@ -4,42 +4,52 @@ #client-preferences-dialog { - height:200px; - min-height:200px; form { - width:100%; + width: 100%; @include border_box_sizing; .column { - float:left; + float: left; @include border_box_sizing; &:nth-of-type(1) { - width:100%; + width: 100%; } } } label { - display:inline; + display: inline; vertical-align: middle; } .icheckbox_minimal { - margin-right:5px; + margin-right: 5px; vertical-align: middle; } .field[data-purpose="autostart"] { - line-height:18px; + line-height: 18px; vertical-align: middle; } p.hint { - font-size:12px; - line-height:15px; - margin:5px 0 0 23px; + font-size: 12px; + line-height: 15px; + margin: 5px 0 0 23px; } + .input { + max-width: 70px; + display: inline-block; + margin-right: 10px; + input { + width: 100%; + @include border_box_sizing; + } + } + .field { + margin-bottom: 20px; + } } \ No newline at end of file diff --git a/web/app/views/dialogs/_clientPreferencesDialog.html.slim b/web/app/views/dialogs/_clientPreferencesDialog.html.slim index e7d2285c6..a347c1ceb 100644 --- a/web/app/views/dialogs/_clientPreferencesDialog.html.slim +++ b/web/app/views/dialogs/_clientPreferencesDialog.html.slim @@ -6,9 +6,20 @@ form action='post' .column .field data-purpose="autostart" - input type="checkbox" name="autostart" + .input + input type="checkbox" name="autostart" label for="autostart" Start JamKazam when system starts - p.hint We strongly recommend that you leave this box checked to allow the JamKazam application to start each time you start your computer. It will run quietly in the background, and you won't notice it, but it will collect critical latency data periodically to help you connect with other musicians, and it will also upload/download any recordings you make in sessions. + p.hint If you use JamKazam mostly to play with others in real-time, we recommend that you check this box to allow the JamKazam application to start each time you start your computer. It will run quietly in the background, and you won't notice it, but it will collect critical latency data periodically to help you connect with other musicians, and it will also upload/download any recordings you make in sessions. + .field data-purpose="use-static-port" + .input + input type="checkbox" name="use-static-port" + label for="use-static-port" Always use the same set of UDP ports + p.hint If you are having problems with the network test or not hearing audio from others and need to configure Port Forwarding in your router, check this box. + .field data-purpose="static-port" + .input + input type="number" name="static-port" + label for="static-port" The first port that the client will open + p.hint You can specify any port you like, but we recommend an even number in the range including 1026-49150 to avoid conflicts with other programs. When configuring Port Forwarding in your router, be sure to open this port along with the next ten. For example, if this field is 12000, then in your router, forward ports 12000-12010 to your computer's IP address. br clear='all' br clear='all' .buttons