Ejemplo n.º 1
0
        public void OnBufferChanged(IAudioBufferProto eventSource)
        {
            if (FlowRiderSettings.IsFlowRecorded == false)
            {
                return;
            }

            lock (_flowDictionary)
            {
                if (_flowDictionary.ContainsKey(eventSource.BufferUid) == false)
                {
                    _flowDictionary.Add(eventSource.BufferUid, new List <BufferFlowDescription>());

                    if (string.IsNullOrEmpty(eventSource.Name))
                    {
                        throw new BuffersException(
                                  $"Unable to register flow for unnamed buffer with UID {eventSource.BufferUid}");
                    }

                    _flowBufferNames.Add(eventSource.BufferUid, eventSource.Name);
                }

                var flowList = _flowDictionary[eventSource.BufferUid];

                var lastState    = flowList.LastOrDefault();
                var currentState = BufferFlowDescription.FromSource(eventSource);

                if (lastState == null && currentState.DataLength == 0)
                {
                    return;
                }

                flowList.Add(currentState);
            }
        }
Ejemplo n.º 2
0
        public void PostInfo(int id, string infoText)
        {
            if (FlowRiderSettings.IsFlowRecorded == false)
            {
                return;
            }

            lock (_flowDictionary)
            {
                var uid       = InfoGuid;
                var infoEvent = new BufferFlowDescription {
                    InfoId = id, Info = infoText
                };

                if (_flowDictionary.ContainsKey(uid) == false)
                {
                    _flowDictionary.Add(uid, new List <BufferFlowDescription>());
                    _flowBufferNames.Add(uid, "Info flow");
                }

                var flowList = _flowDictionary[uid];
                flowList.Add(infoEvent);
            }
        }