public void AddAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => EnqueueAction(() => { switch (type) { case AdjustableProperty.Balance: if (balanceAdjustments.Contains(adjustBindable)) { throw new ArgumentException("An adjustable binding may only be registered once."); } balanceAdjustments.Add(adjustBindable); break; case AdjustableProperty.Frequency: if (frequencyAdjustments.Contains(adjustBindable)) { throw new ArgumentException("An adjustable binding may only be registered once."); } frequencyAdjustments.Add(adjustBindable); break; case AdjustableProperty.Volume: if (volumeAdjustments.Contains(adjustBindable)) { throw new ArgumentException("An adjustable binding may only be registered once."); } volumeAdjustments.Add(adjustBindable); break; } InvalidateState(); });
public void RemoveAllAdjustments(AdjustableProperty type) { var aggregate = getAggregate(type); aggregate.RemoveAllSources(); aggregate.AddSource(getProperty(type)); }
public void TestMultiplicativeComponent(AdjustableProperty type) { var adjustments = new AudioAdjustments(); adjustments.AddAdjustment(type, new BindableDouble(0.5)); adjustments.AddAdjustment(type, new BindableDouble(0.5)); Assert.AreEqual(0.25, adjustments.GetAggregate(type).Value); }
public void TestAddAdjustment([Values] AdjustableProperty type) { var adjustments = new AudioAdjustments(); Assert.IsTrue(adjustments.GetAggregate(type).IsDefault); adjustments.AddAdjustment(type, new BindableDouble(0.5)); Assert.IsFalse(adjustments.GetAggregate(type).IsDefault); }
private Func <double, double, double> getAggregateFunction(AdjustableProperty type) { switch (type) { default: return((a, b) => a * b); case AdjustableProperty.Balance: return((a, b) => a + b); } }
public void TestRemoveAllAdjustmentsRemovesExternalBindings([Values] AdjustableProperty type) { var adjustments = new AudioAdjustments(); Assert.IsTrue(adjustments.GetAggregate(type).IsDefault); adjustments.AddAdjustment(type, new BindableDouble(0.5)); adjustments.AddAdjustment(type, new BindableDouble(0.5)); adjustments.RemoveAllAdjustments(type); Assert.IsTrue(adjustments.GetAggregate(type).IsDefault); }
public void RemoveAdjustment(AdjustableProperty type, BindableDouble adjustBindable) { switch (type) { case AdjustableProperty.Balance: balanceAggregate.RemoveSource(adjustBindable); break; case AdjustableProperty.Frequency: frequencyAggregate.RemoveSource(adjustBindable); break; case AdjustableProperty.Volume: volumeAggregate.RemoveSource(adjustBindable); break; } }
private ref AggregateBindable <double> getAggregate(AdjustableProperty type) { switch (type) { case AdjustableProperty.Balance: return(ref balanceAggregate); case AdjustableProperty.Frequency: return(ref frequencyAggregate); case AdjustableProperty.Volume: return(ref volumeAggregate); case AdjustableProperty.Tempo: return(ref tempoAggregate); } throw new ArgumentException($"{nameof(AdjustableProperty)} \"{type}\" is missing mapping", nameof(type)); }
public void RemoveAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => EnqueueAction(() => { switch (type) { case AdjustableProperty.Balance: balanceAdjustments.Remove(adjustBindable); break; case AdjustableProperty.Frequency: frequencyAdjustments.Remove(adjustBindable); break; case AdjustableProperty.Volume: volumeAdjustments.Remove(adjustBindable); break; } InvalidateState(); });
public void PopulateAdjustableProperties() { if (_selectedResponse != null) { _adjustableProperties.Clear(); var responseType = _selectedResponse.GetType(); var adjustablePropertyList = PlottingUtilities.GetAllAdjustableProperties(responseType); var headerItem = new AdjustableProperty { PropertyName = AdjustableProperty._header, }; AdjustableProperty1 = headerItem; AdjustableProperties.Add(headerItem); foreach (var adjustableProperty in adjustablePropertyList) { AdjustableProperties.Add(adjustableProperty); } } }
private BindableNumber <double> getProperty(AdjustableProperty type) { switch (type) { case AdjustableProperty.Balance: return(Balance); case AdjustableProperty.Frequency: return(Frequency); case AdjustableProperty.Volume: return(Volume); case AdjustableProperty.Tempo: return(Tempo); } throw new ArgumentException($"{nameof(AdjustableProperty)} \"{type}\" is missing mapping", nameof(type)); }
public void AddAdjustment(AdjustableProperty type, BindableDouble adjustBindable) { switch (type) { case AdjustableProperty.Balance: balanceAdjustments.Add(adjustBindable); break; case AdjustableProperty.Frequency: frequencyAdjustments.Add(adjustBindable); break; case AdjustableProperty.Volume: volumeAdjustments.Add(adjustBindable); break; } InvalidateState(); }
public void RemoveAllAdjustments(AdjustableProperty type) => throw new NotSupportedException();
public void RemoveAdjustment(AdjustableProperty type, IBindable <double> adjustBindable) => throw new NotSupportedException();
public void RemoveAllAdjustments(AdjustableProperty type) => adjustments.RemoveAllAdjustments(type);
public void RemoveAdjustment(AdjustableProperty type, IBindable <double> adjustBindable) => adjustments.RemoveAdjustment(type, adjustBindable);
public IBindable <double> GetAggregate(AdjustableProperty type) => adjustments.GetAggregate(type);
public void AddAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => adjustments.AddAdjustment(type, adjustBindable);
public void AddAdjustment(AdjustableProperty type, IBindable <double> adjustBindable) => getAggregate(type).AddSource(adjustBindable);
public void RemoveAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) => throw new NotImplementedException();
public void AddAdjustment(AdjustableProperty type, IBindable <double> adjustBindable) { sample.AddAdjustment(type, adjustBindable); }
public void RemoveAllAdjustments(AdjustableProperty type) { sample.RemoveAllAdjustments(type); }
public void AddAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) => adjustments.AddAdjustment(type, adjustBindable);
public IBindable <double> GetAggregate(AdjustableProperty type) => throw new NotSupportedException();
public void AddAdjustment(AdjustableProperty type, IBindable <double> adjustBindable) => throw new NotImplementedException();
public void RemoveAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) => getAggregate(type).RemoveSource(adjustBindable);
public static IBindable <double> GetAggregate(this IAggregateAudioAdjustment adjustment, AdjustableProperty type) { switch (type) { case AdjustableProperty.Volume: return(adjustment.AggregateVolume); case AdjustableProperty.Balance: return(adjustment.AggregateBalance); case AdjustableProperty.Frequency: return(adjustment.AggregateFrequency); case AdjustableProperty.Tempo: return(adjustment.AggregateTempo); default: throw new ArgumentOutOfRangeException(nameof(type), "Invalid adjustable property type."); } }
public IBindable <double> GetAggregate(AdjustableProperty type) => getAggregate(type).Result;
public void AddAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) => throw new NotSupportedException();