Пример #1
0
        public static T Chain <T>(this IAudioActiveProducer producer, Action <T>?init = null) where T : IAudioPassiveConsumer, new()
        {
            var addConsumer = new T();

            init?.Invoke(addConsumer);
            return(producer.Chain(addConsumer));
        }
Пример #2
0
 public static T Chain <T>(this IAudioActiveProducer producer, T addConsumer) where T : IAudioPassiveConsumer
 {
     if (producer.OutStream is null)
     {
         producer.OutStream = addConsumer;
     }
     else if (producer.OutStream is PassiveSplitterPipe splitter)
     {
         splitter.Add(addConsumer);
     }
     else
     {
         splitter = new PassiveSplitterPipe();
         splitter.Add(addConsumer);
         splitter.Add(producer.OutStream);
         producer.OutStream = splitter;
     }
     return(addConsumer);
 }