* VRFS-3118 - refresh latency by start/stopping audio system

This commit is contained in:
Seth Call 2015-04-29 21:51:54 -05:00
parent 0ddbfc5e72
commit 69ccf0d4e5
5 changed files with 44 additions and 7 deletions

View File

@ -24,15 +24,34 @@ context.JK.SinglePlayerProfileGuardDialog = class SinglePlayerProfileGuardDialog
@audioLatency = @dialog.find('.audio-latency')
@btnPrivateSession = @dialog.find('.btn-private-session')
@btnGearSetup = @dialog.find('.btn-gear-setup')
@btnRescan = @dialog.find('.btn-rescan')
@rescanningNotice = @dialog.find('.rescanning-notice')
@btnPrivateSession.on('click', @onPrivateSessionChoice)
@btnGearSetup.on('click', @onGearSetupChoice)
@btnRescan.on('click', @onRescan)
beforeShow:() =>
@dialog.data('result', { choice: null})
afterShow:() =>
onRescan: () =>
@gearUtils.scheduleAudioRestart('single-player-guard', 1000, @beforeScan, @afterScan)
beforeScan: () =>
@dialog.find('.action-buttons a').addClass('disabled')
@rescanningNotice.show();
afterScan: (canceled) =>
@dialog.find('.action-buttons a').removeClass('disabled')
@rescanningNotice.hide();
if !canceled
result = context.jamClient.ReloadAudioSystem(true, true, true);
@refresh();
refresh:() =>
canPlayWithOthers = @gearUtils.canPlayWithOthers()
if canPlayWithOthers.isNoInputProfile
@ -46,6 +65,11 @@ context.JK.SinglePlayerProfileGuardDialog = class SinglePlayerProfileGuardDialog
@audioLatency.text("#{latency} milliseconds.")
afterShow:() =>
@refresh()
onPrivateSessionChoice: () =>
@dialog.data('result', { choice: 'private_session'})
@app.layout.closeDialog(@dialogId)

View File

@ -937,12 +937,6 @@
}
}
if(optionRequiresMultiplayerProfile()) {
if(context.JK.guardAgainstSinglePlayerProfile(app).canPlay == false) {
return false;
}
}
var valid = beforeMoveStep();
if (!valid) {
return false;

View File

@ -34,6 +34,12 @@
// as well have a score below 20 ms
gearUtils.canPlayWithOthers = function(profile) {
if(!context.jamClient.IsAudioStarted()) {
context.jamClient.ReloadAudioSystem(true, true, true);
context.jamClient.StopAudio();
}
var isNoInputProfile = gearUtils.isNoInputProfile(profile);
var expectedLatency = context.jamClient.FTUEGetExpectedLatency();
var audioLatency = expectedLatency ? expectedLatency.latency : null;

View File

@ -26,4 +26,13 @@
p {
line-height:125%;
}
.rescanning-notice {
display:none;
span.spinner-small {
display:inline-block;
vertical-align: middle;
}
}
}

View File

@ -17,6 +17,10 @@
br
| With this profile, you can't play with others in real-time. However, you can play with JamTracks and backing tracks by yourself in a private session, or go to the gear setup wizard and add a new audio profile that uses your gear.
.right.action-buttons
span.rescanning-notice
span.spinner-small
| Rescanning...
a.button-grey.btn-cancel href='#' layout-action="cancel" CANCEL
a.button-grey.btn-rescan.hidden href='#' RESCAN
a.button-grey.btn-gear-setup href="/client#/account/audio" GO TO GEAR SETUP
a.button-orange.btn-private-session href="#" PRIVATE SESSION