Wire up voice chat, and show if there's a channel. Mute not working yet.
This commit is contained in:
parent
9907d272ba
commit
47ff8182b8
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
|
@ -10,10 +10,13 @@
|
|||
var users = {}; // Light cache of user info for session users.
|
||||
var tracks = {};
|
||||
var mixers = [];
|
||||
// Consolidate dragged controls and handles
|
||||
var $draggingFaderHandle = null;
|
||||
var $draggingFader = null;
|
||||
var $draggingVolumeHandle = null;
|
||||
var $draggingVolume = null;
|
||||
var $draggingChatHandle = null;
|
||||
var $draggingChat = null;
|
||||
var currentMixerId = null;
|
||||
var currentMixerRangeMin = null;
|
||||
var currentMixerRangeMax = null;
|
||||
|
|
@ -182,7 +185,17 @@
|
|||
}
|
||||
|
||||
function _addVoiceChat() {
|
||||
logger.debug("TODO: If user has a voice chat input defined, add controls and wire them up.");
|
||||
// If, and only if, there is a mixer in group 3 (voice chat)
|
||||
// Add the voice chat controls below my tracks, and hook up the mixer.
|
||||
// Assumption is that there is only ever one, so we just take the first one.
|
||||
$.each(mixers, function(index, mixer) {
|
||||
if (mixer.group_id === 3) { // Local voice chat
|
||||
var $voiceChat = $('#voice-chat');
|
||||
$voiceChat.show();
|
||||
$voiceChat.attr('mixer-id', mixer.id);
|
||||
$('#voice-chat .voicechat-mute').attr('mixer-id', mixer.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _renderTracks() {
|
||||
|
|
@ -326,6 +339,7 @@
|
|||
}
|
||||
|
||||
function toggleMute(evt) {
|
||||
logger.debug('toggleMute');
|
||||
var $control = $(evt.currentTarget);
|
||||
var mixerId = $control.attr('mixer-id');
|
||||
fillTrackVolumeObject(currentMixerId);
|
||||
|
|
@ -404,6 +418,112 @@
|
|||
context.jamClient.SessionSetControlState(mixerId);
|
||||
}
|
||||
|
||||
|
||||
// Refactor. Only need one of these xxxDown methods.
|
||||
function faderHandleDown(evt) {
|
||||
evt.stopPropagation();
|
||||
$draggingFaderHandle = $(evt.currentTarget);
|
||||
$draggingFader = $draggingFaderHandle.closest('div[control="fader"]');
|
||||
currentMixerId = $draggingFader.closest('[mixer-id]').attr('mixer-id');
|
||||
fillTrackVolumeObject(currentMixerId);
|
||||
return false;
|
||||
}
|
||||
|
||||
function volumeHandleDown(evt) {
|
||||
evt.stopPropagation();
|
||||
$draggingVolumeHandle = $(evt.currentTarget);
|
||||
$draggingVolume = $('#volume');
|
||||
currentMixerId = $draggingVolume.attr('master-id');
|
||||
fillTrackVolumeObject(currentMixerId);
|
||||
return false;
|
||||
}
|
||||
|
||||
function chatHandleDown(evt) {
|
||||
evt.stopPropagation();
|
||||
$draggingChatHandle = $(evt.currentTarget);
|
||||
$draggingChat = $draggingChatHandle.closest('div[control="fader"]');
|
||||
currentMixerId = $draggingChat.closest('[mixer-id]').attr('mixer-id');
|
||||
fillTrackVolumeObject(currentMixerId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// TODO - only need one of these next three
|
||||
function tracksMouseUp(evt) {
|
||||
evt.stopPropagation();
|
||||
if ($draggingFaderHandle) {
|
||||
$draggingFaderHandle = null;
|
||||
$draggingFader = null;
|
||||
currentMixerId = null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function volumeMouseUp(evt) {
|
||||
evt.stopPropagation();
|
||||
if ($draggingVolumeHandle) {
|
||||
$draggingVolumeHandle = null;
|
||||
$draggingVolume = null;
|
||||
currentMixerId = null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function chatMouseUp(evt) {
|
||||
evt.stopPropagation();
|
||||
if ($draggingChatHandle) {
|
||||
$draggingChatHandle = null;
|
||||
$draggingChat = null;
|
||||
currentMixerId = null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO - only need one of next three
|
||||
function tracksMouseMove(evt) {
|
||||
// bail out early if there's no in-process drag
|
||||
if (!($draggingFaderHandle)) {
|
||||
return false;
|
||||
}
|
||||
evt.stopPropagation();
|
||||
var faderPct = getFaderPercent(evt.clientY, $draggingFader);
|
||||
setMixerVolume(currentMixerId, faderPct);
|
||||
if (faderPct > 90) { faderPct = 90; } // Visual limit
|
||||
$draggingFaderHandle.css('bottom', faderPct + '%');
|
||||
return false;
|
||||
}
|
||||
|
||||
function volumeMouseMove(evt) {
|
||||
// bail out early if there's no in-process drag
|
||||
if (!($draggingVolumeHandle)) {
|
||||
return false;
|
||||
}
|
||||
evt.stopPropagation();
|
||||
var faderPct = getHorizontalFaderPercent(evt.clientX, $draggingVolume);
|
||||
setMixerVolume(currentMixerId, faderPct);
|
||||
// TODO - this could use attention:
|
||||
var monitorId = $draggingVolume.attr('monitor-id');
|
||||
setMixerVolume(monitorId, faderPct);
|
||||
if (faderPct > 90) { faderPct = 90; } // Visual limit
|
||||
$draggingVolumeHandle.css('left', faderPct + '%');
|
||||
return false;
|
||||
}
|
||||
|
||||
function chatMouseMove(evt) {
|
||||
// bail out early if there's no in-process drag
|
||||
if (!($draggingChatHandle)) {
|
||||
return false;
|
||||
}
|
||||
evt.stopPropagation();
|
||||
var faderPct = getHorizontalFaderPercent(evt.clientX, $draggingChat);
|
||||
setMixerVolume(currentMixerId, faderPct);
|
||||
if (faderPct > 90) { faderPct = 90; } // Visual limit
|
||||
$draggingChatHandle.css('left', faderPct + '%');
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO - refactor - all these clicks are the same.
|
||||
// Parameters and consolidate into one.
|
||||
function faderClick(evt) {
|
||||
evt.stopPropagation();
|
||||
if ($draggingFaderHandle) {
|
||||
|
|
@ -420,35 +540,19 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function faderHandleDown(evt) {
|
||||
function voiceChatClick(evt) {
|
||||
evt.stopPropagation();
|
||||
$draggingFaderHandle = $(evt.currentTarget);
|
||||
$draggingFader = $draggingFaderHandle.closest('div[control="fader"]');
|
||||
currentMixerId = $draggingFader.closest('[mixer-id]').attr('mixer-id');
|
||||
fillTrackVolumeObject(currentMixerId);
|
||||
return false;
|
||||
}
|
||||
|
||||
function tracksMouseUp(evt) {
|
||||
evt.stopPropagation();
|
||||
if ($draggingFaderHandle) {
|
||||
$draggingFaderHandle = null;
|
||||
$draggingFader = null;
|
||||
currentMixerId = null;
|
||||
if ($draggingChatHandle) {
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function tracksMouseMove(evt) {
|
||||
// bail out early if there's no in-process drag
|
||||
if (!($draggingFaderHandle)) {
|
||||
return false;
|
||||
}
|
||||
evt.stopPropagation();
|
||||
var faderPct = getFaderPercent(evt.clientY, $draggingFader);
|
||||
setMixerVolume(currentMixerId, faderPct);
|
||||
var $fader = $(evt.currentTarget);
|
||||
var $handle = $fader.find('div[control="fader-handle"]');
|
||||
var faderPct = getHorizontalFaderPercent(evt.clientX, $fader);
|
||||
var mixerId = $fader.closest('[mixer-id]').attr('mixer-id');
|
||||
fillTrackVolumeObject(mixerId);
|
||||
setMixerVolume(mixerId, faderPct);
|
||||
if (faderPct > 90) { faderPct = 90; } // Visual limit
|
||||
$draggingFaderHandle.css('bottom', faderPct + '%');
|
||||
$handle.css('left', faderPct + '%');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -471,40 +575,7 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function volumeHandleDown(evt) {
|
||||
evt.stopPropagation();
|
||||
$draggingVolumeHandle = $(evt.currentTarget);
|
||||
$draggingVolume = $('#volume');
|
||||
currentMixerId = $draggingVolume.attr('master-id');
|
||||
fillTrackVolumeObject(currentMixerId);
|
||||
return false;
|
||||
}
|
||||
|
||||
function volumeMouseUp(evt) {
|
||||
evt.stopPropagation();
|
||||
if ($draggingVolumeHandle) {
|
||||
$draggingVolumeHandle = null;
|
||||
$draggingVolume = null;
|
||||
currentMixerId = null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function volumeMouseMove(evt) {
|
||||
// bail out early if there's no in-process drag
|
||||
if (!($draggingVolumeHandle)) {
|
||||
return false;
|
||||
}
|
||||
evt.stopPropagation();
|
||||
var faderPct = getHorizontalFaderPercent(evt.clientX, $draggingVolume);
|
||||
setMixerVolume(currentMixerId, faderPct);
|
||||
// TODO - this could use attention:
|
||||
var monitorId = $draggingVolume.attr('monitor-id');
|
||||
setMixerVolume(monitorId, faderPct);
|
||||
if (faderPct > 90) { faderPct = 90; } // Visual limit
|
||||
$draggingVolumeHandle.css('left', faderPct + '%');
|
||||
return false;
|
||||
}
|
||||
|
||||
function events() {
|
||||
$('#session-contents').on("click", '[action="delete"]', deleteSession);
|
||||
|
|
@ -518,6 +589,14 @@
|
|||
$('#volume').on('mousedown', '.slider-volume', volumeHandleDown);
|
||||
$('body').on('mousemove', volumeMouseMove);
|
||||
$('body').on('mouseup', volumeMouseUp);
|
||||
|
||||
// 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="mute"]', toggleMute);
|
||||
$('#voice-chat').on('click', 'div[control="fader"]', voiceChatClick);
|
||||
$('#voice-chat').on('mousedown', 'div[control="fader-handle"]', chatHandleDown);
|
||||
$('#voice-chat').on('mousemove', chatMouseMove);
|
||||
$('body').on('mouseup', chatMouseUp);
|
||||
}
|
||||
|
||||
this.initialize = function() {
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ table.vu td {
|
|||
left:45px;
|
||||
width:51px;
|
||||
height:186px;
|
||||
background-image:url(../images/content/bkg_slider_gain_horiz.png);
|
||||
background-image:url(/assets/content/bkg_slider_gain_horiz.png);
|
||||
background-repeat:repeat-x;
|
||||
}
|
||||
|
||||
|
|
@ -493,6 +493,10 @@ table.vu td {
|
|||
position:absolute;
|
||||
top:4px;
|
||||
left: 103px;
|
||||
width: 20px;
|
||||
height: 18px;
|
||||
background-image:url('/assets/content/icon_mute.png');
|
||||
background-repeat:no-repeat;
|
||||
}
|
||||
|
||||
.voicechat-settings {
|
||||
|
|
@ -548,7 +552,7 @@ table.vu td {
|
|||
|
||||
.recording-playback {
|
||||
display:inline-block;
|
||||
background-image:url(../images/content/bkg_playcontrols.png);
|
||||
background-image:url(/assets/content/bkg_playcontrols.png);
|
||||
background-repeat:repeat-x;
|
||||
position:relative;
|
||||
width:65%;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,29 @@
|
|||
</div>
|
||||
|
||||
<!-- my tracks scroller -->
|
||||
<div class="session-tracks-scroller" id="session-mytracks-container">
|
||||
<div class="session-tracks-scroller">
|
||||
<div id="session-mytracks-container"></div>
|
||||
<!-- voice chat box -->
|
||||
<div id="voice-chat" class="voicechat" style="display:none;" mixer-id="">
|
||||
<div class="voicechat-label">CHAT</div>
|
||||
<!-- voice chat gain -->
|
||||
<div class="voicechat-gain">
|
||||
<div class="voicechat-gain-wrapper" control="fader">
|
||||
<!-- voice chat gain slider -->
|
||||
<div class="voicechat-gain-slider" style="left:0%;" control="fader-handle">
|
||||
<%= image_tag "content/slider_gain_horiz.png", {:width => 10, :height => 18} %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- mute icon -->
|
||||
<div class="voicechat-mute enabled" control="mute" mixer-id=""></div>
|
||||
<!-- settings icon -->
|
||||
<div class="voicechat-settings">
|
||||
<%= image_tag "content/icon_settings_lg.png", {:width => 18, :height => 18} %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end voice chat -->
|
||||
<div id="voice-chat"></div>
|
||||
</div> <!-- end session-tracks-scroller -->
|
||||
</div> <!-- end session-mytracks -->
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue