preserve audio data during pal refresh

This commit is contained in:
howard-stearns 2017-03-03 16:56:12 -08:00
parent aaec6ce9f7
commit 15d680d4f9

View file

@ -248,12 +248,16 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
}
break;
case 'refresh':
data = {};
ExtendedOverlay.some(function (overlay) { // capture the audio data
data[overlay.key] = overlay;
});
removeOverlays();
// If filter is specified from .qml instead of through settings, update the settings.
if (message.params.filter !== undefined) {
Settings.setValue('pal/filtered', !!message.params.filter);
}
populateUserList(message.params.selected);
populateUserList(message.params.selected, data);
UserActivityLogger.palAction("refresh", "");
break;
case 'displayNameUpdate':
@ -285,7 +289,7 @@ function addAvatarNode(id) {
}
// Each open/refresh will capture a stable set of avatarsOfInterest, within the specified filter.
var avatarsOfInterest = {};
function populateUserList(selectData) {
function populateUserList(selectData, oldAudioData) {
var filter = Settings.getValue('pal/filtered') && {distance: Settings.getValue('pal/nearDistance')};
var data = [], avatars = AvatarList.getAvatarIdentifiers();
avatarsOfInterest = {};
@ -317,12 +321,13 @@ function populateUserList(selectData) {
if (id && filter && ((Math.abs(horizontal) > horizontalHalfAngle) || (Math.abs(vertical) > verticalHalfAngle))) {
return;
}
var oldAudio = oldAudioData && oldAudioData[id];
var avatarPalDatum = {
displayName: name,
userName: '',
sessionId: id || '',
audioLevel: 0.0,
avgAudioLevel: 0.0,
audioLevel: (oldAudio && oldAudio.audioLevel) || 0.0,
avgAudioLevel: (oldAudio && oldAudio.avgAudioLevel) || 0.0,
admin: false,
personalMute: !!id && Users.getPersonalMuteStatus(id), // expects proper boolean, not null
ignore: !!id && Users.getIgnoreStatus(id) // ditto