Exemple #1
0
        private void SendOnOnly(MidiData data, MidiMappingSettingViewModel mapping)
        {
            if (mapping.prevValue > 127 / 2f)
            {
                return;
            }
            if (data.Value <= 127 / 2f)
            {
                return;
            }

            var endPoints = endPointSettingUseCase.GetCurrent();

            foreach (var endPoint in endPoints)
            {
                if (!endPoint.ConnectionEnabled)
                {
                    continue;
                }

                sendToEndpointUseCase.Send(endPoint.EndPoint, mapping.OscAddressConversion,
                                           data.Value.ToString(),
                                           CommandType.Osc);
            }
        }
        public void Send(string command)
        {
            if (!onAirSettingUseCase.OnAirSettingViewModel.IsOnAir)
            {
                Debug.Log($"Current not on air. but this command triggered : {command}");
                return;
            }

            // TODO: CommandSettingUseCaseにGetCurrentを実装する
            var commandData = commandSettingUseCase.Load()
                              .FirstOrDefault(element => element.CommandName == command);

            var endPoints = endPointSettingUseCase.GetCurrent();

            foreach (var endPoint in endPoints)
            {
                // 設定で有効じゃない場合はスキップ
                if (!endPoint.ConnectionEnabled)
                {
                    continue;
                }

                var ipEndPoint = endPoint.EndPoint;

                if (commandData != null)
                {
                    sendToEndpointUseCase.Send(ipEndPoint, commandData.CommandName, commandData.CommandArguments,
                                               commandData.CommandType);

                    overlayUseCase.Trigger(Color.red);
                }
            }

            // =================== OBS
            if (obsSettingUseCase.ViewModel.ChangeScene.Value)
            {
                obsCommunucationUseCase.SetScene(command);
            }

            if (obsSettingUseCase.ViewModel.RestartMedia.Value)
            {
                obsCommunucationUseCase.RestartMediaSource(command);
            }

            // =================== OBS
        }