예제 #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 void SendMyName()
        {
            if (!_flowId.HasValue)
            {
                return;
            }
            var d       = new SpeakerLogicForFlow(DataModel, _flowId.Value);
            var package = d.PresetNameFactory();

            CommunicationViewModel.AddData(package);
        }
예제 #3
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));
        }
예제 #4
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);
        }
예제 #5
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);
            }
        }