Merge branch 'master' of bitbucket.org:jamkazam/jam-web
This commit is contained in:
commit
52cf087321
|
|
@ -7,6 +7,53 @@
|
|||
var logger = context.JK.logger;
|
||||
logger.info("*** Fake JamClient instance initialized. ***");
|
||||
|
||||
var ftue = false;
|
||||
|
||||
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).
|
||||
|
||||
function GetFTUE() { return ftue; }
|
||||
function SetFTUE(b) { ftue = b; }
|
||||
function GetOS() { return 100000000; }
|
||||
|
||||
function LatencyUpdated(map) { dbg('LatencyUpdated:' + JSON.stringify(map)); }
|
||||
function LeaveSession(map) { dbg('LeaveSession:' + JSON.stringify(map)); }
|
||||
function P2PMessageReceived(s1,s2) { dbg('P2PMessageReceived:' + s1 + ',' + s2); }
|
||||
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(map) { dbg('StartRecording' + JSON.stringify(arguments)); }
|
||||
function StopPlayTest() { dbg('StopPlayTest'); }
|
||||
function StopRecording(map) { dbg('StopRecording' + JSON.stringify(arguments)); }
|
||||
function TestASIOLatency(s) { dbg('TestASIOLatency' + JSON.stringify(arguments)); }
|
||||
|
||||
|
||||
function testLatency(clientID, callbackFunctionName) {
|
||||
logger.debug("Fake JamClient: testLatency called with client, " + clientID + " and callback function name: " + callbackFunctionName);
|
||||
var response = {
|
||||
|
|
@ -17,33 +64,38 @@
|
|||
eval(js);
|
||||
}
|
||||
|
||||
function GetASIODevices(callbackFunctionName) {
|
||||
var response = {'todo':'fill me in'};
|
||||
var js = callbackFunctionName + "(" + JSON.stringify(response) + ");";
|
||||
eval(js);
|
||||
}
|
||||
function GetASIODevices() {
|
||||
var response =[{"device_id":0,"device_name":"Realtek High Definition Audio","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","interfaces":[{"interface_id":0,"interface_name":"FW AP Multi","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","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","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}];
|
||||
|
||||
function TestAudioDevice(deviceId, callbackFunctionName) {
|
||||
var response = {
|
||||
deviceId: deviceId,
|
||||
deviceLatencyMS: 5.3
|
||||
};
|
||||
var js = callbackFunctionName + "(" + JSON.stringify(response) + ");";
|
||||
eval(js);
|
||||
return response;
|
||||
}
|
||||
|
||||
function joinSession(sessionId) {}
|
||||
function participantLeft(session, participant) {}
|
||||
function participantJoined(session, participant) {}
|
||||
|
||||
// Javascript Bridge seems to camel-case
|
||||
this.TestLatency = testLatency;
|
||||
// Set the instance functions:
|
||||
this.GetASIODevices = GetASIODevices;
|
||||
this.TestAudioDevice = TestAudioDevice;
|
||||
this.JoinSession = joinSession;
|
||||
this.ParticipantLeft = participantLeft;
|
||||
this.ParticipantJoined = participantJoined;
|
||||
|
||||
this.GetFTUE = GetFTUE;
|
||||
this.GetOS = GetOS;
|
||||
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.SendP2PMessage = SendP2PMessage;
|
||||
this.SetASIOEnabled = SetASIOEnabled;
|
||||
this.SetFTUE = SetFTUE;
|
||||
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.connected = true;
|
||||
};
|
||||
|
||||
})(window,jQuery);
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
/**
|
||||
* The First-Time User Experience (FTUE) Screen to be shown
|
||||
* to users who have not set up their audio hardware yet.
|
||||
* Corresponds to the route #/ftue3
|
||||
*/
|
||||
(function(context,$) {
|
||||
|
||||
"use strict";
|
||||
|
||||
context.JK = context.JK || {};
|
||||
context.JK.FTUEScreen = function(app) {
|
||||
var logger = context.JK.logger;
|
||||
var jamClient = context.jamClient;
|
||||
|
||||
function beforeShow(data) {
|
||||
loadDevices();
|
||||
}
|
||||
|
||||
function afterShow(data) {
|
||||
}
|
||||
|
||||
function loadDevices() {
|
||||
$('#choose-input-audio-device select').empty();
|
||||
$('#choose-output-audio-device select').empty();
|
||||
var optionTemplate = $('#template_audio_device_item').html();
|
||||
var devices = context.jamClient.GetASIODevices();
|
||||
var inputOptions = [];
|
||||
var outputOptions = [];
|
||||
// We're going to build a list of individual choices...
|
||||
// Each 'value' will be device id.interface id.pin id (dot separated).
|
||||
// example: 1.1.1
|
||||
// Label will be a string with device name, interface name, pin name.
|
||||
var d, i, p;
|
||||
var deviceName, deviceId;
|
||||
var interfaceName, interfaceId;
|
||||
var pinName, pinId, isInput;
|
||||
var value, label, option;
|
||||
for (d=0; d<devices.length; d++) {
|
||||
deviceName = devices[d].device_name;
|
||||
deviceId = devices[d].device_id;
|
||||
for (i=0; i<devices[d].interfaces.length; i++) {
|
||||
interfaceName = devices[d].interfaces[i].interface_name;
|
||||
interfaceId = devices[d].interfaces[i].interface_id;
|
||||
for (p=0; p<devices[d].interfaces[i].pins.length; p++) {
|
||||
pinName = devices[d].interfaces[i].pins[p].pin_name;
|
||||
pinId = devices[d].interfaces[i].pins[p].pin_id;
|
||||
value = deviceId + "." + interfaceId + "." + pinId;
|
||||
label = deviceName + ":" + interfaceName + ":" + pinName;
|
||||
option = context.JK.fillTemplate(optionTemplate, { value: value, label: label});
|
||||
isInput = devices[d].interfaces[i].pins[p].is_input;
|
||||
if (isInput) {
|
||||
inputOptions.push(option);
|
||||
} else {
|
||||
outputOptions.push(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$('#choose-input-audio-device select').html(inputOptions.join(''));
|
||||
$('#choose-output-audio-device select').html(outputOptions.join(''));
|
||||
}
|
||||
|
||||
function enableAudioDevices() {
|
||||
var input = $('#choose-input-audio-device select').val().split('.');
|
||||
var output = $('#choose-output-audio-device select').val().split('.');
|
||||
context.jamClient.SetASIOEnabled(
|
||||
parseInt(input[0], 10),
|
||||
parseInt(input[1], 10),
|
||||
parseInt(input[2], 10),
|
||||
parseInt(output[0], 10),
|
||||
parseInt(output[1], 10),
|
||||
parseInt(output[2], 10));
|
||||
}
|
||||
|
||||
function events() {
|
||||
$('#enableDevices').click(enableAudioDevices);
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
events();
|
||||
var screenBindings = { 'beforeShow': beforeShow, 'afterShow': afterShow };
|
||||
app.bindScreen('ftue3', screenBindings);
|
||||
}
|
||||
|
||||
// Expose publics
|
||||
this.initialize = initialize;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
})(window,jQuery);
|
||||
|
|
@ -5,6 +5,23 @@
|
|||
<%= render "screen_navigation" %>
|
||||
</div>
|
||||
|
||||
<p>TESTS happen on this page...</p>
|
||||
<div id="choose-devices">
|
||||
<h2>Step 1: Choose Devices</h2>
|
||||
<label id="choose-input-audio-device">Select input
|
||||
<select>
|
||||
</select>
|
||||
</label>
|
||||
<label id="choose-output-audio-device">Select output
|
||||
<select>
|
||||
</select>
|
||||
</label>
|
||||
<button id="enableDevices">Next</button>
|
||||
</div>
|
||||
|
||||
<p>If everything looks good, then <a cucumber-id="ftue-home-link" href="#/home">WE'RE DONE</a>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/template" id="template_audio_device_item">
|
||||
<option value="{value}">{label}</option>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@
|
|||
var sessionScreen = new JK.SessionScreen(jk);
|
||||
sessionScreen.initialize();
|
||||
|
||||
var ftueScreen = new JK.FTUEScreen(jk);
|
||||
ftueScreen.initialize();
|
||||
|
||||
var testBridgeScreen = new JK.TestBridgeScreen(jk);
|
||||
testBridgeScreen.initialize();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue