jam-cloud/app/assets/javascripts/sessionTrack.js

93 lines
2.4 KiB
JavaScript

(function(context,$) {
context.JK = context.JK || {};
context.JK.SessionTrack = function(clientId) {
var logger = context.JK.logger;
var selectorTemplate = '[client-id="' + clientId + '"] [track-role="{role}"]';
var parts = ['latency', 'vu', 'gain', 'mute', 'name', 'part', 'avatar'];
var $parts = {};
$.each(parts, function() {
var selector = JK.fillTemplate(selectorTemplate, {role: this});
$parts[this] = $(selector);
//logger.debug(this + ":" + $parts[this]);
});
function events() {
}
/**
* Set latency. val = [good,medium,bad]
*/
this.setLatency = function(val) {
$parts.latency.html(val);
};
/**
* Set VU level. val = 0.0-1.0
*/
this.setVolumeUnit = function(val) {
$parts.vu.html(val);
};
/**
* Set the track's gain. val = 0.0-1.0
* Allows external control of channel fader.
*/
this.setGain = function(val) {
logger.debug('setGain:' + val);
$parts.gain.html("Gain: " + val);
};
/**
* Get the track's gain from current fader. Returns 0.0-1.0
*/
this.getGain = function() {
return $parts.gain.html().split("Gain: ")[1];
};
/**
* Set whether this channel is muted. Takes a boolean where
* true means mute, false, means unmuted.
*/
function _mute(muted) {
}
/**
* Return whether the channel is currently muted.
*/
function _isMute() {
}
/**
* Set the name (typically user name)
*/
function _setName(name) {
}
/**
* Set the part this user is performing. If part is
* one of ENUM.FIGURE_ME_OUT then it is a recognized
* part with an icon, otherwise it is an 'other' value
* with a default icon.
*/
function _setPart(part) {
}
/**
* Set the channel's avatar. Typically the user's profile
* avatar url.
*/
function _setAvatar(avatar_url) {
}
this.initialize = function() {
events();
screenBindings = {
'afterShow': afterShow
};
app.bindScreen('session', screenBindings);
};
};
})(window,jQuery);