예제 #1
0
        /// <summary>
        ///     Loads data in current window
        /// </summary>
        public void Load(SpeakerDataViewModel librarySpeaker)
        {
            if (librarySpeaker.RequiredBiquads >
                ((int)DataModel.SpeakerPeqType))
            {
                MessageBox.Show(string.Format(
                                    SpeakerLibrary.NotEnoughSpaceWarning, librarySpeaker.RequiredBiquads,
                                    (int)DataModel.SpeakerPeqType),
                                SpeakerLibrary.NotEnoughSpaceWarningTitle, MessageBoxButton.OK, MessageBoxImage.Warning,
                                MessageBoxResult.OK);
                return;
            }
            Clear();

            AddRange(librarySpeaker.DataModel.PEQ.ToArray());
            CopySpeakerName(librarySpeaker.SpeakerName);

            SendMyName();
            RaisePropertyChanged(() => InLibrary);
            //copy the data to the model
            if (_flowId.HasValue)
            {
                var sl = new SpeakerLogicForFlow(DataModel, _flowId.Value);
                sl.UpdateIntegraty();
                foreach (var pd in sl.TotalSpeakerData())
                {
                    CommunicationViewModel.AddData(pd);
                }
            }

            OnSpeakerNameChanged();
        }
예제 #2
0
        public async Task SetInputSensitivity(IProgress <DownloadProgress> iProgress)
        {
            //sensitivity
            _inputSensitivityPackages = 0;
            bool b;

            if (!Boolean.TryParse(LibraryData.Settings["InputsensitivityIsEnabled"], out b) || !b)
            {
                return;
            }
            if (Main.InputSensitivity == null)
            {
                return;
            }

            var lst =
                Main.InputSensitivity.Select((x, y) => new SetInputSensitivity(Main.Id * 12 + y, x)).ToArray();

            CommunicationViewModel.AddData(lst);

            foreach (var sensitivity in lst)
            {
                await sensitivity.WaitAsync();

                iProgress.Report(new DownloadProgress
                {
                    Total    = 12,
                    Progress = ++_inputSensitivityPackages
                });
            }
        }
예제 #3
0
        /// <summary>
        ///     Get message selection
        /// </summary>
        /// <param name="iProgress"></param>
        /// <returns></returns>
        public async Task GetButtonProgramming(IProgress <DownloadProgress> iProgress)
        {
            //get button programming first unit
            if (Main.Id != 0)
            {
                return;
            }

            var s = new GetMessageSelection(Main.Id);

            CommunicationViewModel.AddData(s);

            await s.WaitAsync();

            LibraryData.FuturamaSys.PreannAlrm1 = s.AlarmTrack;
            LibraryData.FuturamaSys.PreannAlrm2 = s.AlertTrack;

            LibraryData.FuturamaSys.PreannEvac = s.PreannounceEP;
            LibraryData.FuturamaSys.PreannExt  = s.PreannounceExtAudio;
            LibraryData.FuturamaSys.PreannFds  = s.PreannounceFDS;
            LibraryData.FuturamaSys.PreannFp   = s.PreannounceFP;

            LibraryData.FuturamaSys.Messages = s.MessageSelectModels;
            iProgress.Report(new DownloadProgress()
            {
                Progress = 1, Total = 1
            });
        }
예제 #4
0
        public async void GetBoseVersion()
        {
            var q = new GetBoseVersion(Main.Id);

            CommunicationViewModel.AddData(q);
            await q.WaitAsync();

            Main.BoseVersion = q.BoseVersion;
            OnBoseVersionReceived();
        }
예제 #5
0
 /// <summary>
 /// mute all the muteblocks except for this channel
 /// </summary>
 /// <param name="channelId">
 /// 0-11 = Flow1-12,
 /// 12 = Alarm1,
 /// 13 = Alarm2,
 /// 14 = Mic1,
 /// 15 = Mic2,
 /// 16 = ExtAudio,
 /// 17 = Pilote,
 /// 18 = Spdif1,
 /// 19 = Spdif2,
 /// </param>
 public void SetVuChannel(int channelId)
 {
     ChannelId = channelId;
     for (int i = 0; i < 20; i++)
     {
         CommunicationViewModel.AddData((i == ChannelId)
                 ? new MuteBlock(i, false, _main.Id)
                 : new MuteBlock(i, true, _main.Id));
     }
 }
예제 #6
0
        public void SendMyName()
        {
            if (!_flowId.HasValue)
            {
                return;
            }
            var d       = new SpeakerLogicForFlow(DataModel, _flowId.Value);
            var package = d.PresetNameFactory();

            CommunicationViewModel.AddData(package);
        }
