2012-12-01 23:50:28 +00:00
( function ( context , $ ) {
2012-12-07 00:31:46 +00:00
"use strict" ;
2012-12-01 23:50:28 +00:00
context . JK = context . JK || { } ;
context . JK . FakeJamClient = function ( app ) {
var logger = context . JK . logger ;
logger . info ( "*** Fake JamClient instance initialized. ***" ) ;
2013-05-27 01:12:35 +00:00
var ftueStatus = false ;
2013-01-30 16:50:43 +00:00
var eventCallbackName = '' ;
var eventCallbackRate = 1000 ;
var vuValue = - 70 ;
var vuChange = 10 ;
var callbackTimer = null ;
2013-04-10 15:01:29 +00:00
var _mix = - 30 ;
2013-05-12 05:43:36 +00:00
var device _id = - 1 ;
2013-05-31 00:20:26 +00:00
var latencyCallback = null ;
2013-06-01 16:16:48 +00:00
var frameSize = 2.5 ;
2013-01-05 21:30:24 +00:00
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).
2013-06-01 16:16:48 +00:00
function FTUEGetInputLatency ( ) {
dbg ( "FTUEGetInputLatency" ) ;
return 2 ;
}
function FTUESetInputLatency ( latency ) {
2013-06-02 00:12:54 +00:00
dbg ( "FTUESetInputLatency:" + latency ) ;
2013-06-01 16:16:48 +00:00
}
function FTUEGetOutputLatency ( ) {
dbg ( "FTUEGetOutputLatency" ) ;
return 2 ;
}
function FTUESetOutputLatency ( latency ) {
2013-06-02 00:12:54 +00:00
dbg ( "FTUESetOutputLatency:" + latency ) ;
2013-06-01 16:16:48 +00:00
}
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 ) {
2013-06-02 00:12:54 +00:00
dbg ( "FTUESetFrameSize:" + newSize ) ;
2013-06-01 16:16:48 +00:00
// one of 2.5, 5 or 10
frameSize = newSize ;
}
2013-05-28 01:00:57 +00:00
function FTUEOpenControlPanel ( ) {
dbg ( "FTUEOpenControlPanel" ) ;
context . alert ( "Simulated ASIO Dialog" ) ;
}
function FTUEInit ( ) { dbg ( "FTUEInit" ) ; }
function FTUESave ( ) { dbg ( "FTUESave" ) ; }
2013-05-27 01:12:35 +00:00
function FTUEGetStatus ( ) { return ftueStatus ; }
function FTUESetStatus ( b ) { ftueStatus = b ; }
2013-05-28 01:00:57 +00:00
function FTUESetMusicDevice ( id ) { dbg ( "FTUESetMusicDevice" ) ; }
function FTUEGetDevices ( ) {
dbg ( 'FTUEGetMusicDevices' ) ;
return {
"ASIO4ALL v2" : "ASIO4ALL v2 - ASIO" ,
"M-Audio FW ASIO" : "M-AUDIO FW ASIO - ASIO"
} ;
}
2013-05-27 15:34:24 +00:00
function FTUEGetMusicInputs ( ) {
dbg ( 'FTUEGetMusicInputs' ) ;
return {
"i~11~MultiChannel (FW AP Multi)~0^i~11~Multichannel (FW AP Multi)~1" :
"Multichannel (FW AP Multi) - Channel 1/Multichannel (FW AP Multi) - Channel 2"
} ;
}
function FTUEGetMusicOutputs ( ) {
dbg ( 'FTUEGetMusicOutputs' ) ;
return {
"o~11~Multichannel (FW AP Multi)~0^o~11~Multichannel (FW AP Multi)~1" :
"Multichannel (FW AP Multi) - Channel 1/Multichannel (FW AP Multi) - Channel 2"
} ;
}
function FTUEGetChatInputs ( ) {
dbg ( 'FTUEGetChatInputs' ) ;
return {
"i~11~MultiChannel (FW AP Multi)~0^i~11~Multichannel (FW AP Multi)~1" :
"Multichannel (FW AP Multi) - Channel 1/Multichannel (FW AP Multi) - Channel 2"
} ;
}
2013-05-27 15:53:58 +00:00
function FTUESetMusicInput ( ) { dbg ( 'FTUESetMusicInput' ) ; }
function FTUESetChatInput ( ) { dbg ( 'FTUESetChatInput' ) ; }
function FTUESetMusicOutput ( ) { dbg ( 'FTUESetMusicOutput' ) ; }
2013-05-28 01:00:57 +00:00
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' ) ; }
2013-05-31 00:20:26 +00:00
function FTUERegisterLatencyCallback ( functionName ) {
dbg ( 'FTUERegisterLatencyCallback' ) ;
latencyCallback = functionName ;
}
function FTUEStartLatency ( ) {
function cb ( ) {
2013-06-02 19:14:31 +00:00
// Change 4192 to modify latency MS results (in microseconds)
eval ( latencyCallback + "(4192)" ) ;
2013-05-31 00:20:26 +00:00
}
context . setTimeout ( cb , 1000 ) ;
}
2013-05-27 01:12:35 +00:00
2013-01-05 21:30:24 +00:00
function GetOS ( ) { return 100000000 ; }
2013-06-02 01:06:20 +00:00
function GetOSAsString ( ) {
return "Win32" ;
//return "Mac";
}
2013-01-05 21:30:24 +00:00
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 ) ) ; }
2013-02-12 20:29:40 +00:00
function TestLatency ( clientID , callbackFunctionName , timeoutCallbackName ) {
2013-01-06 20:34:48 +00:00
logger . debug ( "Fake JamClient: TestLatency called with client, " + clientID + " and callback function name: " + callbackFunctionName ) ;
2012-12-01 23:50:28 +00:00
var response = {
2012-12-13 04:53:15 +00:00
clientID : clientID ,
2012-12-01 23:50:28 +00:00
latency : 50
} ;
2012-12-08 20:14:00 +00:00
var js = callbackFunctionName + "(" + JSON . stringify ( response ) + ");" ;
2012-12-08 17:12:00 +00:00
eval ( js ) ;
2012-12-01 23:50:28 +00:00
}
2013-01-05 21:30:24 +00:00
function GetASIODevices ( ) {
2013-05-13 22:35:14 +00:00
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" : "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" , "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 } ] ;
2013-01-05 21:30:24 +00:00
return response ;
2012-12-16 19:28:10 +00:00
}
2013-01-30 16:50:43 +00:00
// Session Functions
function SessionAddTrack ( ) { }
function SessionGetControlState ( mixerIds ) {
2013-06-02 00:12:54 +00:00
dbg ( "SessionGetControlState" )
2013-02-07 04:58:41 +00:00
var groups = [ 0 , 1 , 2 , 3 , 7 , 9 ] ;
2013-02-05 05:10:37 +00:00
var names = [
2013-02-07 04:58:41 +00:00
"FW AP Multi" ,
"FW AP Multi" ,
2013-02-05 05:10:37 +00:00
"FW AP Multi" ,
"FW AP Multi" ,
"" ,
""
] ;
var clientIds = [
2013-02-07 04:58:41 +00:00
"" ,
"" ,
2013-02-05 05:10:37 +00:00
"" ,
"" ,
"3933ebec-913b-43ab-a4d3-f21dc5f8955b" ,
""
] ;
2013-01-30 16:50:43 +00:00
var response = [ ] ;
for ( var i = 0 ; i < mixerIds . length ; i ++ ) {
2013-01-31 16:32:32 +00:00
response . push ( {
2013-02-05 05:10:37 +00:00
client _id : clientIds [ i ] ,
group _id : groups [ i ] ,
2013-01-30 16:50:43 +00:00
id : mixerIds [ i ] ,
master : true ,
monitor : true ,
mute : false ,
2013-02-05 05:10:37 +00:00
name : names [ i ] ,
2013-01-30 16:50:43 +00:00
range _high : 20 ,
range _low : - 80 ,
record : true ,
stereo : true ,
2013-02-10 02:00:29 +00:00
volume _left : - 40 ,
2013-02-14 02:04:54 +00:00
volume _right : - 40 ,
instrument _id : 'electric guitar'
2013-01-30 16:50:43 +00:00
} ) ;
}
return response ;
}
function SessionGetIDs ( ) {
2013-02-05 05:10:37 +00:00
return [
"FW AP Multi_0_10000" ,
2013-02-07 04:58:41 +00:00
"FW AP Multi_1_10100" ,
2013-02-05 05:10:37 +00:00
"FW AP Multi_2_10200" ,
2013-02-07 04:58:41 +00:00
"FW AP Multi_3_10500" ,
2013-02-05 05:10:37 +00:00
"User@208.191.152.98#" ,
"User@208.191.152.98_*"
] ;
2013-01-30 16:50:43 +00:00
}
function SessionRegisterCallback ( callbackName ) {
eventCallbackName = callbackName ;
if ( callbackTimer ) { context . clearInterval ( callbackTimer ) ; }
if ( eventCallbackName ) {
callbackTimer = context . setInterval ( doCallbacks , eventCallbackRate ) ;
}
}
2013-06-02 00:12:54 +00:00
function SessionSetControlState ( stringValue ) {
dbg ( 'SessionSetControlState: ' + stringValue ) ;
}
2013-01-30 16:50:43 +00:00
function SessionSetRecordingFilename ( filename ) { }
function SessionSetRecordingFolder ( folderName ) { }
function SessionStartPlay ( ) { }
function SessionStartRecording ( ) { }
function SessionStopPlay ( ) { }
function SessionStopRecording ( ) { }
2013-04-10 15:01:29 +00:00
2013-05-27 19:08:45 +00:00
function SessionGetDeviceLatency ( ) { return 10.0 ; }
2013-04-10 15:01:29 +00:00
function SessionGetMasterLocalMix ( ) {
logger . debug ( 'SessionGetMasterLocalMix. Returning: ' + _mix ) ;
return _mix ;
}
function SessionSetMasterLocalMix ( level ) {
logger . debug ( 'SessionSetMasterLocalMix(' + level + ')' ) ;
_mix = level ;
}
2013-01-30 16:50:43 +00:00
function doCallbacks ( ) {
var names = [ "left_vu" , "right_vu" ] ;
var ids = [ "FW AP Multi_2_10200" , "FW AP Multi_0_10000" ] ;
2013-01-31 16:32:32 +00:00
var args = [ ] ;
for ( var i = 0 ; i < ids . length ; i ++ ) {
for ( var j = 0 ; j < names . length ; j ++ ) {
args . push ( '"' + names [ j ] + '"' ) ;
args . push ( '"' + ids [ i ] + '"' ) ;
args . push ( vuValue ) ;
}
2013-01-30 16:50:43 +00:00
}
2013-01-31 16:32:32 +00:00
var js = eventCallbackName + '(' + args . join ( ',' ) + ')' ;
eval ( js ) ;
2013-01-30 16:50:43 +00:00
vuValue += vuChange ;
if ( vuValue > 10 || vuValue < - 70 ) { vuChange = vuChange * - 1 ; }
}
function SetVURefreshRate ( rateMS ) {
eventCallbackRate = rateMS ;
if ( callbackTimer ) { context . clearInterval ( callbackTimer ) ; }
if ( eventCallbackName ) {
callbackTimer = context . setInterval ( doCallbacks , eventCallbackRate ) ;
}
}
2013-03-24 20:18:58 +00:00
// 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 = [
2013-05-21 05:46:13 +00:00
"M-Audio FW Audiophile: FW AP 1/2"
2013-05-18 05:59:25 +00:00
//"M-Audio FW Audiophile: FW Multi 1/2",
//"M-Audio FW Audiophile: FW SPDIF 1/2",
2013-05-21 05:46:13 +00:00
//"Realtek High Definition Audio: Realtek HD Digital",
2013-05-18 05:59:25 +00:00
// "Realtek High Definition Audio: Realtek HD Line",
// "Realtek High Definition Audio: Realtek HD Audio Mic",
// "Realtek High Definition Audio: Realtek HD Audio Stereo",
2013-05-21 05:46:13 +00:00
//"WebCamDV WDM Audio Capture: WebCamDV Audio"
2013-03-24 20:18:58 +00:00
] ;
var suffixes = [ " - Left" , " - Right" , " - Left" , " - Right" ] ;
var lefts = [ true , false , true , false ] ;
var inputs = [ true , true , false , false ] ;
2013-05-13 22:35:14 +00:00
var types = [ "music" , "non-music" , "music" , "non-music" ] ;
2013-03-24 20:18:58 +00:00
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 ] ,
2013-05-13 22:35:14 +00:00
name : name ,
device _type : types [ j ]
2013-03-24 20:18:58 +00:00
} ;
response . push ( o ) ;
}
}
return response ;
}
function TrackGetCount ( ) {
return 1 ; // Real version returns whatever was set
}
2013-05-13 22:35:14 +00:00
function TrackGetInstrument ( trackNumber ) {
if ( trackNumber === 1 ) {
2013-05-15 05:59:09 +00:00
return 100 ;
2013-05-13 22:35:14 +00:00
}
else {
2013-05-15 05:59:09 +00:00
return 200 ;
2013-05-13 22:35:14 +00:00
}
}
2013-05-12 05:43:36 +00:00
2013-05-15 05:59:09 +00:00
function TrackSaveAssignments ( ) { }
2013-05-12 05:43:36 +00:00
function TrackGetDevices ( ) {
2013-05-13 22:35:14 +00:00
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" } ;
2013-05-12 05:43:36 +00:00
return response ;
}
2013-05-13 22:35:14 +00:00
function TrackGetMusicDeviceID ( ) {
2013-05-16 05:15:16 +00:00
return device _id ;
2013-05-13 22:35:14 +00:00
}
2013-05-12 05:43:36 +00:00
function TrackSetMusicDevice ( id ) {
device _id = id ;
}
2013-05-28 04:27:57 +00:00
function TrackGetMusicDeviceNames ( input ) {
var names = [ ] ;
names . push ( "Test 1" ) ;
names . push ( "Test 2" ) ;
return names ;
}
2013-05-12 05:43:36 +00:00
// mock response of this method by allowing only even device IDs to open control panel
function TrackHasControlPanel ( ) {
2013-05-13 22:35:14 +00:00
return true ;
}
function TrackIsMusicDeviceType ( type ) {
return true ;
}
function TrackGetChatUsesMusic ( ) {
2013-05-15 01:17:12 +00:00
return 0 ;
2013-05-12 05:43:36 +00:00
}
2013-05-15 05:59:09 +00:00
function TrackSetChatUsesMusic ( usesMusic ) {
}
2013-05-12 05:43:36 +00:00
function TrackOpenControlPanel ( ) {
return ;
}
2013-03-24 20:18:58 +00:00
function TrackLoadAssignments ( ) { }
function TrackSave ( ) { }
// Set a Track Assignment.
// assignment is an enum:
// CHAT = -2, OUTPUT = -1, UNASSIGNED = 0
function TrackSetAssignment ( chanId , isInput , assignment ) { }
2013-05-13 22:35:14 +00:00
2013-03-24 20:18:58 +00:00
// Get a Track Assignment.
function TrackGetAssignment ( chanId , isInput ) {
// CHAT = -2, OUTPUT = -1, UNASSIGNED = 0
return 0 ;
}
function TrackSetCount ( count ) { }
function TrackSetInstrument ( track , instrumentId ) { }
// Method which sets volume
function UpdateMixer ( mixerId ) { }
2013-04-10 22:14:19 +00:00
// Client Update Functions
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 ++ ;
2013-05-27 01:12:35 +00:00
context . setTimeout ( function ( ) {
2013-04-10 22:14:19 +00:00
bytesReceived = ( count / max ) * bytesTotal ;
2013-05-27 01:12:35 +00:00
context . JK . ClientUpdate . DownloadProgressCallback ( bytesReceived , bytesTotal , 0 , 0 ) ;
2013-04-10 22:14:19 +00:00
if ( count < max ) {
2013-05-27 01:12:35 +00:00
fire ( ) ;
2013-04-10 22:14:19 +00:00
}
2013-04-24 23:03:58 +00:00
else {
2013-05-27 01:12:35 +00:00
context . JK . ClientUpdate . DownloadFailureCallback ( "/some/path/here" ) ;
2013-04-24 23:03:58 +00:00
}
2013-05-27 01:12:35 +00:00
} , 50 ) ;
2013-04-10 22:14:19 +00:00
}
2013-05-27 01:12:35 +00:00
fire ( ) ;
2013-04-10 22:14:19 +00:00
}
function ClientUpdateStartUpdate ( path , successCallback , failureCallback ) { }
2013-03-24 20:18:58 +00:00
2012-12-01 23:50:28 +00:00
// Javascript Bridge seems to camel-case
2013-01-05 21:30:24 +00:00
// Set the instance functions:
2012-12-16 19:28:10 +00:00
this . GetASIODevices = GetASIODevices ;
2013-01-05 21:30:24 +00:00
this . GetOS = GetOS ;
2013-04-10 22:14:19 +00:00
this . GetOSAsString = GetOSAsString ;
2013-01-05 21:30:24 +00:00
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 . SignalLatencyUpdated = SignalLatencyUpdated ;
this . SignalSendP2PMessage = SignalSendP2PMessage ;
this . StartPlayTest = StartPlayTest ;
this . StartRecordTest = StartRecordTest ;
this . StartRecording = StartRecording ;
this . StopPlayTest = StopPlayTest ;
this . StopRecording = StopRecording ;
this . TestASIOLatency = TestASIOLatency ;
2013-01-06 20:34:48 +00:00
this . TestLatency = TestLatency ;
2013-01-05 21:30:24 +00:00
this . connected = true ;
2013-01-30 16:50:43 +00:00
2013-05-27 01:12:35 +00:00
// FTUE (round 3)
2013-06-01 16:16:48 +00:00
this . FTUEGetChatInputVolume = FTUEGetChatInputVolume ;
this . FTUEGetChatInputs = FTUEGetChatInputs ;
2013-05-28 01:00:57 +00:00
this . FTUEGetDevices = FTUEGetDevices ;
2013-06-01 16:16:48 +00:00
this . FTUEGetFrameSize = FTUEGetFrameSize ;
this . FTUEGetInputLatency = FTUEGetInputLatency ;
this . FTUEGetInputVolume = FTUEGetInputVolume ;
2013-05-27 15:34:24 +00:00
this . FTUEGetMusicInputs = FTUEGetMusicInputs ;
this . FTUEGetMusicOutputs = FTUEGetMusicOutputs ;
2013-06-01 16:16:48 +00:00
this . FTUEGetOutputLatency = FTUEGetOutputLatency ;
this . FTUEGetOutputVolume = FTUEGetOutputVolume ;
this . FTUEGetStatus = FTUEGetStatus ;
this . FTUEGetVolumeRanges = FTUEGetVolumeRanges ;
this . FTUEHasControlPanel = FTUEHasControlPanel ;
2013-05-28 01:00:57 +00:00
this . FTUEInit = FTUEInit ;
2013-06-01 16:16:48 +00:00
this . FTUEOpenControlPanel = FTUEOpenControlPanel ;
this . FTUERegisterLatencyCallback = FTUERegisterLatencyCallback ;
2013-05-28 01:00:57 +00:00
this . FTUERegisterVUCallbacks = FTUERegisterVUCallbacks ;
2013-06-01 16:16:48 +00:00
this . FTUESave = FTUESave ;
this . FTUESetChatInput = FTUESetChatInput ;
this . FTUESetChatInputVolume = FTUESetChatInputVolume ;
2013-05-28 01:00:57 +00:00
this . FTUESetInputVolume = FTUESetInputVolume ;
2013-06-01 16:16:48 +00:00
this . FTUESetFrameSize = FTUESetFrameSize ;
this . FTUESetInputLatency = FTUESetInputLatency ;
this . FTUESetMusicDevice = FTUESetMusicDevice ;
this . FTUESetMusicInput = FTUESetMusicInput ;
this . FTUESetMusicOutput = FTUESetMusicOutput ;
this . FTUESetOutputLatency = FTUESetOutputLatency ;
2013-05-28 01:00:57 +00:00
this . FTUESetOutputVolume = FTUESetOutputVolume ;
2013-06-01 16:16:48 +00:00
this . FTUESetStatus = FTUESetStatus ;
2013-05-31 00:20:26 +00:00
this . FTUEStartLatency = FTUEStartLatency ;
2013-05-27 01:12:35 +00:00
2013-01-30 16:50:43 +00:00
// Session
this . SessionAddTrack = SessionAddTrack ;
this . SessionGetControlState = SessionGetControlState ;
this . SessionGetIDs = SessionGetIDs ;
this . SessionRegisterCallback = SessionRegisterCallback ;
this . SessionSetControlState = SessionSetControlState ;
this . SessionSetRecordingFilename = SessionSetRecordingFilename ;
this . SessionSetRecordingFolder = SessionSetRecordingFolder ;
this . SessionStartPlay = SessionStartPlay ;
this . SessionStartRecording = SessionStartRecording ;
this . SessionStopPlay = SessionStopPlay ;
this . SessionStopRecording = SessionStopRecording ;
this . SetVURefreshRate = SetVURefreshRate ;
2013-04-10 15:01:29 +00:00
this . SessionGetMasterLocalMix = SessionGetMasterLocalMix ;
this . SessionSetMasterLocalMix = SessionSetMasterLocalMix ;
2013-05-27 19:08:45 +00:00
this . SessionGetDeviceLatency = SessionGetDeviceLatency ;
2013-03-24 20:18:58 +00:00
// 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 ;
2013-05-15 05:59:09 +00:00
this . TrackSaveAssignments = TrackSaveAssignments ;
2013-03-24 20:18:58 +00:00
2013-05-12 05:43:36 +00:00
this . TrackGetDevices = TrackGetDevices ;
2013-05-13 22:35:14 +00:00
this . TrackGetMusicDeviceID = TrackGetMusicDeviceID ;
2013-05-12 05:43:36 +00:00
this . TrackSetMusicDevice = TrackSetMusicDevice ;
2013-05-28 04:27:57 +00:00
this . TrackGetMusicDeviceNames = TrackGetMusicDeviceNames ;
2013-05-12 05:43:36 +00:00
this . TrackHasControlPanel = TrackHasControlPanel ;
this . TrackOpenControlPanel = TrackOpenControlPanel ;
2013-05-13 22:35:14 +00:00
this . TrackIsMusicDeviceType = TrackIsMusicDeviceType ;
this . TrackGetChatUsesMusic = TrackGetChatUsesMusic ;
2013-05-15 05:59:09 +00:00
this . TrackSetChatUsesMusic = TrackSetChatUsesMusic ;
2013-05-12 05:43:36 +00:00
2013-04-10 22:14:19 +00:00
// Client Update
this . ClientUpdateVersion = ClientUpdateVersion ;
this . ClientUpdateStartDownload = ClientUpdateStartDownload ;
this . ClientUpdateStartUpdate = ClientUpdateStartUpdate ;
2012-12-01 23:50:28 +00:00
} ;
} ) ( window , jQuery ) ;