Пример #1
0
 public IEnumerable <SetE2PromExt> GetEmtptyRedundancyData(IEnumerable <int> biquads)
 {
     return
         (biquads.Select(
              bq =>
              new SetE2PromExt(GenericMethods.GetMainunitIdForFlowId(_flowId),
                               (new FilterBase(null)).RedundancyToBytes(),
                               RedundancyAddress(bq))));
 }
Пример #2
0
 public void GetMainUnitId()
 {
     Assert.AreEqual(0, GenericMethods.GetMainunitIdForFlowId(500));
     Assert.AreEqual(0, GenericMethods.GetMainunitIdForFlowId(504));
     Assert.AreEqual(1, GenericMethods.GetMainunitIdForFlowId(505));
     Assert.AreEqual(0, GenericMethods.GetMainunitIdForFlowId(0));
     Assert.AreEqual(1, GenericMethods.GetMainunitIdForFlowId(12));
     Assert.AreEqual(0, GenericMethods.GetMainunitIdForFlowId(11));
     Assert.AreEqual(3, GenericMethods.GetMainunitIdForFlowId(36));
 }
Пример #3
0
        public PresetNameUpdate PresetNameFactory()
        {
            //set the name of choosen preset
            if (Model.SpeakerPeqType == SpeakerPeqType.BiquadsMic)
            {
                return(null);
            }
            var mcuId = GenericMethods.GetMainunitIdForFlowId(_flowId);

            return(new PresetNameUpdate(mcuId, Model.SpeakerName, Model.Id));
        }
Пример #4
0
        public virtual IEnumerable <SetE2PromExt> RedundancyData()
        {
            var mcuId = GenericMethods.GetMainunitIdForFlowId(FlowId);

            var redAddress = GetRedundancyAddress(0);

            var data = RedundancyToBytes();

            yield return(new SetE2PromExt(mcuId, data, redAddress));

            //if biquad consists out of more biquads remove their redundancy data
            for (int i = 1; i < PEQDataModel.Biquads.Count; i++)
            {
                yield return(new SetE2PromExt(mcuId, RedundancyToBytes(), GetRedundancyAddress(i)));
            }
        }
Пример #5
0
        public static bool TryGetFlowFromId(int id, FuturamaSysModel model, out FlowModel flow)
        {
            if (model == null)
            {
                Debug.WriteLine("No model ");
                flow = null;
                return(false);
            }
            if (model.MainUnits == null)
            {
                Debug.WriteLine("No mainUnits ");
                flow = null;
                return(false);
            }
            var mainu = model.MainUnits.FirstOrDefault(c => c.Id == GenericMethods.GetMainunitIdForFlowId(id));

            if (mainu == null)
            {
                Debug.WriteLine("No mainunit for Id");
                flow = null;
                return(false);
            }
            var card = mainu.Cards.FirstOrDefault(c => c.Id == GetCardIdFromFlowId(id));

            if (card == null)
            {
                Debug.WriteLine("no card for Id");
                flow = null;
                return(false);
            }
            if (card.Flows == null)
            {
                Debug.WriteLine("no flow for Id");
                flow = null;
                return(false);
            }

            flow = card.Flows.FirstOrDefault(s => s.Id == id);
            return(true);
        }