예제 #7
0
        private async Task <int[]> GetSdMessageCount()
        {
            var q = new SdCardMessageCount();

            CommunicationViewModel.AddData(q);

            await q.WaitAsync();

            _messageCount = q.CountA + q.CountB + 1 + (SdCardMessageName.TrackShift * 2);
            return(new[] { q.CountA, q.CountB });
        }
예제 #8
0
        private void Update()
        {
            var sos = DspCoefficients.GetToneControl(_flow.Bass,
                                                     _flow.Treble);
            bool b;

            CommunicationViewModel.AddData(bool.TryParse(LibraryData.Settings["SafeloadEnabled"], out b) && b
                        ? new SafeToneControl(sos, _flow.Id)
                        : new SetToneControl(sos, _flow.Id));
            RaisePropertyChanged(() => DisplaySetting);
        }
예제 #9
0
        /// <summary>
        ///     get inputsensitivity for each of the 12 channels
        /// </summary>
        public async Task GetSensitivityValues(IProgress <DownloadProgress> downloadProgress)
        {
            var data = new GetInputSensitivity(_mcuId);

            CommunicationViewModel.AddData(data);
            await data.WaitAsync();

            _main.InputSensitivity = data.Flows.ToList();
            downloadProgress.Report(new DownloadProgress()
            {
                Progress = 1, Total = 1
            });
        }
예제 #10
0
        private void UpdateBiquads(PeqDataViewModel vm)
        {
            if (!_flowId.HasValue)
            {
                return;
            }
            var usedBiquads = new List <int>(vm.PeqDataModel.Biquads);
            var sl          = new SpeakerLogicForFlow(DataModel, _flowId.Value);

            sl.AssignBiquads(vm.PeqDataModel);
            var toClear = usedBiquads.Except(vm.PeqDataModel.Biquads).ToArray();

            CommunicationViewModel.AddData(sl.GetEmptyDspData(toClear));
            CommunicationViewModel.AddData(sl.GetEmtptyRedundancyData(toClear));
        }
예제 #11
0
        public async Task SetSpeakerPresetData(IProgress <DownloadProgress> iProgress)
        {
            var dataToSend = GetTotalPresetData().ToArray();
            var total      = dataToSend.Length;

            foreach (var data in dataToSend)
            {
                CommunicationViewModel.AddData(data);
                await data.WaitAsync();

                iProgress.Report(new DownloadProgress()
                {
                    Progress = ++_peqDataCount,
                    Total    = total
                });
            }
        }
예제 #12
0
        public async Task SetPeqNames(IProgress <DownloadProgress> iProgress)
        {
            var list = Main.SpeakerDataModels.Where(t => t.SpeakerPeqType != SpeakerPeqType.BiquadsMic)
                       .Select(n => new PresetNameUpdate(Main.Id, n.SpeakerName, n.Id)).ToList();

            CommunicationViewModel.AddData(list);

            foreach (var nameUpdate in list)
            {
                await nameUpdate.WaitAsync();

                iProgress.Report(new DownloadProgress()
                {
                    Progress = ++_peqNamesCount, Total = 15
                });
            }
        }
예제 #13
0
        public async Task SetLinkDemuxers(IProgress <DownloadProgress> iProgress)
        {
            _linkDemuxPackages = 0;
            var q = _flows.Skip(1).Select(result => new SetLinkDemux(result.Id, result.Path)).ToArray();

            CommunicationViewModel.AddData(q);

            foreach (var setLinkDemux in q)
            {
                await setLinkDemux.WaitAsync();

                iProgress.Report(new DownloadProgress()
                {
                    Progress = ++_linkDemuxPackages,
                    Total    = 11
                });
            }
        }
예제 #14
0
        private void RemovePeqParam(object sender, EventArgs eventArgs)
        {
            var s = (PeqDataViewModel)sender;

            RemoveVm(s);
            OnRemoveParam(s);
            RedrawMasterLine();
            if (!_flowId.HasValue)
            {
                return;
            }

            var sl              = new SpeakerLogicForFlow(DataModel, _flowId.Value);
            var emptyDspdata    = sl.GetEmptyDspData(s.PeqDataModel.Biquads);
            var emptyRedundancy = sl.GetEmtptyRedundancyData(s.PeqDataModel.Biquads);

            CommunicationViewModel.AddData(emptyDspdata);
            CommunicationViewModel.AddData(emptyRedundancy);
        }
