Пример #1
0
        private void _midiController_MuteChannelEvent(object sender, MIDIController.ChannelEventArgs e)
        {
            var ch = _mixer.getChannelNumberInCurrentLayer(e.ChannelNumber);

            _mixerChannels[ch].IsMute = !_mixerChannels[ch].IsMute;
            _client.Send(_mixerChannels[ch].MuteMessage());
            _settings.Controller.SetMuteLed(e.ChannelNumber, _mixerChannels[ch].IsMute);
            //if the channel is linked we have to set the other channel to the same value
            if (_mixerChannels[ch] is IStereoLinkable)
            {
                var stereoChannel = _mixerChannels[ch] as IStereoLinkable;
                if (stereoChannel.LinkedWith != -1)
                {
                    var otherCh = stereoChannel.LinkedWith == 0 ? ch + 1 : ch - 1;
                    _mixerChannels[otherCh].IsMute = !_mixerChannels[otherCh].IsMute;
                    _client.Send(_mixerChannels[otherCh].MuteMessage());
                    //If the other chanel is on the current layout we have to set too
                    (var otherChOnLayer, var isOnLayer) = GetControllerChannel(otherCh);
                    if (isOnLayer)
                    {
                        _settings.Controller.SetMuteLed(otherChOnLayer, _mixerChannels[otherCh].IsMute);
                    }
                }
            }
            SetControllerMuteButtonsForCurrentLayer();
        }
Пример #2
0
        private void _midiController_SelectChannelEvent(object sender, MIDIController.ChannelEventArgs e)
        {
            var ch = _mixer.getChannelNumberInCurrentLayer(e.ChannelNumber);

            if (_selectedChannel != -1)
            {
                _mixerChannels[_selectedChannel].IsSelected = false;
            }
            _mixerChannels[ch].IsSelected = true;
            _selectedChannel = ch;
            _settings.Controller.SetSelectLed(e.ChannelNumber, true);
            _client.Send(_mixerChannels[ch].SelectChannelMessage(_settings.SyncID));
        }
Пример #3
0
        private void _midiController_RecChannelEvent(object sender, MIDIController.ChannelEventArgs e)
        {
            var ch = _mixer.getChannelNumberInCurrentLayer(e.ChannelNumber);

            if (_settings.ChannelRecButtonBehavior == BridgeSettings.ChannelRecButtonBehaviorEnum.Rec)
            {
                if (_mixerChannels[ch] is IRecordable)
                {
                    var channel = _mixerChannels[ch] as IRecordable;
                    channel.IsRec = !channel.IsRec;
                    _client.Send(channel.RecMessage());
                    _settings.Controller.SetRecLed(e.ChannelNumber, channel.IsRec);
                }
            }
            else //phantom
            {
                if (_mixerChannels[ch] is IInputable)
                {
                    var currentChannel = _mixerChannels[ch] as IInputable;
                    if (currentChannel.SrcType == SrcTypeEnum.Hw)
                    {
                        currentChannel.IsPhantom = !currentChannel.IsPhantom;
                        _client.Send(currentChannel.PhantomMessage());
                        _settings.Controller.SetRecLed(e.ChannelNumber, currentChannel.IsPhantom);

                        //if multiple channels are set to same HW input
                        foreach (var singleChannel in _mixerChannels)
                        {
                            if (singleChannel is IInputable)
                            {
                                var singleInputChannel = singleChannel as IInputable;
                                if (singleInputChannel.SrcType == SrcTypeEnum.Hw && singleInputChannel.SrcNumber == currentChannel.SrcNumber)
                                {
                                    singleInputChannel.IsPhantom = currentChannel.IsPhantom;
                                    for (int i = 0; i < 8; ++i)
                                    {
                                        if (singleInputChannel == _mixerChannels[_mixer.getChannelNumberInCurrentLayer(i)])
                                        {
                                            _settings.Controller.SetRecLed(i, currentChannel.IsPhantom);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }