Пример #1
0
        public CSLOBSConnector()
        {
            Mode = EOBSMode.Normal;

            Scenes        = new List <SOBSScene>();
            PreviewScenes = new List <SOBSScene>();
            Transitions   = new List <SOBSTransition>();
            Sources       = new List <SOBSSource>();
            AudioSources  = new List <SOBSAudioSource>();

            ActiveScene        = new SOBSScene();
            ActivePreviewScene = new SOBSScene();
            ActiveTransition   = new SOBSTransition();


            _state        = new SOBSStreamingState();
            _state.Stream = EOBSStreamingState.Unkown;
            _state.Record = EOBSStreamingState.Unkown;
            _state.Replay = EOBSStreamingState.Unkown;

            ws = new SLOBSWebsocket();
            ws.ConnectionStatus       += Ws_ConnectionStatus;
            ws.SceneChanged           += Ws_SceneChanged;
            ws.SceneListChanged       += Ws_SceneListChanged;
            ws.SceneItemChanged       += Ws_SceneItemChanged;
            ws.SourceChanged          += Ws_SourceChanged;
            ws.StreamingStatusChanged += Ws_StreamingStatusChanged;

            //timer for querying Recording & Replay buffer status
            //SLOBS api has no events for this types yet.
            statusTimer           = new System.Timers.Timer(5000);
            statusTimer.Elapsed  += StatusTimer_Elapsed;;
            statusTimer.AutoReset = true;
            statusTimer.Enabled   = false;
        }
Пример #2
0
        private SOBSTransition _translateTransition(string input, int index = 0)
        {
            SOBSTransition transition = new SOBSTransition();

            transition.Name  = input;
            transition.Id    = _uidFromString(input);
            transition.Index = index;
            return(transition);
        }
Пример #3
0
        private SOBSTransition _translateActiveTransition(TransitionSettings input)
        {
            SOBSTransition transition = new SOBSTransition();

            transition.Name = input.Name;
            transition.Id   = _uidFromString(input.Name);
            for (int i = 0; i < Transitions.Count; i++)
            {
                if (Transitions[i].Id == transition.Id)
                {
                    transition.Index = i;
                }
            }
            return(transition);
        }
Пример #4
0
        private void Ws_TransitionChanged(OBSWebsocket sender, string newTransitionName)
        {
            SOBSTransition newTransition = new SOBSTransition();

            newTransition.Name = newTransitionName;
            newTransition.Id   = _uidFromString(newTransitionName);
            for (int i = 0; i < Transitions.Count; i++)
            {
                if (Transitions[i].Name == newTransitionName)
                {
                    newTransition.Index = i;
                }
            }
            ActiveTransition = newTransition;
            if (TransitionChanged != null)
            {
                TransitionChanged(this, EOBSEvent.TransitionChanged);
            }
        }
Пример #5
0
        public COBSConnector()
        {
            Mode = EOBSMode.Normal;

            Scenes        = new List <SOBSScene>();
            PreviewScenes = new List <SOBSScene>();
            Transitions   = new List <SOBSTransition>();
            Sources       = new List <SOBSSource>();
            AudioSources  = new List <SOBSAudioSource>();

            ActiveScene        = new SOBSScene();
            ActivePreviewScene = new SOBSScene();
            ActiveTransition   = new SOBSTransition();

            _state        = new SOBSStreamingState();
            _state.Stream = EOBSStreamingState.Unkown;
            _state.Record = EOBSStreamingState.Unkown;
            _state.Replay = EOBSStreamingState.Unkown;

            SpecialSources = new Dictionary <string, string>();

            ws                             = new OBSWebsocket();
            ws.Connected                  += Ws_Connected;
            ws.Disconnected               += Ws_Disconnected;
            ws.OnError                    += Ws_OnError;
            ws.SceneChanged               += Ws_SceneChanged;
            ws.PreviewSceneChanged        += Ws_PreviewSceneChanged;
            ws.SceneCollectionChanged     += Ws_SceneCollectionChanged;
            ws.TransitionChanged          += Ws_TransitionChanged;
            ws.TransitionListChanged      += Ws_TransitionListChanged;
            ws.SceneItemVisibilityChanged += Ws_SceneItemVisibilityChanged;
            ws.SceneItemAdded             += Ws_SceneItemAdded;
            ws.SceneItemRemoved           += Ws_SceneItemRemoved;
            ws.SourceOrderChanged         += Ws_SourceOrderChanged;
            ws.StudioModeSwitched         += Ws_StudioModeSwitched;
            ws.StreamingStateChanged      += Ws_StreamingStateChanged;
            ws.RecordingStateChanged      += Ws_RecordingStateChanged;
        }