예제 #15
0
        public async Task SetAuxLink(IProgress <DownloadProgress> iProgress)
        {
            _auxLinks = 0;
            var t =
                Main.Cards.OfType <CardModel>()
                .Select(result => AuxLinkOption.SetAuxLink(Main.Id, result))
                .ToArray();

            CommunicationViewModel.AddData(t);

            foreach (var dispatchData in t)
            {
                await dispatchData.WaitAsync();

                iProgress.Report(new DownloadProgress {
                    Progress = ++_auxLinks, Total = 3
                });
            }
        }
예제 #16
0
        /// <summary>
        ///     tonecontrol blocks (flow 0-4, card 0)
        /// </summary>
        /// <returns>packages for sending tone control</returns>
        public async Task SetToneControls(IProgress <DownloadProgress> iProgress)
        {
            _toneControlPackages = 0;
            var list = new List <SetToneControl>(
                Main.Cards.First().Flows
                .Select(flow => new SetToneControl(DspCoefficients.GetToneControl(flow.Bass, flow.Treble), flow.Id)));

            CommunicationViewModel.AddData(list);

            foreach (var setToneControl in list)
            {
                await setToneControl.WaitAsync();

                iProgress.Report(new DownloadProgress()
                {
                    Total    = 4,
                    Progress = ++_toneControlPackages
                });
            }
        }
예제 #17
0
        /// <summary>
        ///     Set the downloaded hardware settigns in the given mainunit
        /// </summary>
        public async Task GetHardware(IProgress <DownloadProgress> iProgress)
        {
            var data = new GetInstallTree(Main.Id);

            CommunicationViewModel.AddData(data);

            await data.WaitAsync();

            var sq = data.GetBackupConfig().ToList();
            var sp = data.GetChannels().ToList();

            //set amount of expension cards
            Main.ExpansionCards = Main.InputSensitivity.Skip(4)
                                  .TakeWhile(sense => sense == InputSens.High || sense == InputSens.Low || sense == InputSens.None)
                                  .Count() >> 2;

            //set backupamps
            var n = 0;

            foreach (var cardBaseModel in Main.Cards.OfType <CardModel>().OrderBy(z => z.Id))
            {
                cardBaseModel.AttachedBackupAmps =
                    new BitArray(new[] { sq[n].Item1, sq[n].Item2, sq[n].Item3, sq[n].Item4, sq[n].Item5, sq[n].Item6 });
                n++;
            }

            //loop through cards and channels;
            var id = 0;

            foreach (var result in Main.Cards.OfType <CardModel>().SelectMany(f => f.Flows))
            {
                result.HasAmplifier           = sp[id].Item1 || sp[id].Item2 || sp[id].Item3 || sp[id].Item4;
                result.AmplifierOperationMode = result.HasAmplifier ? sp[id].Item6 : AmplifierOperationMode.Unknown;
                result.AttachedChannels       = new[] { sp[id].Item1, sp[id].Item2, sp[id].Item3, sp[id].Item4 };
                id++;
            }
            iProgress.Report(new DownloadProgress()
            {
                Progress = 1, Total = 1
            });
        }
예제 #18
0
        /// <summary>
        ///     Send Message selection
        /// </summary>
        /// <returns></returns>
        public async Task SetMessageData(IProgress <DownloadProgress> iProgress)
        {
            var z = new SetMessageSelection(
                LibraryData.FuturamaSys.Messages,
                LibraryData.FuturamaSys.PreannAlrm1,
                LibraryData.FuturamaSys.PreannAlrm2,
                LibraryData.FuturamaSys.PreannFp,
                LibraryData.FuturamaSys.PreannEvac,
                LibraryData.FuturamaSys.PreannFds,
                LibraryData.FuturamaSys.PreannExt,
                Main.Id);

            CommunicationViewModel.AddData(z);

            await z.WaitAsync();

            iProgress.Report(new DownloadProgress()
            {
                Progress = 1, Total = 1
            });
        }
예제 #19
0
        public async Task SetDelaySettings(IProgress <DownloadProgress> iProgress)
        {
            _delayPackages = 0;
            var q = new[]
            {
                new SetDelay(1, Main.DelayMilliseconds1, Main.Id),
                new SetDelay(2, Main.DelayMilliseconds2, Main.Id)
            };

            CommunicationViewModel.AddData(q);

            foreach (var dispatchData in q)
            {
                await dispatchData.WaitAsync();

                iProgress.Report(new DownloadProgress {
                    Total = 2, Progress = ++_delayPackages
                });
            }
            //todo: chain delays
        }
