* VRFS-3374 - relative move of media group

This commit is contained in:
Seth Call 2015-07-23 14:12:44 -05:00
parent dd579f8c32
commit 82b0272786
6 changed files with 59 additions and 15 deletions

View File

@ -58,7 +58,7 @@ context = window
$mute,
'SessionTrackVolumeHover',
() =>
{mixers:@props.mixers}
{mixers:@props.mixers, gainType : 'music'}
,
{width:235, positions:['right', 'left'], offsetParent:$root.closest('.top-parent')})

View File

@ -81,7 +81,7 @@ MixerActions = @MixerActions
<div>Volume</div>
<div>{monitorVolumeLeft}dB</div>
</div>
<SessionTrackGain mixers={this.state.inputGroupMixers} />
<SessionTrackGain mixers={this.state.inputGroupMixers} gainType='music' />
<div className={monitorMuteClasses} data-control="mute" onClick={this.handleAudioInputMute}/>
<input type="checkbox" name="mute"/>

View File

@ -1,8 +1,13 @@
context = window
logger = context.JK.logger
CategoryGroupIds = context.JK.CategoryGroupIds
@SessionTrackGain = React.createClass({
propTypes: {
gainType: React.PropTypes.string
}
getInitialState: () ->
{
mixers: @props.mixers,
@ -14,7 +19,7 @@ logger = context.JK.logger
groupId = $target.data('groupId')
mixers = @state.mixers.mixer
MixerActions.faderChanged(data, mixers, groupId)
MixerActions.faderChanged(data, mixers, @props.gainType)
render: () ->
# mixer can be a single item or array

View File

@ -5,6 +5,11 @@ ptrCount = 0
@SessionTrackVolumeHover = React.createClass({
# example: 'music' when it represent the gainer that controls all non-chat inputs
propTypes: {
gainType: React.PropTypes.string
}
mixins: [Reflux.listenTo(@SessionMyTracksStore,"onInputsChanged")]
iCheckMaint: false
@ -78,7 +83,7 @@ ptrCount = 0
<div>Volume</div>
<div>{volume_left}dB</div>
</div>
<SessionTrackGain mixers={this.state.mixers} />
<SessionTrackGain mixers={this.state.mixers} gainType={this.props.gainType} />
<div className={classes} data-control="mute" data-mixer-id={muteMixerId} onClick={this.handleMute}/>
<input type="checkbox" name="mute"/>

View File

@ -657,27 +657,44 @@ MIX_MODES = context.JK.MIX_MODES;
mixer = @getMixer(mixerId, mode)
mixer.mute = muting
faderChanged: (data, mixers, groupId) ->
getOriginalVolume: (mixers, gainType) ->
originalVolume = null
if gainType == 'music'
# find a non media volL to compare against for later 'relative move'
for mixer in mixers
if mixer.name != CategoryGroupIds.UserMedia && mixer.name != CategoryGroupIds.MediaTrack
originalVolume = mixer.volume_left
break
else
originalVolume = mixers[0].volume_left
originalVolume
faderChanged: (data, mixers, gainType) ->
mixers = [mixers] unless $.isArray(mixers)
originalVolume = @getOriginalVolume(mixers, gainType)
for mixer in mixers
broadcast = !(data.dragging) # If fader is still dragging, don't broadcast
mixer = @fillTrackVolumeObject(mixer.id, mixer.mode, broadcast)
@setMixerVolume(mixer, data.percentage)
relative = gainType == 'music' && (mixer.name == CategoryGroupIds.UserMedia || mixer.name == CategoryGroupIds.MediaTrack)
@setMixerVolume(mixer, data.percentage, relative, originalVolume)
# keep state of mixer in sync with backend
mixer = @getMixer(mixer.id, mixer.mode)
mixer.volume_left = context.trackVolumeObject.volL
if groupId == ChannelGroupIds.UserMusicInputGroup
# there may be other mixers with this same ID in the case of a Peer Music Stream, so update them as well
context.JK.FaderHelpers.setFaderValue(mixerId, data.percentage)
#if groupId == ChannelGroupIds.UserMusicInputGroup
# # there may be other mixers with this same ID in the case of a Peer Music Stream, so update them as well
# context.JK.FaderHelpers.setFaderValue(mixerId, data.percentage)
initGain: (mixer) ->
if $.isArray(mixer)
mixer = mixer[0]
gainPercent = context.JK.FaderHelpers.convertAudioTaperToPercent(mixer.volume_left)
context.JK.FaderHelpers.setFaderValue(mixer.id, gainPercent)
@ -716,7 +733,7 @@ MIX_MODES = context.JK.MIX_MODES;
mixer = @getMixer(mixer.id, mixer.mode)
mixer.loop = context.trackVolumeObject.loop
setMixerVolume: (mixer, volumePercent) ->
setMixerVolume: (mixer, volumePercent, relative, originalVolume) ->
###
// The context.trackVolumeObject has been filled with the mixer values
// that go with mixerId, and the range of that mixer
@ -726,9 +743,26 @@ MIX_MODES = context.JK.MIX_MODES;
// volumes on trackVolumeObject, and call SetControlState to stick.
###
context.trackVolumeObject.volL = context.JK.FaderHelpers.convertPercentToAudioTaper(volumePercent);
context.trackVolumeObject.volR = context.JK.FaderHelpers.convertPercentToAudioTaper(volumePercent);
newVolume = context.JK.FaderHelpers.convertPercentToAudioTaper(volumePercent);
if relative
context.trackVolumeObject.volL = context.trackVolumeObject.volL + (newVolume - originalVolume)
context.trackVolumeObject.volR = context.trackVolumeObject.volR + (newVolume - originalVolume)
# keep within range
if context.trackVolumeObject.volL < -80
context.trackVolumeObject.volL = -80
else if context.trackVolumeObject.volL > 20
context.trackVolumeObject.volL = 20
if context.trackVolumeObject.volR < -80
context.trackVolumeObject.volR = -80
else if context.trackVolumeObject.volR > 20
context.trackVolumeObject.volR = 20
else
context.trackVolumeObject.volL = newVolume
context.trackVolumeObject.volR = newVolume
context.jamClient.SessionSetControlState(mixer.id, mixer.mode);
percentFromMixerValue: (min, max, value) ->

View File

@ -139,9 +139,9 @@ rest = context.JK.Rest()
# simulate a state change to cause a UI redraw
@issueChange()
onFaderChanged: (data, mixers, groupId) ->
onFaderChanged: (data, mixers, gainType) ->
@mixers.faderChanged(data, mixers, groupId)
@mixers.faderChanged(data, mixers, gainType)
@issueChange()