示例#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
        public async Task <bool> Reload()
        {
            if (ObsTypes.Count == 0)
            {
                ObsTypes = await ws.GetSourcesTypesList();
            }

            Version = await ws.GetVersion();

            var studiomode = await ws.StudioModeEnabled();

            Mode = studiomode ? EOBSMode.Studio : EOBSMode.Normal;

            var OutputStatus = await ws.GetStreamingStatus();

            _state = _translateStreamingStatus(OutputStatus);

            await _loadTransitions();
            await _loadActiveTransition();

            SpecialSources = await ws.GetSpecialSources();

            await _loadSources();
            await _loadScenes();
            await _loadActiveScene();

            if (Mode == EOBSMode.Studio)
            {
                _loadActivePScene();
            }

            return(true);
        }
示例#3
0
 private void Obs_ModeChanged(IOBSConnector sender, EOBSMode mode)
 {
     if (mode == EOBSMode.Normal)
     {
         Midi.Display(EMidiOBSItemType.Pscene, EMidiOBSOutputType.Off, -1, -1);
         Midi.Display(EMidiOBSItemType.PsceneItem, EMidiOBSOutputType.Off, -1, -1);
         Midi.Display(EMidiOBSItemType.Scene, EMidiOBSOutputType.Off, -1, -1);
         Midi.Display(EMidiOBSItemType.SceneItem, EMidiOBSOutputType.Off, -1, -1);
     }
     Midi.Display(EMidiOBSItemType.Mode, (int)Obs.Mode == 2 ? EMidiOBSOutputType.Active : EMidiOBSOutputType.On, -1);
     _renderScenes();
     _renderSceneItems();
     Midi.FlushQueue();
 }
示例#4
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;
        }
示例#5
0
        private void Ws_StudioModeSwitched(OBSWebsocket sender, bool enabled)
        {
            if (enabled)
            {
                Mode = EOBSMode.Studio;
            }
            else
            {
                Mode = EOBSMode.Normal;
            }
            if (ModeChanged != null)
            {
                ModeChanged(this, Mode);
            }

            if (Mode == EOBSMode.Studio)
            {
                _loadActivePScene(true);
            }
            else
            {
                ActivePreviewScene = new SOBSScene();
            }
        }