diff --git a/app/assets/javascripts/session.js b/app/assets/javascripts/session.js index a4e0c6446..725ca9bac 100644 --- a/app/assets/javascripts/session.js +++ b/app/assets/javascripts/session.js @@ -503,7 +503,8 @@ logger.debug('faderChanged. faderId: ' + faderId + ', newValue: ' + newValue + ', dragging: ' + dragging); var mixerIds = faderId.split(','); $.each(mixerIds, function(i,v) { - fillTrackVolumeObject(v); + var broadcast = !(dragging); // If fader is still dragging, don't broadcast + fillTrackVolumeObject(v, broadcast); setMixerVolume(v, newValue); }); } @@ -591,36 +592,6 @@ _toggleVisualMuteControl($control, muting); } - /* - function getVerticalFaderPercent(eventY, $fader) { - return getFaderPercent(eventY, $fader, 'vertical'); - } - - function getHorizontalFaderPercent(eventX, $fader) { - return getFaderPercent(eventX, $fader, 'horizontal'); - } - - function getFaderPercent(value, $fader, orientation) { - var faderPosition = $fader.offset(); - var faderMin = faderPosition.top; - var faderSize = $fader.height(); - var handleValue = (faderSize - (value-faderMin)); - if (orientation === "horizontal") { - faderMin = faderPosition.left; - faderSize = $fader.width(); - handleValue = (value - faderMin); - } - var faderPct = Math.round(handleValue/faderSize * 100); - if (faderPct < 0) { - faderPct = 0; - } - if (faderPct > 100) { - faderPct = 100; - } - return faderPct; - } - */ - function fillTrackVolumeObject(mixerId, broadcast) { _updateMixers(); var mixer = null; @@ -695,129 +666,10 @@ } } - - // Refactor. Only need one of these xxxDown methods. - /* - function faderHandleDown(evt) { - if (!screenActive) return true; // allow other screens to use mouseevents while this screen is not active - - evt.stopPropagation(); - $draggingFaderHandle = $(evt.currentTarget); - $draggingFader = $draggingFaderHandle.closest('div[control="fader"]'); - currentMixerIds = $draggingFader.closest('[mixer-id]').attr('mixer-id').split(','); - var mixerIds = currentMixerIds; - $.each(mixerIds, function(i,v) { - fillTrackVolumeObject(v); - }); - return false; - } - */ - - /* - function faderMouseUp(evt) { - if (!screenActive) return true; // allow other screens to use mouseevents while this screen is not active - - evt.stopPropagation(); - if ($draggingFaderHandle) { - $draggingFaderHandle = null; - $draggingFader = null; - currentMixerIds = null; - } - return false; - } - */ - - /* - function faderMouseMove(evt) { - if (!screenActive) return true; // allow other screens to use mouseevents while this screen is not active - - // bail out early if there's no in-process drag - if (!($draggingFaderHandle)) { - return false; - } - var $fader = $draggingFader; - var $handle = $draggingFaderHandle; - evt.stopPropagation(); - var orientation = $fader.attr('orientation'); - var getPercentFunction = getVerticalFaderPercent; - var absolutePosition = evt.clientY; - var handleCssAttribute = 'bottom'; - if (orientation && orientation == 'horizontal') { - getPercentFunction = getHorizontalFaderPercent; - absolutePosition = evt.clientX; - handleCssAttribute = 'left'; - } - var faderPct = getPercentFunction(absolutePosition, $fader); - var mixerIds = currentMixerIds; - $.each(mixerIds, function(i,v) { - setMixerVolume(v, faderPct); - }); - if (faderPct > 90) { faderPct = 90; } // Visual limit - $handle.css(handleCssAttribute, faderPct + '%'); - return false; - } - */ - - /* - function faderClick(evt) { - evt.stopPropagation(); - if ($draggingFaderHandle) { - return; - } - var $fader = $(evt.currentTarget); - - // Switch based on fader orientation - var orientation = $fader.attr('orientation'); - var getPercentFunction = getVerticalFaderPercent; - var absolutePosition = evt.clientY; - var handleCssAttribute = 'bottom'; - if (orientation && orientation == 'horizontal') { - getPercentFunction = getHorizontalFaderPercent; - absolutePosition = evt.clientX; - handleCssAttribute = 'left'; - } - - var $handle = $fader.find('div[control="fader-handle"]'); - var faderPct = getPercentFunction(absolutePosition, $fader); - // mixerIds can be a comma-separated list - var mixerIds = $fader.closest('[mixer-id]').attr('mixer-id').split(','); - $.each(mixerIds, function(i,v) { - fillTrackVolumeObject(v); - setMixerVolume(v, faderPct); - }); - if (faderPct > 90) { faderPct = 90; } // Visual limit - $handle.css(handleCssAttribute, faderPct + '%'); - return false; - } - */ - function events() { $('#session-contents').on("click", '[action="delete"]', deleteSession); $('#tracks').on('click', 'div[control="mute"]', toggleMute); - /* - $('#tracks').on('click', 'div[control="fader"]', faderClick); - $('#tracks').on('mousedown', 'div[control="fader-handle"]', faderHandleDown); - $('#tracks').on('mousemove', faderMouseMove); - $('body').on('mouseup', faderMouseUp); - */ - - /* - $('#session-controls .fader').on('click', 'div[control="fader"]', faderClick); - $('#session-controls .fader').on('mousedown', '.handle', faderHandleDown); - $('body').on('mousemove', faderMouseMove); - $('body').on('mouseup', faderMouseUp); - */ - - // Go ahead and wire up voice-chat events, although it won't be visible - // (and can't fire events) unless the user has a voice chat mixer - /* - $('#voice-chat').on('click', 'div[control="fader"]', faderClick); - $('#voice-chat').on('mousedown', 'div[control="fader-handle"]', faderHandleDown); - $('#voice-chat').on('mousemove', faderMouseMove); - $('body').on('mouseup', faderMouseUp); - */ - $('.voicechat-settings').click(function() { // call this to initialize Music Audio tab configureTrackDialog.showMusicAudioPanel(true);