context = window ChannelGroupIds = context.JK.ChannelGroupIds CategoryGroupIds = context.JK.CategoryGroupIds MixerActions = @MixerActions 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 closeHover: (e) -> e.preventDefault() $container = $(this.getDOMNode()).closest('.react-holder') $container.data('bt').btOff() onInputsChanged: (sessionMixers) -> mixers = sessionMixers.mixers if mixers? newMixers = mixers.refreshMixer(@state.mixers) newMixers = {} unless newMixers? sessionController = sessionMixers.session.sessionController() this.setState({mixers: newMixers, sessionController: sessionController}) getInitialState: () -> {mixers: this.props.mixers, ptr: "STVH#{ptrCount++}", sessionController: window.SessionStore.helper.sessionController()} handleMute: (e) -> e.preventDefault() muting = $(e.currentTarget).is('.enabled') # if it's a chat, my input, or media track, or jam track, or media track group, then do both mixers at the same time #if @state.mixers.mixer.group_id == ChannelGroupIds.AudioInputMusicGroup || @state.mixers.mixer.group_id == ChannelGroupIds.AudioInputChatGroup || @state.mixers.mixer.group_id == ChannelGroupIds.MediaTrackGroup || @state.mixers.mixer.group_id == ChannelGroupIds.JamTrackGroup || ((@state.mixers.mixer.group_id == ChannelGroupIds.MonitorCatGroup || @state.mixers.mixer.group_id == ChannelGroupIds.MasterCatGroup) && @state.mixers.mixer.name == CategoryGroupIds.MediaTrack) # MixerActions.mute([this.state.mixers.mixer, this.state.mixers.oppositeMixer], muting) #else # MixerActions.mute(this.state.mixers.mixer, muting) handleMuteCheckbox: (e) -> return if @iCheckMaint muting = $(e.target).is(':checked') # if it's a chat, my input, or media track, or jam track, or media track group, then do both mixers at the same time if @state.mixers.mixer.group_id == ChannelGroupIds.AudioInputMusicGroup || @state.mixers.mixer.group_id == ChannelGroupIds.AudioInputChatGroup || @state.mixers.mixer.group_id == ChannelGroupIds.MediaTrackGroup || @state.mixers.mixer.group_id == ChannelGroupIds.JamTrackGroup || ((@state.mixers.mixer.group_id == ChannelGroupIds.MonitorCatGroup || @state.mixers.mixer.group_id == ChannelGroupIds.MasterCatGroup) && @state.mixers.mixer.name == CategoryGroupIds.MediaTrack) MixerActions.mute([this.state.mixers.mixer, this.state.mixers.oppositeMixer], muting) else MixerActions.mute(this.state.mixers.mixer, muting) render: () -> muteMixer = @state.mixers?.muteMixer if muteMixer && $.isArray(muteMixer) muteMixer = muteMixer[0] muteMixerId = muteMixer?.id mixer = @state.mixers?.mixer if mixer && $.isArray(mixer) mixer = mixer[0] volume_left = mixer.volume_left classes = classNames({ 'track-icon-mute': true 'enabled' : !muteMixer?.mute 'muted' : muteMixer?.mute }) textualHelp = null if (@props.trackType == 'SessionMyTrack' || @props.trackType == 'SessionMyChat') && @props.mode == context.JK.MIX_MODES.MASTER textualHelp = `

Use the gain knobs on your audio interface or this slider to adjust your input level up/down.

Play or sing, and watch where the meter lights peak.

These lights should reach the top of the green lights, and maybe one light into the orange/red zone.

` else if @props.trackType == 'SessionOtherTrack' || @props.trackType == 'SessionMyTrack' textualHelp = `

Use this slider to adjust this audio track's volume up or down to get your mix where you like.

This only affects what you hear, not what others hear in your session.

Your personal mix is what will be used for recordings and broadcasts you personally control in sessions.

` else textualHelp = `

Use this slider to adjust this audio track's volume up or down to get your mix where you like.

This only affects what you hear, not what others hear in your session.

Your personal mix is what will be used for recordings and broadcasts you personally control in sessions.

` `
Volume
{volume_left}dB
{textualHelp}
close
` componentDidMount: () -> $root = jQuery(this.getDOMNode()) muteMixer = this.state.mixers?.muteMixer if $.isArray(muteMixer) muteMixer = muteMixer[0] # initialize icheck $checkbox = $root.find('input') context.JK.checkbox($checkbox) $checkbox.on('ifChanged', this.handleMuteCheckbox); # using iCheck causes a 'ifChanged' event, so we need to swallow this up @iCheckMaint = true if muteMixer?.mute $checkbox.iCheck('check').attr('checked', true) else $checkbox.iCheck('uncheck').attr('checked', false) @iCheckMaint = false componentWillUpdate: (nextProps, nextState) -> $root = jQuery(this.getDOMNode()) # if the mixers go dead, whack our selves out of existence unless nextState.mixers? $container = $root.closest('.react-holder') $container.data('bt').btOff() return # re-initialize icheck $checkbox = $root.find('input') muteMixer = nextState.mixers?.muteMixer if muteMixer? && $.isArray(muteMixer) muteMixer = muteMixer[0] # using iCheck causes a 'ifChanged' event, so we need to swallow this up @iCheckMaint = true if muteMixer?.mute $checkbox.iCheck('check').attr('checked', true) else $checkbox.iCheck('uncheck').attr('checked', false) @iCheckMaint = false })