예제 #20
0
        public async Task SetSliders(IProgress <DownloadProgress> iProgress)
        {
            _emergencySliderPackages = 0;
            var r = Main.Cards.OfType <ExtensionCardModel>().First()
                    .Flows.Select(flow => new SetGainSlider(flow.Id, (int)flow.InputSlider, SliderType.Input))
                    .Concat(GainSliders())
                    .ToArray();

            CommunicationViewModel.AddData(r);

            var total = r.Length;

            foreach (var setGainSlider in r)
            {
                await setGainSlider.WaitAsync();

                iProgress.Report(new DownloadProgress()
                {
                    Progress = ++_emergencySliderPackages, Total = total
                });
            }
        }
예제 #21
0
        public async Task SetMatrixSelections(IProgress <DownloadProgress> iProgress)
        {
            var matrixBlocks = 0;

            var list = Enumerable.Range(0, 18).Select(i =>
                                                      new RoutingTable(Enumerable.Range(i * 12, 12).ToArray(), Main.Id,
                                                                       LibraryData.FuturamaSys.MatrixSelection)).ToArray();

            CommunicationViewModel.AddData(list);

            foreach (var table in list)
            {
                await table.WaitAsync();

                Interlocked.Increment(ref matrixBlocks);
                iProgress.Report(new DownloadProgress()
                {
                    Progress = ++matrixBlocks,
                    Total    = 18
                });
            }
        }
예제 #22
0
        private void SendParamData(PeqDataModel dm)
        {
            if (!_flowId.HasValue)
            {
                return;
            }
            try
            {
                var sl = new SpeakerLogicForFlow(DataModel, _flowId.Value);

                var data       = sl.DspData(dm);
                var redundancy = sl.RedundancyData();

                CommunicationViewModel.AddData(redundancy);
                CommunicationViewModel.AddData(data);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Filter upload", MessageBoxButton.OK, MessageBoxImage.Error,
                                MessageBoxResult.OK);
            }
        }
예제 #23
0
        private async void VuTimerEvent(object sender, ElapsedEventArgs elapsedEventArgs)
        {
            _vuTimer.Stop();
            //VuMeterValue = _r.Next(0,100);
            var z = new GetVu(_main.Id);

            CommunicationViewModel.AddData(z);
            await z.WaitAsync();

            _vuValues.Add(z.VuMeterValue);
            OnVuDataReceived(new VuDataReceivedEventArgs
            {
                Last          = _vuValues.Last(),
                Max           = _vuValues.Max(),
                Avarage       = _vuValues.Average(),
                LastVuMeasure = DateTime.Now,
                Channel       = ChannelId,
            });
            if (IsActive)
            {
                _vuTimer.Start();
            }
        }
예제 #24
0
        /// <summary>
        ///     List of in and output names
        /// </summary>
        /// <returns></returns>
        public async Task SetInAndOutputNames(IProgress <DownloadProgress> iProgress)
        {
            _inOutputNamesPackages = 0;

            var list = new List <NameUpdate>(
                _flows.Select(result => new[]
            {
                new NameUpdate(result.Id, result.NameOfInput, NameType.Input),
                new NameUpdate(result.Id, result.NameOfOutput, NameType.Output),
            }).SelectMany(io => io));

            CommunicationViewModel.AddData(list);

            foreach (var update in list)
            {
                await update.WaitAsync();

                iProgress.Report(new DownloadProgress()
                {
                    Progress = ++_inOutputNamesPackages,
                    Total    = 24
                });
            }
        }
예제 #25
0
        public async Task GetEeprom(IProgress <DownloadProgress> iProgress)
        {
            _eepromReceivePackages[_area] = 0;
            var ar = McuDat.EepromAreaFactory(_area);

            var count = ar.Size / McuDat.BufferSize + 1;

            for (var i = ar.Location; i < ar.Location + ar.Size + McuDat.BufferSize; i += McuDat.BufferSize)
            {
                var s = new GetE2PromExt(_mcuid, McuDat.BufferSize, i);
                CommunicationViewModel.AddData(s);

                await s.WaitAsync();

                UpdateEepromData(s);

                iProgress.Report(new DownloadEeprom()
                {
                    Progress = ++_eepromReceivePackages[_area],
                    Total    = count,
                    Area     = _area
                });
            }
        }
 private void UpdateSettings1()
 {
     CommunicationViewModel.AddData(new SetMeasurement(_main.Id, Error48VInterval, Error220VInterval, Error48VAmount.Value, Error220VAmount.Value));
 }
예제 #27
0
 private void SendData()
 {
     CommunicationViewModel.AddData(new RoutingTable(new[] { ButtonId }, MainUnit.Id, LibraryData.FuturamaSys.MatrixSelection));
 }
예제 #28
0
 private static SdCardMessageName CardNameFactory(int card, int track)
 {
     var download = new SdCardMessageName(card, track);
     CommunicationViewModel.AddData(download);
     return download;
 }