diff --git a/web/app/assets/javascripts/session.js b/web/app/assets/javascripts/session.js index 697cfd4d6..8d41a0a0c 100644 --- a/web/app/assets/javascripts/session.js +++ b/web/app/assets/javascripts/session.js @@ -2174,8 +2174,8 @@ } else { rest.openMetronome({id: sessionModel.id()}) .done(function() { - context.JK.CurrentSessionModel.refreshCurrentSession(true) setMetronomeFromForm() + context.JK.CurrentSessionModel.refreshCurrentSession(true) }) .fail(function(jqXHR) { console.log(jqXHR, jqXHR) @@ -2334,9 +2334,23 @@ } function setMetronomeFromForm() { - var sound = $("select.metro-sound:visible option:selected").val() var tempo = $("select.metro-tempo:visible option:selected").val() - context.jamClient.SessionSetMetronome(tempo, sound, 1, 0) + var sound = $("select.metro-sound:visible option:selected").val() + + var t = parseInt(tempo); + var s; + if (tempo==NaN || tempo==0 || tempo==null) { + t = 120 + } + + if (sound==null || typeof(sound)=='undefined' || sound=="") { + s = "click" + } else { + s = sound + } + + console.log("Setting tempo and sound:", t, s) + context.jamClient.SessionSetMetronome(t, s, 1, 0) } function onMetronomeChanged(e, data) {