public PeqDataViewModel NewParam() { if (RequiredBiquads <= (int)(DataModel.SpeakerPeqType)) { var dm = new PeqDataModel { Frequency = 1000, FilterType = FilterType.Peaking, IsEnabled = true, BandWidth = 1, Boost = 0, Order = 2, Id = PeqDataModels.Count }; //vms might not be initiated, add viewmodel before model as initialisation wraps all available models var vm = new PeqDataViewModel(dm); PeqDataViewModels.Add(vm); PeqDataModels.Add(dm); var sl = new SpeakerLogic(DataModel); sl.AssignBiquads(dm); return(vm); } throw new Exception("not enough biquads"); }
private void AddNew(PeqDataModel data) { var dm = new PeqDataModel { Id = PeqDataModels.Count, FilterType = data.FilterType, IsEnabled = data.IsEnabled, BandWidth = data.BandWidth, Boost = data.Boost, Frequency = data.Frequency, Order = data.Order, Gain = data.Gain, }; //dm.Parse(data); PeqDataModels.Add(dm); var vm = new PeqDataViewModel(dm); vm.RemoveThisParam += RemovePeqParam; PeqDataViewModels.Add(vm); }